From: xangelo Date: Tue, 6 Jun 2023 15:13:57 +0000 (-0400) Subject: dont let players heal while at full health X-Git-Tag: v0.0.1~59 X-Git-Url: https://git.xangelo.ca/?a=commitdiff_plain;h=65d81ba7a15fa0d010a86aeacb63a6d49f925620;p=risinglegends.git dont let players heal while at full health --- 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("
")