mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Using the common WinGameEffect in some cards.
This commit is contained in:
parent
1deebdb3f6
commit
d07839fcb4
4 changed files with 14 additions and 87 deletions
|
@ -29,7 +29,6 @@ package mage.sets.ninthedition;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.TargetController;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -37,7 +36,7 @@ import mage.abilities.TriggeredAbility;
|
|||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.WinGameEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
@ -55,7 +54,7 @@ public class BattleOfWits extends CardImpl<BattleOfWits> {
|
|||
this.color.setBlue(true);
|
||||
|
||||
// At the beginning of your upkeep, if you have 200 or more cards in your library, you win the game.
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new BattleOfWitsEffect(), TargetController.YOU, false);
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameEffect(), TargetController.YOU, false);
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, new BattleOfWitsCondition(), "At the beginning of your upkeep, if you have 200 or more cards in your library, you win the game."));
|
||||
}
|
||||
|
||||
|
@ -80,30 +79,3 @@ class BattleOfWitsCondition implements Condition {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class BattleOfWitsEffect extends OneShotEffect<BattleOfWitsEffect> {
|
||||
|
||||
public BattleOfWitsEffect() {
|
||||
super(Outcome.Win);
|
||||
this.staticText = "you win the game";
|
||||
}
|
||||
|
||||
public BattleOfWitsEffect(final BattleOfWitsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattleOfWitsEffect copy() {
|
||||
return new BattleOfWitsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.won(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,11 +32,13 @@ import mage.Constants;
|
|||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.common.WinGameEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,7 +53,8 @@ public class NearDeathExperience extends CardImpl<NearDeathExperience> {
|
|||
this.color.setWhite(true);
|
||||
|
||||
// At the beginning of your upkeep, if you have exactly 1 life, you win the game.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Constants.Zone.BATTLEFIELD, new NearDeathExperienceEffect(), Constants.TargetController.YOU, false));
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameEffect(), Constants.TargetController.YOU, false);
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, new OneLifeCondition(), "At the beginning of your upkeep, if you have exactly 1 life, you win the game."));
|
||||
}
|
||||
|
||||
public NearDeathExperience(final NearDeathExperience card) {
|
||||
|
@ -64,30 +67,10 @@ public class NearDeathExperience extends CardImpl<NearDeathExperience> {
|
|||
}
|
||||
}
|
||||
|
||||
class NearDeathExperienceEffect extends OneShotEffect<NearDeathExperienceEffect> {
|
||||
|
||||
public NearDeathExperienceEffect() {
|
||||
super(Constants.Outcome.Win);
|
||||
this.staticText = "you win the game";
|
||||
}
|
||||
|
||||
public NearDeathExperienceEffect(final NearDeathExperienceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NearDeathExperienceEffect copy() {
|
||||
return new NearDeathExperienceEffect(this);
|
||||
}
|
||||
class OneLifeCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
if (you != null && you.getLife() == 1) {
|
||||
you.won(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return game.getPlayer(source.getControllerId()).getLife() == 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,6 @@ package mage.sets.zendikar;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Outcome;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.Constants.TargetController;
|
||||
import mage.MageInt;
|
||||
|
@ -38,12 +37,11 @@ import mage.abilities.TriggeredAbility;
|
|||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.abilities.effects.common.WinGameEffect;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -64,7 +62,7 @@ public class FelidarSovereign extends CardImpl<FelidarSovereign> {
|
|||
this.addAbility(VigilanceAbility.getInstance());
|
||||
this.addAbility(LifelinkAbility.getInstance());
|
||||
// At the beginning of your upkeep, if you have 40 or more life, you win the game.
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new FelidarSovereignEffect(), TargetController.YOU, false);
|
||||
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(new WinGameEffect(), TargetController.YOU, false);
|
||||
this.addAbility(new ConditionalTriggeredAbility(ability, new FortyOrMoreLifeCondition(), "At the beginning of your upkeep, if you have 40 or more life, you win the game."));
|
||||
|
||||
}
|
||||
|
@ -86,30 +84,3 @@ class FortyOrMoreLifeCondition implements Condition {
|
|||
return game.getPlayer(source.getControllerId()).getLife() >= 40;
|
||||
}
|
||||
}
|
||||
|
||||
class FelidarSovereignEffect extends OneShotEffect<FelidarSovereignEffect> {
|
||||
|
||||
public FelidarSovereignEffect() {
|
||||
super(Outcome.Win);
|
||||
this.staticText = "you win the game";
|
||||
}
|
||||
|
||||
public FelidarSovereignEffect(final FelidarSovereignEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FelidarSovereignEffect copy() {
|
||||
return new FelidarSovereignEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
player.won(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ Unleash|new|
|
|||
Deathtouch|instance|
|
||||
Defender|instance|
|
||||
Double Strike|instance|
|
||||
Extort|new|
|
||||
Fear|instance|
|
||||
First strike|instance|
|
||||
Flash|instance|
|
||||
|
|
Loading…
Reference in a new issue