Have familiar: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Eliteofdelete
No edit summary
 
(3 intermediate revisions by 3 users not shown)
Line 5: Line 5:
FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Equipment|


function1={{Function|
function1={{Function|
Line 20: Line 19:
<p>Mafia will not detect transformations of familiars due to wardrobe or doppleshifting, so this function is incapable of detecting such transformation if it is called during combat.|
<p>Mafia will not detect transformations of familiars due to wardrobe or doppleshifting, so this function is incapable of detecting such transformation if it is called during combat.|


needscode=yes|
code1={{CodeSample|
title=Code Samples|
description=Lists out all the familiars you currently have and the total number you have over the total available.|
code=
<syntaxhighlight>
int total, have;
foreach it in $familiars[] {
  total += 1;
  if (have_familiar(it)) {
      print("You have the familiar "+it+"!", "blue");
      have +=1;
  }
}
print("");
print("You have "+have+"/"+total+" available familiars.", "green");
</syntaxhighlight>|
 
}}|


see_also={{SeeAlso|use_familiar}}|
see_also={{SeeAlso|use_familiar}}|
Line 26: Line 42:
special= Note that in Bad Moon it only checks the familiars you have acquired in the current run.|
special= Note that in Bad Moon it only checks the familiars you have acquired in the current run.|
}}
}}
[[Category:Equipment]]

Latest revision as of 03:37, 14 January 2015

Function Syntax

boolean have_familiar(familiar check_me )

  • check_me is the familiar to check for

Returns true if you have the specified familiar check_me, and false otherwise. The familiar will be detected if it is active or in your Terrarium. It will not notice familiar hatchlings since those are items, not familiars and need to be detected separately.

Mafia will not detect transformations of familiars due to wardrobe or doppleshifting, so this function is incapable of detecting such transformation if it is called during combat.

Code Samples

Lists out all the familiars you currently have and the total number you have over the total available.

int total, have;
foreach it in $familiars[] {
   total += 1;
   if (have_familiar(it)) {
      print("You have the familiar "+it+"!", "blue");
      have +=1;
   }
}
print("");
print("You have "+have+"/"+total+" available familiars.", "green");

CLI Equivalent

The CLI command "familiar" with the parameter "list" functions similarly.

See Also

use_familiar()

Special

Note that in Bad Moon it only checks the familiars you have acquired in the current run.