diff --git a/ElectronicObserver/Data/ShipData.cs b/ElectronicObserver/Data/ShipData.cs index 7aa85bed4..5d72c48de 100644 --- a/ElectronicObserver/Data/ShipData.cs +++ b/ElectronicObserver/Data/ShipData.cs @@ -496,6 +496,21 @@ public int ExpNextRemodel } + /// + /// 最終改装まで必要な経験値 + /// + public int ExpFinalRemodel + { + get + { + ShipDataMaster master = MasterShip; + if (master.FinalRemodelShipID <= 0) + return 0; + return Math.Max(ExpTable.ShipExp[master.FinalRemodelLevel].Total - ExpTotal, 0); + } + } + + /// /// 艦名 /// diff --git a/ElectronicObserver/Data/ShipDataMaster.cs b/ElectronicObserver/Data/ShipDataMaster.cs index 8e58e40ea..a4217c2f5 100644 --- a/ElectronicObserver/Data/ShipDataMaster.cs +++ b/ElectronicObserver/Data/ShipDataMaster.cs @@ -82,6 +82,76 @@ public class ShipDataMaster : ResponseWrapper, IIdentifiable /// public ShipDataMaster RemodelBeforeShip => RemodelBeforeShipID > 0 ? KCDatabase.Instance.MasterShips[RemodelBeforeShipID] : null; + /// + /// Backing field for FinalRemodelShip since it's not likely changing during runtime + /// + private ShipDataMaster finalRemodelShip = null; + + /// + /// 最終改装の艦船 + /// May be *this*, means already been the final remodel ship + /// + public ShipDataMaster FinalRemodelShip + { + get + { + if (finalRemodelShip != null) return finalRemodelShip; + if (RemodelAfterShipID <= 0) + { + // Currently being the final remodel ship + finalRemodelShip = this; + } + + ShipDataMaster lastRemodel = this; + int lastRemodelLv = RemodelBeforeShip == null ? 0 : RemodelBeforeShip.RemodelAfterLevel; + + while (lastRemodel != null && lastRemodel.RemodelAfterLevel > lastRemodelLv && lastRemodel.RemodelAfterShipID != this.ShipID) + { + //find the final remodel ship which has the largest remodeling level + lastRemodelLv = lastRemodel.RemodelAfterLevel; + lastRemodel = lastRemodel.RemodelAfterShip; + } + finalRemodelShip = lastRemodel; + return finalRemodelShip; + } + } + + /// + /// 最終改装Lv + /// + public int FinalRemodelLevel => FinalRemodelShip == null ? 0 : FinalRemodelShip.RemodelBeforeShip.RemodelAfterLevel; + + /// + /// 最終改装の艦船ID + /// 0=なし + /// + public int FinalRemodelShipID => FinalRemodelShip == null ? 0 : FinalRemodelShip.ShipID; + + public bool CanConvertRemodel + { + get + { + if (FinalRemodelShip == null || FinalRemodelShip.RemodelAfterShip == null) + { + // If it cannot remodel after final-remodel, it cannot convert-remodel + return false; + } + if (ShipID == FinalRemodelShipID && RemodelAfterShipID != 0) + { + return true; + } + + ShipDataMaster tmpShip = FinalRemodelShip.RemodelAfterShip; + bool result = false; + while(!result && tmpShip.ShipID != FinalRemodelShipID) + { + // if current ship can be remodeled from final-remodel, it can convert-remodel + result = tmpShip.RemodelAfterShipID == ShipID; + tmpShip = tmpShip.RemodelAfterShip; + } + return result; + } + } /// /// 改装に必要な弾薬 diff --git a/ElectronicObserver/Window/FormFleet.cs b/ElectronicObserver/Window/FormFleet.cs index 8cbac0187..6c561c0a4 100644 --- a/ElectronicObserver/Window/FormFleet.cs +++ b/ElectronicObserver/Window/FormFleet.cs @@ -504,17 +504,36 @@ public void Update(int shipMasterID) if (!Utility.Configuration.Config.FormFleet.ShowNextExp) tip.AppendFormat("次のレベルまで: {0} exp.\r\n", ship.ExpNext); - if (ship.MasterShip.RemodelAfterShipID != 0 && ship.Level < ship.MasterShip.RemodelAfterLevel) + if (ship.MasterShip.RemodelAfterShipID != 0 && ship.MasterShip.RemodelAfterShipID != ship.MasterShip.FinalRemodelShipID && ship.Level < ship.MasterShip.RemodelAfterLevel) { tip.AppendFormat("改装まで: Lv. {0} / {1} exp.\r\n", ship.MasterShip.RemodelAfterLevel - ship.Level, ship.ExpNextRemodel); } - else if (ship.Level <= 99) - { - tip.AppendFormat("Lv99まで: {0} exp.\r\n", Math.Max(ExpTable.GetExpToLevelShip(ship.ExpTotal, 99), 0)); + else if (ship.MasterShip != ship.MasterShip.FinalRemodelShip && ship.Level < ship.MasterShip.FinalRemodelLevel) + { + if (ship.MasterShip.RemodelAfterShipID != ship.MasterShip.FinalRemodelShipID) + { + tip.Append("今改装可能.\r\n"); + } + tip.AppendFormat("最終改装まで: Lv. {0} / {1} exp.\r\n", ship.MasterShip.FinalRemodelLevel - ship.Level, ship.ExpFinalRemodel); } - else - { - tip.AppendFormat("Lv{0}まで: {1} exp.\r\n", ExpTable.ShipMaximumLevel, Math.Max(ExpTable.GetExpToLevelShip(ship.ExpTotal, ExpTable.ShipMaximumLevel), 0)); + else + { + if (ship.ShipID != ship.MasterShip.FinalRemodelShipID) + { + tip.Append("今最終改装可能.\r\n"); + } + else if (ship.MasterShip.CanConvertRemodel) + { + tip.Append("今コンバート改装可能.\r\n"); + } + if (ship.Level <= 99) + { + tip.AppendFormat("Lv99まで: {0} exp.\r\n", Math.Max(ExpTable.GetExpToLevelShip(ship.ExpTotal, 99), 0)); + } + else + { + tip.AppendFormat("Lv{0}まで: {1} exp.\r\n", ExpTable.ShipMaximumLevel, Math.Max(ExpTable.GetExpToLevelShip(ship.ExpTotal, ExpTable.ShipMaximumLevel), 0)); + } } tip.AppendLine("(右クリックで必要Exp計算)");