15
|
1 // This file (UnitExclusion.cs) is a part of the IBBoard.WarFoundry.API project and is copyright 2009 IBBoard.
|
|
2 //
|
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
|
|
4
|
0
|
5 using System;
|
|
6 using System.Text;
|
|
7 using IBBoard.WarFoundry.API.Objects;
|
|
8
|
|
9 namespace IBBoard.WarFoundry.API.Requirements
|
|
10 {
|
|
11 /// <summary>
|
|
12 /// Summary description for UnitMaxNumberRequirement.
|
|
13 /// </summary>
|
|
14 public class UnitExclusion : FailedUnitRequirement
|
|
15 {
|
|
16 private string unitList;
|
|
17 private UnitType type;
|
|
18
|
|
19 public UnitExclusion(UnitRequirement req, UnitType unitType, UnitType[] excludingTypes) : base(req)
|
|
20 {
|
|
21 type = unitType;
|
|
22
|
|
23 if (excludingTypes.Length > 1)
|
|
24 {
|
|
25 StringBuilder sb = new StringBuilder(excludingTypes[0].Name);
|
|
26
|
|
27 for (int i = 1; i<excludingTypes.Length; i++)
|
|
28 {
|
|
29 sb.Append(", "+excludingTypes[i].Name);
|
|
30 }
|
|
31
|
|
32 unitList = sb.ToString();
|
|
33 }
|
|
34 else
|
|
35 {
|
|
36 unitList = excludingTypes[0].Name;
|
|
37 }
|
|
38 }
|
|
39
|
|
40 public override string Description
|
|
41 {
|
|
42 get { return "The army cannot have any of the following units to include a unit of type "+type.Name+": "+unitList; }
|
|
43 }
|
|
44 }
|
|
45 }
|