SpeciesGameRules
The SpeciesGameRules affects the amount of damage a particular species deals and recieves in the game. Species are defined in subclasses in of SpeciesType and contain their augmented damage ratios in their respective defaultproperties.
Known SpeciesType Subclasses
SpeciesType +-SPECIES_Alien? +-SPECIES_Bot? +-SPECIES_Human? | +-SPECIES_Egypt? | +-SPECIES_Merc? | +-SPECIES_Night? +-SPECIES_Jugg?
Methods
- int NetDamage( int OriginalDamage, int Damage, Pawn injured, Pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType )
- Augments the amount of damage done by a specific species in the game.
Code Walkthrough.
I thought that these would be useful examples to further demonstrate writing a GameRules for your game.
class SpeciesGameRules extends GameRules; function int NetDamage( int OriginalDamage, int Damage, pawn injured, pawn instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType ) { if ( NextGameRules != None ) return NextGameRules.NetDamage( OriginalDamage,Damage,injured,instigatedBy,HitLocation,Momentum,DamageType ); if ( xPawn(injured) != None ) Damage = xPawn(injured).Species.static.ModifyReceivedDamage(Damage,injured,instigatedBy,HitLocation,Momentum,DamageType); if ( (InstigatedBy != Injured) && (xPawn(InstigatedBy) != None) ) Damage = xPawn(InstigatedBy).Species.static.ModifyImpartedDamage(Damage,injured,instigatedBy,HitLocation,Momentum,DamageType); return Damage; }
The block of code handles three things: Allows the other GameRules modifiers to go first; Calculates the damage recieved by the xPawn; Calculates the damage Imparted by the xPawn.
This GameRules allows all other GameRules to affect the NetDamage before it augments the damage in play. If you neglect giving the other GameRules a chance to augment NetDamage, then all other GameRules loaded after this GameRules will not have a chance to augment play.
Here is a list of damage received and imparted modifiers.
Discussion
Burtlo: Thought I would use the subclasses as a great oppurtunity to show how GameRules work.