hugmeir

Untitled

Sep 12th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.40 KB | None | 0 0
  1.  
  2. static
  3. {
  4. // Stolen from Ezandora, presumably originally taken from BanishManager.java
  5. int [string] __banish_source_length;
  6. __banish_source_length["banishing shout"] = -1;
  7. __banish_source_length["batter up!"] = -1;
  8. //__banish_source_length["chatterboxing"] = 20;
  9. __banish_source_length["classy monkey"] = 20;
  10. //__banish_source_length["cocktail napkin"] = 20;
  11. __banish_source_length["crystal skull"] = 20;
  12. __banish_source_length["deathchucks"] = -1;
  13. __banish_source_length["dirty stinkbomb"] = -1;
  14. __banish_source_length["divine champagne popper"] = 5;
  15. __banish_source_length["harold's bell"] = 20;
  16. __banish_source_length["howl of the alpha"] = -1;
  17. //__banish_source_length["ice house"] = -1;
  18. __banish_source_length["louder than bomb"] = 20;
  19. __banish_source_length["nanorhino"] = -1;
  20. __banish_source_length["pantsgiving"] = 30;
  21. __banish_source_length["peel out"] = -1;
  22. __banish_source_length["pulled indigo taffy"] = 20;
  23. __banish_source_length["smoke grenade"] = 20;
  24. //__banish_source_length["spooky music box mechanism"] = -1;
  25. __banish_source_length["staff of the standalone cheese"] = -1;
  26. __banish_source_length["stinky cheese eye"] = 10;
  27. __banish_source_length["thunder clap"] = 40;
  28. __banish_source_length["v for vivala mask"] = 10;
  29. __banish_source_length["walk away from explosion"] = 30;
  30. __banish_source_length["tennis ball"] = 30;
  31. __banish_source_length["curse of vacation"] = -1;
  32. __banish_source_length["ice hotel bell"] = -1;
  33. __banish_source_length["bundle of "fragrant" herbs"] = -1;
  34. __banish_source_length["snokebomb"] = 30;
  35. __banish_source_length["beancannon"] = -1;
  36. __banish_source_length["spring-loaded front bumper"] = 30;
  37. __banish_source_length["mafia middle finger ring"] = 60;
  38. }
  39.  
  40.  
  41. string [monster] banishes_active() {
  42. string banished_monsters_string = get_property("banishedMonsters");
  43. string [monster] result;
  44.  
  45. // Stolen from Ezandora:
  46. string [int] banished_monsters_string_split = banished_monsters_string.split_string(":");
  47. foreach key, s in banished_monsters_string_split {
  48. if (s.length() == 0)
  49. continue;
  50. if (key % 3 != 0)
  51. continue;
  52.  
  53. if (!(banished_monsters_string_split contains (key + 1)) || !(banished_monsters_string_split contains (key + 2)))
  54. continue;
  55.  
  56. // Robbery ended here
  57. monster banished_foe = banished_monsters_string_split[key + 0].to_monster();
  58. string banish_source = banished_monsters_string_split[key + 1];
  59. result[banished_foe] = banish_source;
  60. }
  61.  
  62. return result;
  63. }
  64.  
  65. string [monster] foes_banished_in_location(location where) {
  66. string [monster] banishes_active = banishes_active();
  67. boolean [monster] location_monsters;
  68. foreach key, m in where.get_monsters() {
  69. location_monsters[m] = true;
  70. }
  71. string [monster] result;
  72. foreach banished_monster, banish_source in banishes_active {
  73. if (location_monsters contains banished_monster)
  74. result[banished_monster] = banish_source;
  75. }
  76. return result;
  77. }
  78.  
  79. boolean banish_not_active_and_can_use(boolean [string] banish_methods_active, string wanted_banish) {
  80. if ( banish_methods_active contains wanted_banish ) {
  81. return false;
  82. }
  83.  
  84. skill banish_skill = wanted_banish.to_skill();
  85. if ( banish_skill != $skill[none] ) {
  86. if ( !can_use_skill(banish_skill) )
  87. return false;
  88. push_skill(banish_skill);
  89. return true;
  90. }
  91.  
  92. item banish_item = wanted_banish.to_item();
  93. if ( banish_item != $item[none] ) {
  94. if ( banish_item.item_amount() > 0 ) {
  95. push_blockable_action("use " + banish_item.to_int());
  96. return true;
  97. }
  98. return false;
  99. }
  100.  
  101. print("No clue what to do with " + wanted_banish);
  102. return false;
  103. }
  104.  
  105. void do_any_banish(location where, monster foe) {
  106. boolean [string] banish_methods_active;
  107. foreach banished_foe, banish_method in foes_banished_in_location(where) {
  108. banish_methods_active[banish_method] = true;
  109. }
  110.  
  111. // Time to do the work!
  112. foreach banish_source, length in __banish_source_length {
  113. if ( banish_not_active_and_can_use(banish_methods_active, banish_source) ) {
  114. print("Will banish with " + banish_source);
  115. }
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment