rle.simple.charm
Class CharmEngine

java.lang.Object
  extended by rle.core.vm.PlugInBase
      extended by rle.simple.charm.CharmEngine
All Implemented Interfaces:
PlugIn

public class CharmEngine
extends PlugInBase

Applies charms. A charm is any affect, magical or non-magical that affects a Creature. Examples include the food value of a ration, the damage that a Magic Missile spell does, or the speed boost from a Potion of Speed. At a later time, we may add support for charms that affect Terrain.


Field Summary
 
Fields inherited from class rle.core.vm.PlugInBase
config, context, parameters
 
Constructor Summary
CharmEngine()
           
 
Method Summary
 void applyCharms(java.util.Map<java.lang.String,java.lang.Object> charmMap, Creature target, Cause cause)
          Analyze the given Map and apply the appropriate "Charms" to the target creature.
 
Methods inherited from class rle.core.vm.PlugInBase
config, getContext, getParameters, paramMap, setConfig, setParameters
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CharmEngine

public CharmEngine()
Method Detail

applyCharms

public void applyCharms(java.util.Map<java.lang.String,java.lang.Object> charmMap,
                        Creature target,
                        Cause cause)
Analyze the given Map and apply the appropriate "Charms" to the target creature. Where appropriate, events will be posted allowing interested classes to respond. Such events will include the given cause. Each type of charm has a key, and only one charm for a particular key can be active at a time. Attempts to activate a new charm when one is active will be handled as follows:
    Existing          New       Result
    Good              Good      Fizzle(existing charm unchanged)
    Good              Bad       Cancel(existing charm cancelled, no further action)
    Bad               Bad       Fizzle
    Bad               Good      Cancel
 

Parameters:
charmMap - - key/value pairs indicating 0 or more affects to invoke
target - - the creature to be affected
cause - - the cause of the application of charms