mirror of
https://github.com/magefree/mage.git
synced 2025-12-28 14:32:06 -08:00
* Added an option to auto order triggers with the same text. Added options to pass priority automatically after spell cast and ability activation. Fixed a problem of the tests with the new Scry mulligan.
This commit is contained in:
parent
e16276a3cd
commit
707c1acf6b
10 changed files with 281 additions and 78 deletions
|
|
@ -52,6 +52,7 @@ import mage.cards.Card;
|
|||
import mage.cards.Cards;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.choices.Choice;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.ManaType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.PlayerAction;
|
||||
|
|
@ -192,6 +193,10 @@ public interface Player extends MageItem, Copyable<Player> {
|
|||
|
||||
boolean getPassedAllTurns();
|
||||
|
||||
AbilityType getJustActivatedType();
|
||||
|
||||
void setJustActivatedType(AbilityType abilityType);
|
||||
|
||||
boolean hasLost();
|
||||
|
||||
boolean hasWon();
|
||||
|
|
|
|||
|
|
@ -176,6 +176,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
* and abilities in the stack and will pass them as well.
|
||||
*/
|
||||
protected boolean passedAllTurns; // F9
|
||||
protected AbilityType justActivatedType; // used to check if priority can be passed automatically
|
||||
|
||||
protected int turns;
|
||||
protected int storedBookmark = -1;
|
||||
|
|
@ -317,6 +318,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.passedUntilStackResolved = player.passedUntilStackResolved;
|
||||
this.dateLastAddedToStack = player.dateLastAddedToStack;
|
||||
this.passedAllTurns = player.passedAllTurns;
|
||||
this.justActivatedType = player.justActivatedType;
|
||||
|
||||
this.priorityTimeLeft = player.getPriorityTimeLeft();
|
||||
this.reachedNextTurnAfterLeaving = player.reachedNextTurnAfterLeaving;
|
||||
|
|
@ -440,6 +442,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
this.skippedAtLeastOnce = false;
|
||||
this.passedUntilStackResolved = false;
|
||||
this.passedAllTurns = false;
|
||||
this.justActivatedType = null;
|
||||
this.canGainLife = true;
|
||||
this.canLoseLife = true;
|
||||
this.topCardRevealed = false;
|
||||
|
|
@ -1130,7 +1133,11 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
}
|
||||
|
||||
//if player has taken an action then reset all player passed flags
|
||||
justActivatedType = null;
|
||||
if (result) {
|
||||
if (isHuman() && (ability.getAbilityType().equals(AbilityType.SPELL) || ability.getAbilityType().equals(AbilityType.ACTIVATED))) {
|
||||
setJustActivatedType(ability.getAbilityType());
|
||||
}
|
||||
game.getPlayers().resetPassed();
|
||||
}
|
||||
return result;
|
||||
|
|
@ -3246,6 +3253,16 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
return passedUntilStackResolved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityType getJustActivatedType() {
|
||||
return justActivatedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJustActivatedType(AbilityType justActivatedType) {
|
||||
this.justActivatedType = justActivatedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revokePermissionToSeeHandCards() {
|
||||
usersAllowedToSeeHandCards.clear();
|
||||
|
|
|
|||
|
|
@ -19,10 +19,14 @@ public class UserData implements Serializable {
|
|||
protected boolean askMoveToGraveOrder;
|
||||
protected boolean manaPoolAutomatic;
|
||||
protected boolean manaPoolAutomaticRestricted;
|
||||
protected boolean passPriorityCast;
|
||||
protected boolean passPriorityActivation;
|
||||
protected boolean autoOrderTrigger;
|
||||
|
||||
public UserData(UserGroup userGroup, int avatarId, boolean showAbilityPickerForced,
|
||||
boolean allowRequestShowHandCards, boolean confirmEmptyManaPool, UserSkipPrioritySteps userSkipPrioritySteps,
|
||||
String flagName, boolean askMoveToGraveOrder, boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted) {
|
||||
String flagName, boolean askMoveToGraveOrder, boolean manaPoolAutomatic, boolean manaPoolAutomaticRestricted,
|
||||
boolean passPriorityCast, boolean passPriorityActivation, boolean autoOrderTrigger) {
|
||||
this.groupId = userGroup.getGroupId();
|
||||
this.avatarId = avatarId;
|
||||
this.showAbilityPickerForced = showAbilityPickerForced;
|
||||
|
|
@ -33,6 +37,9 @@ public class UserData implements Serializable {
|
|||
this.askMoveToGraveOrder = askMoveToGraveOrder;
|
||||
this.manaPoolAutomatic = manaPoolAutomatic;
|
||||
this.manaPoolAutomaticRestricted = manaPoolAutomaticRestricted;
|
||||
this.passPriorityCast = passPriorityCast;
|
||||
this.passPriorityActivation = passPriorityActivation;
|
||||
this.autoOrderTrigger = autoOrderTrigger;
|
||||
}
|
||||
|
||||
public void update(UserData userData) {
|
||||
|
|
@ -46,10 +53,13 @@ public class UserData implements Serializable {
|
|||
this.askMoveToGraveOrder = userData.askMoveToGraveOrder;
|
||||
this.manaPoolAutomatic = userData.manaPoolAutomatic;
|
||||
this.manaPoolAutomaticRestricted = userData.manaPoolAutomaticRestricted;
|
||||
this.passPriorityCast = userData.passPriorityCast;
|
||||
this.passPriorityActivation = userData.passPriorityActivation;
|
||||
this.autoOrderTrigger = userData.autoOrderTrigger;
|
||||
}
|
||||
|
||||
public static UserData getDefaultUserDataView() {
|
||||
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, "world.png", false, true, true);
|
||||
return new UserData(UserGroup.DEFAULT, 0, false, false, true, null, "world.png", false, true, true, false, false, false);
|
||||
}
|
||||
|
||||
public void setGroupId(int groupId) {
|
||||
|
|
@ -132,4 +142,28 @@ public class UserData implements Serializable {
|
|||
this.manaPoolAutomaticRestricted = manaPoolAutomaticRestricted;
|
||||
}
|
||||
|
||||
public boolean isPassPriorityCast() {
|
||||
return passPriorityCast;
|
||||
}
|
||||
|
||||
public void setPassPriorityCast(boolean passPriorityCast) {
|
||||
this.passPriorityCast = passPriorityCast;
|
||||
}
|
||||
|
||||
public boolean isPassPriorityActivation() {
|
||||
return passPriorityActivation;
|
||||
}
|
||||
|
||||
public void setPassPriorityActivation(boolean passPriorityActivation) {
|
||||
this.passPriorityActivation = passPriorityActivation;
|
||||
}
|
||||
|
||||
public boolean isAutoOrderTrigger() {
|
||||
return autoOrderTrigger;
|
||||
}
|
||||
|
||||
public void setAutoOrderTrigger(boolean autoOrderTrigger) {
|
||||
this.autoOrderTrigger = autoOrderTrigger;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class SoulbondWatcher extends Watcher {
|
|||
Cards cards = new CardsImpl();
|
||||
cards.add(chosen);
|
||||
controller.lookAtCards("Soulbond", cards, game);
|
||||
if (controller.chooseUse(Outcome.Benefit, "Use Soulbond for recent " + permanent.getLogName() + "?", null, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Use Soulbond for recent " + permanent.getLogName() + "?", SoulbondAbility.getInstance(), game)) {
|
||||
chosen.setPairedCard(permanent.getId());
|
||||
permanent.setPairedCard(chosen.getId());
|
||||
if (!game.isSimulation()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue