mirror of
https://github.com/correl/mage.git
synced 2024-11-22 03:00:11 +00:00
[AER] Inspiring Statuary display fix (#9214)
This commit is contained in:
parent
ea6cbcc962
commit
f6ff32e38b
3 changed files with 69 additions and 62 deletions
|
@ -9,6 +9,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -21,13 +22,17 @@ public final class InspiringStatuary extends CardImpl {
|
|||
|
||||
static {
|
||||
filter.add(Predicates.not(CardType.ARTIFACT.getPredicate()));
|
||||
filter.add(Predicates.not(CardType.LAND.getPredicate()));
|
||||
filter.add(Predicates.not(new AbilityPredicate(ImproviseAbility.class))); // So there are not redundant copies being added to each card
|
||||
}
|
||||
|
||||
public InspiringStatuary(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// Non-artifact spells you cast have improvise.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledSpellsEffect(new ImproviseAbility(), filter)));
|
||||
ImproviseAbility improviseAbility = new ImproviseAbility();
|
||||
improviseAbility.setRuleAtTheTop(false);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityControlledSpellsEffect(improviseAbility, filter)));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -41,50 +41,52 @@ public class GainAbilityControlledSpellsEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (player != null && permanent != null) {
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (card.isOwnedBy(source.getControllerId())
|
||||
&& filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
if (player == null || permanent == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// workaround to gain cost reduction abilities to commanders before cast (make it playable)
|
||||
game.getCommanderCardsFromCommandZone(player, CommanderCardType.ANY)
|
||||
.stream()
|
||||
.filter(card -> filter.match(card, game))
|
||||
.forEach(card -> {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
});
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
if (card.isOwnedBy(source.getControllerId())
|
||||
&& filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
}
|
||||
}
|
||||
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
// only spells cast, so no copies of spells
|
||||
if ((stackObject instanceof Spell)
|
||||
&& !stackObject.isCopy()
|
||||
&& stackObject.isControlledBy(source.getControllerId())) {
|
||||
Card card = game.getCard(stackObject.getSourceId());
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
return true;
|
||||
}
|
||||
// workaround to gain cost reduction abilities to commanders before cast (make it playable)
|
||||
game.getCommanderCardsFromCommandZone(player, CommanderCardType.ANY)
|
||||
.stream()
|
||||
.filter(card -> filter.match(card, game))
|
||||
.forEach(card -> {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
});
|
||||
|
||||
for (StackObject stackObject : game.getStack()) {
|
||||
// only spells cast, so no copies of spells
|
||||
if ((stackObject instanceof Spell)
|
||||
&& !stackObject.isCopy()
|
||||
&& stackObject.isControlledBy(source.getControllerId())) {
|
||||
Card card = game.getCard(stackObject.getSourceId());
|
||||
if (filter.match(card, game)) {
|
||||
game.getState().addOtherAbility(card, ability);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false; // TODO: Why is this returning false?
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,28 +153,28 @@ class ImproviseEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Spell spell = game.getStack().getSpell(source.getSourceId());
|
||||
if (controller != null && spell != null) {
|
||||
for (UUID artifactId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent perm = game.getPermanent(artifactId);
|
||||
if (perm == null) {
|
||||
continue;
|
||||
}
|
||||
if (!perm.isTapped() && perm.tap(source, game)) {
|
||||
ManaPool manaPool = controller.getManaPool();
|
||||
manaPool.addMana(Mana.ColorlessMana(1), game, source);
|
||||
manaPool.unlockManaType(ManaType.COLORLESS);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Improvise: " + controller.getLogName() + " taps " + perm.getLogName() + " to pay {1}");
|
||||
}
|
||||
|
||||
// can't use mana abilities after that (improvise cost must be payed after mana abilities only)
|
||||
spell.setCurrentActivatingManaAbilitiesStep(ActivationManaAbilityStep.AFTER);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
if (controller == null || spell == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
for (UUID artifactId : this.getTargetPointer().getTargets(game, source)) {
|
||||
Permanent perm = game.getPermanent(artifactId);
|
||||
if (perm == null) {
|
||||
continue;
|
||||
}
|
||||
if (!perm.isTapped() && perm.tap(source, game)) {
|
||||
ManaPool manaPool = controller.getManaPool();
|
||||
manaPool.addMana(Mana.ColorlessMana(1), game, source);
|
||||
manaPool.unlockManaType(ManaType.COLORLESS);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers("Improvise: " + controller.getLogName() + " taps " + perm.getLogName() + " to pay {1}");
|
||||
}
|
||||
|
||||
// can't use mana abilities after that (improvise cost must be payed after mana abilities only)
|
||||
spell.setCurrentActivatingManaAbilitiesStep(ActivationManaAbilityStep.AFTER);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue