RanvierMUD / ranviermud

A node.js based MUD game engine
https://ranviermud.com
MIT License
796 stars 247 forks source link

Attributes update #105

Closed shawncplus closed 7 years ago

shawncplus commented 7 years ago

All attributes should follow a pattern similar to below.

damage/healing scenario

baseHealth: 100
maxHealth: 100
healthDelta: Math.min(0, healthDelta)
health = Math.max(maxHealth, maxHealth + healthDelta) = 100

player takes 25 damage

baseHealth = 100
maxHealth = 100
healthDelta = Math.min(0, -25) = -25
health = health = Math.max(maxHealth, maxHealth + healthDelta) = 75

player heals for 100

baseHealth = 100
maxHealth = 100
healthDelta = Math.min(0, 75) = 0
health = health = Math.max(maxHealth, maxHealth + healthDelta) = 100

temporary stat debuff scenario (-5 str for 5 seconds, for example)

In practice pools (health/mana/energy) should be the only stats where the delta changes. Attributes (str, int, wis, etc.) buffs/debuffs should modify only the max property

baseStr = 10
maxStr = 5
delta = 0    // stat buffs/debuffs modify max _not_ delta
str = 5

delta is essentially a effect-agnostic modification to a stat. So there would be no reason for an effect to ever directly modify delta. Effects could cause damage but that would happen by them firing damage events which in turn modify delta

marado commented 7 years ago

Math.max(0, -25) = -25

You're doing it wrong! ;-)

On Feb 7, 2017 21:39, "Shawn Biddle" notifications@github.com wrote:

stat pools (health, mana, energy, etc.) Should no longer have a "pool/maxPool" prop, e.g., health/maxHealth. health should be a byproduct of maxHealth - damage taken. This prevents weirdness with an effect temporarily modifying health to be less or more than max health.

This new property should be called something like poolDelta (e.g., healthDelta)

Restoration of a pool in this case would not add to a stat, it would subtract from the healthDelta.

Flow:

maxHealth: 100 healthDelta: Math.max(0, healthDelta) health = Math.max(maxHealth, maxHealth + healthDelta) = 100

player takes 25 damage

maxHealth = 100 healthDelta = Math.max(0, -25) = -25 health = health = Math.max(maxHealth, maxHealth + healthDelta) = 75

player heals for 100

maxHealth = 100 healthDelta = Math.max(0, 75) = 0 health = health = Math.max(maxHealth, maxHealth + healthDelta) = 100

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/shawncplus/ranviermud/issues/105, or mute the thread https://github.com/notifications/unsubscribe-auth/AACBi2xLYF11kM1ZGfG98MsfDcy3LTBaks5raOSsgaJpZM4L6Ews .

shawncplus commented 7 years ago

https://www.youtube.com/watch?v=PibDMGxiyJw

shawncplus commented 7 years ago

Closed with #107