that better work

This commit is contained in:
Hexugory 2023-04-01 00:03:00 -05:00
parent 4add3d504c
commit fcd2184df8

View File

@ -35,13 +35,17 @@ export class ActiveBattle {
this.rounds++;
const outcome = this.battle.simulateRound();
const log = this.battle.log.slice(0, 1024);
if (this.battle.channel.isDMBased()) return;
const player1 = this.battle.channel.guild.members.resolve(this.battle.player1.user_id);
const player2 = this.battle.channel.guild.members.resolve(this.battle.player2.user_id);
await this.message.edit({
embeds: [
new EmbedBuilder()
.addFields([
{ name: 'Team 1', value: `${this.battle.team1[0].character.name} [${this.battle.team1[0].health}]\n${this.battle.team1[1].character.name} [${this.battle.team1[1].health}]\n${this.battle.team1[2].character.name} [${this.battle.team1[2].health}]`, inline: true },
{ name: 'Team 2', value: `${this.battle.team2[0].character.name} [${this.battle.team2[0].health}]\n${this.battle.team2[1].character.name} [${this.battle.team2[1].health}]\n${this.battle.team2[2].character.name} [${this.battle.team2[2].health}]`, inline: true },
{ name: player1?.user.username || '████████', value: `${this.battle.team1[0].character.name} [${this.battle.team1[0].health}]\n${this.battle.team1[1].character.name} [${this.battle.team1[1].health}]\n${this.battle.team1[2].character.name} [${this.battle.team1[2].health}]`, inline: true },
{ name: player2?.user.username || '████████', value: `${this.battle.team2[0].character.name} [${this.battle.team2[0].health}]\n${this.battle.team2[1].character.name} [${this.battle.team2[1].health}]\n${this.battle.team2[2].character.name} [${this.battle.team2[2].health}]`, inline: true },
{ name: 'Log', value: log }
])
.setColor(0x8c110b)
@ -53,11 +57,8 @@ export class ActiveBattle {
this.battle.client.ACTIVE_BATTLES.splice(this.battle.client.ACTIVE_BATTLES.indexOf(this), 1);
if (this.battle.channel.isDMBased()) return;
let elo1 = this.battle.player1.elo;
let elo2 = this.battle.player1.elo;
const player1 = this.battle.channel.guild.members.resolve(this.battle.player1.user_id);
const player2 = this.battle.channel.guild.members.resolve(this.battle.player2.user_id);
switch (outcome) {
case BattleState.Team1Win:
@ -149,14 +150,19 @@ export class CBClient extends CommandClient {
await Unit.findOne({ where: { id: challenge.player2.slot2 || -1 } }) || defaultUnit,
await Unit.findOne({ where: { id: challenge.player2.slot3 || -1 } }) || defaultUnit
]
if (challenge.message.channel.isDMBased()) return;
const player1 = challenge.message.channel.guild.members.resolve(challenge.player1.user_id);
const player2 = challenge.message.channel.guild.members.resolve(challenge.player2.user_id);
const battle = new Battle(this, int.channel, challenge.player1, challenge.player2, team1, team2);
const activeBattle = new ActiveBattle(battle,
await int.channel.send({
embeds: [
new EmbedBuilder()
.addFields([
{ name: 'Team 1', value: `${battle.team1[0].character.name} [${battle.team1[0].health}]\n${battle.team1[1].character.name} [${battle.team1[1].health}]\n${battle.team1[2].character.name} [${battle.team1[2].health}]`, inline: true },
{ name: 'Team 2', value: `${battle.team2[0].character.name} [${battle.team2[0].health}]\n${battle.team2[1].character.name} [${battle.team2[1].health}]\n${battle.team2[2].character.name} [${battle.team2[2].health}]`, inline: true },
{ name: player1?.user.username || '████████', value: `${battle.team1[0].character.name} [${battle.team1[0].health}]\n${battle.team1[1].character.name} [${battle.team1[1].health}]\n${battle.team1[2].character.name} [${battle.team1[2].health}]`, inline: true },
{ name: player2?.user.username || '████████', value: `${battle.team2[0].character.name} [${battle.team2[0].health}]\n${battle.team2[1].character.name} [${battle.team2[1].health}]\n${battle.team2[2].character.name} [${battle.team2[2].health}]`, inline: true },
{ name: 'Log', value: 'Starting...' }
])
.setColor(0x8c110b)