51 lines
1.3 KiB
Ucode
51 lines
1.3 KiB
Ucode
class ACTION_DamagePawnX extends ACTION_DamagePawn;
|
|
|
|
|
|
var(Action) int MaxVictims;
|
|
|
|
|
|
function bool InitActionFor(ScriptedController C)
|
|
{
|
|
local Actor A;
|
|
local Pawn Victim, Instigator;
|
|
local int Damage, count;
|
|
|
|
switch ( DamageInstigator ) {
|
|
case DMG_Instigator: Instigator = C.Instigator; break;
|
|
case DMG_Myself: Instigator = C.Pawn; break;
|
|
}
|
|
|
|
ForEach C.DynamicActors(VictimClass, A, VictimTag) {
|
|
Victim = Pawn(A);
|
|
if ( Victim.Health <= 0 || Victim.bDeleteMe )
|
|
continue;
|
|
|
|
if ( DamageInstigator == DMG_Himself )
|
|
Instigator = Victim;
|
|
|
|
switch ( DamageCalculation )
|
|
{
|
|
case DCALC_Amount: Damage = RandRange(MinDamageAmount, MaxDamageAmount); break;
|
|
case DCALC_HealthPct: Damage = Victim.Health * ( MinDamagePct + frand()*(MaxDamagePct - MinDamagePct) ); break;
|
|
case DCALC_HealthMaxPct: Damage = Victim.HealthMax * ( MinDamagePct + frand()*(MaxDamagePct - MinDamagePct) ); break;
|
|
}
|
|
|
|
Victim.TakeDamage(Damage, Instigator, Victim.Location, vect(0,0,0), DamageType);
|
|
if ( ++count >= MaxVictims )
|
|
break;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
function string GetActionString()
|
|
{
|
|
return ActionString @ GetItemName(String(VictimClass)) @ VictimTag;
|
|
}
|
|
|
|
defaultproperties
|
|
{
|
|
MaxVictims=1
|
|
DamageType=Class'Engine.Suicided'
|
|
}
|