guard_scorpion.lua 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. guard_scorpion = {
  2. default_defense;
  3. default_magic_defense;
  4. default_action_idle;
  5. default_action_hurt;
  6. new_defense = 255;
  7. new_magic_defense = 384;
  8. new_action_idle = "action_idle_stance_1";
  9. new_action_hurt = "action_hurt_stance_1";
  10. stage = 0;
  11. count = 0;
  12. warning = false;
  13. on_start = function(self)
  14. self.default_defense = fighter_self.data.defense;
  15. self.default_magic_defense = fighter_self.data.magic_defense;
  16. self.default_action_idle = fighter_self.data.action_idle;
  17. self.default_action_hurt = fighter_self.data.action_hurt;
  18. return 0;
  19. end;
  20. on_action = function(self)
  21. if self.count == 0 or self.count == 2 then
  22. set_random_enemy_as_target();
  23. temp_target = fighters_target;
  24. battle:run_command(Battle.MONSTER_ACTION, 284);
  25. -- DisplayText(2c4f434b4544002f4e00344152474554ff)(Locked On Target)
  26. self.count = self.count + 1;
  27. elseif self.count == 1 or self.count == 3 then
  28. fighters_target = temp_target;
  29. if math.random(3) == 1 then
  30. battle:run_command(Battle.MONSTER_ACTION, 283);
  31. else
  32. if fighter_self.data.current_hp < (fighter_self.data.max_hp / 2) then
  33. battle:run_command(Battle.MONSTER_ACTION, 283);
  34. else
  35. battle:run_command(Battle.MONSTER_ACTION, 282);
  36. end;
  37. end;
  38. self.count = self.count + 1;
  39. elseif self.count == 4 then
  40. set_self_as_target();
  41. battle:run_command(Battle.MONSTER_ACTION, 287);
  42. fighter_self.data.defense = self.new_defense;
  43. fighter_self.data.macic_defense = self.new_magic_defense;
  44. fighter_self.data.action_idle = self.new_action_idle;
  45. fighter_self.data.action_hurt = self.new_action_hurt;
  46. self.stage = 1;
  47. if self.warning == false then
  48. --[[
  49. if player1_is_dead() == false then
  50. if player2_is_dead() == true then
  51. --DisplayText([variableea0000]00b22954075300474f4e4e4100464952450054484154004c41534552a9b3ff)( “It's gonna fire that laser…”)
  52. battle:run_command(Battle.DISPLAY_TEXT, 0);
  53. else
  54. --DisplayText([variableea0000]00b2[variableea0001]0c004245004341524546554c01b3ff)( “, be careful!”)
  55. battle:run_command(Battle.DISPLAY_TEXT, 0);
  56. --DisplayText(b221545441434b005748494c450049540753005441494c075300555001ff)(“Attack while it's tail's up!)
  57. battle:run_command(Battle.DISPLAY_TEXT, 0);
  58. --DisplayText(2954075300474f4e4e4100434f554e54455241545441434b005749544800495453004c415345520eb3ff)(It's gonna counterattack with its laser.”)
  59. battle:run_command(Battle.DISPLAY_TEXT, 0);
  60. end;
  61. else
  62. --DisplayText([variableea0001]00b2290044554e4e4f0057484154075300474f494e07004f4e0c00425554a9ff)( “I dunno what's goin' on, but…)
  63. battle:run_command(Battle.DISPLAY_TEXT, 0);
  64. --DisplayText(004954004c4f4f4b5300505245545459004241440eff)( it looks pretty bad.)
  65. battle:run_command(Battle.DISPLAY_TEXT, 0);
  66. --DisplayText(002c4554075300534545005748415400495400444f4553005748454e0049540753005441494c0753005550a9b3ff)( Let's see what it does when it's tail's up…”)
  67. battle:run_command(Battle.DISPLAY_TEXT, 0);
  68. end;
  69. ]]
  70. self.warning = true;
  71. end;
  72. self.count = self.count + 1;
  73. elseif self.count == 5 or self.count == 6 then
  74. self.count = self.count + 1;
  75. elseif self.count == 7 then
  76. set_self_as_target();
  77. battle:run_command(Battle.MONSTER_ACTION, 288);
  78. fighter_self.data.defense = self.default_defense;
  79. fighter_self.data.magic_defense = self.default_magic_defense;
  80. fighter_self.data.action_idle = self.default_action_idle;
  81. fighter_self.data.action_hurt = self.default_action_hurt;
  82. self.stage = 0;
  83. self.count = 0;
  84. end;
  85. return 0;
  86. end;
  87. on_counter = function(self)
  88. if self.stage == 1 then
  89. fighters_target = fighters_enemy;
  90. battle:run_command(Battle.MONSTER_ACTION, 286);
  91. end;
  92. return 0;
  93. end;
  94. on_death = function(self)
  95. if self.stage == 1 then
  96. set_self_as_target();
  97. battle:run_command(Battle.MONSTER_ACTION, 288);
  98. fighter_self.data.action_idle = self.default_action_idle;
  99. fighter_self.data.action_hurt = self.default_action_hurt;
  100. end;
  101. return 0;
  102. end;
  103. action_idle_stance_0 = function(self)
  104. fighter_self:play_animation("0");
  105. return 0;
  106. end;
  107. action_hurt_stance_0 = function(self)
  108. fighter_self:play_animation("1");
  109. return 0;
  110. end;
  111. action_idle_stance_1 = function(self)
  112. fighter_self:play_animation("20");
  113. return 0;
  114. end;
  115. action_hurt_stance_1 = function(self)
  116. fighter_self:play_animation("21");
  117. return 0;
  118. end;
  119. action_rifle_1 = function(self)
  120. fighter_self:play_animation("2");
  121. script:play_hurt_action(fighters_target[1], 0.5);
  122. fighter_self:play_animation("3");
  123. fighter_self:play_animation("4");
  124. fighter_self:play_animation("5");
  125. return 0;
  126. end;
  127. action_scorpion_tail = function(self)
  128. fighter_self:play_animation("6");
  129. fighter_self:play_animation("7");
  130. fighter_self:play_animation("8");
  131. script:play_hurt_action(fighters_target[1], 0.1);
  132. fighter_self:play_animation("9");
  133. return 0;
  134. end;
  135. action_search_scope = function(self)
  136. fighter_self:play_animation("10");
  137. fighter_self:play_animation("11");
  138. fighter_self:play_animation("12");
  139. fighter_self:play_animation("13");
  140. return 0;
  141. end;
  142. -- this is never used in real game
  143. action_rifle_2 = function(self)
  144. fighter_self:play_animation("22");
  145. script:play_hurt_action(fighters_target[1], 0.5);
  146. fighter_self:play_animation("23");
  147. fighter_self:play_animation("24");
  148. fighter_self:play_animation("25");
  149. return 0;
  150. end;
  151. action_tail_laser = function(self)
  152. fighter_self:play_animation("26");
  153. fighter_self:play_animation("27");
  154. fighter_self:play_animation("28");
  155. fighter_self:play_animation("29");
  156. return 0;
  157. end;
  158. action_go_to_stance_1 = function(self)
  159. fighter_self:play_animation("0");
  160. fighter_self:play_animation("14");
  161. fighter_self:play_animation("20");
  162. return 0;
  163. end;
  164. action_go_to_stance_0 = function(self)
  165. fighter_self:play_animation("20");
  166. fighter_self:play_animation("30");
  167. fighter_self:play_animation("0");
  168. return 0;
  169. end;
  170. };