Mp cost

From Kolmafia
Jump to navigation Jump to search

Function Syntax

int mp_cost(skill use_me )

  • 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.
   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.