|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.groovydice.plugin.builtin.DiceModifier
public class DiceModifier
This class is used to specify a modifier to each die of a dice rolling command. A modifier can also hold a condition object, which is used when applying the modifier in such a way that only matching dice are modified.
Constructor Summary | |
---|---|
DiceModifier()
|
Method Summary | |
---|---|
Object |
apply(Object logic)
Apply this modifier using the given logic closure. |
Object |
getCondition()
|
groovy.lang.MetaClass |
getMetaClass()
|
Object |
getModifier()
|
Object |
getProperty(String name)
|
Object |
invokeMethod(String name,
Object args)
|
Object |
negative()
Multiply the modifier value by '-1' when the unary '-' operator is used in this object. |
void |
setCondition(Object condition)
Set the condition, which restricts the modifier to be applied only to a specific set of dice. |
void |
setMetaClass(groovy.lang.MetaClass metaClass)
|
void |
setModifier(Object value)
|
void |
setProperty(String name,
Object value)
|
String |
toString()
String representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiceModifier()
Method Detail |
---|
public Object getModifier()
public void setModifier(Object value)
public Object getCondition()
public void setCondition(Object condition)
condition
- An object that express an condition which all dice must
fit in order to be 'modified'. Any object that fit into a
grep()
call can be used here. You can also pass a dice
rolling command object to apply this modifier only to dice equals to
any dice of the given roll.public Object negative()
this
.public Object apply(Object logic)
logic
- Closure which is used to apply this modifier. This closure
should be a method borrowed from a dice rolling command.
public String toString()
toString
in class Object
public groovy.lang.MetaClass getMetaClass()
getMetaClass
in interface groovy.lang.GroovyObject
public void setMetaClass(groovy.lang.MetaClass metaClass)
setMetaClass
in interface groovy.lang.GroovyObject
public Object invokeMethod(String name, Object args)
invokeMethod
in interface groovy.lang.GroovyObject
public Object getProperty(String name)
getProperty
in interface groovy.lang.GroovyObject
public void setProperty(String name, Object value)
setProperty
in interface groovy.lang.GroovyObject
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |