class ComboShockwave expands WRECorona;

#exec TEXTURE IMPORT NAME=ComboShockwave FILE=CORONAS\ComboShockwave.bmp GROUP=Coronas FLAGS=2

var int Kickback;
var float Splasher, MoreDamage;
var bool HealthGiver;

replication
{
	// Things the server should send to the client.
	reliable if(Role==ROLE_Authority)
		Kickback, MoreDamage, HealthGiver, Splasher;
}

simulated function Tick( float DeltaTime)
{
	DrawScale = (Default.LifeSpan - LifeSpan) * 2.5;
	ScaleGlow = LifeSpan * Default.ScaleGlow / Default.LifeSpan;
}


simulated function Timer()
{
local Actor A;
local vector dir;
local Pawn P;
local X_Electric_CorpseOv XOver;

	ForEach VisibleCollidingActors(Class'Actor', A, DrawScale * 256 * FMax(1.0, Splasher))
	{

		if (Role == ROLE_Authority)
		{
		dir = Normal(A.Location - Location);

		if (HealthGiver && A.IsA('Pawn'))
		{
			P = Pawn(A);
			If ((P.PlayerReplicationInfo.Team == Instigator.PlayerReplicationInfo.Team && Level.Game.IsA('TeamGamePlus') && !Level.Game.IsA('MonsterHunt')) ||
		(Level.Game.IsA('MonsterHunt') && !P.IsA('ScriptedPawn')) && P.Health < Class'NWMutator'.default.MaxHealth && P!=Instigator)
		{
				P.Health += 200 * FMax(1.0,MoreDamage) * (Default.DrawScale - DrawScale);
					if (P.Health > Class'NWMutator'.default.MaxHealth)
						P.Health = Class'NWMutator'.default.MaxHealth;
		}
		else if (P == Instigator && P.Health < Class'NWMutator'.default.MaxHealth)
		{
			P.Health += 200 * FMax(1.0,MoreDamage) * ((DrawScale * 256 * FMax(1.0, Splasher)) - VSize(Location - P.Location));
				if (P.Health > Class'NWMutator'.default.MaxHealth)
					P.Health = Class'NWMutator'.default.MaxHealth;
		}
		else
			A.TakeDamage(200 * FMax(1.0,MoreDamage),  Instigator, A.Location - 0.5 * (A.CollisionHeight + A.CollisionRadius) * dir, dir * 100000 * FMax(1.0, Kickback), 'Electrified');
		}
		else
			A.TakeDamage(200 * FMax(1.0,MoreDamage),  Instigator, A.Location - 0.5 * (A.CollisionHeight + A.CollisionRadius) * dir, dir * 100000 * FMax(1.0, Kickback), 'Electrified');
		}
	}

	Xover = Spawn(class'X_Electric_CorpseOv',,, Location);
	Xover.EffectRadius = DrawScale * 256 * FMax(1.0, Splasher);
}


simulated function PostBeginPlay()
{

	SetTimer(0.1, True);
}

defaultproperties
{
	Texture=ComboShockwave
	DrawScale=0.500000
	ScaleGlow=2.000000
	LifeSpan=0.400000
	bUnlit=True
}