Planeshift
Public Member Functions | Protected Types | Protected Attributes

Reaction Class Reference

A reaction embodies the change in desire which occurs in an NPC when he perceives something. More...

#include <reaction.h>

List of all members.

Public Member Functions

void DeepCopy (Reaction &other, BehaviorSet &behaviors)
bool DoNotInterrupt (Behavior *behavior)
 Check if this is a behavior that shouldn't be interrupted.
csString GetAffectedBehaviors ()
const csString & GetEventType () const
int GetFactionDiff ()
const csString & GetLastTriggerd ()
char GetOp ()
int GetRandom (int i)
bool GetRandomValid (int i)
float GetRange ()
const csString GetType (NPC *npc) const
csString GetValue ()
int GetValue (int i)
bool GetValueValid (int i)
bool Load (iDocumentNode *node, BehaviorSet &behaviors)
bool OnlyInterrupt (Behavior *behavior)
 Check if this is a behavior is on the only interrupt list if set.
void React (NPC *who, Perception *pcpt)
 Reaction (Reaction &other, BehaviorSet &behaviors)
 Reaction ()
bool SetValue (int i, int value)
 Setting the value.
bool ShouldReact (gemNPCObject *entity)
 Check if the player should react to this reaction.

Protected Types

enum  DesireType { DESIRE_NONE, DESIRE_DELTA, DESIRE_ABSOLUTE, DESIRE_GUARANTEED }

Protected Attributes

bool activeOnly
csArray< Behavior * > affected
MathScriptcalcCondition
 This is the particular calculation for condition.
csString condition
DesireType desireType
 Indicate the type of desire change this reaction has.
float desireValue
 The value to use for the desire type.
csArray< csString > doNotInterrupt
csString eventType
int factionDiff
bool inactiveOnly
csString lastTriggered
 Used for debug, show when this was last triggered.
csArray< csString > onlyInterrupt
csString oper
csArray< intrandoms
csArray< bool > randomsValid
float range
bool reactWhenDead
bool reactWhenInvincible
bool reactWhenInvisible
csString type
csArray< intvalues
csArray< bool > valuesValid
float weight
 The weight to apply to deltas.

Detailed Description

A reaction embodies the change in desire which occurs in an NPC when he perceives something.

Definition at line 51 of file reaction.h.


Member Enumeration Documentation

enum Reaction::DesireType [protected]
Enumerator:
DESIRE_NONE 
DESIRE_DELTA 
DESIRE_ABSOLUTE 
DESIRE_GUARANTEED 

Definition at line 79 of file reaction.h.


Constructor & Destructor Documentation

Reaction::Reaction ( )
Reaction::Reaction ( Reaction other,
BehaviorSet behaviors 
) [inline]

Definition at line 95 of file reaction.h.


Member Function Documentation

void Reaction::DeepCopy ( Reaction other,
BehaviorSet behaviors 
)
bool Reaction::DoNotInterrupt ( Behavior behavior)

Check if this is a behavior that shouldn't be interrupted.

Parameters:
behaviorThe behavior to check.
Returns:
True if this is a behavior that shouldn't be interrupted.
csString Reaction::GetAffectedBehaviors ( )
const csString& Reaction::GetEventType ( ) const
int Reaction::GetFactionDiff ( ) [inline]

Definition at line 139 of file reaction.h.

const csString& Reaction::GetLastTriggerd ( ) [inline]

Definition at line 157 of file reaction.h.

char Reaction::GetOp ( )
int Reaction::GetRandom ( int  i)
bool Reaction::GetRandomValid ( int  i)
float Reaction::GetRange ( ) [inline]

Definition at line 135 of file reaction.h.

const csString Reaction::GetType ( NPC npc) const
csString Reaction::GetValue ( )
int Reaction::GetValue ( int  i)
bool Reaction::GetValueValid ( int  i)
bool Reaction::Load ( iDocumentNode *  node,
BehaviorSet behaviors 
)
bool Reaction::OnlyInterrupt ( Behavior behavior)

Check if this is a behavior is on the only interrupt list if set.

If there is a limitation on behaviors to interrupt for this reaction this function will return true if the behavior isn't on that list.

Parameters:
behaviorThe behavior to check.
Returns:
True if this is a behavior that isn't allowed to interrupt.
void Reaction::React ( NPC who,
Perception pcpt 
)
bool Reaction::SetValue ( int  i,
int  value 
)

Setting the value.

This function ignore the data valid flag. And will not update it for the value set.

bool Reaction::ShouldReact ( gemNPCObject entity)

Check if the player should react to this reaction.

Caled by perception related to entitis to check for reaction against visibility and invincibility

Parameters:
entityThe entity tho check for visibility and invincibility

Member Data Documentation

bool Reaction::activeOnly [protected]

Definition at line 63 of file reaction.h.

Definition at line 77 of file reaction.h.

This is the particular calculation for condition.

Definition at line 62 of file reaction.h.

csString Reaction::condition [protected]

Definition at line 61 of file reaction.h.

Indicate the type of desire change this reaction has.

Definition at line 87 of file reaction.h.

The value to use for the desire type.

Definition at line 88 of file reaction.h.

csArray<csString> Reaction::doNotInterrupt [protected]

Definition at line 74 of file reaction.h.

csString Reaction::eventType [protected]

Definition at line 57 of file reaction.h.

Definition at line 59 of file reaction.h.

bool Reaction::inactiveOnly [protected]

Definition at line 64 of file reaction.h.

csString Reaction::lastTriggered [protected]

Used for debug, show when this was last triggered.

Definition at line 91 of file reaction.h.

csArray<csString> Reaction::onlyInterrupt [protected]

Definition at line 73 of file reaction.h.

csString Reaction::oper [protected]

Definition at line 60 of file reaction.h.

Definition at line 71 of file reaction.h.

csArray<bool> Reaction::randomsValid [protected]

Definition at line 70 of file reaction.h.

float Reaction::range [protected]

Definition at line 58 of file reaction.h.

bool Reaction::reactWhenDead [protected]

Definition at line 65 of file reaction.h.

Definition at line 67 of file reaction.h.

bool Reaction::reactWhenInvisible [protected]

Definition at line 66 of file reaction.h.

csString Reaction::type [protected]

Definition at line 72 of file reaction.h.

Definition at line 69 of file reaction.h.

csArray<bool> Reaction::valuesValid [protected]

Definition at line 68 of file reaction.h.

float Reaction::weight [protected]

The weight to apply to deltas.

Definition at line 89 of file reaction.h.


The documentation for this class was generated from the following file: