Planeshift
Public Member Functions | Protected Attributes

SpellPerception Class Reference

Whenever a player casts a spell on himself, another player, or any npc, this perception is passed to npc's in the vicinity. More...

#include <perceptions.h>

List of all members.

Public Member Functions

virtual void ExecutePerception (NPC *npc, float weight)
 All preconditions has been checked, now excecute the perception.
virtual gemNPCObjectGetTarget ()
 Some perception has a target/source.
virtual PerceptionMakeCopy ()
 Make a copy of this perception.
virtual bool ShouldReact (Reaction *reaction, NPC *npc)
 Check if this perception should react to a reaction.
 SpellPerception (const char *name, gemNPCObject *caster, gemNPCObject *target, const char *spell_type, float severity)

Protected Attributes

csWeakRef< gemNPCActorcaster
float spell_severity
csWeakRef< gemNPCActortarget

Detailed Description

Whenever a player casts a spell on himself, another player, or any npc, this perception is passed to npc's in the vicinity.

We cannot only use targeted NPCs because an npc in combat may want to react to a player healing his group mate, which helps his team and hurts the NPC indirectly. Right now, reactions are allowed by type of spell, and depending on the severity, it affects his/her hate list according to the weight supplied.

Definition at line 391 of file perceptions.h.


Constructor & Destructor Documentation

SpellPerception::SpellPerception ( const char *  name,
gemNPCObject caster,
gemNPCObject target,
const char *  spell_type,
float  severity 
)

Member Function Documentation

virtual void SpellPerception::ExecutePerception ( NPC npc,
float  weight 
) [virtual]

All preconditions has been checked, now excecute the perception.

Parameters:
npcThe target of the percpetion.
weightIndicate how much the HateList of the npc should be changed. Value comes from the reaction.

Reimplemented from Perception.

virtual gemNPCObject* SpellPerception::GetTarget ( ) [inline, virtual]

Some perception has a target/source.

See also:
DamagePerception
Returns:
the target of this perception.

Reimplemented from Perception.

Definition at line 403 of file perceptions.h.

virtual Perception* SpellPerception::MakeCopy ( ) [virtual]

Make a copy of this perception.

Returns:
the copy.

Reimplemented from Perception.

virtual bool SpellPerception::ShouldReact ( Reaction reaction,
NPC npc 
) [virtual]

Check if this perception should react to a reaction.

Parameters:
reactionThe reaction to check for.
npcThe NPC that might receive this.
Returns:
true if reaction should be reacted to.

Reimplemented from Perception.


Member Data Documentation

csWeakRef<gemNPCActor> SpellPerception::caster [protected]

Definition at line 394 of file perceptions.h.

Definition at line 396 of file perceptions.h.

csWeakRef<gemNPCActor> SpellPerception::target [protected]

Definition at line 395 of file perceptions.h.


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