public IEnumerator DotDamage(CStatus stat, Tile tile)
    // 도트 데미지 생성
    {
        if (tile.dotDamageDuration != 0)
        {
            subject.hasDotDmg = true;
            float t        = tile.dotDamageDuration;
            float elapsedT = 0;

            while (elapsedT < t)
            {
                if (subject.isStunned == true)
                {
                    stat.characterHP -= BattleFormulas.CalDotTileDamage(stat, Game.curStageInfo.mapEA, tile, true);
                }
                else
                {
                    stat.characterHP -= BattleFormulas.CalDotTileDamage(stat, Game.curStageInfo.mapEA, tile, false);
                }

                elapsedT += 0.5f;
                yield return(new WaitForSeconds(0.5f));
            }
            subject.hasDotDmg = false;
        }
    }
Beispiel #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);

            // 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;
            }
        }
Beispiel #3
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);
 }
Beispiel #4
0
        public void GetAttackScore_ShouldCalculateCorrectScore(
            [FrozenMock] UnitModFactory unitModFactory,
            ICombatObject attacker,
            ICombatObject target,
            BattleFormulas battleFormulas)
        {
            attacker.AttackBonus(target).Returns(0.2m);
            attacker.Stats.Base.Weapon.Returns(WeaponType.Bow);
            target.Stats.Base.Armor.Returns(ArmorType.Machine);
            attacker.Type.Returns <ushort>(1);
            target.Type.Returns <ushort>(2);
            unitModFactory.GetModifier(1, 2).Returns(1.25);

            var score = battleFormulas.GetAttackScore(attacker, target, 1);

            score.Should().Be(1.5m);
        }
    public IEnumerator InstantDamage(CStatus stat, Tile tile)
    {
        // 단일 데미지 생성
        if (tile.instantDamage != 0)
        {
            stat.characterMovementSpeed = 0;
            subject.anim.SetInteger("speed", 0);
            subject.anim.SetBool("isHit", true);
            subject.anim.SetTrigger("hit");
            stat.characterHP -= BattleFormulas.CalInstantTileDamage(stat, Game.curStageInfo.mapEA, tile);
            yield return(new WaitForSeconds(stiffTime));

            subject.anim.ResetTrigger("hit");
            subject.anim.SetBool("isHit", false);
            stat.characterMovementSpeed = 1;
            subject.anim.SetInteger("speed", 1);
        }
    }
Beispiel #6
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;
            }
        }
Beispiel #7
0
 public override int LootPerRound()
 {
     return(BattleFormulas.GetLootPerRoundForCity(City));
 }