Пример #1
0
        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);
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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));
            }
        }
Пример #6
0
        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);
        }
Пример #7
0
 public void UndoDestoryUnit(UnitCard card)
 {
     card.Unit++;
 }
Пример #8
0
        public void UndoBuildUnit(BuildUnitPack pack)
        {
            UnitCard tempCard = pack.card;

            tempCard.Unit--;
        }
Пример #9
0
 public void ConsumeScience(UnitCard card)
 {
     SciencePoint -= card.ScienceCost;
 }
Пример #10
0
 public DestroyUnitPack(UnitCard _card) : base(GameAction.DestroyUnit)
 {
     card = _card;
 }
Пример #11
0
 public BuildUnitPack(UnitCard _card) : base(GameAction.BuildUnit)
 {
     card = _card;
 }