mirror of
https://github.com/magefree/mage.git
synced 2025-12-29 15:02:13 -08:00
* Improved handling of asThoughtAs approval by abilities that allows a clear and easy assignment of the approving effect.
This commit is contained in:
parent
0565d32f55
commit
8105d8b26c
117 changed files with 523 additions and 442 deletions
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import mage.ApprovingObject;
|
||||
import mage.ConditionalMana;
|
||||
import mage.MageObject;
|
||||
import mage.MageObjectReference;
|
||||
|
|
@ -1400,7 +1401,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
protected boolean playManaHandling(Ability ability, ManaCost unpaid, final Game game) {
|
||||
// log.info("paying for " + unpaid.getText());
|
||||
MageObjectReference permittingObject = game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game);
|
||||
ApprovingObject approvingObject = game.getContinuousEffects().asThough(ability.getSourceId(), AsThoughEffectType.SPEND_OTHER_MANA, ability, ability.getControllerId(), game);
|
||||
ManaCost cost;
|
||||
List<MageObject> producers;
|
||||
if (unpaid instanceof ManaCosts) {
|
||||
|
|
@ -1444,7 +1445,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof ColoredManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1459,7 +1460,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof SnowManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1474,7 +1475,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof HybridManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1489,7 +1490,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof MonoHybridManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1504,7 +1505,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof ColorlessManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1519,7 +1520,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
for (ActivatedManaAbilityImpl manaAbility : getManaAbilitiesSortedByManaCount(mageObject, game)) {
|
||||
if (cost instanceof GenericManaCost) {
|
||||
for (Mana netMana : manaAbility.getNetMana(game)) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -1534,7 +1535,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
|
||||
// pay phyrexian life costs
|
||||
if (cost instanceof PhyrexianManaCost) {
|
||||
return cost.pay(null, game, null, playerId, false, null) || permittingObject != null;
|
||||
return cost.pay(null, game, null, playerId, false, null) || approvingObject != null;
|
||||
}
|
||||
|
||||
// pay special mana like convoke cost (tap for pay)
|
||||
|
|
@ -1545,7 +1546,7 @@ public class ComputerPlayer extends PlayerImpl implements Player {
|
|||
ManaOptions specialMana = specialAction == null ? null : specialAction.getManaOptions(ability, game, unpaid);
|
||||
if (specialMana != null) {
|
||||
for (Mana netMana : specialMana) {
|
||||
if (cost.testPay(netMana) || permittingObject != null) {
|
||||
if (cost.testPay(netMana) || approvingObject != null) {
|
||||
if (netMana instanceof ConditionalMana && !((ConditionalMana) netMana).apply(ability, game, getId(), cost)) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue