Advertisement
Guest User

Untitled

a guest
Dec 18th, 2015
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using ClashOfKings.Contracts;
  7. using ClashOfKings.Models.Armies;
  8.  
  9. namespace ClashOfKings.Models.Cities
  10. {
  11. public abstract class City : ICity
  12. {
  13. private string name;
  14. private CityType cityType;
  15. private IHouse controllingHouse;
  16. private decimal upgradeCost;
  17. private int defense;
  18. private decimal taxBase;
  19. private IEnumerable<IMilitaryUnit> availableMilitaryUnits = new List<IMilitaryUnit>();
  20. private Dictionary<UnitType, int> availableUnitsByType;
  21. private IEnumerable<IArmyStructure> armyStructures = new List<IArmyStructure>();
  22. private double foodProduction;
  23. private double foodStorage;
  24.  
  25. public City(
  26. string name,
  27. CityType cityType,
  28. IHouse controllingHouse,
  29. decimal upgradeCost,
  30. int defense,
  31. decimal taxBase,
  32. IEnumerable<IMilitaryUnit> availableMilitaryUnits,
  33. Dictionary<UnitType, int> availableUnitsByType,
  34. IEnumerable<IArmyStructure> armyStructures,
  35. double foodProduction,
  36. double foodStorage)
  37. {
  38. this.Name = name;
  39. this.CityType = cityType;
  40. this.ControllingHouse = controllingHouse;
  41. this.UpgradeCost = upgradeCost;
  42. this.Defense = defense;
  43. this.TaxBase = taxBase;
  44. this.AvailableUnitsByType = new Dictionary<UnitType, int>();
  45. this.FoodProduction = foodProduction;
  46. this.FoodStorage = foodStorage;
  47.  
  48. }
  49.  
  50.  
  51. public string Name
  52. {
  53. get
  54. {
  55. return this.name;
  56. }
  57. set
  58. {
  59. if (string.IsNullOrWhiteSpace(value))
  60. {
  61. throw new ArgumentNullException("The name of the city cannot be null");
  62. }
  63. this.name = value;
  64. }
  65. }
  66.  
  67. public CityType CityType { get; set; }
  68.  
  69. public IHouse ControllingHouse { get; set; }
  70.  
  71.  
  72. public decimal UpgradeCost
  73. {
  74. get
  75. {
  76. return this.upgradeCost;
  77. }
  78. set
  79. {
  80. if (value < 0)
  81. {
  82. throw new ArgumentNullException("The upgrade cost cannot be negative");
  83. }
  84. this.upgradeCost = value;
  85. }
  86. }
  87.  
  88. public int Defense
  89. {
  90. get
  91. {
  92. return this.defense;
  93. }
  94. set
  95. {
  96. if (value < 0)
  97. {
  98. throw new ArgumentNullException("The defense cannot be negative");
  99. }
  100. this.defense = value;
  101. }
  102. }
  103.  
  104. public decimal TaxBase
  105. {
  106. get
  107. {
  108. return this.taxBase;
  109. }
  110. set
  111. {
  112. if (value < 0)
  113. {
  114. throw new ArgumentNullException("The tax base cost cannot be negative");
  115. }
  116. this.taxBase = value;
  117. }
  118. }
  119.  
  120. public IEnumerable<IMilitaryUnit> AvailableMilitaryUnits
  121. {
  122. get { return this.availableMilitaryUnits; }
  123. }
  124.  
  125. public Dictionary<UnitType, int> AvailableUnitsByType { get; }
  126.  
  127.  
  128. public IEnumerable<IArmyStructure> ArmyStructures
  129. {
  130. get { return this.armyStructures; }
  131. }
  132.  
  133. public double FoodProduction
  134. {
  135. get
  136. {
  137. return this.foodProduction;
  138. }
  139. set
  140. {
  141. if (value < 0)
  142. {
  143. throw new ArgumentNullException("The food production cannot be negative");
  144. }
  145. this.foodProduction = value;
  146. }
  147. }
  148.  
  149. public double FoodStorage
  150. {
  151. get
  152. {
  153. return this.foodStorage;
  154. }
  155. set
  156. {
  157. if (value < 0)
  158. {
  159. throw new ArgumentNullException("The food storage cannot be negative");
  160. }
  161. this.foodStorage = value;
  162. }
  163. }
  164.  
  165. public void Upgrade()
  166. {
  167. throw new NotImplementedException();
  168. }
  169.  
  170. public void Downgrade()
  171. {
  172. throw new NotImplementedException();
  173. }
  174.  
  175. public int AvailableUnitCapacity(UnitType type)
  176. {
  177. throw new NotImplementedException();
  178. }
  179.  
  180. public void AddUnits(ICollection<IMilitaryUnit> units)
  181. {
  182. this.availableMilitaryUnits.Concat(units);
  183. }
  184.  
  185. public ICollection<IMilitaryUnit> RemoveUnits()
  186. {
  187. throw new NotImplementedException();
  188. }
  189.  
  190. public void AddArmyStructure(IArmyStructure structure)
  191. {
  192. throw new NotImplementedException();
  193. }
  194.  
  195. public void Update()
  196. {
  197. throw new NotImplementedException();
  198. }
  199.  
  200. public string Print()
  201. {
  202. throw new NotImplementedException();
  203. }
  204. }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement