forked from External/mage
Conditional mana - fixed that some mana cant be used for paying “counter unless” cost and other things (#11447)
* Add tests for conditional mana usage with soft counterspells * Fix "to cast" conditions on common ManaCondition classes * Add fix to all remaining ManaCondition classes * SimpleActivatedAbilityConditionalMana is tested to pay for a soft counterspell activated ability * Remove now-unused imports
This commit is contained in:
parent
2cc9957753
commit
e43e918c67
30 changed files with 81 additions and 55 deletions
|
|
@ -42,7 +42,7 @@ class InstantOrSorceryCastManaCondition extends ManaCondition implements Conditi
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
if (source instanceof SpellAbility && !source.isActivated()) {
|
||||
MageObject object = game.getObject(source);
|
||||
return object != null && object.isInstantOrSorcery(game);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class SimpleActivatedAbilityManaBuilder extends ConditionalManaBuilder {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Spend this mana only to activate simple abilities";
|
||||
return "Spend this mana only to activate or pay for simple abilities";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +34,7 @@ class SimpleActivatedAbilityConditionalMana extends ConditionalMana {
|
|||
|
||||
public SimpleActivatedAbilityConditionalMana(Mana mana) {
|
||||
super(mana);
|
||||
staticText = "Spend this mana only to activate simple abilities";
|
||||
staticText = "Spend this mana only to activate or pay for simple abilities";
|
||||
addCondition(new SimpleActivatedAbilityManaCondition());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class SpellCastManaCondition extends ManaCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
if (source instanceof SpellAbility && !source.isActivated()) {
|
||||
MageObject object = game.getObject(source);
|
||||
if ((object instanceof StackObject)) {
|
||||
return filter.match((StackObject) object, source.getControllerId(), source, game);
|
||||
|
|
|
|||
|
|
@ -16,11 +16,9 @@ public class CreatureCastManaCondition extends ManaCondition implements Conditio
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
if (source instanceof SpellAbility && !source.isActivated()) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isCreature(game)) {
|
||||
return true;
|
||||
}
|
||||
return object != null && object.isCreature(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,11 +17,9 @@ public class PlaneswalkerCastManaCondition extends ManaCondition implements Cond
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (source instanceof SpellAbility) {
|
||||
if (source instanceof SpellAbility && !source.isActivated()) {
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isPlaneswalker(game)) {
|
||||
return true;
|
||||
}
|
||||
return object != null && object.isPlaneswalker(game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,14 +73,11 @@ class PowerstoneTokenManaCondition extends ManaCondition implements Condition {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
if (!(source instanceof SpellAbility)) {
|
||||
if (!(source instanceof SpellAbility) || source.isActivated()) {
|
||||
return true;
|
||||
}
|
||||
MageObject object = game.getObject(source);
|
||||
if (object != null && object.isArtifact(game)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return object != null && object.isArtifact(game);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue