Skip to content

Commit

Permalink
fix: order of heal embeds
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-gates committed Jul 10, 2023
1 parent a5bc3a5 commit 6e971d2
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions packages/game/src/commands/heal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,8 @@ export const execute = async ({
)

let character = findOrCreateCharacter(interaction.user)

const result = heal({
healerId: character.id,
targetId: target.id,
interaction,
})
if (!result) return
if (result.outcome === 'cooldown') {
await cooldowns.execute({ interaction })
return
}
updateQuestProgess({
interaction,
characterId: interaction.user.id,
questId: 'healer',
amount: result.amount,
})

character = findOrCreateCharacter(interaction.user)

const maybeOnTarget =
target.id === character.id ? '' : ' on ' + decoratedName(target)

await interaction.channel?.send({
embeds: [
new EmbedBuilder({
Expand All @@ -66,6 +45,25 @@ export const execute = async ({
.setThumbnail(character.profile),
].concat(),
})

const result = heal({
healerId: character.id,
targetId: target.id,
interaction,
})
if (!result) return
if (result.outcome === 'cooldown') {
await cooldowns.execute({ interaction })
return
}
updateQuestProgess({
interaction,
characterId: interaction.user.id,
questId: 'healer',
amount: result.amount,
})

character = findOrCreateCharacter(interaction.user)
}

export default { command, execute }

0 comments on commit 6e971d2

Please sign in to comment.