Difference between revisions of "Meat drop modifier"

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
imported>Grotfang
(Code snippet number 2)
Line 25: Line 25:
 
   float expected_drop = monster_drop + adjust_drop;
 
   float expected_drop = monster_drop + adjust_drop;
 
   return expected_drop;
 
   return expected_drop;
 +
}
 +
</syntaxhighlight>
 +
}}|
 +
code2={{CodeSample|
 +
description=This goes one step further and calculates an average return per monster for a given location.|
 +
code=
 +
<syntaxhighlight>
 +
float monster_drop() {
 +
  monster[int] monster_list = get_monsters($location[giant's castle]);
 +
  float total_meat = 0;
 +
  int counter = 0;
 +
  foreach int in monster_list {
 +
      int monster_drop = meat_drop(monster_list[int]);
 +
      float adjust_drop = monster_drop * (meat_drop_modifier() / 100);
 +
      float expected_drop = monster_drop + adjust_drop;
 +
      total_meat = total_meat + expected_drop;
 +
      counter = counter + 1;
 +
  }
 +
  return (total_meat / counter);
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 23:36, 28 February 2010



Function Syntax

float meat_drop_modifier()

Returns the percentage that you currently increase or decrease your meat drops as a result of equipment, effects (including familiars) and area modifiers (such as on the sea floor).

Code Samples

Uses the baseline meat drop to determine how much you can expect to get, on average, from a given monster.

float monster_drop() {
   int monster_drop = meat_drop($monster[alphabet giant]);
   float adjust_drop = monster_drop * (meat_drop_modifier() / 100);
   float expected_drop = monster_drop + adjust_drop;
   return expected_drop;
}

This goes one step further and calculates an average return per monster for a given location.

float monster_drop() {
   monster[int] monster_list = get_monsters($location[giant's castle]);
   float total_meat = 0;
   int counter = 0;
   foreach int in monster_list {
      int monster_drop = meat_drop(monster_list[int]);
      float adjust_drop = monster_drop * (meat_drop_modifier() / 100);
      float expected_drop = monster_drop + adjust_drop;
      total_meat = total_meat + expected_drop;
      counter = counter + 1;
   }
   return (total_meat / counter);
}

See Also

meat_drop()

Special

Returns 0 when not logged in.