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:
ssk97 2023-11-22 13:37:45 -08:00 committed by GitHub
parent 2cc9957753
commit e43e918c67
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
30 changed files with 81 additions and 55 deletions

View file

@ -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);
}

View file

@ -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());
}
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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