mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
Fix the Licids to use normal AnimateEffect rather than states. Works much better with copy effects and other parts of the game.
This commit is contained in:
@@ -922,7 +922,7 @@ public class GameAction {
|
||||
|
||||
// Check if Card Aura is attached to is a legal target
|
||||
final GameEntity entity = c.getEnchanting();
|
||||
SpellAbility sa = c.getSpells().get(0);
|
||||
SpellAbility sa = c.getFirstAttachSpell();
|
||||
if (c.isBestowed()) {
|
||||
for (SpellAbility s : c.getSpellAbilities()) {
|
||||
if (s.getApi() == ApiType.Attach && s.hasParam("Bestow")) {
|
||||
@@ -939,7 +939,7 @@ public class GameAction {
|
||||
|
||||
if (entity instanceof Card) {
|
||||
final Card perm = (Card) entity;
|
||||
ZoneType tgtZone = tgt.getZone().get(0);
|
||||
final ZoneType tgtZone = tgt.getZone().get(0);
|
||||
|
||||
if (!perm.isInZone(tgtZone) || !perm.canBeEnchantedBy(c, true) || (perm.isPhasedOut() && !c.isPhasedOut())) {
|
||||
c.unEnchantEntity(perm);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package forge.game.ability.effects;
|
||||
|
||||
import forge.GameCommand;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostParser;
|
||||
import forge.game.Game;
|
||||
import forge.game.ability.AbilityFactory;
|
||||
import forge.game.ability.AbilityUtils;
|
||||
@@ -10,6 +12,7 @@ import forge.game.event.GameEventCardStatsChanged;
|
||||
import forge.game.phase.PhaseType;
|
||||
import forge.game.replacement.ReplacementEffect;
|
||||
import forge.game.replacement.ReplacementHandler;
|
||||
import forge.game.spellability.AbilityStatic;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
import forge.game.staticability.StaticAbility;
|
||||
import forge.game.trigger.Trigger;
|
||||
@@ -166,6 +169,11 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
}
|
||||
}
|
||||
|
||||
if (sa.hasParam("RemoveThisAbility") && !removedAbilities.contains(sa)) {
|
||||
c.removeSpellAbility(sa);
|
||||
removedAbilities.add(sa);
|
||||
}
|
||||
|
||||
// give abilities
|
||||
final ArrayList<SpellAbility> addedAbilities = new ArrayList<SpellAbility>();
|
||||
if (abilities.size() > 0) {
|
||||
@@ -307,7 +315,24 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
game.getEndOfTurn().addUntil(unanimate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sa.hasParam("RevertCost")) {
|
||||
final ManaCost cost = new ManaCost(new ManaCostParser(sa.getParam("RevertCost")));
|
||||
final String desc = this.getStackDescription(sa);
|
||||
final SpellAbility revertSA = new AbilityStatic(c, cost) {
|
||||
@Override
|
||||
public void resolve() {
|
||||
unanimate.run();
|
||||
c.removeSpellAbility(this);
|
||||
}
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return cost + ": End Effect: " + desc;
|
||||
}
|
||||
};
|
||||
c.addSpellAbility(revertSA);
|
||||
}
|
||||
|
||||
game.fireEvent(new GameEventCardStatsChanged(c));
|
||||
}
|
||||
} // animateResolve extends SpellEffect {
|
||||
|
||||
@@ -2651,6 +2651,20 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return sas.isEmpty() ? null : sas.get(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first {@link SpellAbility} marked as a Spell with API type
|
||||
* {@link ApiType#Attach} in this {@link Card}, or {@code null} if no such
|
||||
* object exists.
|
||||
* @see SpellAbility#isSpell()
|
||||
*/
|
||||
public final SpellAbility getFirstAttachSpell() {
|
||||
for (final SpellAbility sa : this.getSpells()) {
|
||||
if (sa.isSpell() && sa.getApi() == ApiType.Attach) {
|
||||
return sa;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -8526,7 +8540,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
* @return a boolean
|
||||
*/
|
||||
public final boolean canBeEnchantedBy(final Card aura, final boolean checkSBA) {
|
||||
SpellAbility sa = aura.getFirstSpellAbility();
|
||||
SpellAbility sa = aura.getFirstAttachSpell();
|
||||
if (aura.isBestowed()) {
|
||||
for (SpellAbility s : aura.getSpellAbilities()) {
|
||||
if (s.getApi() == ApiType.Attach && s.hasParam("Bestow")) {
|
||||
|
||||
Reference in New Issue
Block a user