Monster element: Difference between revisions
Jump to navigation
Jump to search
imported>Bale answered RFI |
imported>Bale template |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 26: | Line 24: | ||
<p>This function can be used from within an [[In-combat Consulting]] script to help determine your fight strategy. When used this way, it isn't necessary to specify a monster, as the function will default to the one currently being fought.| | <p>This function can be used from within an [[In-combat Consulting]] script to help determine your fight strategy. When used this way, it isn't necessary to specify a monster, as the function will default to the one currently being fought.| | ||
code1={{CodeSample| | |||
title=Sample Code| | |||
description=This example attempts to find element(s) that the monster being fought right now is weak against.| | |||
code=<syntaxhighlight> | |||
boolean [element] weak_elements; | |||
see_also={{SeeAlso|monster_attack|monster_defense|monster_hp}}| | switch (monster_element()) | ||
special=If no monster is specified and no monster has been fought in this session, this function returns $element[none]. This is because mafia forgets the value of | { | ||
case $element[cold]: weak_elements = $elements[spooky, hot]; break; | |||
case $element[spooky]: weak_elements = $elements[hot, stench]; break; | |||
case $element[hot]: weak_elements = $elements[stench, sleaze]; break; | |||
case $element[stench]: weak_elements = $elements[sleaze, cold]; break; | |||
case $element[sleaze]: weak_elements = $elements[cold, spooky]; break; | |||
} | |||
</syntaxhighlight> | |||
}}| | |||
see_also={{SeeAlso|monster_attack|monster_defense|monster_initiative|monster_hp}}| | |||
special=If no monster is specified and no monster has been fought in this session, this function returns $element[none]. This is because mafia forgets the value of {{f|last_monster}} when it logs out.| | |||
}} | }} | ||
[[Category:Adventuring]][[Category:In-combat Consulting]] |
Latest revision as of 06:26, 8 November 2014
Function Syntax
element monster_element()
element monster_element(monster check_me )
- check_me is the (optional) monster to get the elemental alignment of
Returns the elemental alignment of the specified monster check_me. If check_me is not specified, it defaults to the last monster you encountered.
This function can be used from within an In-combat Consulting script to help determine your fight strategy. When used this way, it isn't necessary to specify a monster, as the function will default to the one currently being fought.
Sample Code
This example attempts to find element(s) that the monster being fought right now is weak against.
boolean [element] weak_elements;
switch (monster_element())
{
case $element[cold]: weak_elements = $elements[spooky, hot]; break;
case $element[spooky]: weak_elements = $elements[hot, stench]; break;
case $element[hot]: weak_elements = $elements[stench, sleaze]; break;
case $element[stench]: weak_elements = $elements[sleaze, cold]; break;
case $element[sleaze]: weak_elements = $elements[cold, spooky]; break;
}
See Also
Special
If no monster is specified and no monster has been fought in this session, this function returns $element[none]. This is because mafia forgets the value of last_monster()
when it logs out.