Refactor DataTables and cleanup redundant code
Refactored `WeaponTable` grid to use a typed parameter and improve readability. Removed outdated or unnecessary sample comments, consolidated duplicate code, and reorganized theme-related components in `PageLayout`. Simplified initialization logic and improved formatting consistency.
This commit is contained in:
@@ -1376,7 +1376,8 @@ public class DATA
|
||||
.AddPart(new EntityMovementModel { Speed = 532, Movement = MovementType.Air })
|
||||
.AddPart(new EntityWeaponModel
|
||||
{
|
||||
Damage = 100, LightDamage = 100, MediumDamage = 130, HeavyDamage = 160, Range = 20, AttacksPerSecond = 1,
|
||||
Damage = 100, LightDamage = 100, MediumDamage = 130, HeavyDamage = 160, Range = 20,
|
||||
AttacksPerSecond = 1,
|
||||
Targets =
|
||||
TargetType.Air
|
||||
})
|
||||
@@ -3656,7 +3657,7 @@ public class DATA
|
||||
Description = "Passively harvest pyre.",
|
||||
Notes = ""
|
||||
})
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -38,22 +38,25 @@ public class EntityModel
|
||||
public bool IsSpeculative { get; set; }
|
||||
|
||||
public string Descriptive { get; set; } = DescriptiveType.None;
|
||||
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityInfoModel)) as EntityInfoModel;
|
||||
return entityInfo == null ? string.Empty : entityInfo.Name;
|
||||
}
|
||||
|
||||
|
||||
public string GetFaction()
|
||||
{
|
||||
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityFactionModel)) as EntityFactionModel;
|
||||
var entityInfo =
|
||||
EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityFactionModel)) as EntityFactionModel;
|
||||
return entityInfo == null ? string.Empty : DATA.Get()[entityInfo.Faction].GetName();
|
||||
}
|
||||
|
||||
|
||||
public string GetImmortal()
|
||||
{
|
||||
var entityInfo = EntityParts.FirstOrDefault(a => a.GetType() == typeof(EntityVanguardAddedModel)) as EntityVanguardAddedModel;
|
||||
var entityInfo =
|
||||
EntityParts.FirstOrDefault(a =>
|
||||
a.GetType() == typeof(EntityVanguardAddedModel)) as EntityVanguardAddedModel;
|
||||
return entityInfo == null ? string.Empty : DATA.Get()[entityInfo.ImmortalId].GetName();
|
||||
}
|
||||
|
||||
@@ -82,7 +85,7 @@ public class EntityModel
|
||||
public EntityModel AddPart(IEntityPartInterface unitPart)
|
||||
{
|
||||
unitPart.Parent = this;
|
||||
|
||||
|
||||
EntityParts.Add(unitPart);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -12,52 +12,6 @@ public class EntityWeaponModel : IEntityPartInterface
|
||||
public float AttacksPerSecond { get; set; } = 0;
|
||||
public float SecondsBetweenAttacks { get; set; } = 0;
|
||||
|
||||
public float DamagePerSecond()
|
||||
{
|
||||
if (SecondsBetweenAttacks == 0)
|
||||
{
|
||||
return Damage * AttacksPerSecond;
|
||||
}
|
||||
|
||||
return Damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondLight()
|
||||
{
|
||||
var damage = LightDamage != 0 ? LightDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0)
|
||||
{
|
||||
return damage * AttacksPerSecond;
|
||||
}
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondMedium()
|
||||
{
|
||||
var damage = MediumDamage != 0 ? MediumDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0)
|
||||
{
|
||||
return damage * AttacksPerSecond;
|
||||
}
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondHeavy()
|
||||
{
|
||||
var damage = HeavyDamage != 0 ? HeavyDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0)
|
||||
{
|
||||
return damage * AttacksPerSecond;
|
||||
}
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float Cooldown { get; set; } = 0;
|
||||
public float Charges { get; set; } = 0;
|
||||
|
||||
@@ -77,4 +31,38 @@ public class EntityWeaponModel : IEntityPartInterface
|
||||
public int EthericDamageBonus { get; set; } = 0;
|
||||
public string Targets { get; set; } = TargetType.All;
|
||||
public string Attack { get; set; } = AttackType.DPS;
|
||||
|
||||
public float DamagePerSecond()
|
||||
{
|
||||
if (SecondsBetweenAttacks == 0) return Damage * AttacksPerSecond;
|
||||
|
||||
return Damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondLight()
|
||||
{
|
||||
var damage = LightDamage != 0 ? LightDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0) return damage * AttacksPerSecond;
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondMedium()
|
||||
{
|
||||
var damage = MediumDamage != 0 ? MediumDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0) return damage * AttacksPerSecond;
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
|
||||
public float DamagePerSecondHeavy()
|
||||
{
|
||||
var damage = HeavyDamage != 0 ? HeavyDamage : Damage;
|
||||
|
||||
if (SecondsBetweenAttacks == 0) return damage * AttacksPerSecond;
|
||||
|
||||
return damage / SecondsBetweenAttacks;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user