示例#1
0
        public override void CalcActualDmgToBeTaken(ICombatList attackers,
                                                    ICombatList defenders,
                                                    IBattleRandom random,
                                                    decimal baseDmg,
                                                    int attackIndex,
                                                    out decimal actualDmg)
        {
            // Miss chance
            actualDmg = BattleFormulas.GetDmgWithMissChance(attackers.UpkeepExcludingWaitingToJoinBattle, defenders.UpkeepExcludingWaitingToJoinBattle, baseDmg, random);

            // Splash dmg reduction
            actualDmg = BattleFormulas.SplashReduction(this, actualDmg, attackIndex);

            // if hp is less than 20% of the original total HP(entire group), lastStand kicks in.
            if (Hp < (Hp + DmgRecv) / 5m)
            {
                var lastStandEffects = TroopStub.City.Technologies.GetEffects(EffectCode.LastStand);
                var percent          =
                    lastStandEffects.Where(
                        tech =>
                        BattleFormulas.UnitStatModCheck(Stats.Base,
                                                        TroopBattleGroup.Attack,
                                                        (string)tech.Value[1]))
                    .DefaultIfEmpty()
                    .Max(x => x == null ? 0 : (int)x.Value[0]);

                actualDmg = actualDmg * (100 - percent) / 100m;
            }
        }
示例#2
0
        public override void CalcActualDmgToBeTaken(ICombatList attackers,
                                                    ICombatList defenders,
                                                    IBattleRandom random,
                                                    decimal baseDmg,
                                                    int attackIndex,
                                                    out decimal actualDmg)
        {
            // Miss chance
            actualDmg = BattleFormulas.GetDmgWithMissChance(attackers.UpkeepExcludingWaitingToJoinBattle, defenders.UpkeepExcludingWaitingToJoinBattle, baseDmg, random);

            // Splash dmg reduction
            actualDmg = BattleFormulas.SplashReduction(this, actualDmg, attackIndex);

            // AP Bonuses
            if (City.AlignmentPoint >= 90m)
            {
                actualDmg *= .1m;
            }
        }