Skip to content

Instantly share code, notes, and snippets.

@Mailaender
Created July 26, 2016 07:31
Show Gist options
  • Save Mailaender/54dcf9183630b09633711cf355e301dc to your computer and use it in GitHub Desktop.
Save Mailaender/54dcf9183630b09633711cf355e301dc to your computer and use it in GitHub Desktop.
#region Copyright & License Information
/*
* Copyright 2007-2016 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. For more
* information, see COPYING.
*/
#endregion
using System.Linq;
using System.Collections.Generic;
using OpenRA.GameRules;
using OpenRA.Mods.Common.Traits;
using OpenRA.Traits;
namespace OpenRA.Mods.Common.Warheads
{
public class ActorDamageWarhead : DamageWarhead
{
public override void DoImpact(Target target, Actor firedBy, IEnumerable<int> damageModifiers)
{
if (target.Type != TargetType.Actor)
return;
var victim = target.Actor;
if (!IsValidAgainst(victim, firedBy))
return;
var damage = Util.ApplyPercentageModifiers(Damage, damageModifiers.Append(DamageVersus(victim)));
victim.InflictDamage(firedBy, new Damage(damage, DamageTypes));
}
public override void DoImpact(WPos pos, Actor firedBy, IEnumerable<int> damageModifiers)
{
// missed the target
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment