mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
Fix hasManaAbility
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
package forge.game;
|
package forge.game;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import forge.card.ColorSet;
|
import forge.card.ColorSet;
|
||||||
import forge.card.MagicColor;
|
import forge.card.MagicColor;
|
||||||
import forge.card.mana.ManaAtom;
|
import forge.card.mana.ManaAtom;
|
||||||
@@ -11,7 +13,10 @@ import forge.game.cost.Cost;
|
|||||||
import forge.game.mana.ManaCostBeingPaid;
|
import forge.game.mana.ManaCostBeingPaid;
|
||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.spellability.SpellAbility;
|
import forge.game.spellability.SpellAbility;
|
||||||
|
import forge.game.spellability.SpellAbilityPredicates;
|
||||||
import forge.game.staticability.StaticAbility;
|
import forge.game.staticability.StaticAbility;
|
||||||
|
import forge.game.trigger.Trigger;
|
||||||
|
import forge.game.trigger.WrappedAbility;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Expressions;
|
import forge.util.Expressions;
|
||||||
|
|
||||||
@@ -102,8 +107,12 @@ public class ForgeScript {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (property.equals("hasManaAbility")) {
|
} else if (property.equals("hasManaAbility")) {
|
||||||
for (final SpellAbility sa : cardState.getSpellAbilities()) {
|
if (Iterables.any(cardState.getSpellAbilities(), SpellAbilityPredicates.isManaAbility())) {
|
||||||
if (sa.isManaAbility()) {
|
return true;
|
||||||
|
}
|
||||||
|
for (final Trigger trig : cardState.getTriggers()) {
|
||||||
|
WrappedAbility wrap = new WrappedAbility(trig, trig.getOverridingAbility(), sourceController);
|
||||||
|
if (wrap.isManaAbility()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -364,11 +364,12 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
if (isPwAbility()) {
|
if (isPwAbility()) {
|
||||||
return false; //Loyalty ability, not a mana ability.
|
return false; //Loyalty ability, not a mana ability.
|
||||||
}
|
}
|
||||||
|
// CR 605.1b
|
||||||
if (isWrapper() && this.getTrigger().getMode() != TriggerType.TapsForMana) {
|
if (isWrapper() && this.getTrigger().getMode() != TriggerType.TapsForMana) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellAbility tail = this;
|
SpellAbility tail = isWrapper() ? ((WrappedAbility) this).getWrappedAbility() : this;
|
||||||
while (tail != null) {
|
while (tail != null) {
|
||||||
if (tail.manaPart != null) {
|
if (tail.manaPart != null) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user