From: xangelo Date: Tue, 4 Jul 2023 15:18:23 +0000 (-0400) Subject: fix: level <= 3 is free healing X-Git-Tag: v0.0.1~4 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=23646fd5287f2d0138215d8771e8c76a44890d38;p=risinglegends.git fix: level <= 3 is free healing --- diff --git a/src/events/healer/server.ts b/src/events/healer/server.ts index f621c41..4347954 100644 --- a/src/events/healer/server.ts +++ b/src/events/healer/server.ts @@ -105,15 +105,21 @@ export const healer: SocketEvent = { text.push(`

${service.name}

`); text.push(`

"${getText('intro', service, city)}"

`); + if(api.player.hp === maxHp(api.player.constitution, api.player.level)) { text.push(`

You're already at full health?

`); } else { - text.push(`

`); + if(api.player.level <= 3) { + text.push(`

Since you still seem to be new around here, this one's on the house!

`); + text.push(`

`); + } + else { + text.push(`

`); + } } - api.socket.emit('city:service:healer', { text: text.join("\n") }); @@ -139,7 +145,9 @@ export const heal: SocketEvent = { text.push(`

${service.name}

`); - if(api.player.gold < healCost) { + const cost = api.player.level <= 3 ? 0 : healCost; + + if(api.player.gold < cost) { text.push(`

${getText('insufficient_money', service, city)}

`) api.socket.emit('city:service:healer', { text: text.join("\n") @@ -148,7 +156,7 @@ export const heal: SocketEvent = { } api.player.hp = maxHp(api.player.constitution, api.player.level); - api.player.gold -= healCost; + api.player.gold -= cost; await updatePlayer(api.player); api.socket.emit('updatePlayer', api.player);