From 268c714ac22c1a5a571a4b46d5d01995ac9108fd Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Thu, 1 Apr 2010 22:21:04 +1300 Subject: [PATCH] fixed up weapon validity stuff --- OpenRA.Game/Combat.cs | 5 ++--- OpenRA.Game/Effects/Bullet.cs | 6 +----- OpenRA.Game/Effects/Missile.cs | 3 --- OpenRA.Game/GameRules/WeaponInfo.cs | 5 ++++- mods/ra/weapons.yaml | 26 +++++++++++--------------- 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/OpenRA.Game/Combat.cs b/OpenRA.Game/Combat.cs index cbb70cd0f3..b786e671c6 100644 --- a/OpenRA.Game/Combat.cs +++ b/OpenRA.Game/Combat.cs @@ -117,9 +117,8 @@ namespace OpenRA if (weapon.Warheads.All( w => w.EffectivenessAgainst(target.Info.Traits.Get().Armor) <= 0)) return false; - /* todo: access to UnderWater is interesting */ -// if (projectile.UnderWater && !target.Info.Traits.Get().WaterBound) -// return false; + if (weapon.Underwater && !target.Info.Traits.Get().WaterBound) + return false; return true; } diff --git a/OpenRA.Game/Effects/Bullet.cs b/OpenRA.Game/Effects/Bullet.cs index a733162e35..dd72496ca6 100755 --- a/OpenRA.Game/Effects/Bullet.cs +++ b/OpenRA.Game/Effects/Bullet.cs @@ -28,9 +28,6 @@ namespace OpenRA.Effects public class BulletInfo : IProjectileInfo { public readonly int Speed = 1; - public readonly bool AA = false; - public readonly bool AG = true; - public readonly bool ASW = false; public readonly string Trail = null; public readonly bool Inaccurate = false; public readonly string Image = null; @@ -38,7 +35,6 @@ namespace OpenRA.Effects public readonly bool Arcing = false; public readonly int RangeLimit = 0; public readonly int Arm = 0; - public readonly bool UnderWater = false; public readonly bool Shadow = false; public readonly bool Proximity = false; @@ -119,7 +115,7 @@ namespace OpenRA.Effects } else yield return new Renderable(anim.Image, pos - .5f * anim.Image.size, - Info.UnderWater ? "shadow" : Args.firedBy.Owner.Palette); + Args.weapon.Underwater ? "shadow" : Args.firedBy.Owner.Palette); } } diff --git a/OpenRA.Game/Effects/Missile.cs b/OpenRA.Game/Effects/Missile.cs index 4b80b64e38..37f35313ad 100755 --- a/OpenRA.Game/Effects/Missile.cs +++ b/OpenRA.Game/Effects/Missile.cs @@ -35,9 +35,6 @@ namespace OpenRA.Effects public readonly bool Proximity = false; public readonly string Trail = null; public readonly bool Inaccurate = false; - public readonly bool AA = false; - public readonly bool AG = true; - public readonly bool ASW = false; public readonly string Image = null; public readonly int ROT = 5; public readonly int RangeLimit = 0; diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index d1ac12186a..93552f6b40 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -81,7 +81,8 @@ namespace OpenRA.GameRules public readonly int ROF = 1; public readonly int Burst = 1; public readonly bool Charges = false; - public readonly string[] ValidTargets = { "Vehicle", "Infantry" }; + public readonly bool Underwater = false; + public readonly string[] ValidTargets = { "Vehicle", "Infantry", "Building", "Defense", "Ship" }; public IProjectileInfo Projectile; public List Warheads = new List(); @@ -98,6 +99,8 @@ namespace OpenRA.GameRules case "Report": FieldLoader.LoadField(this, "Report", content.Nodes["Report"].Value); break; case "Burst": FieldLoader.LoadField(this, "Burst", content.Nodes["Burst"].Value); break; case "Charges": FieldLoader.LoadField(this, "Charges", content.Nodes["Charges"].Value); break; + case "ValidTargets": FieldLoader.LoadField(this, "ValidTargets", content.Nodes["ValidTargets"].Value); break; + case "Underwater": FieldLoader.LoadField(this, "Underwater", content.Nodes["Underwater"].Value); break; case "Warhead": { diff --git a/mods/ra/weapons.yaml b/mods/ra/weapons.yaml index d1e1a35636..707b1a692e 100644 --- a/mods/ra/weapons.yaml +++ b/mods/ra/weapons.yaml @@ -15,9 +15,8 @@ ZSU-23: ROF: 10 Range: 6 Report: AACANON3 + ValidTargets: Plane Bullet: - AA: true - AG: false Speed: 100 Warhead: Spread: 3 @@ -42,6 +41,7 @@ Maverick: ROF: 3 Range: 6 Report: MISSILE7 + ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship Missile: Speed: 30 Arm: 2 @@ -50,7 +50,6 @@ Maverick: Proximity: true Trail: smokey Inaccurate: true - AA: true Image: DRAGON ROT: 5 RangeLimit: 20 @@ -141,6 +140,7 @@ Dragon: ROF: 50 Range: 5 Report: MISSILE6 + ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship Missile: Speed: 25 Arm: 2 @@ -149,7 +149,6 @@ Dragon: Proximity: true Trail: smokey Inaccurate: true - AA: true Image: DRAGON ROT: 5 RangeLimit: 20 @@ -167,6 +166,7 @@ Hellfire: ROF: 60 Range: 4 Report: MISSILE6 + ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship Missile: Speed: 30 Arm: 2 @@ -175,7 +175,6 @@ Hellfire: Proximity: true Trail: smokey Inaccurate: true - AA: true Image: DRAGON ROT: 5 RangeLimit: 20 @@ -299,6 +298,7 @@ MammothTusk: Range: 5 Report: MISSILE6 Burst: 2 + ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship Missile: Speed: 30 Arm: 2 @@ -307,7 +307,6 @@ MammothTusk: Proximity: true Trail: smokey Inaccurate: true - AA: true Image: DRAGON ROT: 5 RangeLimit: 20 @@ -410,14 +409,13 @@ Nike: ROF: 20 Range: 7.5 Report: MISSILE1 + ValidTargets: Plane Missile: Arm: 3 High: true Shadow: false Proximity: true Trail: smokey - AA: true - AG: false Image: MISSILE ROT: 20 RangeLimit: 30 @@ -435,14 +433,13 @@ RedEye: ROF: 50 Range: 7.5 Report: MISSILE1 + ValidTargets: Plane Missile: Arm: 3 High: true Shadow: false Proximity: true Trail: smokey - AA: true - AG: false Image: MISSILE ROT: 20 RangeLimit: 30 @@ -480,13 +477,13 @@ Stinger: ROF: 60 Range: 9 Report: MISSILE6 + ValidTargets: Vehicle, Infantry, Plane, Building, Defense, Ship Missile: Arm: 3 High: true Shadow: false Proximity: true Trail: smokey - AA: true Image: DRAGON ROT: 20 RangeLimit: 20 @@ -506,10 +503,10 @@ TorpTube: ROF: 60 Range: 9 Report: TORPEDO1 + ValidTargets: Ship, Building + Underwater: yes Bullet: - UnderWater: yes Image: MISSILE - ASW: true Speed: 15 Warhead: Spread: 3 @@ -541,14 +538,13 @@ TorpTube: DepthCharge: ROF: 60 Range: 5 + ValidTargets: Ship Bullet: Speed: 5 Image: BOMB Arcing: true High: true Inaccurate: true - ASW: true - AG: false Warhead: Spread: 3 Wall: true