From 65d81ba7a15fa0d010a86aeacb63a6d49f925620 Mon Sep 17 00:00:00 2001 From: xangelo Date: Tue, 6 Jun 2023 11:13:57 -0400 Subject: [PATCH] dont let players heal while at full health --- src/server/api.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/api.ts b/src/server/api.ts index 82992c1..29e5567 100644 --- a/src/server/api.ts +++ b/src/server/api.ts @@ -161,13 +161,18 @@ io.on('connection', async socket => { socket.on('city:services:healer', async () => { let text: string[] = [`Welcome to the Healer`]; - if(player.gold < 10) { - text.push(`Oh wow.. you sure dont have any money on you... I guess I'll heal you for free this time.`); + if(player.hp < maxHp(player.constitution, player.level)) { + if(player.gold < 10) { + text.push(`Oh wow.. you sure dont have any money on you... I guess I'll heal you for free this time.`); + } + else { + text.push('Healing to full health will cost you 10G.'); + } + text.push(`
`); } else { - text.push('Healing to full health will cost you 10G.'); + text.push(`You seem like you're in pretty good health right now, not sure I can do anything...`); } - text.push(`
`); socket.emit('city:service:healer', { text: text.join("
") -- 2.25.1