Armor Nick
Member
In my project, my characters will have low stats (5-20), and I need to customize the battle algorithms in order to be able to have this. Now, I played around with attack_effect so far, and I've come up with this:
The problem is that the damage I get is too high. Can anyone tell me what's wrong and how I would fix this?
Thanks in advance.
Code:
def attack_effect(attacker)
# Clear critical flag
self.critical = false
# First hit detection
hit_result = (rand(50) < attacker.hit)
# If hit occurs
if hit_result == true
# Calculate basic damage
atk = [attacker.atk + 50, 0].max
self.damage = atk * (attacker.str)
# Element correction
self.damage *= elements_correct(attacker.element_set)
# If damage value is strictly positive
if self.damage > 0
# Critical correction
if rand(100) < 4 * attacker.agi / self.agi + critical_bonus(attacker)
self.damage += (((attacker.atk + 30) * (attacker.str + 30) * self.pdef) / ((self.pdef + 70) * (self.pdef + 50)))
self.damage *= 9 / 7
self.critical = true
end
# Guard correction
if self.guarding?
self.damage = guard_effect(self.damage)
end
end
# Second hit detection
hit_result = (rand(50) < rand(attacker.agi))
end
# If hit occurs
if hit_result == true
# State Removed by Shock
remove_states_shock
# Substract damage from HP
self.hp -= self.damage
# State change
@state_changed = false
states_plus(attacker.plus_state_set)
states_minus(attacker.minus_state_set)
# When missing
else
# Set damage to "Miss"
self.damage = "Miss"
# Clear critical flag
self.critical = false
end
# End Method
return true
end
Thanks in advance.