diff --git a/logic/GameClass/GameObj/Base.cs b/logic/GameClass/GameObj/Base.cs index cb4d24a1..1d965f11 100644 --- a/logic/GameClass/GameObj/Base.cs +++ b/logic/GameClass/GameObj/Base.cs @@ -32,6 +32,7 @@ public Base(Home home) { if (ship.IsRemoved.TrySet(false)) { + ship.Init(); ship.CanMove.SetROri(true); return true; } diff --git a/logic/GameClass/GameObj/Ship.cs b/logic/GameClass/GameObj/Ship.cs index a9818643..c6073182 100755 --- a/logic/GameClass/GameObj/Ship.cs +++ b/logic/GameClass/GameObj/Ship.cs @@ -434,23 +434,16 @@ public bool Commandable() && shipState != ShipStateType.Attacking); } } - public Ship(int initRadius, ShipType shipType, MoneyPool moneyPool) : - base(GameData.PosNotInGame, initRadius, GameObjType.Ship) + public void Init() { - CanMove.SetROri(false); - IsRemoved.SetROri(true); - Occupation = OccupationFactory.FindIOccupation(ShipType = shipType); - ViewRange = Occupation.ViewRange; - HP = new(Occupation.MaxHp); - Armor = new(Occupation.BaseArmor); - Shield = new(Occupation.BaseShield); + HP.SetMaxV(Occupation.MaxHp); + HP.SetVToMaxV(); + Armor.SetMaxV(Occupation.BaseArmor); + Armor.SetVToMaxV(); + Shield.SetMaxV(Occupation.BaseShield); + Shield.SetVToMaxV(); MoveSpeed.SetROri(orgMoveSpeed = Occupation.MoveSpeed); - MoneyPool = moneyPool; - - ProducerType producerType; - ConstructorType constructorType; - WeaponType weaponType; - (producerType, constructorType, weaponType) = ShipType switch + var (producerType, constructorType, weaponType) = ShipType switch { ShipType.CivilShip => ( ProducerType.Producer1, @@ -475,4 +468,17 @@ public Ship(int initRadius, ShipType shipType, MoneyPool moneyPool) : ShieldModule.SetROri(ModuleFactory.FindIShield(ShipType, ShieldType.Null)); WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, weaponType)); } + public Ship(int initRadius, ShipType shipType, MoneyPool moneyPool) : + base(GameData.PosNotInGame, initRadius, GameObjType.Ship) + { + CanMove.SetROri(false); + IsRemoved.SetROri(true); + Occupation = OccupationFactory.FindIOccupation(ShipType = shipType); + ViewRange = Occupation.ViewRange; + HP = new(Occupation.MaxHp); + Armor = new(Occupation.BaseArmor); + Shield = new(Occupation.BaseShield); + MoneyPool = moneyPool; + Init(); + } }