コード例 #1
0
        protected void ParseAttacks(OldBattle battle, sortie_battle_old.airbattle api, ShipInBattle friendtorpedo, ShipInBattle friendbomb, ShipInBattle enemytorpedo, ShipInBattle enemybomb)
        {
            var result = Enumerable.Empty <Attack>();

            void ParseStage3(sortie_battle_old.airbattle.stage3 stage3, ShipInBattle[] friend, ShipInBattle[] enemy)
            {
                if (stage3 == null)
                {
                    return;
                }
                if (stage3.api_fdam != null)
                {
                    result = result.Concat(ParseAttack(stage3.api_fdam, stage3.api_frai_flag, stage3.api_fbak_flag, stage3.api_fcl_flag,
                                                       false, friend, enemytorpedo, enemybomb));
                }
                if (stage3.api_edam != null)
                {
                    result = result.Concat(ParseAttack(stage3.api_edam, stage3.api_erai_flag, stage3.api_ebak_flag, stage3.api_ecl_flag,
                                                       true, enemy, friendtorpedo, friendbomb));
                }
            }

            ParseStage3(api.api_stage3, battle.Fleet1, battle.EnemyFleet);
            ParseStage3(api.api_stage3_combined, battle.Fleet2, battle.EnemyFleet2);

            ApplyAttacks(result, battle);
        }
コード例 #2
0
 public void ApplyAttacks(IEnumerable <Attack> attacks, OldBattle battle = null)
 {
     Attacks = attacks.Where(x => x.Damage >= 0).ToArray();
     foreach (var attack in Attacks)
     {
         attack.Apply(battle);
     }
 }
コード例 #3
0
        public void Apply(OldBattle battle = null)
        {
            if (applied)
            {
                return;
            }
            applied = true;
            ShipInBattle source, dest;

            if (Direction)
            {
                source = Friend;
                dest   = Enemy;
            }
            else
            {
                source = Enemy;
                dest   = Friend;
            }
            if (source != null)
            {
                source.DamageGiven += Damage;
            }
            else if (battle != null)
            {
                if (Direction)
                {
                    battle.AnonymousFriendDamage += Damage;
                }
                else
                {
                    battle.AnonymousEnemyDamage += Damage;
                }
            }
            if (dest != null)
            {
                MaxHP        = dest.MaxHP;
                FromHP       = dest.ToHP;
                dest.Damage += Damage;
                dest.ToHP   -= Damage;
                if (dest.ToHP <= 0)
                {
                    if (dest.IsEnemy || dest.DamageControl == null)
                    {
                        dest.ToHP = 0;
                    }
                    else if (dest.DamageControl.Id == 42)//応急修理要員
                    {
                        dest.ToHP = (int)(dest.MaxHP * 0.2);
                    }
                    else if (dest.DamageControl.Id == 43)//応急修理女神
                    {
                        dest.ToHP = dest.MaxHP;
                    }
                }
                ToHP = dest.ToHP;
            }
        }