Beispiel #1
0
        //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();
            }
        }
Beispiel #2
0
        //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();
            }
        }