Buffed hit stat: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
m moved Buffed hit stat() to Buffed hit stat: Conformity
imported>Grotfang
Conform to template
Line 1: Line 1:
'''int buffed_hit_stat()'''<br/>
{{#vardefine:name|buffed_hit_stat}}
Returns the buffed value of stat that is currently used to calculate hit percentages.
{{#vardefine:return_type|int}}
[[Category:Your Character | Buffed hit stat()]]
 
[[Category:Ash Functions |Buffed hit stat()]]
{{FunctionPage|
[[Category:Needs Code Samples | Buffed hit stat()]]
name={{#var:name}}|
function_category=Your Character|
 
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
}}|
 
function_description=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.|
 
code1={{CodeSample|
title=Code Samples|
description=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.|
code=
<syntaxhighlight>
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_base_defense(monster_list[int]))) / 10.5) * (100 - fumble))
      if(hit_percentage < 50) {
        return false;
      }
  }
  return true;
  }
}
</syntaxhighlight>
}}|
 
see_also={{SeeAlso|get_monsters|monster_base_defense}}|
more_info=<a href="http://kol.coldfront.net/thekolwiki/index.php/Hit_Chance">Hit Chance</a>|
special=This function returns ?? when not logged in (needs spading).
}}

Revision as of 19:52, 28 February 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_base_defense(monster_list[int]))) / 10.5) * (100 - fumble))
      if(hit_percentage < 50) {
         return false;
      }
   }
   return true;
   }
}

See Also

get_monsters() | monster_base_defense()

More Information

<a href="http://kol.coldfront.net/thekolwiki/index.php/Hit_Chance">Hit Chance</a>

Special

This function returns ?? when not logged in (needs spading).