refactor: create a public dictionary for turret damage types

This commit is contained in:
cswimr 2024-12-31 10:37:41 -05:00
parent 35508c8264
commit e66cbcf262
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
2 changed files with 14 additions and 9 deletions

View file

@ -1,3 +1,5 @@
using System.Collections.Generic;
namespace ZenithInfo.Models namespace ZenithInfo.Models
{ {
public enum ModuleSizes public enum ModuleSizes
@ -29,4 +31,15 @@ namespace ZenithInfo.Models
Railgun, Railgun,
PulseLaser, PulseLaser,
} }
public Dictionary<TurretTypes, DamageTypes> TurretDamageTypes { get; } =
new Dictionary<TurretTypes, DamageTypes>
{
{ TurretTypes.Artillery, DamageTypes.Hull },
{ TurretTypes.Autocannon, DamageTypes.Hull },
{ TurretTypes.BeamLaser, DamageTypes.Shield },
{ TurretTypes.Blaster, DamageTypes.Shield },
{ TurretTypes.Railgun, DamageTypes.Hull },
{ TurretTypes.PulseLaser, DamageTypes.Shield },
};
} }

View file

@ -20,15 +20,7 @@ namespace ZenithInfo.Models
public DamageTypes DamageType() public DamageTypes DamageType()
{ {
new Dictionary<TurretTypes, DamageTypes> TurretDamageTypes[this.Type];
{
{ TurretTypes.Artillery, DamageTypes.Hull },
{ TurretTypes.Autocannon, DamageTypes.Hull },
{ TurretTypes.BeamLaser, DamageTypes.Shield },
{ TurretTypes.Blaster, DamageTypes.Shield },
{ TurretTypes.Railgun, DamageTypes.Hull },
{ TurretTypes.PulseLaser, DamageTypes.Shield },
}[this.Type];
} }
public DamageStats Dps(int range: 0) public DamageStats Dps(int range: 0)