diff --git a/OpenRA.Game/Combat.cs b/OpenRA.Game/Combat.cs index 0430f7ee1b..0bf322fe9d 100644 --- a/OpenRA.Game/Combat.cs +++ b/OpenRA.Game/Combat.cs @@ -61,12 +61,30 @@ namespace OpenRA .Select(a => a.GetFirepowerModifier()) .Product(); - var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2); - var hitActors = world.FindUnitsInCircle(args.dest, maxSpread); + switch (warhead.DamageModel) + { + case DamageModel.Normal: + { + var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2); + var hitActors = world.FindUnitsInCircle(args.dest, maxSpread); - foreach (var victim in hitActors) - victim.InflictDamage(args.firedBy, - (int)GetDamageToInflict(victim, args, warhead, firepowerModifier), warhead); + foreach (var victim in hitActors) + victim.InflictDamage(args.firedBy, + (int)GetDamageToInflict(victim, args, warhead, firepowerModifier), warhead); + } break; + + case DamageModel.PerCell: + { + foreach (var t in world.FindTilesInCircle(targetTile, warhead.SmudgeSize[0])) + { + var x = Util.CenterOfCell(t); + foreach (var unit in world.FindUnits(x, x)) + unit.InflictDamage(args.firedBy, + (int)(warhead.Damage * warhead.EffectivenessAgainst( + unit.Info.Traits.Get().Armor)), warhead); + } + } break; + } } public static void DoImpacts(ProjectileArgs args, int2 visualLocation) diff --git a/OpenRA.Game/Effects/NukeLaunch.cs b/OpenRA.Game/Effects/NukeLaunch.cs index b1f447c585..76f64ac178 100644 --- a/OpenRA.Game/Effects/NukeLaunch.cs +++ b/OpenRA.Game/Effects/NukeLaunch.cs @@ -76,8 +76,7 @@ namespace OpenRA.Effects void Explode(World world) { world.AddFrameEndTask(w => w.Remove(this)); - //var warhead = Rules.WarheadInfo[weapon.Warhead]; - //Combat.DoImpact(pos.ToInt2(), pos.ToInt2(), weapon, Rules.ProjectileInfo[weapon.Projectile], warhead, silo, true); + Combat.DoExplosion(silo, "Atomic", pos.ToInt2(), 0); world.WorldActor.traits.Get().AddEffect(20, pos, 5); } diff --git a/OpenRA.Game/GameRules/WeaponInfo.cs b/OpenRA.Game/GameRules/WeaponInfo.cs index 93552f6b40..4842c17f23 100644 --- a/OpenRA.Game/GameRules/WeaponInfo.cs +++ b/OpenRA.Game/GameRules/WeaponInfo.cs @@ -27,19 +27,20 @@ namespace OpenRA.GameRules { public class WarheadInfo { - public readonly int Spread = 1; - public readonly float[] Verses = { 1, 1, 1, 1, 1 }; - public readonly bool Wall = false; - public readonly bool Wood = false; - public readonly bool Ore = false; - public readonly int Explosion = 0; - public readonly SmudgeType SmudgeType = SmudgeType.None; - public readonly int[] SmudgeSize = { 0, 0 }; - public readonly int InfDeath = 0; - public readonly string ImpactSound = null; - public readonly string WaterImpactSound = null; - public readonly int Damage = 0; // for new weapons infrastructure - public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant + public readonly int Spread = 1; // distance (in pixels) from the explosion center at which damage is 1/2. + public readonly float[] Verses = { 1, 1, 1, 1, 1 }; // damage vs each armortype + public readonly bool Wall = false; // can this damage walls? + public readonly bool Wood = false; // can this damage wood? + public readonly bool Ore = false; // can this damage ore? + public readonly int Explosion = 0; // explosion effect to use + public readonly SmudgeType SmudgeType = SmudgeType.None; // type of smudge to apply + public readonly int[] SmudgeSize = { 0, 0 }; // bounds of the smudge. first value is the outer radius; second value is the inner radius. + public readonly int InfDeath = 0; // infantry death animation to use + public readonly string ImpactSound = null; // sound to play on impact + public readonly string WaterImpactSound = null; // sound to play on impact with water + public readonly int Damage = 0; // how much (raw) damage to deal + public readonly int Delay = 0; // delay in ticks before dealing the damage. 0=instant (old model) + public readonly DamageModel DamageModel = DamageModel.Normal; // public float EffectivenessAgainst(ArmorType at) { return Verses[(int)at]; } } @@ -60,6 +61,12 @@ namespace OpenRA.GameRules Scorch = 2, } + public enum DamageModel + { + Normal, // classic RA damage model: point actors, distance-based falloff + PerCell, // like RA's "nuke damage" + } + public class ProjectileArgs { public WeaponInfo weapon; diff --git a/mods/ra/rules.ini b/mods/ra/rules.ini index da9560bf61..fd519746a1 100644 --- a/mods/ra/rules.ini +++ b/mods/ra/rules.ini @@ -47,7 +47,7 @@ Incoming=10 ; If an incoming projectile is as slow or slower than th ; parachute bombs have this characteristic. ; income and production -BuildSpeed=.4 ; general build speed [time (in minutes) to produce a 1000 credit cost item] +BuildSpeed=.01 ; general build speed [time (in minutes) to produce a 1000 credit cost item] BuildupTime=.06 ; average minutes that building build-up animation runs OreTruckRate=1 ; speed that harvester truck manages ore [larger means slower] SeparateAircraft=no ; Is first helicopter to be purchased separately from helipad? diff --git a/mods/ra/rules.yaml b/mods/ra/rules.yaml index bd37a9afcd..0d5afc54f6 100755 --- a/mods/ra/rules.yaml +++ b/mods/ra/rules.yaml @@ -46,7 +46,7 @@ Player: DropItems: E1,E1,E1,E3,E3 NukePower: Image: atomicon - ChargeTime: 13 + ChargeTime: .1 Description: Atom Bomb LongDesc: Launches a nuclear missile at a target location. Prerequisites: MSLO @@ -429,7 +429,7 @@ MSLO: Inherits: ^Building Buildable: TechLevel: 13 - Prerequisites: @Tech Center + Prerequisites: powr Owner: soviet,allies Cost: 2500 Description: Missile Silo diff --git a/mods/ra/weapons.yaml b/mods/ra/weapons.yaml index 9f34669826..bf14ed18c4 100644 --- a/mods/ra/weapons.yaml +++ b/mods/ra/weapons.yaml @@ -628,7 +628,7 @@ SCUD: Atomic: Nuke: Image: Nuke - Warhead: + Warhead@impact: Damage: 1000 Spread: 6 Wall: true @@ -637,8 +637,29 @@ Atomic: Verses: 90%,100%,60%,25%,50% Explosion: 6 InfDeath: 4 + Warhead@inner-nuke: + DamageModel: PerCell + Damage: 150 + SmudgeType: Scorch + SmudgeSize: 3,2 + Wall: true + Wood: true + Ore: true + Verses: 90%,100%,60%,25%,50% + Delay: 3 + InfDeath: 4 + Warhead@outer-nuke: + DamageModel: PerCell + Damage: 150 SmudgeType: Scorch SmudgeSize: 5,4 + Wall: true + Wood: true + Ore: true + Verses: 90%,100%,60%,25%,50% + Delay: 3 + InfDeath: 4 + UnitExplode: Warhead: