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

U2.DamageFilter


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
//=============================================================================
// $Workfile: DamageFilter.uc $
// Created By: Mark Poesch
// Created On: 2/10/01
// $Author: Pcarlson $
// $Date: 7/15/02 4:15p $
// $Revision: 4 $
//=============================================================================
class DamageFilter extends Info
	abstract;

const MaxFilteredDamageTypes = 10;

struct STRUCT_DamageFilter
{
	var class<DamageType> DamageType;
	var float DamageMultiplier;
	var float MomentumMultiplier;
};

var STRUCT_DamageFilter Filter[MaxFilteredDamageTypes];

/*
!!mdf-tbd: couple of ideas:

#1 

Allow optionally instanced DamageFilter to support NPCs etc. modifying
their damage filter dynamically -- e.g. shoot NPC, damage it initially
but it "adapts" and after a while no longer hurt by that type of damage (alternatively, 
could just support multiple static filters which are swapped-in but this
wouldn't be as flexible. Could be very cool for boss creatures. Just
add support for instances of DamageFilter (MyDamageFilter) and support
for adding/removing/modifying entries.

#2

Allow damage filter to modify DamageType also (make this an "out" parameter).
e.g. say, shian might react to leeches as though they are burning rather than
causing biological damage.
*/

/*NEW 2002.07.15 PWC
	Added optional out parameter DamageFloat because precision was being lost by using int
	I didn't want to break anyone else's code so I just added an extra parameter which can 
	be used if necessary
*/
static function ApplyFilter( out int Damage, out vector Momentum, class<DamageType> DamageType, optional out float DamageFloat )
{
	local int i;

	for( i = 0; i < ArrayCount(default.Filter) && default.Filter[i].DamageType != None; i++ )
	{
		if( ClassIsChildOf( DamageType, default.Filter[i].DamageType ) )
		{
			if( DamageFloat? )
			{
				DamageFloat *= default.Filter[i].DamageMultiplier;
			}
			Damage   *= default.Filter[i].DamageMultiplier;
			Momentum *= default.Filter[i].MomentumMultiplier;
			return;
		}
	}
}

defaultproperties
{
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:42.000 - Creation time: sk 3-1-2016 10:48:37.883 - Created with UnCodeX