Mp cost: Difference between revisions
Jump to navigation
Jump to search
imported>Heeheehee Code sample with plenty of documentation/explanatory comments. |
imported>Bale mNo edit summary |
||
Line 6: | Line 6: | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 48: | Line 47: | ||
}} | }} | ||
[[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.