Пример #1
0
 /// <summary>
 /// 演習ダメージ適用
 /// </summary>
 /// <param name="fleet">艦隊</param>
 /// <param name="damages">適用ダメージリスト</param>
 public static void CalcPracticeDamages(this FleetData fleet, params FleetDamages[] damages)
 {
     foreach (var damage in damages)
     {
         fleet.Ships.SetValues(damage.ToArray(), (s, d) => s.NowHP -= d);
     }
     if (fleet.Ships == null)
     {
         return;
     }
     foreach (var item in fleet.Ships)
     {
         int tempHP = item.NowHP;
         if (item.NowHP < 0)
         {
             tempHP = 0;
         }
         fleet.TotalDamaged += (item.BeforeNowHP - tempHP);
         if (item.NowHP <= 0)
         {
             fleet.SinkCount++;
         }
     }
 }