foul-magics/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java
Oleg Agafonov 236cb46125 Additional token fixes for #6032:
- fixed wrong Elemental token images in BFZ's cards (Omnath, Locus of Rage and Seed Guardian);
 - fixed wrong Elemental token image in OGW's cards (Chandra Flamecaller);
 - removed unnecessary tokens from AKH, HOU and EMN (card duplicates);
 - fixed missing Goblin token in DOM;
 - fixed missing Bird Illusion token in GRN;
 - fixed same Zombie token in C19;
2019-11-28 23:42:39 +04:00

63 lines
2.1 KiB
Java

package mage.game.command.emblems;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterPlaneswalkerPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.command.Emblem;
import mage.game.events.GameEvent;
/**
* @author spjspj
*/
public final class GideonOfTheTrialsEmblem extends Emblem {
public GideonOfTheTrialsEmblem() {
this.setName("Emblem Gideon");
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GideonOfTheTrialsCantLoseEffect());
this.getAbilities().add(ability);
}
}
class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl {
private static final FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a Gideon planeswalker");
static {
filter.add(new SubtypePredicate(SubType.GIDEON));
}
public GideonOfTheTrialsCantLoseEffect() {
super(Duration.EndOfGame, Outcome.Benefit, false, false);
staticText = "As long as you control a Gideon planeswalker, you can't lose the game and your opponents can't win the game";
}
public GideonOfTheTrialsCantLoseEffect(final GideonOfTheTrialsCantLoseEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == GameEvent.EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId()))
|| (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId()))) {
return game.getBattlefield().contains(filter, source.getControllerId(), 1, game);
}
return false;
}
@Override
public GideonOfTheTrialsCantLoseEffect copy() {
return new GideonOfTheTrialsCantLoseEffect(this);
}
}