Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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["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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment