コード例 #1
0
ファイル: Unit.cs プロジェクト: flabbergasted/fitzbooch-tbs
        //calculates the morale shocks to be administered to the losing side of one 'round' of combat
        //decided by who did more damage as a percent of total soldiers.
        public void CalculatePostBattleMoraleShocks(double UnitADmg, double UnitBDmg, Unit UnitA, Unit UnitB)
        {
            double Apercentdmg;
            double Bpercentdmg;

            Apercentdmg = UnitBDmg / UnitA.SoldierCount;
            Bpercentdmg = UnitADmg / UnitB.SoldierCount;

            if (Apercentdmg > Bpercentdmg)
            {
                UnitA.MoraleShock();
            }
            else if (Bpercentdmg > Apercentdmg)
            {
                UnitB.MoraleShock();
            }
        }
コード例 #2
0
ファイル: Unit.cs プロジェクト: flabbergasted/fitzbooch-tbs
        //calculate morale shocks based on 2 fighting units numbers and equipment
        //  -you get a morale shock if the enemy has 20% more soldiers and
        //    if the enemy has double the soldiers (note that this stacks)
        //  -you also get a morale shock if the enemy armor is higher quality
        public void CalculatePreBattleMoraleShocks(Unit UnitA, Unit UnitB)
        {
            if (UnitA.SoldierCount > ((double)UnitB.SoldierCount * 1.2))
            {
                UnitB.MoraleShock();
            }

            if (UnitB.SoldierCount > ((double)UnitA.SoldierCount * 1.2))
            {
                UnitA.MoraleShock();
            }

            if (UnitA.SoldierCount > ((double)UnitB.SoldierCount * 2))
            {
                UnitB.MoraleShock();
            }

            if (UnitB.SoldierCount > ((double)UnitA.SoldierCount * 2))
            {
                UnitA.MoraleShock();
            }

            if (UnitB.Armor > UnitA.Armor)
            {
                UnitA.MoraleShock();
            }

            if(UnitA.Armor > UnitB.Armor)
            {
                UnitB.MoraleShock();
            }
        }