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

Gameplay.ExtendedStat


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
class ExtendedStat extends Stat;

var()	int		minTargetAltitude;
var()	float	minTargetSpeed;
var()	float	maxTargetSpeed;
var()	int		minDistance;
var()	int		maxDistance;
var()	float	minDamage;
var()	bool	bAllowTargetInVehicleOrTurret;

// Some other parameters that could be implemented.
// To do this properly, you'd have to take a snapshot of the source's relevant movement stats
// at the time the projectile was fired, otherwise it wouldn't be entirely accurate (especially
// for slow-moving projectiles).  That would be a lot of effort though.
//var()	int		minSourceAltitude;
//var()	int		minTargetAltitudeRelative;
//var()	float	minSourceSpeed;
//var()	float	minTargetSpeedRelative;
//var()	int		maxSourceAltitude;
//var()	int		maxTargetAltitude;
//var()	int		maxTargetAltitudeRelative;
//var()	float	maxSourceSpeed;
//var()	float	maxTargetSpeedRelative;

static function bool isEligible(Controller Source, Controller Target, float damageAmount)
{
	local vector hitLocation, hitNormal, startTrace, endTrace;
	local int relativeDistance;
	local Character targetCharacter;
	local PlayerCharacterController pcc;

	if (Target == None || Source == None)
		return false;

	// Damage check, but only if target is alive
	if (Target.Pawn.IsAlive() && damageAmount < default.minDamage)
		return false;

	// Vehicle/turret check
	pcc = PlayerCharacterController(Target);
	if (!default.bAllowTargetInVehicleOrTurret && pcc != None && !pcc.IsInState('CharacterMovement'))
		return false;

	// Minimum distance check
	relativeDistance = VSize(Source.Pawn.Location - Target.Pawn.Location);
	if (relativeDistance < default.minDistance)
		return false;

	// Maximum distance check
	if (default.maxDistance != 0 && relativeDistance >= default.maxDistance)
		return false;

	// Minimum target altitude check
	startTrace = Target.Pawn.Location;
	endTrace = Target.Pawn.Location;
	endTrace.z -= default.minTargetAltitude;
	if (Target.Trace(hitLocation, hitNormal, endTrace, startTrace) != None)
		return false;

	// Minimum target speed check
	targetCharacter = Character(Target.Pawn);
	if (targetCharacter.movementSpeed < default.minTargetSpeed)
		return false;

	// Maximum target speed check
	if (default.maxTargetSpeed != 0 && targetCharacter.movementSpeed >= default.maxTargetSpeed)
		return false;

	// If this point is reached, all tests passed and the stat is awarded
	return true;
}

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: ne 5.9.2004 15:53:14.000 - Creation time: st 23.5.2018 00:10:43.384 - Created with UnCodeX