Guest User

Untitled

a guest
Mar 9th, 2019
63
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Game_Battler
  2. #--------------------------------------------------------------------------
  3. # * Applying Normal Attack Effects
  4. # attacker : battler
  5. #--------------------------------------------------------------------------
  6. def attack_effect(attacker)
  7. # Clear critical flag
  8. self.critical = false
  9. # First hit detection
  10. hit_result = (rand(100) < attacker.hit)
  11. # If hit occurs
  12. if hit_result == true
  13. # Calculate basic damage
  14. atk = [attacker.atk - self.pdef / 2, 0].max
  15. self.damage = atk * attacker.str / 10
  16. # Element correction
  17. self.damage *= elements_correct(attacker.element_set)
  18. self.damage /= 100
  19. # If damage value is strictly positive
  20. if self.damage > 0
  21. # Critical correction
  22. if (rand(100) < attacker.dex / 4) and self.is_a?(Game_Enemy)
  23. self.damage *= 2
  24. self.critical = true
  25. end
  26. # Guard correction
  27. if self.guarding?
  28. self.damage /= 2
  29. end
  30. end
  31. # Dispersion
  32. if self.damage.abs > 0
  33. amp = [self.damage.abs * 15 / 100, 1].max
  34. self.damage += rand(amp+1) + rand(amp+1) - amp
  35. end
  36. # Second hit detection
  37. eva = 8 * self.agi / attacker.dex + self.eva
  38. hit = self.damage < 0 ? 100 : 100 - eva
  39. hit = self.cant_evade? ? 100 : hit
  40. hit_result = (rand(100) < hit)
  41. end
  42. # If hit occurs
  43. if hit_result == true
  44. # State Removed by Shock
  45. remove_states_shock
  46. # Substract damage from HP
  47. self.hp -= self.damage
  48. # State change
  49. @state_changed = false
  50. states_plus(attacker.plus_state_set)
  51. states_minus(attacker.minus_state_set)
  52. # When missing
  53. else
  54. # Set damage to "Miss"
  55. self.damage = "Miss"
  56. # Clear critical flag
  57. self.critical = false
  58. end
  59. # End Method
  60. return true
  61. end
  62.  
  63. end
RAW Paste Data