Ditto combat
This commit is contained in:
@@ -13,13 +13,15 @@ namespace OpenRa
|
|||||||
public static void DoImpact(int2 loc, int2 visualLoc,
|
public static void DoImpact(int2 loc, int2 visualLoc,
|
||||||
WeaponInfo weapon, ProjectileInfo projectile, WarheadInfo warhead, Actor firedBy)
|
WeaponInfo weapon, ProjectileInfo projectile, WarheadInfo warhead, Actor firedBy)
|
||||||
{
|
{
|
||||||
|
var world = firedBy.World;
|
||||||
|
|
||||||
var targetTile = ((1f / Game.CellSize) * loc.ToFloat2()).ToInt2();
|
var targetTile = ((1f / Game.CellSize) * loc.ToFloat2()).ToInt2();
|
||||||
|
|
||||||
var isWater = Game.world.IsWater(targetTile);
|
var isWater = world.IsWater(targetTile);
|
||||||
var hitWater = Game.world.IsCellBuildable(targetTile, UnitMovementType.Float);
|
var hitWater = world.IsCellBuildable(targetTile, UnitMovementType.Float);
|
||||||
|
|
||||||
if (warhead.Explosion != 0)
|
if (warhead.Explosion != 0)
|
||||||
Game.world.AddFrameEndTask(
|
world.AddFrameEndTask(
|
||||||
w => w.Add(new Explosion(visualLoc, warhead.Explosion, hitWater)));
|
w => w.Add(new Explosion(visualLoc, warhead.Explosion, hitWater)));
|
||||||
|
|
||||||
var impactSound = warhead.ImpactSound;
|
var impactSound = warhead.ImpactSound;
|
||||||
@@ -28,10 +30,10 @@ namespace OpenRa
|
|||||||
if (impactSound != null) Sound.Play(impactSound + ".aud");
|
if (impactSound != null) Sound.Play(impactSound + ".aud");
|
||||||
|
|
||||||
if (!isWater) Smudge.AddSmudge(targetTile, warhead);
|
if (!isWater) Smudge.AddSmudge(targetTile, warhead);
|
||||||
if (warhead.Ore) Game.world.Map.DestroyOre(targetTile.X, targetTile.Y);
|
if (warhead.Ore) world.Map.DestroyOre(targetTile.X, targetTile.Y);
|
||||||
|
|
||||||
var maxSpread = GetMaximumSpread(weapon, warhead);
|
var maxSpread = GetMaximumSpread(weapon, warhead);
|
||||||
var hitActors = Game.world.FindUnitsInCircle(loc, maxSpread);
|
var hitActors = world.FindUnitsInCircle(loc, maxSpread);
|
||||||
|
|
||||||
foreach (var victim in hitActors)
|
foreach (var victim in hitActors)
|
||||||
victim.InflictDamage(firedBy, (int)GetDamageToInflict(victim, loc, weapon, warhead), warhead);
|
victim.InflictDamage(firedBy, (int)GetDamageToInflict(victim, loc, weapon, warhead), warhead);
|
||||||
|
|||||||
Reference in New Issue
Block a user