that better work
This commit is contained in:
parent
4add3d504c
commit
fcd2184df8
@ -36,12 +36,16 @@ export class ActiveBattle {
|
|||||||
const outcome = this.battle.simulateRound();
|
const outcome = this.battle.simulateRound();
|
||||||
const log = this.battle.log.slice(0, 1024);
|
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({
|
await this.message.edit({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.addFields([
|
.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: 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: '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: 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 }
|
{ name: 'Log', value: log }
|
||||||
])
|
])
|
||||||
.setColor(0x8c110b)
|
.setColor(0x8c110b)
|
||||||
@ -53,11 +57,8 @@ export class ActiveBattle {
|
|||||||
|
|
||||||
this.battle.client.ACTIVE_BATTLES.splice(this.battle.client.ACTIVE_BATTLES.indexOf(this), 1);
|
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 elo1 = this.battle.player1.elo;
|
||||||
let elo2 = 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) {
|
switch (outcome) {
|
||||||
case BattleState.Team1Win:
|
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.slot2 || -1 } }) || defaultUnit,
|
||||||
await Unit.findOne({ where: { id: challenge.player2.slot3 || -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 battle = new Battle(this, int.channel, challenge.player1, challenge.player2, team1, team2);
|
||||||
const activeBattle = new ActiveBattle(battle,
|
const activeBattle = new ActiveBattle(battle,
|
||||||
await int.channel.send({
|
await int.channel.send({
|
||||||
embeds: [
|
embeds: [
|
||||||
new EmbedBuilder()
|
new EmbedBuilder()
|
||||||
.addFields([
|
.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: 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: '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: 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...' }
|
{ name: 'Log', value: 'Starting...' }
|
||||||
])
|
])
|
||||||
.setColor(0x8c110b)
|
.setColor(0x8c110b)
|
||||||
|
Loading…
Reference in New Issue
Block a user