diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 54ee8cc65..d0434abc0 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -16451,6 +16451,32 @@ static void RequireUnityPhysicsIsNotGameplayAuthority(string root) } var weaponEffectRoot = Path.Combine(root, "Assets", "Scripts", "Gameplay", "Weapons"); + var forbiddenWeaponCombatSymbols = new[] + { + "public float Damage", + "public float Penetration", + "public float Spread", + "public DamageType", + ".Damage =", + ".Penetration =", + ".Spread =", + ".DamageType =", + ".DamageSpread" + }; + var weaponCombatAuthorityHits = Directory.EnumerateFiles(weaponEffectRoot, "*.cs", SearchOption.TopDirectoryOnly) + .SelectMany(path => File.ReadLines(path) + .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line })) + .Where(line => forbiddenWeaponCombatSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal))) + .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}") + .ToArray(); + + if (weaponCombatAuthorityHits.Length > 0) + { + throw new InvalidOperationException( + "Unity weapon effects are presentation only; combat damage, penetration, spread, and damage type belong to daemon/Ymir state: " + + string.Join("; ", weaponCombatAuthorityHits)); + } + var weaponSingletonHits = Directory.EnumerateFiles(weaponEffectRoot, "*.cs", SearchOption.TopDirectoryOnly) .SelectMany(path => File.ReadLines(path) .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line })) diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs index bd27e0df9..0e47dac49 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaser.cs @@ -11,10 +11,7 @@ public class ConstantLaser : MonoBehaviour public float CycleDuration; public LineRenderer LineRenderer; - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public Entity SourceEntity { get; set; } public ZoneRenderer ZoneRenderer { get; set; } public float Range { get; set; } @@ -84,7 +81,7 @@ public class ConstantLaser : MonoBehaviour var entity = hull.Entity; if (entity.Shield != null && entity.Shield.Item.Active.Value) { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); LineRenderer.SetPosition(1, hit.Point); hitFound = true; break; diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs index 8193ab229..a1853c1f2 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLaserManager.cs @@ -20,10 +20,7 @@ public class ConstantLaserManager : ConstantWeaponEffectManager t.SetParent(barrel); t.forward = barrel.forward; t.position = barrel.position; - p.Damage = weapon.Damage; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; _lasers.Add(item, p); } diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs index a39f0b7fd..f2fad96f0 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLightning.cs @@ -10,10 +10,7 @@ public class ConstantLightning : MonoBehaviour public float FadeDuration; public Transform Barrel { get; set; } - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public EntityInstance Source { get; set; } public float Range { get; set; } @@ -63,7 +60,7 @@ public class ConstantLightning : MonoBehaviour var entity = hull.Entity; if (entity.Shield != null && entity.Shield.Item.Active.Value) { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); } else { diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs index f0b152576..9372f2f47 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantLightningManager.cs @@ -16,11 +16,8 @@ public class ConstantLightningManager : ConstantWeaponEffectManager var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y]; var barrel = source.GetBarrel(hp); p.Barrel = barrel; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; _bolts.Add(item, p); } diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeapon.cs b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeapon.cs index 5b24b29d2..dcaee68f7 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeapon.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeapon.cs @@ -6,9 +6,7 @@ public class ConstantParticleWeapon : MonoBehaviour public ParticleSystem[] Particles; public float CastRadius = 0.25f; - public float Damage { get; set; } public float Range { get; set; } - public DamageType DamageType { get; set; } public EntityInstance Source { get; set; } public EntityInstance Target { get; set; } diff --git a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs index c953f7d9a..406d63631 100644 --- a/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ConstantParticleWeaponManager.cs @@ -19,8 +19,6 @@ public class ConstantParticleWeaponManager : ConstantWeaponEffectManager t.SetParent(barrel); t.forward = barrel.forward; t.position = barrel.position; - p.Damage = weapon.Damage; - p.DamageType = weapon.DamageType; p.Range = weapon.Range; _weapons.Add(item, p); p.Initialize(); diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs index a83973a23..695c7aa7d 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectile.cs @@ -34,10 +34,7 @@ public class GuidedProjectile : MonoBehaviour public Vector3 StartPosition { get; set; } public float Range { get; set; } public Vector3 Velocity { get; set; } - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public Entity SourceEntity { get; set; } public ZoneRenderer ZoneRenderer { get; set; } @@ -106,10 +103,7 @@ public class GuidedProjectile : MonoBehaviour var perpendicularRandom = randomDirection.x * right + randomDirection.y * up; child.Velocity = Vector3.Lerp(perpendicularRandom, dir, SplitSeparationForwardness).normalized * Velocity.magnitude * SplitSeparationVelocity; child.Range = Range; - child.Damage = Damage / Children; - child.Penetration = Penetration; - child.Spread = Spread; - child.DamageType = DamageType; + child.ImpactIntensity = ImpactIntensity; child.Source = Source; child.Target = Target; child.SourceEntity = SourceEntity; @@ -160,7 +154,7 @@ public class GuidedProjectile : MonoBehaviour var entity = hull.Entity; if (entity.Shield != null && entity.Shield.Item.Active.Value) { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); } else { diff --git a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs index c3481caf3..9350c2226 100644 --- a/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/GuidedProjectileManager.cs @@ -31,11 +31,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y]; var barrel = source.GetBarrel(hp); p.StartPosition = p.transform.position = barrel.position; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; p.GuidanceCurve = weapon.GuidedProjectileGuidanceCurve.ToCurve(); p.LiftCurve = weapon.GuidedProjectileLiftCurve.ToCurve(); p.ThrustCurve = weapon.GuidedProjectileThrustCurve.ToCurve(); @@ -54,11 +51,8 @@ public class GuidedProjectileManager : InstantWeaponEffectManager var hp = source.Entity.Hardpoints[item.Position.x, item.Position.y]; var barrel = source.GetBarrel(hp); p.StartPosition = p.transform.position = barrel.position; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; p.GuidanceCurve = weapon.GuidedProjectileGuidanceCurve.ToCurve(); p.LiftCurve = weapon.GuidedProjectileLiftCurve.ToCurve(); p.ThrustCurve = weapon.GuidedProjectileThrustCurve.ToCurve(); diff --git a/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs b/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs index 6dd950795..109d6eeb8 100644 --- a/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs +++ b/Assets/Scripts/Gameplay/Weapons/HitscanEffect.cs @@ -8,10 +8,7 @@ public class HitscanEffect : MonoBehaviour public ParticleSystem LineEffect; public Prototype HitEffect; - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public Entity SourceEntity { get; set; } public ZoneRenderer ZoneRenderer { get; set; } public float Range { get; set; } @@ -38,7 +35,7 @@ public class HitscanEffect : MonoBehaviour var entity = hull.Entity; if (entity.Shield != null && entity.Shield.Item.Active.Value) { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); hitFound = true; } else diff --git a/Assets/Scripts/Gameplay/Weapons/HitscanManager.cs b/Assets/Scripts/Gameplay/Weapons/HitscanManager.cs index a48010778..711acc3ad 100644 --- a/Assets/Scripts/Gameplay/Weapons/HitscanManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/HitscanManager.cs @@ -17,10 +17,7 @@ public class HitscanManager : InstantWeaponEffectManager // t.position = barrel.position; // t.forward = barrel.forward; p.Range = weapon.Range; - p.Damage = weapon.Damage; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; p.Fire(); } } diff --git a/Assets/Scripts/Gameplay/Weapons/Laser.cs b/Assets/Scripts/Gameplay/Weapons/Laser.cs index 240c9379b..ce1f002ae 100644 --- a/Assets/Scripts/Gameplay/Weapons/Laser.cs +++ b/Assets/Scripts/Gameplay/Weapons/Laser.cs @@ -8,10 +8,7 @@ public class Laser : MonoBehaviour public float Duration; public LineRenderer LineRenderer; - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public Entity SourceEntity { get; set; } public ZoneRenderer ZoneRenderer { get; set; } public float Range { get; set; } @@ -51,7 +48,7 @@ public class Laser : MonoBehaviour var entity = hull.Entity; if (entity.Shield != null && entity.Shield.Item.Active.Value) { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); LineRenderer.SetPosition(1, hit.Point); hitFound = true; break; diff --git a/Assets/Scripts/Gameplay/Weapons/LaserManager.cs b/Assets/Scripts/Gameplay/Weapons/LaserManager.cs index 415ddd195..371638453 100644 --- a/Assets/Scripts/Gameplay/Weapons/LaserManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/LaserManager.cs @@ -17,10 +17,7 @@ public class LaserManager : InstantWeaponEffectManager t.position = barrel.position; p.SourceEntity = source.Entity; p.ZoneRenderer = source.ZoneRenderer; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; } } diff --git a/Assets/Scripts/Gameplay/Weapons/Lightning.cs b/Assets/Scripts/Gameplay/Weapons/Lightning.cs index 9b4662563..46082bc3d 100644 --- a/Assets/Scripts/Gameplay/Weapons/Lightning.cs +++ b/Assets/Scripts/Gameplay/Weapons/Lightning.cs @@ -6,10 +6,7 @@ public class Lightning : MonoBehaviour public LightningCompute LightningCompute; public float HitRadius; - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public EntityInstance Source { get; set; } public float Range { get; set; } public EntityInstance Target { get; set; } @@ -43,7 +40,7 @@ public class Lightning : MonoBehaviour { LightningCompute.OnLeaderComplete = () => { - hit.Shield?.ShowHit(hit.Point, Mathf.Sqrt(Damage)); + hit.Shield?.ShowHit(hit.Point, Mathf.Max(0.01f, ImpactIntensity)); }; } else diff --git a/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs index cb764b3e2..c27f03d66 100644 --- a/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/LightningGunManager.cs @@ -13,11 +13,8 @@ public class LightningGunManager : InstantWeaponEffectManager var barrel = source.GetBarrel(hp); p.Barrel = barrel; p.Source = source; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; p.Target = target; p.Fire(); } diff --git a/Assets/Scripts/Gameplay/Weapons/Mine.cs b/Assets/Scripts/Gameplay/Weapons/Mine.cs index 8a114c042..2394d8eaa 100644 --- a/Assets/Scripts/Gameplay/Weapons/Mine.cs +++ b/Assets/Scripts/Gameplay/Weapons/Mine.cs @@ -28,8 +28,7 @@ public class Mine : MonoBehaviour private Material _material; private float _pulseLerp; private float _emission; - public float Damage { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public EntityInstance Source { get; set; } public float Range { get; set; } diff --git a/Assets/Scripts/Gameplay/Weapons/MineManager.cs b/Assets/Scripts/Gameplay/Weapons/MineManager.cs index 45c672205..d8d8204c5 100644 --- a/Assets/Scripts/Gameplay/Weapons/MineManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/MineManager.cs @@ -21,8 +21,7 @@ public class MineManager : InstantWeaponEffectManager Random.Range(-angle, angle)) * barrel.forward * weapon.Velocity; - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; } } diff --git a/Assets/Scripts/Gameplay/Weapons/Projectile.cs b/Assets/Scripts/Gameplay/Weapons/Projectile.cs index 0c7a2abac..bb9b29899 100644 --- a/Assets/Scripts/Gameplay/Weapons/Projectile.cs +++ b/Assets/Scripts/Gameplay/Weapons/Projectile.cs @@ -13,16 +13,13 @@ public class Projectile : MonoBehaviour public float AirburstDistance; public float AirburstRange; - public float DirectHitDamageMultiplier = 1; + public float DirectHitIntensityMultiplier = 1; private bool _alive; public Vector3 StartPosition { get; set; } public Vector3 Velocity { get; set; } - public float Damage { get; set; } - public float Penetration { get; set; } - public float Spread { get; set; } - public DamageType DamageType { get; set; } + public float ImpactIntensity { get; set; } = 1; public Entity SourceEntity { get; set; } public EntityInstance TargetInstance { get; set; } public float Range { get; set; } @@ -99,11 +96,7 @@ public class Projectile : MonoBehaviour if (hull.Entity.Shield != null && hull.Entity.Shield.Item.Active.Value) - { - } - else - { - } + hull.Entity.Shield.ShowHit(step.Hit.Point, Mathf.Max(0.01f, ImpactIntensity * DirectHitIntensityMultiplier)); transform.position = step.Hit.Point; if (HitEffect != null) diff --git a/Assets/Scripts/Gameplay/Weapons/ProjectileManager.cs b/Assets/Scripts/Gameplay/Weapons/ProjectileManager.cs index 3032d39bd..088613e99 100644 --- a/Assets/Scripts/Gameplay/Weapons/ProjectileManager.cs +++ b/Assets/Scripts/Gameplay/Weapons/ProjectileManager.cs @@ -25,11 +25,8 @@ public class ProjectileManager : InstantWeaponEffectManager p.StartPosition = p.transform.position = barrel.position + p.Velocity * (Random.value * Time.deltaTime); if(InheritVelocity) p.Velocity += (Vector3)AetheriaMath.ToUnityXZ(source.Entity.CultVelocity); - p.Damage = weapon.Damage; p.Range = weapon.Range; - p.Penetration = weapon.Penetration; - p.Spread = weapon.DamageSpread; - p.DamageType = weapon.DamageType; + p.ImpactIntensity = 1; p.AirburstDistance = target != null ? CultMath.math.length(source.Entity.CultPosition - target.Entity.CultPosition) : (weapon.Range * .75f);