Meat drop modifier: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Grotfang
Code snippet number 2
imported>Bale
mNo edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{#vardefine:name|meat_drop_modifier}}
{{
{{#vardefine:return_type|float}}
#vardefine:name|meat_drop_modifier}}{{
#vardefine:return_type|float}}{{


{{FunctionPage|
FunctionPage|
name={{#var:name}}|
name={{#var:name}}|
function_category=Your Character|


function1={{Function|
function1={{Function|
Line 20: Line 20:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
float monster_drop() {
float monster_drop(monster mob) {
   int monster_drop = meat_drop($monster[alphabet giant]);
   int monster_drop = meat_drop(mob);
   float adjust_drop = monster_drop * (meat_drop_modifier() / 100);
   float adjust_drop = monster_drop * (meat_drop_modifier() / 100.0 + 1);
   float expected_drop = monster_drop + adjust_drop;
   return adjust_drop;
  return expected_drop;
}
}
</syntaxhighlight>
</syntaxhighlight>
}}|
}}
code2={{CodeSample|
{{CodeSample|
description=This goes one step further and calculates an average return per monster for a given location.|
description=This goes one step further and calculates an average return per monster for a given location. It calls the preceeding function.|
code=
code=
<syntaxhighlight>
<syntaxhighlight>
float monster_drop() {
float total_monster_drop() {
   monster[int] monster_list = get_monsters($location[giant's castle]);
   monster [int] monster_list = get_monsters($location[giant castle]);
   float total_meat = 0;
   float total_meat = 0;
  int counter = 0;
   foreach int in monster_list {
   foreach int in monster_list {
       int monster_drop = meat_drop(monster_list[int]);
       total_meat = total_meat + monster_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);
   return (total_meat / count(monster_list));
}
}
</syntaxhighlight>
</syntaxhighlight>
}}|
}}|


see_also={{SeeAlso|meat_drop}}|
see_also={{SeeAlso|item_drop_modifier|meat_drop}}|
special=Returns 0 when not logged in.
special=Returns 0.0 when not logged in.
}}
}}
[[Category:Your Character]]

Latest revision as of 21:36, 21 May 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(monster mob) {
   int monster_drop = meat_drop(mob);
   float adjust_drop = monster_drop * (meat_drop_modifier() / 100.0 + 1);
   return adjust_drop;
}

This goes one step further and calculates an average return per monster for a given location. It calls the preceeding function.

float total_monster_drop() {
   monster [int] monster_list = get_monsters($location[giant castle]);
   float total_meat = 0;
   foreach int in monster_list {
      total_meat = total_meat + monster_drop(monster_list[int]);
   }
   return (total_meat / count(monster_list));
}

See Also

item_drop_modifier() | meat_drop()

Special

Returns 0.0 when not logged in.