Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

OnslaughtSpecialsLiteV2.ACTION_DamagePowerNode


00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
/******************************************************************************
Damages a power node or core directly, even if it is protected or belongs to
the instigator's team.

Creation date: 2010-08-09 13:32
Last change: $Id$
Copyright (c) 2010, Wormbo
******************************************************************************/

class ACTION_DamagePowerNode extends ScriptedAction;


var() name NodeTag;
var() int DamageAmount;
var() bool bAttackNotification;

var ONSPowerCore Node;


function bool InitActionFor(ScriptedController C)
{
	local Pawn Instigator;
	local PlayerReplicationInfo InstigatorPRI;

	if (Node == None && NodeTag != '') {
		foreach C.AllActors(class'ONSPowerCore', Node, NodeTag) {
			break;
		}
		if (Node == None) {
			log(C.SequenceScript@C.ActionNum@Name@"- No power node/core for tag '"$NodeTag$"'");
			NodeTag = '';
		}
	}

	if (Node == None || Node.Health < 0 || DamageAmount <= 0 || Node.CoreStage != 0 && Node.CoreStage != 2)
		return false;

	Instigator = C.GetInstigator();
	if (Instigator != None)
		InstigatorPRI = Instigator.PlayerReplicationInfo;

	if (InstigatorPRI != None && Controller(InstigatorPRI.Owner) != None) {
		Node.LastDamagedBy = InstigatorPRI;
		Node.LastAttacker = Instigator;
		Node.AddScorer(Controller(InstigatorPRI.Owner), FMin(Node.Health, DamageAmount) / Node.DamageCapacity);
	}
	Node.NetUpdateTime = C.Level.TimeSeconds - 1;
	Node.AccumulatedDamage += DamageAmount;
	if (Node.DamageEventThreshold > 0 && Node.AccumulatedDamage >= Node.DamageEventThreshold) {
		Node.TriggerEvent(Node.TakeDamageEvent, Node, Instigator);
		Node.AccumulatedDamage = 0;
	}

	Node.Health -= DamageAmount;
	if (Node.Health < 0)
		Node.DisableObjective(Instigator);
	else if (bAttackNotification) {
		//attack notification
		if (Node.LastAttackMessageTime + 1 < C.Level.TimeSeconds) {
			if (Node.bFinalCore) {
				if (float(Node.Health) / Node.DamageCapacity > 0.55)
					Node.BroadcastLocalizedMessage(class'ONSOnslaughtMessage', 7 + Node.DefenderTeamIndex,,, Node);
				else if (float(Node.Health) / Node.DamageCapacity > 0.45)
					Node.BroadcastLocalizedMessage(class'ONSOnslaughtMessage', 25 + Node.DefenderTeamIndex,,, Node);
				else
					Node.BroadcastLocalizedMessage(class'ONSOnslaughtMessage', 18 + Node.DefenderTeamIndex,,, Node);
			}
			else
				Node.BroadcastLocalizedMessage(class'ONSOnslaughtMessage', 9 + Node.DefenderTeamIndex,,, Node);
			UnrealTeamInfo(C.Level.GRI.Teams[Node.DefenderTeamIndex]).AI.CriticalObjectiveWarning(Node, Instigator);
			Node.LastAttackMessageTime = C.Level.TimeSeconds;
		}
		Node.LastAttackTime = C.Level.TimeSeconds;
	}

	return false;
}


//=============================================================================
// Default values
//=============================================================================

defaultproperties
{
	DamageAmount = 100
	bAttackNotification = True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 2.9.2010 23:40:18.000 - Creation time: Do 14.8.2014 09:58:33.433 - Created with UnCodeX