mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-15 10:13:14 +00:00
Cancel alliance requests if the recipient attacks (#1733)
## Description: Problem: attacking a player right before accepting an alliance request is very effective since the requester can't fight back or reclaim his territory without canceling the alliance and being penalized with the traitor debuff. Change: - Attacking a player after he requested an alliance automatically rejects the request - No changes to existing attacks in both directions, only new attacks affect the request ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I have read and accepted the CLA agreement (only required once). ## Please put your Discord username so you can be contacted if a bug or regression is found: IngloriousTom
This commit is contained in:
@@ -468,7 +468,24 @@ export class EventsDisplay extends LitElement implements Layer {
|
||||
|
||||
onAllianceRequestReplyEvent(update: AllianceRequestReplyUpdate) {
|
||||
const myPlayer = this.game.myPlayer();
|
||||
if (!myPlayer || update.request.requestorID !== myPlayer.smallID()) {
|
||||
if (!myPlayer) {
|
||||
return;
|
||||
}
|
||||
// myPlayer can deny alliances without clicking on the button
|
||||
if (update.request.recipientID === myPlayer.smallID()) {
|
||||
// Remove alliance requests whose requestors are the same as the reply's requestor
|
||||
// Noop unless the request was denied through other means (e.g attacking the requestor)
|
||||
this.events = this.events.filter(
|
||||
(event) =>
|
||||
!(
|
||||
event.type === MessageType.ALLIANCE_REQUEST &&
|
||||
event.focusID === update.request.requestorID
|
||||
),
|
||||
);
|
||||
this.requestUpdate();
|
||||
return;
|
||||
}
|
||||
if (update.request.requestorID !== myPlayer.smallID()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user