The capture the relic countdown should only be reset if a player on the team-to-win tries to switch diplomacy with another player.
This should fix the concern raised in rP19345.
Differential D305
Do not reset the capture the relic countdown if a non-allied player changes diplomacy Sandarac on Apr 9 2017, 9:35 AM. Authored by
Details
The capture the relic countdown should only be reset if a player on the team-to-win tries to switch diplomacy with another player. This should fix the concern raised in rP19345. Capture all relics, switch the perspective to a player you are not allied with, and change the diplomacy with any other player. The countdown will not reset.
Diff Detail
Event TimelineComment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (305 tests).................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/719/ for more details. Comment Actions Ok the question is, what behavior do we intend in diplomacy mode? What if another player joins the team that owns all relics (mutually)? The timer might be reset. [That's the case] Notice it's also reset if we change the alliance from ally to ally. Those should be fixed in the Player component, or Commands.js if that isn't possible, probably in a separate diff. IIRC there was an old rejected GUI patch on trac for the diplomacy manager. I noticed one bug though. First wololo-captured relics and setup alliance, then broke the alliance and set it back again, but the timer didn't start again. Comment Actions I think it makes sense to reset the timer any time a player on the team-to-win tries to change their diplomacy (as is done in the patch), as changing the diplomacy causes the original "team" (that started the countdown) to no longer exist (from my point of view).
I believe this is #3198, and yes, these useless DiplomacyChanged messages that are sent are a real pain (they were also really annoying to deal with when implementing diplomacy requests for Petra). An attempt to deal with them in this patch would just be a hack, and as you said, they should be fixed/handled elsewhere.
Yes, || !this.relicsVictoryCountdownPlayers.length was missing in line 107 (needed to handle cases like this). But there are still cases when a non-allied player switches their diplomacy with a player on the team-to-win to a negative state (i.e. neutral to enemy), which causes the other player to switch diplomacy as well because of the automatic "worsening of relations" in SetDiplomacyIndex() in Player.js. So this can also cause the countdown to reset. Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/980/ for more details. Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/1023/ for more details. Comment Actions @elexis believes that the timer shouldn't be reset when a player on the team-to-win changes their diplomacy with some other player from neutral to enemy - that makes sense. But what if player A is allied with player B, but player B has their diplomacy stance with player A set to enemy, and then later, when player A's team starts the countdown, B switches to become allies with A? Should the countdown reset then? Maybe not, but it certainly comes down to a design decision. Another possibility is to save all mutual allies when the countdown starts, and then only reset the timer if one of these saved players is no longer an ally with any other of the saved players (regardless of any players that later "join" the team). In this case then only the saved players would be marked as won. This approach may be misleading. Comment Actions Reset only if the original team of mutual allies is altered, removing the need to modify the player component. Comment Actions Build is green Updating workspaces. Build (release)... Build (debug)... Running release tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! Running debug tests... Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK! http://jw:8080/job/phabricator/1077/ for more details. Comment Actions From testing: The timer is not reset if one of the teamplayers adds a new mutual ally. (This effect isn't clear from the string (Player1's team will have won in T and Capture all relics spread across the map and keep them for a certain time to win the game.). From reading the code: i.e. if 1 is mutually allied with 2-7 all of them (i.e. 1-7) will win, (i.e. if we made a graph where the vertices are players and the edges mutual alliances, then we check for a star in the current code, but should probably look for a subgraph that is complete). Wonder victory doesn't have this issue since there is only one wonder, so checking for the mutual allies of that player is easier to grasp. Patch still seems a better behavior than before, so I'd be ok with committing it.
Comment Actions Incorrectness: Player 1 is only mutual ally with 2. Player 2 is mutual ally with everyone but 8. Player 1 captures the relic and only 1+2 win. Player 2 is only mutual ally with 1. Player 1 is mutual ally with everyone but 8. Player 2 captures the relic and everyone but 8 will be marked as winners (even if 2 had fought the entire game against player 3 to 7). Correctness:
|