Some changes to the nuke damage model + screen shake

This commit is contained in:
Matthew Bowra-Dean
2010-03-09 17:59:00 +13:00
parent 56b1b45965
commit 61b52ffaf9
2 changed files with 20 additions and 1 deletions

View File

@@ -30,6 +30,12 @@ namespace OpenRA
{
public static void DoImpact(int2 loc, int2 visualLoc,
WeaponInfo weapon, ProjectileInfo projectile, WarheadInfo warhead, Actor firedBy)
{
DoImpact(loc, visualLoc, weapon, projectile, warhead, firedBy, false);
}
public static void DoImpact(int2 loc, int2 visualLoc,
WeaponInfo weapon, ProjectileInfo projectile, WarheadInfo warhead, Actor firedBy, bool nukeDamage)
{
var world = firedBy.World;
@@ -62,6 +68,17 @@ namespace OpenRA
foreach (var victim in hitActors)
victim.InflictDamage(firedBy,
(int)GetDamageToInflict(victim, loc, weapon, warhead, firepowerModifier), warhead);
if (!nukeDamage) return;
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(firedBy,
(int)(weapon.Damage * warhead.EffectivenessAgainst(unit.Info.Traits.Get<OwnedActorInfo>().Armor)) / 4, warhead);
}
}
}
static float GetMaximumSpread(WeaponInfo weapon, WarheadInfo warhead, float modifier)

View File

@@ -79,7 +79,9 @@ namespace OpenRA.Effects
void Explode(World world)
{
world.AddFrameEndTask(w => w.Remove(this));
Combat.DoImpact(pos.ToInt2(), pos.ToInt2(), weapon, Rules.ProjectileInfo[weapon.Projectile], Rules.WarheadInfo[weapon.Warhead], silo);
var warhead = Rules.WarheadInfo[weapon.Warhead];
Combat.DoImpact(pos.ToInt2(), pos.ToInt2(), weapon, Rules.ProjectileInfo[weapon.Projectile], warhead, silo, true);
world.WorldActor.traits.Get<ScreenShaker>().AddEffect(20, pos, 5);
}
public IEnumerable<Renderable> Render()