Preact: Fix bug with forfeiting bo3 games (#2576)

This commit is contained in:
Aurastic 2026-03-15 12:00:30 +05:30 committed by GitHub
parent a0322536dd
commit 5ebc20510d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1176,10 +1176,10 @@ export class PSRoom extends PSStreamModel<Args | null> implements RoomOptions {
},
'part,leave,close'(target, cmd, elem) {
const roomid = (/[^a-z0-9-]/.test(target) ? toID(target) as any as RoomID : target as RoomID) || this.id;
const room = PS.rooms[roomid];
const battle = (room as BattleRoom)?.battle;
const room = PS.rooms[roomid] as BattleRoom;
const battle = room?.battle;
if (room?.type === "battle" && !battle.ended && battle.mySide.id === PS.user.userid && !battle.isReplay) {
if (room?.type === "battle" && !battle.ended && room.users[PS.user.userid]?.startsWith('☆') && !battle.isReplay) {
PS.join("forfeitbattle" as RoomID, { parentElem: elem });
return;
}