nuke damage generalized (DamageModel=PerCell)

This commit is contained in:
Chris Forbes
2010-04-02 11:24:15 +13:00
parent c63697e181
commit 03a037a84f
6 changed files with 69 additions and 24 deletions

View File

@@ -61,12 +61,30 @@ namespace OpenRA
.Select(a => a.GetFirepowerModifier()) .Select(a => a.GetFirepowerModifier())
.Product(); .Product();
switch (warhead.DamageModel)
{
case DamageModel.Normal:
{
var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2); var maxSpread = warhead.Spread * (float)Math.Log(Math.Abs(warhead.Damage), 2);
var hitActors = world.FindUnitsInCircle(args.dest, maxSpread); var hitActors = world.FindUnitsInCircle(args.dest, maxSpread);
foreach (var victim in hitActors) foreach (var victim in hitActors)
victim.InflictDamage(args.firedBy, victim.InflictDamage(args.firedBy,
(int)GetDamageToInflict(victim, args, warhead, firepowerModifier), warhead); (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<OwnedActorInfo>().Armor)), warhead);
}
} break;
}
} }
public static void DoImpacts(ProjectileArgs args, int2 visualLocation) public static void DoImpacts(ProjectileArgs args, int2 visualLocation)

View File

@@ -76,8 +76,7 @@ namespace OpenRA.Effects
void Explode(World world) void Explode(World world)
{ {
world.AddFrameEndTask(w => w.Remove(this)); world.AddFrameEndTask(w => w.Remove(this));
//var warhead = Rules.WarheadInfo[weapon.Warhead]; Combat.DoExplosion(silo, "Atomic", pos.ToInt2(), 0);
//Combat.DoImpact(pos.ToInt2(), pos.ToInt2(), weapon, Rules.ProjectileInfo[weapon.Projectile], warhead, silo, true);
world.WorldActor.traits.Get<ScreenShaker>().AddEffect(20, pos, 5); world.WorldActor.traits.Get<ScreenShaker>().AddEffect(20, pos, 5);
} }

View File

@@ -27,19 +27,20 @@ namespace OpenRA.GameRules
{ {
public class WarheadInfo public class WarheadInfo
{ {
public readonly int Spread = 1; 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 }; public readonly float[] Verses = { 1, 1, 1, 1, 1 }; // damage vs each armortype
public readonly bool Wall = false; public readonly bool Wall = false; // can this damage walls?
public readonly bool Wood = false; public readonly bool Wood = false; // can this damage wood?
public readonly bool Ore = false; public readonly bool Ore = false; // can this damage ore?
public readonly int Explosion = 0; public readonly int Explosion = 0; // explosion effect to use
public readonly SmudgeType SmudgeType = SmudgeType.None; public readonly SmudgeType SmudgeType = SmudgeType.None; // type of smudge to apply
public readonly int[] SmudgeSize = { 0, 0 }; 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; public readonly int InfDeath = 0; // infantry death animation to use
public readonly string ImpactSound = null; public readonly string ImpactSound = null; // sound to play on impact
public readonly string WaterImpactSound = null; public readonly string WaterImpactSound = null; // sound to play on impact with water
public readonly int Damage = 0; // for new weapons infrastructure 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 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]; } public float EffectivenessAgainst(ArmorType at) { return Verses[(int)at]; }
} }
@@ -60,6 +61,12 @@ namespace OpenRA.GameRules
Scorch = 2, 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 class ProjectileArgs
{ {
public WeaponInfo weapon; public WeaponInfo weapon;

View File

@@ -47,7 +47,7 @@ Incoming=10 ; If an incoming projectile is as slow or slower than th
; parachute bombs have this characteristic. ; parachute bombs have this characteristic.
; income and production ; 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 BuildupTime=.06 ; average minutes that building build-up animation runs
OreTruckRate=1 ; speed that harvester truck manages ore [larger means slower] OreTruckRate=1 ; speed that harvester truck manages ore [larger means slower]
SeparateAircraft=no ; Is first helicopter to be purchased separately from helipad? SeparateAircraft=no ; Is first helicopter to be purchased separately from helipad?

View File

@@ -46,7 +46,7 @@ Player:
DropItems: E1,E1,E1,E3,E3 DropItems: E1,E1,E1,E3,E3
NukePower: NukePower:
Image: atomicon Image: atomicon
ChargeTime: 13 ChargeTime: .1
Description: Atom Bomb Description: Atom Bomb
LongDesc: Launches a nuclear missile at a target location. LongDesc: Launches a nuclear missile at a target location.
Prerequisites: MSLO Prerequisites: MSLO
@@ -429,7 +429,7 @@ MSLO:
Inherits: ^Building Inherits: ^Building
Buildable: Buildable:
TechLevel: 13 TechLevel: 13
Prerequisites: @Tech Center Prerequisites: powr
Owner: soviet,allies Owner: soviet,allies
Cost: 2500 Cost: 2500
Description: Missile Silo Description: Missile Silo

View File

@@ -628,7 +628,7 @@ SCUD:
Atomic: Atomic:
Nuke: Nuke:
Image: Nuke Image: Nuke
Warhead: Warhead@impact:
Damage: 1000 Damage: 1000
Spread: 6 Spread: 6
Wall: true Wall: true
@@ -637,8 +637,29 @@ Atomic:
Verses: 90%,100%,60%,25%,50% Verses: 90%,100%,60%,25%,50%
Explosion: 6 Explosion: 6
InfDeath: 4 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 SmudgeType: Scorch
SmudgeSize: 5,4 SmudgeSize: 5,4
Wall: true
Wood: true
Ore: true
Verses: 90%,100%,60%,25%,50%
Delay: 3
InfDeath: 4
UnitExplode: UnitExplode:
Warhead: Warhead: