Difference between revisions of "My effective familiar"

From Kolmafia
Jump to navigation Jump to search
imported>Bale
(r9644)
 
imported>Bale
(fix code sample)
 
(One intermediate revision by the same user not shown)
Line 23: Line 23:
 
   switch(my_effective_familiar()) {
 
   switch(my_effective_familiar()) {
 
   case $familiar[RoboGoose]:
 
   case $familiar[RoboGoose]:
       if(my_hp() <= (familiar_weight()+ 4)/2)
+
       if(my_hp() <= (familiar_weight(my_familiar())+ 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()
  case $familiar[Fuzzy Dice]:
+
        +". You may want to finish this fight yourself.");
 
   case $familiar[Stab Bat]:
 
   case $familiar[Stab Bat]:
 
   case $familiar[Scary Death Orb]:
 
   case $familiar[Scary Death Orb]:
       if(my_hp() <= familiar_weight() + 2) break;
+
       if(my_hp() <= familiar_weight(my_familiar()) + 2) break;
 
   case $familiar[Fuzzy Dice]:
 
   case $familiar[Fuzzy Dice]:
       if(my_hp() <= familiar_weight()) break;
+
       if(my_hp() <= familiar_weight(my_familiar())) break;
 
   case $familiar[Floating Eye]:
 
   case $familiar[Floating Eye]:
 
   case $familiar[Egg Benedict]:
 
   case $familiar[Egg Benedict]:
 
   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>}}|

Latest revision as of 03:57, 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(my_familiar())+ 4)/2)
         abort("Your familiar became a "+my_effective_familiar()
         +". You may want to finish this fight yourself.");
   case $familiar[Stab Bat]:
   case $familiar[Scary Death Orb]:
      if(my_hp() <= familiar_weight(my_familiar()) + 2) break;
   case $familiar[Fuzzy Dice]:
      if(my_hp() <= familiar_weight(my_familiar())) 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()