mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 11:02:00 -08:00
* Qasali Ambusher - fixed that it can't be casted without mana cost and with flash (#6540)
This commit is contained in:
parent
9d25cd0aa9
commit
e4acf7affb
1 changed files with 29 additions and 61 deletions
|
|
@ -2,16 +2,22 @@ package mage.cards.q;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.CompoundCondition;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.AttackedThisStepCondition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.costs.AlternativeCostSourceAbility;
|
||||
import mage.abilities.decorator.ConditionalAsThoughEffect;
|
||||
import mage.abilities.effects.common.continuous.CastAsThoughItHadFlashSourceEffect;
|
||||
import mage.abilities.keyword.ReachAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.combat.CombatGroup;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.watchers.common.PlayerAttackedStepWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -19,6 +25,18 @@ import mage.game.combat.CombatGroup;
|
|||
*/
|
||||
public final class QasaliAmbusher extends CardImpl {
|
||||
|
||||
private static final FilterControlledPermanent filterForest = new FilterControlledPermanent();
|
||||
private static final FilterControlledPermanent filterPlains = new FilterControlledPermanent();
|
||||
|
||||
static {
|
||||
filterForest.add(SubType.FOREST.getPredicate());
|
||||
filterPlains.add(SubType.PLAINS.getPredicate());
|
||||
}
|
||||
|
||||
private static final Condition condition =
|
||||
new CompoundCondition("If a creature is attacking you and you control a Forest and a Plains",
|
||||
AttackedThisStepCondition.instance, new PermanentsOnTheBattlefieldCondition(filterForest), new PermanentsOnTheBattlefieldCondition(filterPlains));
|
||||
|
||||
public QasaliAmbusher(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{W}");
|
||||
this.subtype.add(SubType.CAT);
|
||||
|
|
@ -30,10 +48,13 @@ public final class QasaliAmbusher extends CardImpl {
|
|||
// Reach
|
||||
this.addAbility(ReachAbility.getInstance());
|
||||
|
||||
// If a creature is attacking you and you control a Forest and a Plains,
|
||||
// If a creature is attacking you and you control a Forest and a Plains,
|
||||
// you may cast Qasali Ambusher without paying its mana cost and as though it had flash.
|
||||
this.addAbility(new QasaliAmbusherAbility());
|
||||
|
||||
Ability ability = new AlternativeCostSourceAbility(null, condition);
|
||||
ability.addEffect(new ConditionalAsThoughEffect(new CastAsThoughItHadFlashSourceEffect(Duration.EndOfGame), condition)
|
||||
.setText("you may cast {this} without paying its mana cost and as though it had flash"));
|
||||
ability.addWatcher(new PlayerAttackedStepWatcher());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public QasaliAmbusher(final QasaliAmbusher card) {
|
||||
|
|
@ -44,57 +65,4 @@ public final class QasaliAmbusher extends CardImpl {
|
|||
public QasaliAmbusher copy() {
|
||||
return new QasaliAmbusher(this);
|
||||
}
|
||||
}
|
||||
|
||||
class QasaliAmbusherAbility extends ActivatedAbilityImpl {
|
||||
|
||||
private static final FilterControlledLandPermanent filterPlains = new FilterControlledLandPermanent();
|
||||
private static final FilterControlledLandPermanent filterForest = new FilterControlledLandPermanent();
|
||||
|
||||
static {
|
||||
filterPlains.add(SubType.PLAINS.getPredicate());
|
||||
filterForest.add(SubType.FOREST.getPredicate());
|
||||
}
|
||||
|
||||
public QasaliAmbusherAbility() {
|
||||
super(Zone.HAND, new CastAsThoughItHadFlashSourceEffect(Duration.EndOfGame), new ManaCostsImpl());
|
||||
this.timing = TimingRule.INSTANT;
|
||||
this.usesStack = false;
|
||||
}
|
||||
|
||||
public QasaliAmbusherAbility(final QasaliAmbusherAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public QasaliAmbusherAbility copy() {
|
||||
return new QasaliAmbusherAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActivationStatus canActivate(UUID playerId, Game game) {
|
||||
if (!game.getBattlefield().getActivePermanents(filterPlains,
|
||||
this.getControllerId(), this.getSourceId(), game).isEmpty()
|
||||
&& !game.getBattlefield().getActivePermanents(filterForest,
|
||||
this.getControllerId(), this.getSourceId(), game).isEmpty()) {
|
||||
for (CombatGroup group : game.getCombat().getGroups()) {
|
||||
if (isControlledBy(group.getDefenderId())) {
|
||||
return super.canActivate(playerId, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ActivationStatus.getFalse();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule(boolean all) {
|
||||
return this.getRule();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "If a creature is attacking you and you control a Forest and "
|
||||
+ "a Plains, you may cast {this} without paying its mana "
|
||||
+ "cost and as though it had flash.";
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue