Module: Natural20::HealthFlavor
- Included in:
- Npc, PlayerCharacter
- Defined in:
- lib/natural_20/concerns/health_flavor.rb
Overview
typed: false
Instance Method Summary collapse
Instance Method Details
#describe_health ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/natural_20/concerns/health_flavor.rb', line 3 def describe_health return '' if hp.zero? || hp.negative? percentage = (hp.to_f / max_hp) * 100 token = if dead? 'dead' elsif unconscious? 'unconscious' elsif percentage > 90 'max' elsif percentage > 75 'over_75' elsif percentage > 50 'over_50' elsif percentage > 25 'over_25' elsif percentage > 10 'over_10' else 'almost_dead' end t("entity.health_flavor.#{token}") end |