Difference between pages "Monster initiative" and "Jump chance"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Eliteofdelete
 
imported>Darzil
(Created page with "{{ #vardefine:name|jump_chance}}{{ #vardefine:return_type|int [item]}}{{ #vardefine:aggregate|yes}}{{ FunctionPage| name={{#var:name}}| function1={{Function| name={{#var:nam...")
 
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|monster_initiative}}{{
+
#vardefine:name|jump_chance}}{{
#vardefine:return_type|int}}{{
+
#vardefine:return_type|int [item]}}{{
 +
#vardefine:aggregate|yes}}{{
  
 
FunctionPage|
 
FunctionPage|
Line 10: Line 11:
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
+
return_also={{#var:return_also}}
 
}}|
 
}}|
  
Line 16: Line 17:
 
name={{#var:name}}|
 
name={{#var:name}}|
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
 +
parameter1={{Param|monster|m}}|
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
+
return_also={{#var:return_also}}
parameter1={{Param|monster|check_me}}|
 
p1desc={{Pspan|check_me}} is the (optional) monster to get the initiative value of|
 
 
}}|
 
}}|
function_description=Returns the initiative value of the specified monster {{pspan|check_me}}. If {{pspan|check_me}} is not specified, it will use the current monster if you are in a fight (i.e. you're calling the function from an [[In-combat Consulting]] script), or the last monster you encountered otherwise.</p>
 
<p>When the function is given a monster as a parameter it will return the monster's initiative at the start of a fight including all monster level modifications. This means that for monsters with unknown initiative, the return value will only take into account monster level.|
 
  
code1={{CodeSample|
+
function3={{Function|
title=Code Samples|
+
name={{#var:name}}|
description=|
+
aggregate={{#var:aggregate}}|
code=
+
parameter1={{Param|monster|m}}|
<syntaxhighlight>
+
parameter2={{Param|int|i}}|
void jump (string monstername) {
+
return_type={{#var:return_type}}|
  monster mon  = to_monster(monstername);
+
return_also={{#var:return_also}}
  int mon_ini = monster_initiative(mon);
 
  int my_ini = numeric_modifier("initiative");
 
  int chance = max(0, 100+my_ini-mon_ini+max(0, my_basestat(my_primestat())-monster_attack(mon)));
 
  chance = min(100, chance);
 
  print("You have a current jump chance on "+mon+" of "+chance+"% which is same as "+jump_chance(mon)+"%.", "blue");
 
}
 
jump("bar");
 
</syntaxhighlight>|
 
moreinfo= There is already a KoLMafia built in function called jump_chance() that does the same as the above example, but better. For more information on jump opponents visit KoL Wiki's [http://kol.coldfront.net/thekolwiki/index.php/Talk:Combat_Initiative Combat Initiative]
 
 
}}|
 
}}|
  
see_also={{SeeAlso|monster_attack|monster_defense|monster_element|monster_hp}}|
+
function4={{Function|
more_info=|
+
name={{#var:name}}|
special=If no monster is specified and no monster has been fought in this session, this function returns 0. This is because mafia forgets the value of {{f|last_monster}} when it logs out.|
+
aggregate={{#var:aggregate}}|
 +
parameter1={{Param|monster|m}}|
 +
parameter2={{Param|int|i}}|
 +
parameter3={{Param|int|ml}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}
 +
}}|
 +
 
 +
function_description=Returns the chance of successfully getting the jump against the monster, optionally at a particular initiative value and monster level.|
 
}}
 
}}
 
[[Category:Adventuring]][[Category:In-combat Consulting]]
 

Revision as of 00:10, 4 December 2013

Function Syntax

int [item] jump_chance()

int [item] jump_chance(monster m )

int [item] jump_chance(monster m ,int i )

int [item] jump_chance(monster m ,int i ,int ml )

Returns the chance of successfully getting the jump against the monster, optionally at a particular initiative value and monster level.