Ejemplo n.º 1
0
 public ShipData()
 {
     this._Name           = "???";
     this._AdditionalName = "";
     this._TypeName       = "???";
     this._ShipType       = 0;
     this._Situation      = ShipSituation.None;
     this._Slots          = new ShipSlotData[0];
     this._ShipSpeed      = ShipSpeed.Immovable;
 }
Ejemplo n.º 2
0
        internal void Update(kcsapi_ship2 rawData)
        {
            this.UpdateRawData(rawData);

            this.Info = KanColleClient.Current.Master.Ships[rawData.api_ship_id] ?? ShipInfo.Dummy;
            this.HP   = new LimitedValue(this.RawData.api_nowhp, this.RawData.api_maxhp, 0);
            this.Fuel = new LimitedValue(this.RawData.api_fuel, this.Info.RawData.api_fuel_max, 0);
            this.Bull = new LimitedValue(this.RawData.api_bull, this.Info.RawData.api_bull_max, 0);

            if (this.RawData.api_kyouka.Length >= 5)
            {
                this.Firepower = new ModernizableStatus(this.Info.RawData.api_houg, this.RawData.api_kyouka[0]);
                this.Torpedo   = new ModernizableStatus(this.Info.RawData.api_raig, this.RawData.api_kyouka[1]);
                this.AA        = new ModernizableStatus(this.Info.RawData.api_tyku, this.RawData.api_kyouka[2]);
                this.Armer     = new ModernizableStatus(this.Info.RawData.api_souk, this.RawData.api_kyouka[3]);
                this.Luck      = new ModernizableStatus(this.Info.RawData.api_luck, this.RawData.api_kyouka[4]);
            }

            this.Slots = this.RawData.api_slot
                         .Select(id => this.homeport.Itemyard.SlotItems[id])
                         .Select((t, i) => new ShipSlot(t, this.Info.RawData.api_maxeq.Get(i) ?? 0, this.RawData.api_onslot.Get(i) ?? 0))
                         .ToArray();
            this.EquippedSlots = this.Slots.Where(x => x.Equipped).ToArray();

            if (this.EquippedSlots.Any(x => x.Item.Info.Type == SlotItemType.応急修理要員))
            {
                this.Situation |= ShipSituation.DamageControlled;
            }
            else
            {
                this.Situation &= ~ShipSituation.DamageControlled;
            }

            // Minimum removes equipped values.
            int eqAntiSub = 0, eqEvasion = 0, eqLineOfSight = 0;

            foreach (ShipSlot item in this.EquippedSlots)
            {
                if (item == null)
                {
                    continue;
                }

                eqAntiSub     += item.Item.Info.RawData.api_tais;
                eqEvasion     += item.Item.Info.RawData.api_houk;
                eqLineOfSight += item.Item.Info.RawData.api_saku;
            }

            this.AntiSub     = new LimitedValue(this.RawData.api_taisen[0], this.RawData.api_taisen[1], this.RawData.api_taisen[0] - eqAntiSub);
            this.Evasion     = new LimitedValue(this.RawData.api_kaihi[0], this.RawData.api_kaihi[1], this.RawData.api_kaihi[0] - eqEvasion);
            this.LineOfSight = new LimitedValue(this.RawData.api_sakuteki[0], this.RawData.api_sakuteki[1], this.RawData.api_sakuteki[0] - eqLineOfSight);
        }
Ejemplo n.º 3
0
        public void UpdateSlots()
        {
            this.Slots = this.RawData.api_slot
                         .Select(id => this.homeport.Itemyard.SlotItems[id])
                         .Select((t, i) => new ShipSlot(t, this.Info.RawData.api_maxeq.Get(i) ?? 0, this.RawData.api_onslot.Get(i) ?? 0))
                         .ToArray();
            this.ExSlot        = new ShipSlot(this.homeport.Itemyard.SlotItems[this.RawData.api_slot_ex], 0, 0);
            this.EquippedItems = this.EnumerateAllEquippedItems().ToArray();

            if (this.EquippedItems.Any(x => x.Item.Info.Type == SlotItemType.応急修理要員))
            {
                this.Situation |= ShipSituation.DamageControlled;
            }
            else
            {
                this.Situation &= ~ShipSituation.DamageControlled;
            }
        }
Ejemplo n.º 4
0
 public ShipData()
 {
     this._Name = "???";
     this._AdditionalName = "";
     this._TypeName = "???";
     this._Situation = ShipSituation.None;
     this._Slots = new ShipSlotData[0];
 }
Ejemplo n.º 5
0
        internal void Update(kcsapi_ship2 rawData)
        {
            this.UpdateRawData(rawData);

            this.Info = KanColleClient.Current.Master.Ships[rawData.api_ship_id] ?? ShipInfo.Dummy;
            this.HP   = new LimitedValue(this.RawData.api_nowhp, this.RawData.api_maxhp, 0);
            this.Fuel = new LimitedValue(this.RawData.api_fuel, this.Info.RawData.api_fuel_max, 0);
            this.Bull = new LimitedValue(this.RawData.api_bull, this.Info.RawData.api_bull_max, 0);

            if (this.RawData.api_kyouka.Length >= 5)
            {
                this.Firepower = new ModernizableStatus(this.Info.RawData.api_houg, this.RawData.api_kyouka[0]);
                this.Torpedo   = new ModernizableStatus(this.Info.RawData.api_raig, this.RawData.api_kyouka[1]);
                this.AA        = new ModernizableStatus(this.Info.RawData.api_tyku, this.RawData.api_kyouka[2]);
                this.Armer     = new ModernizableStatus(this.Info.RawData.api_souk, this.RawData.api_kyouka[3]);
                this.Luck      = new ModernizableStatus(this.Info.RawData.api_luck, this.RawData.api_kyouka[4]);
            }

            this.Slots = this.RawData.api_slot
                         .Take(rawData.api_slotnum)
                         .Select(id => this.homeport.Itemyard.SlotItems[id])
                         .Select((t, i) => new ShipSlot(t, this.Info.RawData.api_maxeq.Get(i) ?? 0, this.RawData.api_onslot.Get(i) ?? 0)).ToArray();
            this.EquippedSlots = this.Slots.Where(x => x.Equipped).ToArray();

            if (this.EquippedSlots.Any(x => x.Item.Info.Type == SlotItemType.応急修理要員))
            {
                this.Situation |= ShipSituation.DamageControlled;
            }
            else
            {
                this.Situation &= ~ShipSituation.DamageControlled;
            }

            // Count different types of equipments
            var primaryCannons      = 0;
            var heavyPrimaryCannons = 0;
            var secondaryCannons    = 0;
            var torpedoes           = 0;
            var observationPlanes   = 0;
            var radars              = 0;
            var apShells            = 0;
            var aaShells            = 0;
            var highAngleGun        = 0;
            var comboGunAndDirector = 0;
            var aaFireDirector      = 0;

            foreach (var itemInfo in EquippedSlots.Select(x => x.Item.Info))
            {
                switch (itemInfo.Type)
                {
                case SlotItemType.水上偵察機:
                case SlotItemType.水上爆撃機:
                    observationPlanes++;
                    break;

                default:
                    switch (itemInfo.IconType)
                    {
                    case SlotItemIconType.MainCanonHeavy:
                        heavyPrimaryCannons++;
                        primaryCannons++;
                        break;

                    case SlotItemIconType.MainCanonLight:
                    case SlotItemIconType.MainCanonMedium:
                        primaryCannons++;
                        break;

                    case SlotItemIconType.SecondaryCanon:
                        secondaryCannons++;
                        break;

                    case SlotItemIconType.Rader:
                        radars++;
                        break;

                    case SlotItemIconType.APShell:
                        apShells++;
                        break;

                    case SlotItemIconType.AntiAircraftFireDirector:
                        aaFireDirector++;
                        break;

                    case SlotItemIconType.AAShell:
                        aaShells++;
                        break;

                    case SlotItemIconType.Torpedo:
                        if (itemInfo.Id != 41)          //甲標的
                        {
                            torpedoes++;
                        }
                        break;

                    case SlotItemIconType.HighAngleGun:
                        switch (itemInfo.Id)
                        {
                        case 10:             //12.7cm連装高角砲
                        case 66:             //8cm高角砲
                        case 71:             //10cm連装高角砲(砲架)
                            secondaryCannons++;
                            break;

                        case 130:             //12.7cm高角砲+高射装置
                            secondaryCannons++;
                            comboGunAndDirector++;
                            break;

                        case 3:             //10cm連装高角砲
                        case 48:            //12.7cm単装高角砲
                        case 91:            //12.7cm連装高角砲(後期型)
                            primaryCannons++;
                            break;

                        case 122:             //10cm高角砲+高射装置
                            primaryCannons++;
                            comboGunAndDirector++;
                            break;
                        }
                        highAngleGun++;
                        break;
                    }
                    break;
                }
            }

            SpecialAttackType sat = SpecialAttackType.None;

            if (observationPlanes > 0)
            {
                if (primaryCannons == 2 && secondaryCannons == 0 && apShells == 1 && radars == 0)
                {
                    sat |= SpecialAttackType.DualArtilleryWithCorrection;
                }
                if (primaryCannons == 1 && secondaryCannons == 1 && apShells == 1 && radars == 0)
                {
                    sat |= SpecialAttackType.ArtilleryWithApShellWithCorrection;
                }
                if (primaryCannons == 1 && secondaryCannons == 1 && apShells == 0 && radars == 1)
                {
                    sat |= SpecialAttackType.ArtilleryWithRadarCorrection;
                }
                if (primaryCannons >= 1 && secondaryCannons >= 1)
                {
                    sat |= SpecialAttackType.ArtilleryWithCanonWithCorrection;
                }
                if (primaryCannons >= 2)
                {
                    sat |= SpecialAttackType.DualArtillery;
                }
            }
            BattleSpecialAttack = sat;

            if (heavyPrimaryCannons == 1 && aaShells == 1 && aaFireDirector == 1 && radars == 1)
            {
                AntiAirCutIn = AaCutInType.ArtilleryAaT3ShellWithRadar;
            }
            else if (comboGunAndDirector >= 2 && radars >= 1)
            {
                AntiAirCutIn = AaCutInType.DualNavalAndAaGunWithRadar;
            }
            else if (heavyPrimaryCannons >= 1 && aaShells >= 1 && aaFireDirector >= 1)
            {
                AntiAirCutIn = AaCutInType.ArtilleryAaT3ShellNoRadar;
            }
            else if (highAngleGun >= 1 && aaFireDirector >= 1 && radars >= 1)
            {
                AntiAirCutIn = AaCutInType.NavalGunWithAaGunWithRadar;
            }
            else if (comboGunAndDirector >= 1 && radars >= 1)
            {
                AntiAirCutIn = AaCutInType.NavalAndAaGunWithRadar;
            }
            else if (highAngleGun >= 1 && aaFireDirector >= 1)
            {
                AntiAirCutIn = AaCutInType.NavalGunWithAaGunNoRadar;
            }
            else if (Info.Id == 330 || Info.Id == 421)  //秋月
            {
                if (highAngleGun >= 2 && radars >= 1)
                {
                    AntiAirCutIn = AaCutInType.AkizukiDualNavalGunWithRadar;
                }
                else if (highAngleGun >= 1 && radars >= 1)
                {
                    AntiAirCutIn = AaCutInType.AkizukiNavalGunWithRadar;
                }
                else if (highAngleGun >= 2)
                {
                    AntiAirCutIn = AaCutInType.AkizukiDualNavalGunNoRadar;
                }
            }
            else if (Info.Id == 428)    //摩耶改二
            {
                if ((highAngleGun - comboGunAndDirector) >= 1 && EquippedSlots.Any(x => x.Item.Info.Id == 131))
                {
                    AntiAirCutIn = radars > 0 ? AaCutInType.MayaGen2MultiAaGunWithNavalGunWithRadar : AaCutInType.MayaGen2MultiAaGunWithNavalGunNoRadar;
                }
            }
            else
            {
                AntiAirCutIn = AaCutInType.None;
            }

            if (torpedoes >= 2)
            {
                NightSpecialAttack = NightBattleAttackType.TorpedoCutIn;
            }
            else if (primaryCannons >= 3)
            {
                NightSpecialAttack = NightBattleAttackType.TriArtilleryCutIn;
            }
            else if (primaryCannons == 2 && secondaryCannons >= 1)
            {
                NightSpecialAttack = NightBattleAttackType.DualArtilleryWithCannonCutIn;
            }
            else if (primaryCannons == 2 && secondaryCannons == 0 && torpedoes == 1)
            {
                NightSpecialAttack = NightBattleAttackType.DualArtilleryWithTorpedoCutIn;
            }
            else if (primaryCannons == 1 && torpedoes == 1)
            {
                NightSpecialAttack = NightBattleAttackType.ArtilleryWithTorpedoCutIn;
            }
            else if (primaryCannons == 2 && secondaryCannons == 0 && torpedoes == 0)
            {
                NightSpecialAttack = NightBattleAttackType.DualArtillery;
            }
            else if (primaryCannons == 1 && secondaryCannons >= 1 && torpedoes == 0)
            {
                NightSpecialAttack = NightBattleAttackType.ArtilleryWithCannon;
            }
            else if (secondaryCannons >= 2 && (torpedoes == 0 || torpedoes == 1))
            {
                NightSpecialAttack = NightBattleAttackType.DualCannon;
            }
            else
            {
                NightSpecialAttack = NightBattleAttackType.None;
            }
        }