My effective familiar: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
r9644
 
imported>Bale
fix line breaks
Line 24: Line 24:
   case $familiar[RoboGoose]:
   case $familiar[RoboGoose]:
       if(my_hp() <= (familiar_weight()+ 4)/2)
       if(my_hp() <= (familiar_weight()+ 4)/2)
abort("Your familiar became a "+my_effective_familiar()+". You may want to finish this fight yourself.");
        abort("Your familiar became a "+my_effective_familiar()
        +". You may want to finish this fight yourself.");
   case $familiar[Fuzzy Dice]:
   case $familiar[Fuzzy Dice]:
   case $familiar[Stab Bat]:
   case $familiar[Stab Bat]:
Line 35: Line 36:
   case $familiar[O.A.F.]:
   case $familiar[O.A.F.]:
   case $familiar[Black Cat]:
   case $familiar[Black Cat]:
       abort("Your familiar became a "+my_effective_familiar()+". You may want to finish this fight yourself.");
       abort("Your familiar became a "+my_effective_familiar()
    +". You may want to finish this fight yourself.");
   }
   }
 
</syntaxhighlight>}}|
</syntaxhighlight>}}|



Revision as of 03:54, 19 July 2011

Function Syntax

familiar my_effective_familiar()

This function will return the identity of your current familiar. If you have a Doppelshifter or a tiny costume wardrobe equipped, then the return value will be the identity that your familiar assumed at the beginning of the current combat.

Code Sample

Certain familiars are an extreme danger to their master. If your familiar turns into one of these, the following code will abort automation so that the player can cope.

if(my_familiar() != my_effective_familiar())
   switch(my_effective_familiar()) {
   case $familiar[RoboGoose]:
      if(my_hp() <= (familiar_weight()+ 4)/2)
         abort("Your familiar became a "+my_effective_familiar()
         +". You may want to finish this fight yourself.");
   case $familiar[Fuzzy Dice]:
   case $familiar[Stab Bat]:
   case $familiar[Scary Death Orb]:
      if(my_hp() <= familiar_weight() + 2) break;
   case $familiar[Fuzzy Dice]:
      if(my_hp() <= familiar_weight()) break;
   case $familiar[Floating Eye]:
   case $familiar[Egg Benedict]:
   case $familiar[O.A.F.]:
   case $familiar[Black Cat]:
      abort("Your familiar became a "+my_effective_familiar()
     +". You may want to finish this fight yourself.");	
   }

See Also

my_familiar()