forked from External/mage
[FDN] Implement Herald of Eternal Dawn
This commit is contained in:
parent
311c92ad8c
commit
482fbf0d0c
7 changed files with 119 additions and 166 deletions
|
|
@ -0,0 +1,49 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class CantLoseGameSourceControllerEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public CantLoseGameSourceControllerEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false);
|
||||
staticText = "you can't lose the game and your opponents can't win the game";
|
||||
}
|
||||
|
||||
private CantLoseGameSourceControllerEffect(final CantLoseGameSourceControllerEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantLoseGameSourceControllerEffect copy() {
|
||||
return new CantLoseGameSourceControllerEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
switch (event.getType()) {
|
||||
case WINS:
|
||||
case LOSES:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
switch (event.getType()) {
|
||||
case WINS:
|
||||
return game.getOpponents(source.getControllerId()).contains(event.getPlayerId());
|
||||
case LOSES:
|
||||
return source.isControlledBy(event.getPlayerId());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,26 +1,31 @@
|
|||
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.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousRuleModifyingEffect;
|
||||
import mage.abilities.effects.common.continuous.CantLoseGameSourceControllerEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterPlaneswalkerPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class GideonOfTheTrialsEmblem extends Emblem {
|
||||
|
||||
private static final Condition condition = new PermanentsOnTheBattlefieldCondition(
|
||||
new FilterPlaneswalkerPermanent(SubType.GIDEON), true
|
||||
);
|
||||
|
||||
public GideonOfTheTrialsEmblem() {
|
||||
super("Emblem Gideon");
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new GideonOfTheTrialsCantLoseEffect());
|
||||
this.getAbilities().add(ability);
|
||||
this.getAbilities().add(new SimpleStaticAbility(
|
||||
Zone.COMMAND,
|
||||
new ConditionalContinuousRuleModifyingEffect(new CantLoseGameSourceControllerEffect(), condition)
|
||||
.setText("as long as you control a Gideon planeswalker, you can't lose the game and your opponents can't win the game")
|
||||
));
|
||||
}
|
||||
|
||||
private GideonOfTheTrialsEmblem(final GideonOfTheTrialsEmblem card) {
|
||||
|
|
@ -32,41 +37,3 @@ public final class GideonOfTheTrialsEmblem extends Emblem {
|
|||
return new GideonOfTheTrialsEmblem(this);
|
||||
}
|
||||
}
|
||||
|
||||
class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
private static final FilterPlaneswalkerPermanent filter = new FilterPlaneswalkerPermanent("a Gideon planeswalker");
|
||||
|
||||
static {
|
||||
filter.add(SubType.GIDEON.getPredicate());
|
||||
}
|
||||
|
||||
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";
|
||||
}
|
||||
|
||||
protected GideonOfTheTrialsCantLoseEffect(final GideonOfTheTrialsCantLoseEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.WINS
|
||||
|| event.getType() == GameEvent.EventType.LOSES;
|
||||
}
|
||||
|
||||
@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().containsControlled(filter, source, game, 1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GideonOfTheTrialsCantLoseEffect copy() {
|
||||
return new GideonOfTheTrialsCantLoseEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue