def_enemy.lua 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. FFVII.Enemies = {}
  2. FFVII.Enemies.MP = {
  3. unit_type = FFVII.Battle.Type.ENEMY,
  4. max_hp = 30,
  5. current_hp = 30,
  6. max_mp = 0,
  7. current_mp = 0,
  8. level = 2,
  9. physical_power = 6,
  10. physical_defense = 2,
  11. physical_dodge = 0,
  12. magic_power = 0,
  13. magic_defense = 0,
  14. speed = 50,
  15. luck = 4,
  16. reward_exp = 16,
  17. reward_ap = 2,
  18. reward_gil = 10,
  19. attacks = {
  20. MachineGun = {
  21. script_id = 3,
  22. },
  23. Tonfa = {
  24. script_id = 4,
  25. }
  26. },
  27. row = FFVII.Battle.Row.FRONT,
  28. battle_speed = 0,
  29. timer = 0,
  30. on_start = function( self )
  31. return 0
  32. end,
  33. on_action = function( self )
  34. local attack
  35. if FFVII.Battle.in_front_row( self ) == true then
  36. if math.random( 2 ) == 1 then
  37. attack = FFVII.Battle.Attacks.MachineGun
  38. else
  39. attack = FFVII.Battle.Attacks.Tonfa
  40. end
  41. else
  42. if math.random( 6 ) == 1 then
  43. attack = FFVII.Battle.Attacks.Tonfa
  44. else
  45. attack = FFVII.Battle.Attacks.MachineGun
  46. end
  47. end
  48. --print( "Use \"" .. attack.name .. "\"." )
  49. local target = FFVII.Battle.get_random_enemy_as_target( self )
  50. FFVII.Battle.add_command( self, target, FFVII.Battle.Action.MONSTER_ACTION, attack )
  51. return 0
  52. end,
  53. action_idle = function( self )
  54. fighter_self:play_animation("0");
  55. return 0;
  56. end;
  57. action_hurt = function(self)
  58. fighter_self:play_animation("1");
  59. return 0;
  60. end;
  61. action_machine_gun = function(self)
  62. fighter_self:play_animation("2");
  63. script:play_hurt_action(fighters_target[1], 0.27);
  64. fighter_self:play_animation("3");
  65. fighter_self:play_animation("4");
  66. fighter_self:play_animation("5");
  67. return 0;
  68. end;
  69. action_tonfa = function(self)
  70. fighter_self:play_animation("6");
  71. fighter_self:play_animation("7");
  72. script:play_hurt_action(fighters_target[1], 0.13);
  73. fighter_self:play_animation("8");
  74. fighter_self:play_animation("9");
  75. return 0;
  76. end;
  77. }