Buffed hit stat: Difference between revisions
Jump to navigation
Jump to search
imported>StDoodle mNo edit summary |
imported>Bale mNo edit summary |
||
Line 5: | Line 5: | ||
FunctionPage| | FunctionPage| | ||
name={{#var:name}}| | name={{#var:name}}| | ||
function1={{Function| | function1={{Function| | ||
Line 40: | Line 39: | ||
special=This function returns 0 when not logged in. | special=This function returns 0 when not logged in. | ||
}} | }} | ||
[[Category:Your Character]] |
Revision as of 21:35, 21 May 2010
Function Syntax
int buffed_hit_stat()
Returns the buffed value of the stat that is currently used to calculate hit percentages. Note, ranged weapons use moxie to calculate hit percentage, melee weapons use muscle.
Code Samples
This code will check your hit percentage against every monster in a specified location to make sure it is 50% or over for every monster.
boolean safe_to_attack() {
int x = buffed_hit_stat();
monster [int] monster_list = get_monsters($location[Fantasy Airship]);
foreach int in monster_list {
float fumble = 1/22;
float hit_percentage = (((6 + (x - monster_defense(monster_list[int]))) / 10.5) * (100 - fumble));
if(hit_percentage < 50) {
return false;
}
}
return true;
}
See Also
More Information
http://kol.coldfront.net/thekolwiki/index.php/Hit_Chance
Special
This function returns 0 when not logged in.