Difference between revisions of "Mp cost"
Jump to navigation
Jump to search
imported>StDoodle m |
imported>Bale m |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | {{#vardefine:name|mp_cost}} | + | {{ |
− | {{#vardefine:return_type|int}} | + | #vardefine:name|mp_cost}}{{ |
+ | #vardefine:return_type|int}}{{ | ||
+ | |||
+ | FunctionPage| | ||
− | |||
name={{#var:name}}| | name={{#var:name}}| | ||
− | |||
function1={{Function| | function1={{Function| | ||
Line 17: | Line 18: | ||
function_description=Returns the current MP cost for the next cast of the given skill {{pspan|use_me}} with all current MP cost modifiers accounted for.| | function_description=Returns the current MP cost for the next cast of the given skill {{pspan|use_me}} with all current MP cost modifiers accounted for.| | ||
− | + | code1={{CodeSample| | |
+ | title=Semi-practical Example| | ||
+ | description=Burns MP gained from adventuring by casting Summon BRICKOs as many times as possible.| | ||
+ | code= | ||
+ | <syntaxhighlight> | ||
+ | boolean brickoCaster( int adv_to_use ) { | ||
+ | if(have_skill($skill[Summon BRICKOs]) return false; | ||
+ | // You can't exactly burn MP by casting Summon BRICKOs if you don't have the skill, Einstein! | ||
+ | int c = to_int(get_property("libramSummons")); | ||
+ | int i = 0; | ||
+ | while (my_mp()-12>(i*(i+1)*(i+2)/6)-(i*(i-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) { | ||
+ | // This bit calculates how many times you can cast Summon BRICKOs before beginning the adventuring loop. | ||
+ | i=i+1; | ||
+ | } | ||
+ | use_skill(i, $skill[Summon BRICKOs]); | ||
+ | while ( adv_to_use > 0 ) { | ||
+ | adventure(1, $location[Giants Castle]); | ||
+ | if ( my_mp() > mp_cost($skill[Summon BRICKOs]) + 12 ) | ||
+ | // We're leaving this much mana for Disco Nirvana, which has been worked into your CCS (if you're a DB), right? | ||
+ | use_skill(1, $skill[Summon BRICKOs]); | ||
+ | adv_to_use = adv_to_use - 1; | ||
+ | } | ||
+ | return true; | ||
+ | } | ||
+ | |||
+ | // Note: This scriptlet will use a specified number of turns in the Giant's Castle, assuming you can adventure there. | ||
+ | </syntaxhighlight>}}| | ||
}} | }} | ||
+ | |||
+ | [[Category:Skills and Effects]] |
Latest revision as of 22:14, 21 May 2010
Function Syntax
- use_me is the skill to check the cost of
Returns the current MP cost for the next cast of the given skill use_me with all current MP cost modifiers accounted for.
Semi-practical Example
Burns MP gained from adventuring by casting Summon BRICKOs as many times as possible.
boolean brickoCaster( int adv_to_use ) {
if(have_skill($skill[Summon BRICKOs]) return false;
// You can't exactly burn MP by casting Summon BRICKOs if you don't have the skill, Einstein!
int c = to_int(get_property("libramSummons"));
int i = 0;
while (my_mp()-12>(i*(i+1)*(i+2)/6)-(i*(i-1)/2)-(c*(c+1)*(c+2)/6)-(c*(c-1)/2)) {
// This bit calculates how many times you can cast Summon BRICKOs before beginning the adventuring loop.
i=i+1;
}
use_skill(i, $skill[Summon BRICKOs]);
while ( adv_to_use > 0 ) {
adventure(1, $location[Giants Castle]);
if ( my_mp() > mp_cost($skill[Summon BRICKOs]) + 12 )
// We're leaving this much mana for Disco Nirvana, which has been worked into your CCS (if you're a DB), right?
use_skill(1, $skill[Summon BRICKOs]);
adv_to_use = adv_to_use - 1;
}
return true;
}
// Note: This scriptlet will use a specified number of turns in the Giant's Castle, assuming you can adventure there.