Difference between revisions of "Elemental resistance"

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
m
imported>Fredg1
m (adding slime)
 
(9 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[[float]] [[elemental_resistance()]]
+
{{
 +
#vardefine:name|elemental_resistance}}{{
 +
#vardefine:return_type|float}}{{
  
Returns your current resistance for a specified element in the form of a float.
+
FunctionPage|
 +
name={{#var:name}}|
  
The following [[function]] returns true if you have a resistance greater than 20 for the element "hot".
+
function1={{Function|
 +
name={{#var:name}}|
 +
aggregate={{#var:aggregate}}|
 +
return_type={{#var:return_type}}|
 +
return_also={{#var:return_also}}|
 +
parameter1={{Param|element|}}|
 +
p1desc=The parameter of element is invoked using $element. Valid elements are hot ($element[hot]), cold, stench, spooky, sleaze, slime.
 +
}}|
  
<code>
+
function_description=Returns your current resistance for a specified element in the form of a floating point integer.|
  [[boolean]] hot_check() {
 
    if( '''elemental_resistance( $element[hot] )''' > 20 )
 
        return true;
 
    else
 
        return false;
 
  }
 
</code>
 
[[Category:Your Character | elemental_resistance()]]
 
[[Category:Ash Functions | elemental_resistance()]]
 
  
When not logged in the function returns 0 (needs spading).
+
code1={{CodeSample|
 +
title=Code Samples|
 +
description=Checks that your current hot resistance reduces damage by more than 20 percent.|
 +
code=
 +
<syntaxhighlight>
 +
boolean hot_check() {
 +
  if(elemental_resistance($element[hot]) > 20) {
 +
      return true;
 +
  }
 +
  return false;
 +
}
 +
</syntaxhighlight>
 +
}}|
 +
 
 +
special=When not logged in the function returns 0.0
 +
}}
 +
 
 +
[[Category:Your Character]]

Latest revision as of 22:45, 12 June 2019

Function Syntax

float elemental_resistance(element )

  • The parameter of element is invoked using $element. Valid elements are hot ($element[hot]), cold, stench, spooky, sleaze, slime.

Returns your current resistance for a specified element in the form of a floating point integer.

Code Samples

Checks that your current hot resistance reduces damage by more than 20 percent.

boolean hot_check() {
   if(elemental_resistance($element[hot]) > 20) {
      return true;
   }
   return false;
}

Special

When not logged in the function returns 0.0