Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Both player loss in elimination tournament #214

Open
ckocank opened this issue Nov 1, 2024 · 8 comments
Open

Both player loss in elimination tournament #214

ckocank opened this issue Nov 1, 2024 · 8 comments
Labels
enhancement New feature or request

Comments

@ckocank
Copy link

ckocank commented Nov 1, 2024

Due to #160
I know there can't be 2 player lose at the same time but I want to make this case works, any idea how?
image
Both player will be eliminated at the same time.

@Drarig29
Copy link
Owner

Drarig29 commented Nov 1, 2024

Can you give more context? What game is it? How can both of them lose?

@ckocank
Copy link
Author

ckocank commented Nov 1, 2024

Can you give more context? What game is it? How can both of them lose?

I have a condition that both player must have met before the match start.
If one player fail to match the condition, the other will win.
So both player fail to match the condition, they will be eliminated.
In round-robin, I can set a match draw but not elimination.

@Drarig29
Copy link
Owner

Drarig29 commented Nov 1, 2024

Can you forfeit them instead?

@ckocank
Copy link
Author

ckocank commented Nov 2, 2024

Can you forfeit them instead?

https://drarig29.github.io/brackets-docs/reference/manager/functions/helpers.setForfeits.html
Is this the fuction you are talking about?

@Drarig29
Copy link
Owner

Drarig29 commented Nov 3, 2024

https://drarig29.github.io/brackets-docs/reference/manager/functions/helpers.setForfeits.html Is this the fuction you are talking about?

No, generally you should not have to use helpers. I'm talking about using the usual manager.update.match() method.

You can pass forfeits there:

await manager.update.match({
    id: YOUR_MATCH_ID,
    opponent1: { forfeit: true },
    opponent2: { forfeit: true },
});

See unit tests:

it('should set two forfeits for the match', async () => {
await manager.update.match({
id: 0,
opponent1: { forfeit: true },
opponent2: { forfeit: true },
});
const after = await storage.select('match', 0);
assert.strictEqual(after.status, Status.Completed);
assert.strictEqual(after.opponent1.forfeit, true);
assert.strictEqual(after.opponent2.forfeit, true);
assert.strictEqual(after.opponent1.result, undefined);
assert.strictEqual(after.opponent2.result, undefined);
});

@Drarig29
Copy link
Owner

Drarig29 commented Nov 3, 2024

I have a condition that both player must have met before the match start.

I'm going to close the issue because this is the only solution, and you can say that "players failing to match those conditions will be forfeited". Cheers! 🥂

@Drarig29 Drarig29 closed this as completed Nov 3, 2024
@ckocank
Copy link
Author

ckocank commented Nov 3, 2024

Thanks for your replied.
I tried

await manager.update.match({
          id: match.id,
          opponent1: { id: match.opponent1.id, forfeit: true },
          opponent2: { id: match.opponent2.id, forfeit: true },
        });

But it return
Error: There are two forfeits.
I can only forfeit 1 player.

@Drarig29 Drarig29 reopened this Nov 3, 2024
@Drarig29
Copy link
Owner

Drarig29 commented Nov 3, 2024

Ha... OK I think I designed it this way (double forfeits are only supported in round-robin), but I agree there is a use case.

I'll try to fix this so you are able to have 2 forfeits.

@Drarig29 Drarig29 added the enhancement New feature or request label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants