Skip to content

Instantly share code, notes, and snippets.

@alexcharlie
Created September 22, 2009 22:46
Show Gist options
  • Save alexcharlie/191517 to your computer and use it in GitHub Desktop.
Save alexcharlie/191517 to your computer and use it in GitHub Desktop.
def do_damage(options={})
actual_damage = self.attacker.jitter_damage
actual_damage *= 2 if options[:crit]
# damage reduction
self.damage = (actual_damage * (1.00 - normalize(self.armor * 0.001)))).round
self.defender.health -= self.damage
end
def normalize(power)
power / (1.0+(@character.level-1)*0.10)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment