- Reworked SourceOnBattlefieldControlUnchangedCondition checking now the LOST_CONTROL event which solves the problem with the old code to not be able to detect all controller changes of layered changeController effects when applied later.

- Simplified and fixed some problems of the handling of the "Until end of your next turn" duration.
- Fixed that some continous effects changed controller but shouldn't dependant from their duration type. Controller chnage will now done duration type dependant.
  (that change fixes #6581 in a more general way undoing the effect specific changes of 2e8ece1dbd).
This commit is contained in:
LevelX2 2020-06-10 22:28:23 +02:00
parent 25802dc105
commit 1e36b39434
30 changed files with 534 additions and 469 deletions

View file

@ -1,5 +1,7 @@
package mage.game.combat;
import java.io.Serializable;
import java.util.*;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.RequirementEffect;
@ -33,9 +35,6 @@ import mage.util.Copyable;
import mage.util.trace.TraceUtil;
import org.apache.log4j.Logger;
import java.io.Serializable;
import java.util.*;
/**
* @author BetaSteward_at_googlemail.com
*/
@ -346,8 +345,8 @@ public class Combat implements Serializable, Copyable<Combat> {
if (game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARING_ATTACKERS, attackingPlayerId, attackingPlayerId))
|| (!canBand && !canBandWithOther)
|| !player.chooseUse(Outcome.Benefit,
"Do you wish to " + (isBanded ? "band " + attacker.getLogName()
+ " with another " : "form a band with " + attacker.getLogName() + " and an ")
"Do you wish to " + (isBanded ? "band " + attacker.getLogName()
+ " with another " : "form a band with " + attacker.getLogName() + " and an ")
+ "attacking creature?", null, game)) {
break;
}
@ -412,7 +411,8 @@ public class Combat implements Serializable, Copyable<Combat> {
if (!isBanded) {
return;
}
StringBuilder sb = new StringBuilder(player.getLogName()).append(" formed a band with ").append((attacker.getBandedCards().size() + 1) + " creatures: ");
StringBuilder sb = new StringBuilder(player.getLogName()).append(" formed a band with ")
.append(attacker.getBandedCards().size()).append(1).append(" creatures: ");
sb.append(attacker.getLogName());
for (UUID id : attacker.getBandedCards()) {
sb.append(", ");
@ -565,7 +565,7 @@ public class Combat implements Serializable, Copyable<Combat> {
* Handle the blocker selection process
*
* @param blockController player that controls how to block, if null the
* defender is the controller
* defender is the controller
* @param game
*/
public void selectBlockers(Player blockController, Game game) {
@ -744,15 +744,15 @@ public class Combat implements Serializable, Copyable<Combat> {
}
/**
* 509.1c The defending player checks each creature they control to
* see whether it's affected by any requirements (effects that say a
* creature must block, or that it must block if some condition is met). If
* the number of requirements that are being obeyed is fewer than the
* maximum possible number of requirements that could be obeyed without
* disobeying any restrictions, the declaration of blockers is illegal. If a
* creature can't block unless a player pays a cost, that player is not
* required to pay that cost, even if blocking with that creature would
* increase the number of requirements being obeyed.
* 509.1c The defending player checks each creature they control to see
* whether it's affected by any requirements (effects that say a creature
* must block, or that it must block if some condition is met). If the
* number of requirements that are being obeyed is fewer than the maximum
* possible number of requirements that could be obeyed without disobeying
* any restrictions, the declaration of blockers is illegal. If a creature
* can't block unless a player pays a cost, that player is not required to
* pay that cost, even if blocking with that creature would increase the
* number of requirements being obeyed.
* <p>
* <p>
* Example: A player controls one creature that "blocks if able" and another
@ -1379,7 +1379,7 @@ public class Combat implements Serializable, Copyable<Combat> {
* @param playerId
* @param game
* @param solveBanding check whether also add creatures banded with
* attackerId
* attackerId
*/
public void addBlockingGroup(UUID blockerId, UUID attackerId, UUID playerId, Game game, boolean solveBanding) {
Permanent blocker = game.getPermanent(blockerId);