Beispiel #1
0
 public static FleetDamages GetFirstFleetDamages(this Api_Kouku kouku)
 {
     return(kouku != null
         ? kouku.api_stage3 != null
             ? kouku.api_stage3.api_fdam.GetDamages()
             : defaultValue : defaultValue);
 }
Beispiel #2
0
 public static FleetDamages GetSecondFleetDamages(this Api_Kouku kouku)
 {
     return(kouku != null
         ? kouku.api_stage3_combined != null
             ? kouku.api_stage3_combined.api_fdam != null
                 ? kouku.api_stage3_combined.api_fdam.GetDamages()
                 : defaultValue : defaultValue : defaultValue);
 }
Beispiel #3
0
 public static AirCombatResult[] ToResult(this Api_Kouku kouku, string prefixName = "")
 {
     return(kouku != null
                         ? new []
     {
         kouku.api_stage1.ToResult($"{prefixName}공대공"),
         kouku.api_stage2.ToResult($"{prefixName}공대함")
     }
                         : new AirCombatResult[0]);
 }
 public static AirCombatResult[] ToResult(this Api_Kouku kouku, string prefixName = "")
 {
     return(kouku.IsEnabled()
         ? new[]
     {
         kouku.api_stage1.ToResult($"{prefixName}空対空"),
         kouku.api_stage2.ToResult($"{prefixName}空対艦")
     }
         : new AirCombatResult[0]);
 }
Beispiel #5
0
 public static AirCombatResult[] ToResult(this Api_Kouku kouku, string prefixName = "")
 {
     return(kouku.IsEnabled()
         ? new[]
     {
         kouku.api_stage1.ToResult($"{prefixName}" + Resources.Air_To_Air),
         kouku.api_stage2.ToResult($"{prefixName}" + Resources.Air_To_Ship)
     }
         : new AirCombatResult[0]);
 }
Beispiel #6
0
        public static IEnumerable <Attack> GetDamages(this Api_Kouku kouku, FleetType type)
        {
            var selector = Stage3DamageSelector[type];

            return(selector(kouku.api_stage3)
                   .Concat(selector(kouku.api_stage3_combined))
                   .Select((x, i) => new
            {
                target = type == FleetType.Enemy ? ToIndex(i, type) - 1  : ToIndex(i, type) + 1,
                happened = x.Item1 == 1 || x.Item2 == 1,
                damage = x.Item3,
                isCriticalHit = x.Item4 == 1
            })
                   .Where(x => x.happened)
                   .Select(x => new Attack(0, x.target, x.damage, x.isCriticalHit)));
        }
        private void AirCombat(Api_Kouku airCombat, string prefix = "", bool airSupremacy = true)
        {
            if (airCombat == null) return;

            if (airSupremacy)
            {
                this.FriendAirSupremacy = airCombat.GetAirSupremacy();
            }

            foreach (var fleet in this.FriendFleet.Fleets)
            {
                fleet.CalcDamages(airCombat.GetDamages(FleetType.Friend, fleet.Index));
            }
            foreach (var fleet in this.EnemyFleet.Fleets)
            {
                fleet.CalcDamages(airCombat.GetDamages(FleetType.Enemy, fleet.Index));
            }

            this.AirCombatResults = this.AirCombatResults.Concat(airCombat.ToResult(prefix)).ToArray();
        }
Beispiel #8
0
 public static AirSupremacy GetAirSupremacy(this Api_Kouku kouku)
 {
     return(kouku != null && kouku.api_stage1 != null
         ? (AirSupremacy)kouku.api_stage1.api_disp_seiku
         : AirSupremacy.航空戦なし);
 }
Beispiel #9
0
 public static AirSupremacy GetAirSupremacy(this Api_Kouku kouku)
 => (AirSupremacy)(kouku?.api_stage1?.api_disp_seiku ?? (int)AirSupremacy.항공전없음);
Beispiel #10
0
 public static FleetDamages GetSecondEnemyDamages(this Api_Kouku kouku)
 => kouku?.api_stage3_combined?.api_edam?.GetDamages()
 ?? defaultValue;
Beispiel #11
0
 public static FleetDamages GetEnemyDamages(this Api_Kouku kouku)
 => kouku?.api_stage3?.api_edam?.GetDamages()
 ?? defaultValue;
Beispiel #12
0
 public static FleetDamages GetFirstFleetDamages(this Api_Kouku kouku)
 => kouku?.api_stage3?.api_fdam.GetDamages()
 ?? defaultValue;
Beispiel #13
0
 public static AirSupremacy GetAirSupremacy(this Api_Kouku kouku)
 => kouku.IsEnabled()
         ? (AirSupremacy)(kouku.api_stage1?.api_disp_seiku ?? (int)AirSupremacy.航空戦なし)
         : AirSupremacy.航空戦なし;
Beispiel #14
0
 public static bool IsEnabled(this Api_Kouku kouku)
 => kouku?.api_plane_from?
 .Where(arr => arr != null)
 .Any(arr => arr.Any(n => n != -1))
 ?? false;
 public static FleetDamages GetDamages(this Api_Kouku kouku, FleetType type, int fleetIndex)
 {
     return(Stage3DamageCalculator[type](Stage3Selector[fleetIndex](kouku)));
 }