From 23646fd5287f2d0138215d8771e8c76a44890d38 Mon Sep 17 00:00:00 2001 From: xangelo Date: Tue, 4 Jul 2023 11:18:23 -0400 Subject: [PATCH] fix: level <= 3 is free healing --- src/events/healer/server.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) 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); -- 2.25.1