mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Fixed ForbiddenOrchard triggered ability laso to trigger if ForbiddenOrchad gains another mana ability. Using framework effect within Guttersnipe.
This commit is contained in:
parent
93a8c58f3c
commit
794a4c7179
2 changed files with 42 additions and 42 deletions
|
@ -32,16 +32,19 @@ package mage.sets.championsofkamigawa;
|
|||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.Constants.Zone;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.CreateTokenTargetEffect;
|
||||
import mage.abilities.mana.AnyColorManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.token.SpiritToken;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ForbiddenOrchard extends CardImpl<ForbiddenOrchard> {
|
||||
|
||||
|
@ -49,11 +52,9 @@ public class ForbiddenOrchard extends CardImpl<ForbiddenOrchard> {
|
|||
super(ownerId, 276, "Forbidden Orchard", Rarity.RARE, new CardType[]{CardType.LAND}, null);
|
||||
this.expansionSetCode = "CHK";
|
||||
// {T}: Add one mana of any color to your mana pool.
|
||||
Ability ability = new AnyColorManaAbility();
|
||||
this.addAbility(new AnyColorManaAbility());
|
||||
// Whenever you tap Forbidden Orchard for mana, put a 1/1 colorless Spirit creature token onto the battlefield under target opponent's control.
|
||||
ability.addEffect(new CreateTokenTargetEffect(new SpiritToken()));
|
||||
ability.addTarget(new TargetOpponent());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new ForbiddenOrchardTriggeredAbility());
|
||||
}
|
||||
|
||||
public ForbiddenOrchard (final ForbiddenOrchard card) {
|
||||
|
@ -65,3 +66,34 @@ public class ForbiddenOrchard extends CardImpl<ForbiddenOrchard> {
|
|||
return new ForbiddenOrchard(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ForbiddenOrchardTriggeredAbility extends TriggeredAbilityImpl<ForbiddenOrchardTriggeredAbility> {
|
||||
|
||||
public ForbiddenOrchardTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CreateTokenTargetEffect(new SpiritToken()));
|
||||
this.addTarget(new TargetOpponent(true));
|
||||
}
|
||||
|
||||
public ForbiddenOrchardTriggeredAbility(final ForbiddenOrchardTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.TAPPED_FOR_MANA && event.getSourceId().equals(getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("Whenever you tap {this} for mana, ").append(super.getRule()).toString() ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ForbiddenOrchardTriggeredAbility copy() {
|
||||
return new ForbiddenOrchardTriggeredAbility(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,10 +32,12 @@ import java.util.UUID;
|
|||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.TargetController;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SpellCastTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.predicate.Predicates;
|
||||
|
@ -67,7 +69,7 @@ public class Guttersnipe extends CardImpl<Guttersnipe> {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever you cast an instant or sorcery spell, Guttersnipe deals 2 damage to each opponent.
|
||||
this.addAbility(new SpellCastTriggeredAbility(new GuttersnipeEffect(), filter, false));
|
||||
this.addAbility(new SpellCastTriggeredAbility(new DamagePlayersEffect(2, TargetController.OPPONENT), filter, false));
|
||||
}
|
||||
|
||||
public Guttersnipe (final Guttersnipe card) {
|
||||
|
@ -78,38 +80,4 @@ public class Guttersnipe extends CardImpl<Guttersnipe> {
|
|||
public Guttersnipe copy() {
|
||||
return new Guttersnipe(this);
|
||||
}
|
||||
|
||||
private class GuttersnipeEffect extends OneShotEffect<GuttersnipeEffect> {
|
||||
|
||||
public GuttersnipeEffect() {
|
||||
super(Constants.Outcome.Damage);
|
||||
staticText = "{this} deals 2 damage to each opponent";
|
||||
}
|
||||
|
||||
public GuttersnipeEffect(final GuttersnipeEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
if (playerId != source.getControllerId()) {
|
||||
Player opponent = game.getPlayer(playerId);
|
||||
if (opponent != null) {
|
||||
opponent.damage(2, source.getId(), game, false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuttersnipeEffect copy() {
|
||||
return new GuttersnipeEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue