Restore mp: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
Created page with '{{#vardefine:name|restore_mp}} {{#vardefine:return_type|boolean}} {{FunctionPage| name={{#var:name}}| function_category=Skills and Effects| function1={{Function| name={{#var:na…'
 
imported>StDoodle
mNo edit summary
Line 22: Line 22:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if (my_mp() < my_max_mp()) {
if (my_mp() < my_maxmp()) {
   restore_mp(my_max_mp());
   restore_mp(my_maxmp());
}
}
</syntaxhighlight>}}|
</syntaxhighlight>}}|


see_also={{SeeAlso|my_hp|my_mp|my_max_hp|my_max_mp|restore_hp}}|
see_also={{SeeAlso|my_hp|my_mp|my_maxhp|my_maxmp|restore_hp}}|
cli_equiv=The CLI command "restore" has similar functionality.|
cli_equiv=The CLI command "restore" has similar functionality.|
}}
}}

Revision as of 17:09, 2 March 2010



Function Syntax

boolean restore_mp(int target )

  • target is the minimum MP desired after the function is run.

Restores your MP, following your current recovery settings as closely as possible. This function only attempts to surpass target, not to arrive as closely as possible to it. If your current KoLmafia recovery settings are lower than your current MP (or off), this function will restore the bare minimum necessary to reach target using the restores you have checked. If, however, you have your recovery setting set to "Try to recover up to 100% mana," this function will follow that preference if possible. This function will do nothing and return false if you have not checked any restore items. Otherwise, this function returns true if your MP is at or equal to target when finished. If target is set above your current max MP, this function will attempt to restore to that amount and report its success based on that goal, not the number used for target.

Code Sample

This sample attempts to restore your MP to full.

if (my_mp() < my_maxmp()) {
   restore_mp(my_maxmp());
}

CLI Equivalent

The CLI command "restore" has similar functionality.

See Also

my_hp() | my_mp() | my_maxhp() | my_maxmp() | restore_hp()