My ascensions: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Bale
mNo edit summary
imported>Zarqon
m a little code cleanup
Line 21: Line 21:
<syntaxhighlight>
<syntaxhighlight>
boolean mcd_max() {
boolean mcd_max() {
  if (my_ascensions() < 1 || in_bad_moon()) return true;
  // Heartbreaker's Hotel uses an adventure, and I don't think you want that.
   int maxmcd = 10 + in_mysticality_sign().to_int()
   int maxmcd = 10 + in_mysticality_sign().to_int()
   if(my_ascensions() < 1 || in_bad_moon()) maxmcd = 0;
   return (current_mcd() == maxmcd) ? true : change_mcd(maxmcd);
  // Heartbreaker's Hotel uses an adventure, and I don't think you want that.
  if(current_mcd() == maxmcd) {
      return true;
  }
  return change_mcd(maxmcd);
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 36: Line 33:
<syntaxhighlight>
<syntaxhighlight>
boolean mall_access() {
boolean mall_access() {
   if(my_ascensions() < 1) return (my_level() > 4);
   if (my_ascensions() < 1) return (my_level() > 4);
   // Easier to type >4 than >= 5.
   // Easier to type >4 than >= 5.
   return can_interact();
   return can_interact();

Revision as of 04:20, 4 February 2011

Function Syntax

int my_ascensions()

Returns the number of times your character has ascended. Useful for checking several states that appear only after ascending the first time.

Code Samples

The following function sets the MCD to the maximum possible value.

boolean mcd_max() {
   if (my_ascensions() < 1 || in_bad_moon()) return true;
   // Heartbreaker's Hotel uses an adventure, and I don't think you want that.
   int maxmcd = 10 + in_mysticality_sign().to_int()
   return (current_mcd() == maxmcd) ? true : change_mcd(maxmcd);
}

The following baby of a function checks if you have mall access.

boolean mall_access() {
   if (my_ascensions() < 1) return (my_level() > 4);
   // Easier to type >4 than >= 5.
   return can_interact();
}

See Also

change_mcd() | current_mcd() | in_bad_moon() | in_mysticality_sign() | to_int()

Special

When not logged in, this function returns false.