Skip to content

Commit

Permalink
Merge pull request eesast#279 from Panxuc/dev
Browse files Browse the repository at this point in the history
fix: 🐛 installModule return wrong money
  • Loading branch information
DragonAura authored Apr 27, 2024
2 parents a87c129 + ea7a293 commit 730ea3f
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 deletions logic/GameClass/GameObj/Ship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,45 +94,48 @@ public bool InstallModule(ModuleType moduleType)
case ModuleType.Producer1:
if (ProducerModuleType != ProducerType.Producer1)
{
SubMoney(
ProducerModule.SetROri(
ModuleFactory.FindIProducer(ShipType, ProducerType.Producer1)
).Cost);
ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer1));
SubMoney(ProducerModule.Get().Cost);
return true;
}
break;
case ModuleType.Producer2:
if (ProducerModuleType != ProducerType.Producer2)
{
SubMoney(ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer2)).Cost);
ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer2));
SubMoney(ProducerModule.Get().Cost);
return true;
}
break;
case ModuleType.Producer3:
if (ProducerModuleType != ProducerType.Producer3)
{
SubMoney(ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer3)).Cost);
ProducerModule.SetROri(ModuleFactory.FindIProducer(ShipType, ProducerType.Producer3));
SubMoney(ProducerModule.Get().Cost);
return true;
}
break;
case ModuleType.Constructor1:
if (ConstructorModuleType != ConstructorType.Constructor1)
{
SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor1)).Cost);
ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor1));
SubMoney(ConstructorModule.Get().Cost);
return true;
}
break;
case ModuleType.Constructor2:
if (ConstructorModuleType != ConstructorType.Constructor2)
{
SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor2)).Cost);
ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor2));
SubMoney(ConstructorModule.Get().Cost);
return true;
}
break;
case ModuleType.Constructor3:
if (ConstructorModuleType != ConstructorType.Constructor3)
{
SubMoney(ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor3)).Cost);
ConstructorModule.SetROri(ModuleFactory.FindIConstructor(ShipType, ConstructorType.Constructor3));
SubMoney(ConstructorModule.Get().Cost);
return true;
}
break;
Expand Down Expand Up @@ -198,38 +201,43 @@ public bool InstallModule(ModuleType moduleType)
case ModuleType.LaserGun:
if (WeaponModuleType != WeaponType.LaserGun)
{
SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.LaserGun)).Cost);
WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.LaserGun));
SubMoney(WeaponModule.Get().Cost);
return true;
}
break;
case ModuleType.PlasmaGun:
if (WeaponModuleType != WeaponType.PlasmaGun)
{
SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.PlasmaGun)).Cost);
WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.PlasmaGun));
SubMoney(WeaponModule.Get().Cost);
return true;
}
break;

case ModuleType.ShellGun:
if (WeaponModuleType != WeaponType.ShellGun)
{
SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ShellGun)).Cost);
WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ShellGun));
SubMoney(WeaponModule.Get().Cost);
return true;
}
break;

case ModuleType.MissileGun:
if (WeaponModuleType != WeaponType.MissileGun)
{
SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.MissileGun)).Cost);
WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.MissileGun));
SubMoney(WeaponModule.Get().Cost);
return true;
}
break;

case ModuleType.ArcGun:
if (WeaponModuleType != WeaponType.ArcGun)
{
SubMoney(WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ArcGun)).Cost);
WeaponModule.SetROri(ModuleFactory.FindIWeapon(ShipType, WeaponType.ArcGun));
SubMoney(WeaponModule.Get().Cost);
return true;
}
break;
Expand Down

0 comments on commit 730ea3f

Please sign in to comment.