public bool UpGradeAUnit(UnitCard from, UnitCard to) { int APcost = BASIC_ACTION_COST; if (to.Age > from.Age && to.MyClass == from.MyClass) { int cost = to.Cost - from.Cost; if (currentP.CheckCAP(APcost)) { if (currentP.Consume(cost, DataType.Ore)) { currentP.ConsumeCAP(APcost); from.Unit--; to.Unit++; return(true); } } } else { FeedBackText.Instance.Text = "Cannot upgrade this unit"; } return(false); }
public void DoBuildUnit(int player, UnitCard card, bool reversible) { Player currentP = Players[player]; int AP_Cost = BASIC_ACTION_COST; int resource_Cost = card.Cost; string action = "BuildUnit"; resource_Cost = currentP.ConsumeSpecialResource(resource_Cost, card.MyClass, action); AP_Cost = currentP.ConsumeSpecialAP(AP_Cost, action, card.MyClass, card.MyType); currentP.Consume(resource_Cost, DataType.Ore); currentP.ConsumeAP(AP_Cost, card.MyType); (card as UnitCard).Unit++; if (card.MyClass == CardClass.MilitaryTech && currentP.LongEffect.Contains("Alexander")) { currentP.Strength++; } if (reversible) { SendMessage("Build a Unit on " + card.MyName); AddPack(new BuildUnitPack(card)); } }
public bool CheckDestroy_A_Unit(UnitCard card) { int APcost = BASIC_ACTION_COST; if (currentP.CheckAP(APcost, "DestroyUnit", CardClass.None, card.MyType)) { return(true); } return(false); }
public bool Destroy_A_Unit(UnitCard card) { int APcost = BASIC_ACTION_COST; if (GameManager.gameRound != 1) { if (currentP.CheckCAP(APcost)) { currentP.ConsumeCAP(APcost); card.Unit--; return(true); } } else { FeedBackText.Instance.Text = "Cannot destory a unit in the first round"; } return(false); }
public void DoDestroy_A_Unit(int player, UnitCard card, bool reversible) { int APcost = BASIC_ACTION_COST; currentP.ConsumeAP(APcost, card.MyType); card.Unit--; //Alexander if (card.MyClass == CardClass.MilitaryTech && currentP.LongEffect.Contains("Alexander")) { currentP.Strength--; FeedBackText.Instance.Text = "Alexander--"; } if (reversible) { SendMessage("Destroy a Unit from " + card.MyName); AddPack(new DestroyUnitPack(card)); } }
public bool CheckBuildUnit(UnitCard card) { int AP_Cost = BASIC_ACTION_COST; int resource_Cost = card.Cost; string action = "BuildUnit"; if (card.GetType() != typeof(UrbanBuildingCard) || (card as UnitCard).Unit < me.Gov.Capacity) { if (me.CheckResource(resource_Cost, card.MyClass, action, DataType.Ore)) { if (me.CheckAP(AP_Cost, action, card.MyClass, card.MyType)) { return(true); } } } else { FeedBackText.Instance.Text = "You have reached the limit of building urban units"; } return(false); }
public void UndoDestoryUnit(UnitCard card) { card.Unit++; }
public void UndoBuildUnit(BuildUnitPack pack) { UnitCard tempCard = pack.card; tempCard.Unit--; }
public void ConsumeScience(UnitCard card) { SciencePoint -= card.ScienceCost; }
public DestroyUnitPack(UnitCard _card) : base(GameAction.DestroyUnit) { card = _card; }
public BuildUnitPack(UnitCard _card) : base(GameAction.BuildUnit) { card = _card; }