Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat combat_macro.ash
- // hugmeir's combat script. WIP forever.
- import <zlib.ash>
- boolean [string] mm;
- boolean monster_modifiers_may_stop_actions() {
- if ( mm["annoying"] || mm["phase-shifting"] || mm["restless"] )
- return true;
- return false;
- }
- int get_property_int(string prop) {
- return get_property(prop).to_int();
- }
- boolean can_use_skill(skill this_skill) {
- if ( !have_skill(this_skill) )
- return false;
- if ( !this_skill.is_unrestricted() )
- return false;
- boolean can_use_skill = true;
- switch ( this_skill ) {
- case $skill[KGB tranquilizer dart]:
- if ( get_property_int("_kgbTranquilizerDartUses") >= 3 )
- return false;
- break;
- case $skill[Snokebomb]:
- if ( get_property_int("_snokebombUsed") >= 3 )
- return false;
- break;
- case $skill[Shattering Punch]:
- if ( get_property_int("_shatteringPunchUsed") >= 3 )
- return false;
- break;
- case $skill[Macrometeorite]:
- if ( get_property_int("_macrometeoriteUses") >= 10 )
- return false;
- break;
- }
- if ( mp_cost(this_skill) > my_mp() )
- return false;
- return true;
- }
- string [int] macro_list;
- void push_turnless_macro(string elem) {
- int idx = macro_list.count();
- macro_list[idx] = elem;
- return;
- }
- int rounds_so_far = 0;
- void push_action(string elem) {
- push_turnless_macro(elem);
- rounds_so_far += 1;
- return;
- }
- void push_blockable_action(string action) {
- push_action(action);
- if ( monster_modifiers_may_stop_actions() ) {
- string [int] bullshit;
- if ( mm["phase-shifting"] )
- bullshit[bullshit.count()] = "blinks out of existence";
- if ( mm["annoying"] )
- bullshit[bullshit.count()] = "stopping you in your tracks";
- if ( mm["restless"] )
- bullshit[bullshit.count()] = "moves out of the way before you can";
- bullshit[bullshit.count()] = "moved by the time you can finish";
- if ( mm["cartwheeling"] )
- bullshit[bullshit.count()] = "cartwheels out of the way";
- buffer repeat_macro;
- repeat_macro.append("repeat ");
- foreach idx, match_string in bullshit {
- if ( idx != 0 )
- repeat_macro.append(" || ");
- repeat_macro.append("match \"" + match_string +"\"");
- }
- push_turnless_macro(repeat_macro.to_string());
- }
- }
- string compose_combat_macro() {
- buffer result;
- foreach idx, macro in macro_list {
- if ( idx == 0 ) {
- result.append(macro);
- }
- else {
- result.append(";");
- result.append(macro);
- }
- }
- return result.to_string();
- }
- void push_item_multiuse_if_possible(item this_item) {
- int item_amount = this_item.item_amount();
- if ( item_amount > 0) {
- if ( item_amount == 1 ) {
- push_blockable_action("use " + this_item.to_string());
- }
- else {
- push_blockable_action("use " + this_item.to_string() + ", " + this_item.to_string());
- }
- }
- }
- void push_skill (skill this_skill) {
- push_turnless_macro("if hasskill " + this_skill.to_int());
- push_blockable_action("skill " + this_skill.to_string());
- push_turnless_macro("endif");
- }
- void push_skill (string skill_as_string) {
- push_blockable_action("skill " + skill_as_string);
- }
- boolean [location, monster] yellow_ray_targets;
- // Filthworms:
- yellow_ray_targets[ $location[The Hatching Chamber] ][ $monster[larval filthworm] ] = true;
- // War Hippies, for the outfit:
- yellow_ray_targets[ $location[Wartime Hippy Camp (frat disguise)] ][ $monster[War Hippy drill sergeant] ] = true;
- yellow_ray_targets[ $location[Wartime Hippy Camp (frat disguise)] ][ $monster[War Hippy (space) cadet] ] = true;
- // drum machine (maybe?)
- yellow_ray_targets[ $location[The Oasis] ][ $monster[blur] ] = true;
- boolean yellow_ray_target(monster foe) {
- location where = my_location();
- if ( ! (yellow_ray_targets contains where) )
- return false;
- if ( ! (yellow_ray_targets[where] contains foe) )
- return false;
- return true;
- }
- void yellow_ray (monster foe) {
- // DO NOT YELLOW RAY WHEN WE HAVE SQUINT ON
- if ( $effect[Steely-Eyed Squint].have_effect() > 0 )
- return;
- // See if we can even yellow ray:
- if ( $effect[Everything Looks Yellow].have_effect() > 0 )
- return;
- // TODO: check if we have enough +item to make this not neccessary
- return;
- }
- void instakill_macro(monster foe) {
- if ( yellow_ray_target(foe) ) {
- yellow_ray(foe);
- }
- foreach this_item in $items[exploding cigar] {
- push_item_multiuse_if_possible(this_item);
- }
- foreach this_skill in $skills[shattering punch, macrometeorite, cleesh] {
- if ( can_use_skill( this_skill ) )
- push_skill(this_skill);
- }
- push_turnless_macro("abort \"I bring bad news\"");
- }
- void get_stun_macro() {
- if ( can_use_skill($skill[noodles of fire]) ) {
- push_skill($skill[noodles of fire]);
- return;
- }
- switch ( my_class() ) {
- case $class[pastamancer]:
- push_skill($skill[entangling noodles]);
- return;
- case $class[seal clubber]:
- // todo if club is equipped
- if (
- $slot[weapon].equipped_item().item_type() == "club"
- &&
- my_fury() > 1
- &&
- can_use_skill($skill[club foot])
- ) {
- push_skill($skill[club foot]);
- return;
- }
- break;
- case $class[sauceror]:
- if ( my_soulsauce() > 5 && can_use_skill($skill[soul bubble]) ) {
- push_skill($skill[soul bubble]);
- return;
- }
- break;
- case $class[accordion thief]:
- if (
- $slot[weapon].equipped_item().item_type() == "accordion"
- &&
- can_use_skill($skill[accordion bash])
- ) {
- push_skill($skill[accordion bash]);
- return;
- }
- break;
- // TODO TT love.
- // case $class[turtle tamer]:
- // if hasskill shell up && (haseffect 1422 || haseffect 1423 || haseffect 1424)
- // if ( can_use_skill($skill[shell up]) && )
- // break;
- default:
- break;
- }
- if ( can_use_skill($skill[shadow noodles]) && false ) {
- push_skill($skill[shadow noodles]);
- return;
- }
- return;
- }
- void push_olfaction() {
- if ( can_use_skill($skill[Transcendent Olfaction]) && $effect[On the Trail].have_effect() == 0 ) {
- // push_turnless_macro("if hasskill Transcendent Olfaction");
- push_skill($skill[Transcendent Olfaction]);
- // push_turnless_macro("endif");
- }
- }
- void gallappagos_macro() {
- if ( can_use_skill($skill[Gallapagosian Mating Call]) ) {
- push_turnless_macro("if hasskill Gallapagosian Mating Call");
- push_skill($skill[Gallapagosian Mating Call]);
- push_turnless_macro("endif");
- }
- }
- void nosy_nose_olfact_macro() {
- if ( my_familiar() == $familiar[Nosy Nose] ) {
- push_blockable_action("skill 7166");
- }
- }
- void micrometeorite_macro () {
- push_turnless_macro("if hasskill micrometeorite");
- push_skill("micrometeorite");
- push_turnless_macro("endif");
- }
- int _expected_damage(monster foe, stat this_stat) {
- int player_stat = my_buffedstat(this_stat);
- float attack_type_multiplier = 1.0; // no lunging permed yet
- float weapon_type_multiplier = 0.75;
- int initial_damage = floor(
- player_stat * attack_type_multiplier * weapon_type_multiplier
- );
- if ( initial_damage < 0 )
- initial_damage = 0;
- int damage_minus_def = initial_damage - foe.base_defense;
- // TODO fists?
- item weapon = $slot[weapon].equipped_item();
- int weapon_damage = weapon.get_power();
- int crit_multiplier = 1; // eh
- int weapon_damage_total = weapon_damage * crit_multiplier * attack_type_multiplier;
- int bonus_weapon_damage = numeric_modifier("Weapon Damage").to_int();
- int bonus_prism = numeric_modifier("Prismatic Damage");
- int total = damage_minus_def + weapon_damage_total + bonus_weapon_damage + bonus_prism;
- // wiki formula stops at total, but that gives results almost twice
- // as high as the actual damage dealt. I probably have one of
- // the inputs wrong. In any case, let's just go very conservative
- // and just return half of the damage the formula gave us.
- return floor(total / 2);
- }
- int expected_ranged_damage(monster foe) {
- int ranged_damage = _expected_damage(foe, $stat[moxie]);
- int bonus_ranged_damage = numeric_modifier("Ranged Damage").to_int();
- return ranged_damage + bonus_ranged_damage;
- }
- int expected_weapon_damage(monster foe) {
- return _expected_damage(foe, $stat[muscle]);
- }
- void release_the_boots(monster foe) {
- if ( my_familiar() != $familiar[Pair of Stomping Boots] ) {
- return;
- }
- push_turnless_macro("if hasskill Release the Boots");
- push_skill($skill[Release the Boots]);
- push_turnless_macro("endif");
- }
- void default_fight_macro(monster foe) {
- boolean immune_to_physical = false;
- switch (foe) {
- case $monster[mouthless murmur]:
- immune_to_physical = true;
- break;
- default:
- immune_to_physical = foe.physical_resistance >= 90;
- }
- release_the_boots(foe);
- if ( my_fury() > 1 && $slot[weapon].equipped_item() == $item[bindlestocking] ) {
- push_skill("furious wallop");
- }
- push_turnless_macro("while !pastround 26"); // 28 aborts all
- if ( mm["untouchable"] || immune_to_physical ) {
- // rainbow damage. Or well, this because it's all I got
- push_action("skill saucestorm");
- }
- else {
- item equipped_weapon = $slot[weapon].equipped_item();
- string equipped_weapon_type = weapon_type(equipped_weapon);
- int expected_attack_damage = 0;
- if ( equipped_weapon_type == $stat[moxie] ) {
- expected_attack_damage = expected_ranged_damage(foe);
- }
- else if ( equipped_weapon_type == $stat[muscle] ) {
- expected_attack_damage = expected_weapon_damage(foe);
- }
- if ( expected_attack_damage > 80 ) {
- push_action("attack");
- }
- else {
- push_action("skill saucestorm");
- }
- if ( $item[gauze garter].item_amount() > 1 ) {
- // TODO moar
- push_turnless_macro("if hppercentbelow 50 && pastround 10");
- push_item_multiuse_if_possible($item[gauze garter]);
- push_turnless_macro("endif");
- }
- }
- push_turnless_macro("endwhile");
- if ( mm["untouchable"] ) {
- // Instakill anything that got this far.
- instakill_macro(foe);
- }
- }
- boolean ticking_and_needs_instakill(monster foe) {
- if ( !mm["ticking"] )
- return false;
- if ( mm["frozen"] )
- return false;
- if ( mm["fragile"] && !mm["unlucky"] )
- return false;
- if ( mm["untouchable"] ) {
- if ( mm["unlucky"] )
- return false; // we'll see.
- return true;
- }
- if ( monster_modifiers_may_stop_actions() && foe.raw_hp > 90 )
- return true;
- return false;
- }
- boolean generic_should_olfact (monster foe) {
- switch (foe) {
- case $monster[drunk pygmy]: return true;
- case $monster[pygmy witch surgeon]: return true;
- case $monster[pygmy shaman]: return true;
- case $monster[gaudy pirate]: return true;
- case $monster[dirty old lihc]: return true;
- case $monster[tomb rat]: return true;
- case $monster[pygmy witch accountant]:
- if (my_location() == $location[The Hidden Office Building])
- return true;
- return false;
- }
- return false;
- }
- boolean foe_should_be_olfacted (monster foe) {
- if ( generic_should_olfact(foe) )
- return true;
- return false;
- }
- boolean foe_should_be_nosy_nose_olfacted (monster foe) {
- if ( generic_should_olfact(foe) )
- return true;
- return false;
- }
- boolean foe_should_be_gallagaposed (monster foe) {
- if ( generic_should_olfact(foe) )
- return true;
- return false;
- }
- boolean will_survive_n_rounds(monster foe, int rounds) {
- int damage_in_one_turn = 0;
- if ( mm["cowardly"] )
- return true;
- foreach monster_modifier, has_modifier in mm {
- if ( has_modifier == true ) {
- switch ( monster_modifier ) {
- case "electrified":
- damage_in_one_turn += my_maxhp() * 0.2;
- break;
- case "filthy":
- case "foul-mouthed":
- case "haunted":
- case "hot":
- case "wet":
- damage_in_one_turn += 30; // eh
- break;
- }
- }
- }
- int plain_attack_damage = expected_damage(foe);
- if ( plain_attack_damage < 0 ) // unspaded monster
- plain_attack_damage = 10;
- if ( mm["shaky"] ) {
- plain_attack_damage = plain_attack_damage * 3;
- }
- else if ( mm["cloned"] ) {
- plain_attack_damage = plain_attack_damage * 2;
- }
- print_html("plain dmg: " + plain_attack_damage + " | from mods: " + damage_in_one_turn);
- damage_in_one_turn += plain_attack_damage;
- int total_damage = damage_in_one_turn * rounds;
- return total_damage < my_hp();
- }
- boolean will_survive_round(monster foe) { // shortcut
- return will_survive_n_rounds(foe, 1);
- }
- string gremlin_stasis_macro(monster foe) {
- // TODO
- return "abort \"Do gremlins on your own, you lazy fuck!\"";
- }
- void rave_macro_generic(string which_combo) {
- string rave_combo = get_property("raveCombo1");
- if ( rave_combo == "" )
- return;
- string [int] skill_order = rave_combo.split_string(",");
- foreach rave_skill in skill_order {
- push_skill(skill_order[rave_skill]);
- }
- }
- void rave_plus_item_macro() {
- rave_macro_generic("raveCombo1");
- }
- void rave_plus_meat_macro() {
- rave_macro_generic("raveCombo2");
- }
- void rave_stun_macro() {
- rave_macro_generic("raveCombo3");
- }
- boolean rave_steal_macro() {
- string rave_steal = get_property("raveCombo5");
- if ( rave_steal == "" )
- return false;
- int steals_count = get_property("_raveStealCount").to_int();
- int steals_left = 30 - steals_count;
- if ( steals_left <= 0 )
- return false;
- string [int] skill_order = rave_steal.split_string(",");
- foreach rave_skill in skill_order {
- push_skill(skill_order[rave_skill]);
- }
- return true;
- }
- void pickpocket_macro(int num_items_dropped) {
- if ( num_items_dropped < 1 )
- return;
- // no PP
- if ( !($classes[disco bandit,accordion thief] contains my_class()) )
- return;
- // pp if we got the jump
- push_turnless_macro("if gotjump");
- push_action("pickpocket");
- push_turnless_macro("endif");
- boolean have_second_pp = have_equipped($item[Bling of the New Wave]);
- if ( !have_second_pp )
- return;
- // Second PP; only do it if the first attempt failed, OR
- // if the monster drops more than one item
- if ( num_items_dropped > 1 ) {
- push_action("pickpocket");
- }
- else {
- // Only drops one item. So only do the second PP
- // if the first one failed. This will also trigger if
- // we did not get the jump.
- push_turnless_macro("if !match \"You deftly slip your fingers\"");
- push_action("pickpocket");
- push_turnless_macro("endif");
- }
- // match at this point will show whether we final pickpocket
- // succeeded
- return;
- }
- void disco_dance_macro() {
- push_skill("disco dance of doom");
- push_skill("disco dance ii");
- push_skill("disco dance 3");
- }
- void add_goto_runaway_function(monster foe) {
- push_turnless_macro("sub try_goto_runaway");
- if ( mm["ticking"] ) {
- push_turnless_macro("if pastround 2");
- instakill_macro(foe);
- push_turnless_macro("endif");
- }
- push_turnless_macro("while hascombatitem 4948");
- push_action("use 4948"); // hurmph.
- push_turnless_macro("endwhile");
- // Stole the goto, tried to do a free runaway, but failed.
- // So just kill it.
- default_fight_macro(foe);
- push_turnless_macro("endsub");
- }
- static
- {
- // Stolen from Ezandora, presumably originally taken from BanishManager.java
- int [string] __banish_source_length;
- __banish_source_length["banishing shout"] = -1;
- __banish_source_length["batter up!"] = -1;
- //__banish_source_length["chatterboxing"] = 20;
- __banish_source_length["classy monkey"] = 20;
- //__banish_source_length["cocktail napkin"] = 20;
- __banish_source_length["crystal skull"] = 20;
- __banish_source_length["deathchucks"] = -1;
- __banish_source_length["dirty stinkbomb"] = -1;
- __banish_source_length["divine champagne popper"] = 5;
- __banish_source_length["harold's bell"] = 20;
- __banish_source_length["howl of the alpha"] = -1;
- //__banish_source_length["ice house"] = -1;
- __banish_source_length["louder than bomb"] = 20;
- __banish_source_length["nanorhino"] = -1;
- __banish_source_length["pantsgiving"] = 30;
- __banish_source_length["peel out"] = -1;
- __banish_source_length["pulled indigo taffy"] = 20;
- __banish_source_length["smoke grenade"] = 20;
- //__banish_source_length["spooky music box mechanism"] = -1;
- __banish_source_length["staff of the standalone cheese"] = -1;
- __banish_source_length["stinky cheese eye"] = 10;
- __banish_source_length["thunder clap"] = 40;
- __banish_source_length["v for vivala mask"] = 10;
- __banish_source_length["walk away from explosion"] = 30;
- __banish_source_length["tennis ball"] = 30;
- __banish_source_length["curse of vacation"] = -1;
- __banish_source_length["ice hotel bell"] = -1;
- __banish_source_length["bundle of "fragrant" herbs"] = -1;
- __banish_source_length["snokebomb"] = 30;
- __banish_source_length["beancannon"] = -1;
- __banish_source_length["kgb tranquilizer dart"] = 20;
- __banish_source_length["spring-loaded front bumper"] = 30;
- __banish_source_length["mafia middle finger ring"] = 60;
- }
- string [monster] banishes_active() {
- string banished_monsters_string = get_property("banishedMonsters");
- string [monster] result;
- // Stolen from Ezandora:
- string [int] banished_monsters_string_split = banished_monsters_string.split_string(":");
- foreach key, s in banished_monsters_string_split {
- if (s.length() == 0)
- continue;
- if (key % 3 != 0)
- continue;
- if (!(banished_monsters_string_split contains (key + 1)) || !(banished_monsters_string_split contains (key + 2)))
- continue;
- // Robbery ended here
- monster banished_foe = banished_monsters_string_split[key + 0].to_monster();
- string banish_source = banished_monsters_string_split[key + 1];
- result[banished_foe] = banish_source;
- }
- return result;
- }
- string [monster] foes_banished_in_location(location where) {
- string [monster] banishes_active = banishes_active();
- boolean [monster] location_monsters;
- foreach key, m in where.get_monsters() {
- location_monsters[m] = true;
- }
- string [monster] result;
- foreach banished_monster, banish_source in banishes_active {
- if (location_monsters contains banished_monster)
- result[banished_monster] = banish_source;
- }
- return result;
- }
- boolean banish_not_active_and_can_use(boolean [string] banish_methods_active, string wanted_banish) {
- if ( banish_methods_active contains wanted_banish ) {
- return false;
- }
- skill banish_skill = wanted_banish.to_skill();
- if ( banish_skill != $skill[none] ) {
- if ( !can_use_skill(banish_skill) )
- return false;
- push_skill(banish_skill);
- return true;
- }
- item banish_item = wanted_banish.to_item();
- if ( banish_item != $item[none] ) {
- if ( banish_item.item_amount() > 0 ) {
- push_blockable_action("use " + banish_item.to_int());
- return true;
- }
- return false;
- }
- print("No clue what to do with " + wanted_banish);
- return false;
- }
- void do_any_banish(location where, monster foe) {
- boolean [string] banish_methods_active;
- foreach banished_foe, banish_method in foes_banished_in_location(where) {
- banish_methods_active[banish_method] = true;
- }
- // Time to do the work!
- foreach banish_source, length in __banish_source_length {
- if ( banish_not_active_and_can_use(banish_methods_active, banish_source) ) {
- print("Will banish with " + banish_source);
- }
- }
- }
- boolean delevel_is_useful(monster foe) {
- int monster_attack = foe.base_attack + 20; // to be on the safe side
- if ( my_buffedstat($stat[moxie]) > monster_attack )
- return false;
- return true;
- }
- boolean in_aftercore() {
- return !in_hardcore() && can_interact();
- }
- void tomb_rat_into_rat_king (monster foe) {
- if ( foe == $monster[tomb rat] && $item[tangle of rat tails].item_amount() > 0 ) {
- push_blockable_action("use tangle of rat tails");
- }
- }
- void must_attempt_instakill_or_we_die(monster foe) {
- if ( ticking_and_needs_instakill(foe) ) {
- instakill_macro(foe);
- return;
- }
- if ( !mm["unstoppable"] )
- return;
- if ( !mm["electrified"] )
- return;
- if ( !monster_modifiers_may_stop_actions() )
- return;
- // TODO check if we can survive long enough, otherwise
- // instakill
- if ( foe.raw_hp > 100 ) {
- // eh, no chance. Just instakill it.
- instakill_macro(foe);
- }
- }
- boolean stagger_immune (monster foe) {
- if ( foe == $monster[Eldritch Tentacle] )
- return true;
- if ( mm["unstoppable"] )
- return true;
- return false;
- }
- void megasniff() {
- }
- void resolve_aftercore_combat (monster foe, location where, int pickpocketable_items) {
- boolean do_weaksauce = false;
- switch ( where ) {
- case $location[Hobopolis Town Square]:
- do_weaksauce = true;
- pickpocket_macro(pickpocketable_items);
- break;
- case $location[The Dungeons of Doom]:
- switch (foe) {
- case $monster[Quantum Mechanic]:
- megasniff();
- break;
- case $monster[mind flayer]:
- break;
- default:
- do_any_banish(where, foe);
- }
- break;
- case $location[Cobb's Knob Menagerie\, Level 1]:
- // aftercore UR farming
- if ( mm["solid gold"] ) { // just kill solid gold monsters
- pickpocket_macro(pickpocketable_items);
- }
- else {
- switch (foe) {
- case $monster[Fruit Golem]:
- pickpocket_macro(pickpocketable_items);
- do_any_banish(where, foe);
- break;
- case $monster[BASIC Elemental]:
- add_goto_runaway_function(foe);
- pickpocket_macro(pickpocketable_items);
- push_turnless_macro("if match \"You deftly slip your fingers\"; call try_goto_runaway; endif;");
- // Rave real
- if ( !mm["ticking"] && rave_steal_macro() ) {
- push_turnless_macro("if match \"Your savage beatdown seems to have knocked loose some treasure\"");
- push_turnless_macro("call try_goto_runaway");
- push_turnless_macro("endif");
- }
- break;
- default:
- push_turnless_macro("abort \"what\"");
- break;
- }
- }
- break;
- case $location[the red zeppelin]:
- if ( $item[glark cable].item_amount() > 0 && get_property("_glarkCableUses").to_int() < 5 )
- push_item_multiuse_if_possible($item[glark cable]);
- break;
- case $location[the hidden bowling alley]:
- if ( foe != $monster[drunk pygmy] && $item[short writ of habeas corpus].item_amount() > 0) {
- pickpocket_macro(pickpocketable_items);
- push_item_multiuse_if_possible($item[short writ of habeas corpus]);
- }
- default:
- if ( pickpocketable_items > 0 )
- pickpocket_macro(pickpocketable_items);
- break;
- }
- boolean should_delevel = delevel_is_useful(foe);
- if ( !stagger_immune(foe) ) {
- if ( should_delevel )
- micrometeorite_macro();
- get_stun_macro();
- }
- if ( do_weaksauce && should_delevel && !mm["ticking"] )
- push_skill("curse of weaksauce");
- boolean disco_bandit = my_class() == $class[disco bandit];
- if ( disco_bandit && !mm["ticking"] ) { // can deal with ticking if we keep up a stun.
- int rounds_spent = 0;
- if ( mm["solid gold"] ) {
- // +50% meat from rave
- if ( will_survive_n_rounds(foe, 2 + rounds_spent) ) {
- rounds_spent += 2;
- rave_plus_meat_macro();
- }
- }
- if ( pickpocketable_items > 0 ) {
- // +30% item from discosity
- if ( will_survive_n_rounds(foe, 1 + rounds_spent) ) {
- disco_dance_macro();
- rounds_spent += 1;
- }
- // +30% item from rave
- if ( will_survive_n_rounds(foe, 2 + rounds_spent) ) {
- rave_plus_item_macro();
- rounds_spent += 2;
- }
- }
- if ( !mm["solid gold"] && foe.min_meat > 80 ) {
- // eh, sure.
- if ( will_survive_n_rounds(foe, 2 + rounds_spent) ) {
- rave_plus_meat_macro();
- rounds_spent += 2;
- }
- }
- }
- }
- int number_of_pickpocketable_items (monster foe) {
- int pickpocketable_items = 0;
- foreach item_id, record_value in foe.item_drops_array() {
- if ( record_value.type == "c" ) { // conditional
- if ( item_type( record_value.drop ) != "shirt" )
- continue;
- }
- if ( record_value.rate == 0 ) // < 1% conditional
- continue;
- pickpocketable_items += 1;
- }
- return pickpocketable_items;
- }
- void olfact_if_needed (monster foe) {
- if ( foe_should_be_olfacted(foe) )
- push_olfaction();
- if ( foe_should_be_nosy_nose_olfacted(foe) )
- nosy_nose_olfact_macro();
- if ( foe_should_be_gallagaposed(foe) )
- gallappagos_macro();
- }
- void shattering_punch_to_preserve_buffs (monster foe) {
- if ( $effect[Steely-Eyed Squint].have_effect() == 0 )
- return;
- if ( !can_use_skill($skill[Shattering Punch]) )
- return;
- push_turnless_macro("if hasskill Shattering Punch");
- push_skill($skill[Shattering Punch]);
- push_turnless_macro("endif");
- }
- void do_flyers_if_needed (monster foe) {
- if (
- $item[rock band flyers].item_amount() > 0
- &&
- get_property("flyeredML").to_int() < 10000
- &&
- will_survive_round(foe)
- ) {
- // TODO heal in case we pickpocketed
- if ( $item[beehive].item_amount() > 0 ) {
- push_blockable_action("use rock band flyers, beehive");
- }
- else {
- push_blockable_action("use rock band flyers");
- }
- }
- }
- boolean location_with_desirable_monster(location where) {
- switch (where) {
- case $location[The Haunted Bedroom]:
- case $location[The Defiled Niche]:
- case $location[The Middle Chamber]:
- return true;
- default:
- return false;
- }
- }
- void do_banish(location where, monster foe) {
- push_turnless_macro("abort \"Banish this sucker manually!\"");
- }
- void banish_when_needed(monster foe, location where) {
- switch (where) {
- case $location[The Haunted Bedroom]:
- if (
- foe == $monster[animated ornate nightstand]
- ||
- foe == $monster[elegant animated nightstand]
- )
- return; # We want this one!
- do_banish(where, foe);
- // TODO
- default:
- return;
- }
- }
- // TODO
- void macrometeorite_when_needed(monster foe, location where) {
- return;
- }
- // TODO
- void free_runaway_when_possible(monster foe, location where) {
- return;
- }
- void location_specific_actions(monster foe, location where) {
- banish_when_needed(foe, where);
- macrometeorite_when_needed(foe, where);
- // Turn tomb rats into kings
- tomb_rat_into_rat_king(foe);
- // in-run
- if (
- where == $location[Barrrney's Barrr]
- &&
- foe.phylum == $phylum[pirate]
- ) {
- push_blockable_action("use big book of pirate insults");
- }
- if ( contains_text(foe.manuel_name, "gremlin") ) {
- //string gremlin_stasis_macro = gremlin_stasis_macro(foe);
- //combat_macro = combat_macro + gremlin_stasis_macro;
- }
- }
- void resolve_in_run_combat (monster foe, location where, int pickpocketable) {
- // TODO: pickpocket?
- if ( can_use_skill($skill[Micrometeorite]) ) // Picky, Class Act, G-Lover, etc
- micrometeorite_macro();
- olfact_if_needed(foe);
- // Flyer, must happen before any instakilling or yellow raying
- do_flyers_if_needed(foe);
- shattering_punch_to_preserve_buffs(foe);
- if (yellow_ray_target(foe)) {
- yellow_ray(foe);
- }
- location_specific_actions(foe, where);
- }
- void after_fight_meddling(location where, monster foe) {
- if ( in_aftercore() ) {
- if (
- where == $location[Hobopolis Town Square]
- &&
- my_familiar() == $familiar[slimeling]
- ) {
- int max_mp = my_maxmp();
- int threshold = max_mp * 0.4;
- if ( my_mp() < threshold ) {
- float slimeling_fullness = get_property("slimelingFullness").to_float();
- if ( slimeling_fullness < 5.0 ) {
- cli_execute("slimeling 1 ring of aggravate");
- }
- }
- }
- if ( my_hp() < ( my_maxhp() * 0.6 ) ) {
- cli_execute("cast cannelloni cocoon");
- }
- }
- }
- void main(int initround, monster foe, string pg) {
- mm = foe.random_modifiers;
- // Step up the base macro:
- push_turnless_macro("scrollwhendone");
- push_turnless_macro("abort hppercentbelow 25 || hpbelow 20 || pastround 28");
- must_attempt_instakill_or_we_die(foe);
- int pickpocketable_items = number_of_pickpocketable_items(foe);
- location where = my_location();
- if ( in_aftercore() ) {
- resolve_aftercore_combat(foe, where, pickpocketable_items);
- }
- else { // in-run
- resolve_in_run_combat(foe, where, pickpocketable_items);
- }
- default_fight_macro(foe);
- // Show the macro, just in case...
- string full_combat_macro = compose_combat_macro();
- print_html(full_combat_macro);
- run_combat(full_combat_macro);
- after_fight_meddling(where, foe);
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment