Add fights

This commit is contained in:
Aslan 2026-01-23 11:04:46 -05:00
parent 28ab0873ab
commit 7ad0d493dc

View file

@ -57,7 +57,7 @@ const fightEntity = async (
client.sendTextMessage(roomId, `Round ${round}`);
client.sendTextMessage(
roomId,
`${attacker.name}: ${attacker.health}/${getMaxHealth(attacker)}HP\n${defender.name}: ${defender.health}/${getMaxHealth(defender)}HP`,
`${attacker.name}: ${attacker.health.toFixed(0)}/${getMaxHealth(attacker)}HP\n${defender.name}: ${defender.health.toFixed(0)}/${getMaxHealth(defender)}HP`,
);
await sleep(3000);
@ -119,6 +119,8 @@ const fightRound = (
): boolean => {
const attackerAttack =
attackerAttacks[Math.floor(Math.random() * attackerAttacks.length)];
console.log(attackerAttacks);
console.log(attackerAttack);
if (!attackerAttack) {
return false;