mirror of
https://github.com/correl/mage.git
synced 2024-11-24 19:19:56 +00:00
- Fixed #3064
This commit is contained in:
parent
af0bcbc0a8
commit
8072e79571
1 changed files with 82 additions and 43 deletions
|
@ -157,7 +157,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean chooseUse(Outcome outcome, String message, Ability source, Game game) {
|
public boolean chooseUse(Outcome outcome, String message, Ability source, Game game) {
|
||||||
return this.chooseUse(outcome, message, null, null, null, source, game);
|
return this.chooseUse(outcome, message, null, "Yes", "No", source, game);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -300,7 +300,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map<String, Serializable> options) {
|
public boolean choose(Outcome outcome, Target target, UUID sourceId, Game game, Map<String, Serializable> options) {
|
||||||
updateGameStatePriority("choose(5)", game);
|
updateGameStatePriority("choose(5)", game);
|
||||||
UUID abilityControllerId = playerId;
|
UUID abilityControllerId = playerId;
|
||||||
if (target.getTargetController() != null && target.getAbilityController() != null) {
|
if (target.getTargetController() != null
|
||||||
|
&& target.getAbilityController() != null) {
|
||||||
abilityControllerId = target.getAbilityController();
|
abilityControllerId = target.getAbilityController();
|
||||||
}
|
}
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
|
@ -308,7 +309,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
Set<UUID> targetIds = target.possibleTargets(sourceId, abilityControllerId, game);
|
Set<UUID> targetIds = target.possibleTargets(sourceId, abilityControllerId, game);
|
||||||
if (targetIds == null || targetIds.isEmpty()) {
|
if (targetIds == null
|
||||||
|
|| targetIds.isEmpty()) {
|
||||||
return target.getTargets().size() >= target.getNumberOfTargets();
|
return target.getTargets().size() >= target.getNumberOfTargets();
|
||||||
}
|
}
|
||||||
boolean required = target.isRequired(sourceId, game);
|
boolean required = target.isRequired(sourceId, game);
|
||||||
|
@ -379,7 +381,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
Set<UUID> possibleTargets = target.possibleTargets(source == null ? null : source.getSourceId(), abilityControllerId, game);
|
Set<UUID> possibleTargets = target.possibleTargets(source == null ? null : source.getSourceId(), abilityControllerId, game);
|
||||||
boolean required = target.isRequired(source != null ? source.getSourceId() : null, game);
|
boolean required = target.isRequired(source != null ? source.getSourceId() : null, game);
|
||||||
if (possibleTargets.isEmpty() || target.getTargets().size() >= target.getNumberOfTargets()) {
|
if (possibleTargets.isEmpty()
|
||||||
|
|| target.getTargets().size() >= target.getNumberOfTargets()) {
|
||||||
required = false;
|
required = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,7 +417,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (options == null) {
|
if (options == null) {
|
||||||
options = new HashMap<>();
|
options = new HashMap<>();
|
||||||
}
|
}
|
||||||
if (target.getTargets().size() >= target.getNumberOfTargets() && !options.containsKey("UI.right.btn.text")) {
|
if (target.getTargets().size() >= target.getNumberOfTargets()
|
||||||
|
&& !options.containsKey("UI.right.btn.text")) {
|
||||||
options.put("UI.right.btn.text", "Done");
|
options.put("UI.right.btn.text", "Done");
|
||||||
}
|
}
|
||||||
options.put("targetZone", target.getZone());
|
options.put("targetZone", target.getZone());
|
||||||
|
@ -567,19 +571,22 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getJustActivatedType() != null && !holdingPriority) {
|
if (getJustActivatedType() != null && !holdingPriority) {
|
||||||
if (controllingPlayer.getUserData().isPassPriorityCast() && getJustActivatedType() == AbilityType.SPELL) {
|
if (controllingPlayer.getUserData().isPassPriorityCast()
|
||||||
|
&& getJustActivatedType() == AbilityType.SPELL) {
|
||||||
setJustActivatedType(null);
|
setJustActivatedType(null);
|
||||||
pass(game);
|
pass(game);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (controllingPlayer.getUserData().isPassPriorityActivation() && getJustActivatedType() == AbilityType.ACTIVATED) {
|
if (controllingPlayer.getUserData().isPassPriorityActivation()
|
||||||
|
&& getJustActivatedType() == AbilityType.ACTIVATED) {
|
||||||
setJustActivatedType(null);
|
setJustActivatedType(null);
|
||||||
pass(game);
|
pass(game);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isGameUnderControl()) { // Use the skip actions only if the player itself controls its turn
|
if (isGameUnderControl()) { // Use the skip actions only if the player itself controls its turn
|
||||||
if (passedAllTurns || passedTurnSkipStack) {
|
if (passedAllTurns
|
||||||
|
|| passedTurnSkipStack) {
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -602,15 +609,19 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (game.getStack().isEmpty()) {
|
if (game.getStack().isEmpty()) {
|
||||||
passedUntilStackResolved = false;
|
passedUntilStackResolved = false;
|
||||||
boolean dontCheckPassStep = false;
|
boolean dontCheckPassStep = false;
|
||||||
if (passedTurn || passedTurnSkipStack) {
|
if (passedTurn
|
||||||
|
|| passedTurnSkipStack) {
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (passedUntilNextMain) {
|
if (passedUntilNextMain) {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN || game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN) {
|
if (game.getTurn().getStepType() == PhaseStep.POSTCOMBAT_MAIN
|
||||||
|
|| game.getTurn().getStepType() == PhaseStep.PRECOMBAT_MAIN) {
|
||||||
// it's a main phase
|
// it's a main phase
|
||||||
if (!skippedAtLeastOnce || (!playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) {
|
if (!skippedAtLeastOnce
|
||||||
|
|| (!playerId.equals(game.getActivePlayerId())
|
||||||
|
&& !this.getUserData().getUserSkipPrioritySteps().isStopOnAllMainPhases())) {
|
||||||
skippedAtLeastOnce = true;
|
skippedAtLeastOnce = true;
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -629,7 +640,9 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (passedUntilEndOfTurn) {
|
if (passedUntilEndOfTurn) {
|
||||||
if (game.getTurn().getStepType() == PhaseStep.END_TURN) {
|
if (game.getTurn().getStepType() == PhaseStep.END_TURN) {
|
||||||
// It's end of turn phase
|
// It's end of turn phase
|
||||||
if (!skippedAtLeastOnce || (playerId.equals(game.getActivePlayerId()) && !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) {
|
if (!skippedAtLeastOnce
|
||||||
|
|| (playerId.equals(game.getActivePlayerId())
|
||||||
|
&& !this.getUserData().getUserSkipPrioritySteps().isStopOnAllEndPhases())) {
|
||||||
skippedAtLeastOnce = true;
|
skippedAtLeastOnce = true;
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -645,7 +658,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!dontCheckPassStep && checkPassStep(game, controllingPlayer)) {
|
if (!dontCheckPassStep
|
||||||
|
&& checkPassStep(game, controllingPlayer)) {
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -669,7 +683,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (game.executingRollback()) {
|
if (game.executingRollback()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (response.getBoolean() != null || response.getInteger() != null) {
|
if (response.getBoolean() != null
|
||||||
|
|| response.getInteger() != null) {
|
||||||
if (passWithManaPoolCheck(game)) {
|
if (passWithManaPoolCheck(game)) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -679,7 +694,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response.getString() != null && response.getString().equals("special")) {
|
if (response.getString() != null
|
||||||
|
&& response.getString().equals("special")) {
|
||||||
specialAction(game);
|
specialAction(game);
|
||||||
} else if (response.getUUID() != null) {
|
} else if (response.getUUID() != null) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
|
@ -700,7 +716,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
if (actingPlayer != null) {
|
if (actingPlayer != null) {
|
||||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game);
|
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = actingPlayer.getUseableActivatedAbilities(object, zone, game);
|
||||||
if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
if (useableAbilities != null
|
||||||
|
&& !useableAbilities.isEmpty()) {
|
||||||
activateAbility(useableAbilities, object, game);
|
activateAbility(useableAbilities, object, game);
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
@ -769,7 +786,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (abilitiesWithNoOrderSet.isEmpty()) {
|
if (abilitiesWithNoOrderSet.isEmpty()) {
|
||||||
return abilityOrderLast;
|
return abilityOrderLast;
|
||||||
}
|
}
|
||||||
if (abilitiesWithNoOrderSet.size() == 1 || autoOrderUse) {
|
if (abilitiesWithNoOrderSet.size() == 1
|
||||||
|
|| autoOrderUse) {
|
||||||
return abilitiesWithNoOrderSet.iterator().next();
|
return abilitiesWithNoOrderSet.iterator().next();
|
||||||
}
|
}
|
||||||
updateGameStatePriority("chooseTriggeredAbility", game);
|
updateGameStatePriority("chooseTriggeredAbility", game);
|
||||||
|
@ -806,7 +824,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return false;
|
return false;
|
||||||
} else if (response.getUUID() != null) {
|
} else if (response.getUUID() != null) {
|
||||||
playManaAbilities(abilityToCast, unpaid, game);
|
playManaAbilities(abilityToCast, unpaid, game);
|
||||||
} else if (response.getString() != null && response.getString().equals("special")) {
|
} else if (response.getString() != null
|
||||||
|
&& response.getString().equals("special")) {
|
||||||
if (unpaid instanceof ManaCostsImpl) {
|
if (unpaid instanceof ManaCostsImpl) {
|
||||||
specialManaAction(unpaid, game);
|
specialManaAction(unpaid, game);
|
||||||
}
|
}
|
||||||
|
@ -837,8 +856,10 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
do {
|
do {
|
||||||
game.fireGetAmountEvent(playerId, message, min, max);
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getInteger() == null && !abort);
|
} while (response.getInteger() == null
|
||||||
if (response != null && response.getInteger() != null) {
|
&& !abort);
|
||||||
|
if (response != null
|
||||||
|
&& response.getInteger() != null) {
|
||||||
xValue = response.getInteger();
|
xValue = response.getInteger();
|
||||||
}
|
}
|
||||||
return xValue;
|
return xValue;
|
||||||
|
@ -851,8 +872,10 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
do {
|
do {
|
||||||
game.fireGetAmountEvent(playerId, message, min, max);
|
game.fireGetAmountEvent(playerId, message, min, max);
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
} while (response.getInteger() == null && !abort);
|
} while (response.getInteger() == null
|
||||||
if (response != null && response.getInteger() != null) {
|
&& !abort);
|
||||||
|
if (response != null
|
||||||
|
&& response.getInteger() != null) {
|
||||||
xValue = response.getInteger();
|
xValue = response.getInteger();
|
||||||
}
|
}
|
||||||
return xValue;
|
return xValue;
|
||||||
|
@ -865,14 +888,16 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
Spell spell = game.getStack().getSpell(abilityToCast.getSourceId());
|
||||||
if (spell != null && spell.isDoneActivatingManaAbilities()) {
|
if (spell != null
|
||||||
|
&& spell.isDoneActivatingManaAbilities()) {
|
||||||
game.informPlayer(this, "You can no longer use activated mana abilities to pay for the current spell. Cancel and recast the spell and activate mana abilities first.");
|
game.informPlayer(this, "You can no longer use activated mana abilities to pay for the current spell. Cancel and recast the spell and activate mana abilities first.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Zone zone = game.getState().getZone(object.getId());
|
Zone zone = game.getState().getZone(object.getId());
|
||||||
if (zone != null) {
|
if (zone != null) {
|
||||||
LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getUseableManaAbilities(object, zone, game);
|
LinkedHashMap<UUID, ActivatedManaAbilityImpl> useableAbilities = getUseableManaAbilities(object, zone, game);
|
||||||
if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
if (useableAbilities != null
|
||||||
|
&& !useableAbilities.isEmpty()) {
|
||||||
useableAbilities = ManaUtil.tryToAutoPay(unpaid, useableAbilities); // eliminates other abilities if one fits perfectly
|
useableAbilities = ManaUtil.tryToAutoPay(unpaid, useableAbilities); // eliminates other abilities if one fits perfectly
|
||||||
currentlyUnpaidMana = unpaid;
|
currentlyUnpaidMana = unpaid;
|
||||||
activateAbility(useableAbilities, object, game);
|
activateAbility(useableAbilities, object, game);
|
||||||
|
@ -887,8 +912,13 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
FilterCreatureForCombat filter = filterCreatureForCombat.copy();
|
FilterCreatureForCombat filter = filterCreatureForCombat.copy();
|
||||||
filter.add(new ControllerIdPredicate(attackingPlayerId));
|
filter.add(new ControllerIdPredicate(attackingPlayerId));
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
if (passedAllTurns || passedUntilEndStepBeforeMyTurn
|
if (passedAllTurns
|
||||||
|| (!getUserData().getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction() && (passedTurn || passedTurnSkipStack || passedUntilEndOfTurn || passedUntilNextMain))) {
|
|| passedUntilEndStepBeforeMyTurn
|
||||||
|
|| (!getUserData().getUserSkipPrioritySteps().isStopOnDeclareAttackersDuringSkipAction()
|
||||||
|
&& (passedTurn
|
||||||
|
|| passedTurnSkipStack
|
||||||
|
|| passedUntilEndOfTurn
|
||||||
|
|| passedUntilNextMain))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, Serializable> options = new HashMap<>();
|
Map<String, Serializable> options = new HashMap<>();
|
||||||
|
@ -906,7 +936,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
|
|
||||||
game.fireSelectEvent(playerId, "Select attackers", options);
|
game.fireSelectEvent(playerId, "Select attackers", options);
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getString() != null && response.getString().equals("special")) { // All attack
|
if (response.getString() != null
|
||||||
|
&& response.getString().equals("special")) { // All attack
|
||||||
setStoredBookmark(game.bookmarkState());
|
setStoredBookmark(game.bookmarkState());
|
||||||
UUID attackedDefender = null;
|
UUID attackedDefender = null;
|
||||||
if (game.getCombat().getDefenders().size() > 1) {
|
if (game.getCombat().getDefenders().size() > 1) {
|
||||||
|
@ -941,7 +972,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
boolean validForcedAttacker = false;
|
boolean validForcedAttacker = false;
|
||||||
if (game.getCombat().getAttackers().contains(creatureId)) {
|
if (game.getCombat().getAttackers().contains(creatureId)) {
|
||||||
Set<UUID> possibleDefender = game.getCombat().getCreaturesForcedToAttack().get(creatureId);
|
Set<UUID> possibleDefender = game.getCombat().getCreaturesForcedToAttack().get(creatureId);
|
||||||
if (possibleDefender.isEmpty() || possibleDefender.contains(game.getCombat().getDefenderId(creatureId))) {
|
if (possibleDefender.isEmpty()
|
||||||
|
|| possibleDefender.contains(game.getCombat().getDefenderId(creatureId))) {
|
||||||
validForcedAttacker = true;
|
validForcedAttacker = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -969,10 +1001,6 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (response.getInteger() != null) {
|
} else if (response.getInteger() != null) {
|
||||||
//if (response.getInteger() == -9999) {
|
|
||||||
// passedAllTurns = true;
|
|
||||||
//}
|
|
||||||
//passedTurn = true;
|
|
||||||
return;
|
return;
|
||||||
} else if (response.getUUID() != null) {
|
} else if (response.getUUID() != null) {
|
||||||
Permanent attacker = game.getPermanent(response.getUUID());
|
Permanent attacker = game.getPermanent(response.getUUID());
|
||||||
|
@ -991,7 +1019,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
for (Map.Entry entry : game.getContinuousEffects().getApplicableRequirementEffects(attacker, game).entrySet()) {
|
for (Map.Entry entry : game.getContinuousEffects().getApplicableRequirementEffects(attacker, game).entrySet()) {
|
||||||
RequirementEffect effect = (RequirementEffect) entry.getKey();
|
RequirementEffect effect = (RequirementEffect) entry.getKey();
|
||||||
if (effect.mustAttack(game)) {
|
if (effect.mustAttack(game)) {
|
||||||
if (game.getCombat().getMaxAttackers() >= game.getCombat().getCreaturesForcedToAttack().size() && game.getCombat().getDefenders().size() == 1) {
|
if (game.getCombat().getMaxAttackers() >= game.getCombat().getCreaturesForcedToAttack().size()
|
||||||
|
&& game.getCombat().getDefenders().size() == 1) {
|
||||||
return; // we can't change creatures forced to attack if only one possible defender exists and all forced creatures can attack
|
return; // we can't change creatures forced to attack if only one possible defender exists and all forced creatures can attack
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1013,7 +1042,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (possibleDefender != null) {
|
if (possibleDefender != null) {
|
||||||
forcedToAttack = true;
|
forcedToAttack = true;
|
||||||
}
|
}
|
||||||
if (possibleDefender == null || possibleDefender.isEmpty()) {
|
if (possibleDefender == null
|
||||||
|
|| possibleDefender.isEmpty()) {
|
||||||
possibleDefender = defenders;
|
possibleDefender = defenders;
|
||||||
}
|
}
|
||||||
if (possibleDefender.size() == 1) {
|
if (possibleDefender.size() == 1) {
|
||||||
|
@ -1059,7 +1089,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
updateGameStatePriority("selectBlockers", game);
|
updateGameStatePriority("selectBlockers", game);
|
||||||
FilterCreatureForCombatBlock filter = filterCreatureForCombatBlock.copy();
|
FilterCreatureForCombatBlock filter = filterCreatureForCombatBlock.copy();
|
||||||
filter.add(new ControllerIdPredicate(defendingPlayerId));
|
filter.add(new ControllerIdPredicate(defendingPlayerId));
|
||||||
if (game.getBattlefield().count(filter, null, playerId, game) == 0 && !getUserData().getUserSkipPrioritySteps().isStopOnDeclareBlockerIfNoneAvailable()) {
|
if (game.getBattlefield().count(filter, null, playerId, game) == 0
|
||||||
|
&& !getUserData().getUserSkipPrioritySteps().isStopOnDeclareBlockerIfNoneAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (!abort) {
|
while (!abort) {
|
||||||
|
@ -1076,7 +1107,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
// does not block yet and can block or can block more attackers
|
// does not block yet and can block or can block more attackers
|
||||||
if (filter.match(blocker, null, playerId, game)) {
|
if (filter.match(blocker, null, playerId, game)) {
|
||||||
selectCombatGroup(defendingPlayerId, blocker.getId(), game);
|
selectCombatGroup(defendingPlayerId, blocker.getId(), game);
|
||||||
} else if (filterBlock.match(blocker, null, playerId, game) && game.getStack().isEmpty()) {
|
} else if (filterBlock.match(blocker, null, playerId, game)
|
||||||
|
&& game.getStack().isEmpty()) {
|
||||||
removeBlocker = true;
|
removeBlocker = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1240,11 +1272,15 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
|
|
||||||
protected void activateAbility(LinkedHashMap<UUID, ? extends ActivatedAbility> abilities, MageObject object, Game game) {
|
protected void activateAbility(LinkedHashMap<UUID, ? extends ActivatedAbility> abilities, MageObject object, Game game) {
|
||||||
updateGameStatePriority("activateAbility", game);
|
updateGameStatePriority("activateAbility", game);
|
||||||
if (abilities.size() == 1 && suppressAbilityPicker(abilities.values().iterator().next())) {
|
if (abilities.size() == 1
|
||||||
|
&& suppressAbilityPicker(abilities.values().iterator().next())) {
|
||||||
ActivatedAbility ability = abilities.values().iterator().next();
|
ActivatedAbility ability = abilities.values().iterator().next();
|
||||||
if (!ability.getTargets().isEmpty()
|
if (!ability.getTargets().isEmpty()
|
||||||
|| !(ability.getCosts().size() == 1 && ability.getCosts().get(0) instanceof SacrificeSourceCost)
|
|| !(ability.getCosts().size() == 1
|
||||||
|| !(ability.getCosts().size() == 2 && ability.getCosts().get(0) instanceof TapSourceCost && ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
|
&& ability.getCosts().get(0) instanceof SacrificeSourceCost)
|
||||||
|
|| !(ability.getCosts().size() == 2
|
||||||
|
&& ability.getCosts().get(0) instanceof TapSourceCost
|
||||||
|
&& ability.getCosts().get(0) instanceof SacrificeSourceCost)) {
|
||||||
activateAbility(ability, game);
|
activateAbility(ability, game);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1272,7 +1308,8 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (ability instanceof PlayLandAbility) {
|
if (ability instanceof PlayLandAbility) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!ability.getSourceId().equals(getCastSourceIdWithAlternateMana()) && ability.getManaCostsToPay().convertedManaCost() > 0) {
|
if (!ability.getSourceId().equals(getCastSourceIdWithAlternateMana())
|
||||||
|
&& ability.getManaCostsToPay().convertedManaCost() > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return ability instanceof ActivatedManaAbilityImpl;
|
return ability instanceof ActivatedManaAbilityImpl;
|
||||||
|
@ -1288,9 +1325,11 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
MageObject object = game.getObject(ability.getSourceId());
|
MageObject object = game.getObject(ability.getSourceId());
|
||||||
if (object != null) {
|
if (object != null) {
|
||||||
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game);
|
LinkedHashMap<UUID, ActivatedAbility> useableAbilities = getSpellAbilities(object, game.getState().getZone(object.getId()), game);
|
||||||
if (useableAbilities != null && useableAbilities.size() == 1) {
|
if (useableAbilities != null
|
||||||
|
&& useableAbilities.size() == 1) {
|
||||||
return (SpellAbility) useableAbilities.values().iterator().next();
|
return (SpellAbility) useableAbilities.values().iterator().next();
|
||||||
} else if (useableAbilities != null && !useableAbilities.isEmpty()) {
|
} else if (useableAbilities != null
|
||||||
|
&& !useableAbilities.isEmpty()) {
|
||||||
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
game.fireGetChoiceEvent(playerId, name, object, new ArrayList<>(useableAbilities.values()));
|
||||||
waitForResponse(game);
|
waitForResponse(game);
|
||||||
if (response.getUUID() != null) {
|
if (response.getUUID() != null) {
|
||||||
|
@ -1567,7 +1606,7 @@ public class HumanPlayer extends PlayerImpl {
|
||||||
if (!isGameUnderControl()) {
|
if (!isGameUnderControl()) {
|
||||||
priorityPlayerText = " / priority " + game.getPlayer(game.getPriorityPlayerId()).getName();
|
priorityPlayerText = " / priority " + game.getPlayer(game.getPriorityPlayerId()).getName();
|
||||||
}
|
}
|
||||||
if (!chooseUse(Outcome.Detriment, GameLog.getPlayerConfirmColoredText("You have still mana in your mana pool. Pass regardless?")
|
if (!chooseUse(Outcome.Detriment, GameLog.getPlayerConfirmColoredText("You still have mana in your mana pool. Pass regardless?")
|
||||||
+ GameLog.getSmallSecondLineText(activePlayerText + " / " + game.getStep().getType().toString() + priorityPlayerText), null, game)) {
|
+ GameLog.getSmallSecondLineText(activePlayerText + " / " + game.getStep().getType().toString() + priorityPlayerText), null, game)) {
|
||||||
sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, game, null);
|
sendPlayerAction(PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS, game, null);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue