mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #3882 from theelk801/master
Fixed bugs, implemented Oath of Mages and Oath of Ghouls
This commit is contained in:
commit
42d9312599
16 changed files with 422 additions and 71 deletions
|
@ -80,7 +80,7 @@ public class MathasFiendSeeker extends CardImpl {
|
|||
// At the beginning of your end step, put a bounty counter on target creature an opponent controls. For as long as that creature has a bounty counter on it, it has "When this creature dies, each opponent draws a card and gains 2 life."
|
||||
Ability ability = new BeginningOfYourEndStepTriggeredAbility(new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()), false);
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
Ability ability2 = new DiesTriggeredAbility(new DrawCardAllEffect(2, TargetController.OPPONENT));
|
||||
Ability ability2 = new DiesTriggeredAbility(new DrawCardAllEffect(1, TargetController.OPPONENT));
|
||||
ability2.addEffect(new OpponentsGainLifeEffect());
|
||||
Effect effect = new MathasFiendSeekerGainAbilityEffect(
|
||||
ability2,
|
||||
|
|
|
@ -89,7 +89,7 @@ public class NimDeathmantle extends CardImpl {
|
|||
class NimDeathmantleTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
NimDeathmantleTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new NimDeathmantleEffect(), true);
|
||||
super(Zone.BATTLEFIELD, new NimDeathmantleEffect(), false);
|
||||
}
|
||||
|
||||
NimDeathmantleTriggeredAbility(NimDeathmantleTriggeredAbility ability) {
|
||||
|
|
|
@ -63,10 +63,10 @@ public class OathOfDruids extends CardImpl {
|
|||
}
|
||||
|
||||
public OathOfDruids(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who controls more creatures than he or she does and is his or her opponent. The first player may reveal cards from the top of his or her library until he or she reveals a creature card. If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, true);
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfDruidsEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
originalId = ability.getOriginalId();
|
||||
this.addAbility(ability);
|
||||
|
@ -77,9 +77,11 @@ public class OathOfDruids extends CardImpl {
|
|||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.setControllerId(activePlayer.getId());
|
||||
ability.getTargets().clear();
|
||||
// FilterPlayer filter = new FilterPlayer();
|
||||
// filter.add(new OathOfDruidsPredicate());
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +110,7 @@ class OathOfDruidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
if (targetPlayer == null || activePlayerId == null) {
|
||||
return false;
|
||||
}
|
||||
if (targetPlayer.getId().equals(activePlayerId)) {
|
||||
if (!targetPlayer.hasOpponent(activePlayerId, game)) {
|
||||
return false;
|
||||
}
|
||||
int countTargetPlayer = game.getBattlefield().countAll(filter, targetPlayer.getId(), game);
|
||||
|
@ -119,7 +121,7 @@ class OathOfDruidsPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "player who controls more creatures than he or she does";
|
||||
return "player who controls more creatures than he or she does and is his or her opponent";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,7 +129,9 @@ class OathOfDruidsEffect extends OneShotEffect {
|
|||
|
||||
public OathOfDruidsEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
staticText = "that player chooses target player who controls more creatures than he or she does and is his or her opponent. The first player may reveal cards from the top of his or her library until he or she reveals a creature card. If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard";
|
||||
staticText = "that player chooses target player who controls more creatures than he or she does and is his or her opponent. "
|
||||
+ "The first player may reveal cards from the top of his or her library until he or she reveals a creature card. "
|
||||
+ "If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard";
|
||||
}
|
||||
|
||||
public OathOfDruidsEffect(OathOfDruidsEffect effect) {
|
||||
|
@ -137,16 +141,19 @@ class OathOfDruidsEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null || sourceObject == null) {
|
||||
Player player = game.getPlayer(game.getActivePlayerId());
|
||||
if (player == null || sourceObject == null) {
|
||||
return false;
|
||||
}
|
||||
Cards revealed = new CardsImpl();
|
||||
Card creatureCard = null;
|
||||
Cards nonCreatureCards = new CardsImpl();
|
||||
if (!player.chooseUse(Outcome.Benefit, "Use this ability?", source, game)) {
|
||||
return true;
|
||||
}
|
||||
//The first player may reveal cards from the top of his or her library
|
||||
while (creatureCard == null && controller.getLibrary().hasCards()) {
|
||||
Card card = controller.getLibrary().removeFromTop(game);
|
||||
while (creatureCard == null && player.getLibrary().hasCards()) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
revealed.add(card);
|
||||
// until he or she reveals a creature card.
|
||||
if (card.isCreature()) {
|
||||
|
@ -155,14 +162,14 @@ class OathOfDruidsEffect extends OneShotEffect {
|
|||
nonCreatureCards.add(card);
|
||||
}
|
||||
}
|
||||
controller.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
player.revealCards(sourceObject.getIdName(), revealed, game);
|
||||
|
||||
//If he or she does, that player puts that card onto the battlefield
|
||||
if (creatureCard != null) {
|
||||
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);
|
||||
player.moveCards(creatureCard, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
// and all other cards revealed this way into his or her graveyard
|
||||
controller.moveCards(nonCreatureCards, Zone.GRAVEYARD, source, game);
|
||||
player.moveCards(nonCreatureCards, Zone.GRAVEYARD, source, game);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
177
Mage.Sets/src/mage/cards/o/OathOfGhouls.java
Normal file
177
Mage.Sets/src/mage/cards/o/OathOfGhouls.java
Normal file
|
@ -0,0 +1,177 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.other.OwnerIdPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class OathOfGhouls extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfGhoulsPredicate());
|
||||
}
|
||||
|
||||
public OathOfGhouls(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player whose graveyard has fewer creature cards in it than his or her graveyard does and is his or her opponent. The first player may return a creature card from his or her graveyard to his or her hand.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfGhoulsEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfGhouls(final OathOfGhouls card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OathOfGhouls copy() {
|
||||
return new OathOfGhouls(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfGhoulsPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("creature cards");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
|
||||
Player targetPlayer = input.getObject();
|
||||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (targetPlayer == null
|
||||
|| firstPlayer == null
|
||||
|| !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
int countGraveyardTargetPlayer = targetPlayer.getGraveyard().getCards(filter, game).size();
|
||||
int countGraveyardFirstPlayer = firstPlayer.getGraveyard().getCards(filter, game).size();
|
||||
|
||||
return countGraveyardTargetPlayer < countGraveyardFirstPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "player whose graveyard has fewer creature cards in it than his or her graveyard does and is his or her opponent";
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfGhoulsEffect extends OneShotEffect {
|
||||
|
||||
// private static final FilterCard filter = new FilterCard("creature card");
|
||||
//
|
||||
// static {
|
||||
// filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
// filter.add(new OwnerPredicate(TargetController.ACTIVE));
|
||||
// }
|
||||
|
||||
public OathOfGhoulsEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "that player chooses target player whose graveyard has fewer creature cards in it than his or her graveyard does and is his or her opponent. The first player may return a creature card from his or her graveyard to his or her hand";
|
||||
}
|
||||
|
||||
public OathOfGhoulsEffect(OathOfGhoulsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (sourceObject == null || firstPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
FilterCard filter = new FilterCreatureCard("creature card");
|
||||
filter.add(new OwnerIdPredicate(firstPlayer.getId()));
|
||||
Target target = new TargetCardInGraveyard(filter);
|
||||
target.setNotTarget(true);
|
||||
// target.setTargetController(firstPlayer.getId());
|
||||
if (target.canChoose(source.getSourceId(),firstPlayer.getId(), game)
|
||||
&& firstPlayer.chooseUse(outcome, "Return a creature card from your graveyard to your hand?", source, game)
|
||||
&& firstPlayer.chooseTarget(Outcome.ReturnToHand, target, source, game)) {
|
||||
Card card = game.getCard(target.getFirstTarget());
|
||||
if (card != null) {
|
||||
firstPlayer.moveCards(card, Zone.HAND, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OathOfGhoulsEffect copy() {
|
||||
return new OathOfGhoulsEffect(this);
|
||||
}
|
||||
}
|
|
@ -56,16 +56,15 @@ import java.util.UUID;
|
|||
*/
|
||||
public class OathOfLieges extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer FILTER = new FilterPlayer("player who controls more lands than you do and is your opponent");
|
||||
|
||||
static {
|
||||
FILTER.add(new OathOfLiegesPredicate());
|
||||
}
|
||||
|
||||
private final UUID originalId;
|
||||
|
||||
public OathOfLieges(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfLiegesEffect(), TargetController.ANY, false);
|
||||
|
@ -74,11 +73,6 @@ public class OathOfLieges extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public OathOfLieges(final OathOfLieges card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
|
@ -92,6 +86,11 @@ public class OathOfLieges extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
public OathOfLieges(final OathOfLieges card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OathOfLieges copy() {
|
||||
return new OathOfLieges(this);
|
||||
|
@ -102,7 +101,8 @@ class OathOfLiegesEffect extends OneShotEffect {
|
|||
|
||||
public OathOfLiegesEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "that player chooses target player who controls more lands than he or she does and is his or her opponent. The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library";
|
||||
this.staticText = "that player chooses target player who controls more lands than he or she does and is his or her opponent. "
|
||||
+ "The first player may search his or her library for a basic land card, put that card onto the battlefield, then shuffle his or her library";
|
||||
}
|
||||
|
||||
public OathOfLiegesEffect(final OathOfLiegesEffect effect) {
|
||||
|
@ -142,7 +142,7 @@ class OathOfLiegesPredicate implements ObjectSourcePlayerPredicate<ObjectSourceP
|
|||
if (targetPlayer == null || activePlayerId == null) {
|
||||
return false;
|
||||
}
|
||||
if (targetPlayer.getId().equals(activePlayerId) || !targetPlayer.hasOpponent(activePlayerId, game)) {
|
||||
if (!targetPlayer.hasOpponent(activePlayerId, game)) {
|
||||
return false;
|
||||
}
|
||||
int countTargetPlayer = game.getBattlefield().countAll(FILTER, targetPlayer.getId(), game);
|
||||
|
|
146
Mage.Sets/src/mage/cards/o/OathOfMages.java
Normal file
146
Mage.Sets/src/mage/cards/o/OathOfMages.java
Normal file
|
@ -0,0 +1,146 @@
|
|||
/*
|
||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are
|
||||
* permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* The views and conclusions contained in the software and documentation are those of the
|
||||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class OathOfMages extends CardImpl {
|
||||
|
||||
private final UUID originalId;
|
||||
private static final FilterPlayer filter = new FilterPlayer();
|
||||
|
||||
static {
|
||||
filter.add(new OathOfMagesPredicate());
|
||||
}
|
||||
|
||||
public OathOfMages(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player chooses target player who has more life than he or she does and is his or her opponent. The first player may have Oath of Mages deal 1 damage to the second player.
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new OathOfMagesEffect(), TargetController.ANY, false);
|
||||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public OathOfMages(final OathOfMages card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OathOfMages copy() {
|
||||
return new OathOfMages(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfMagesPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Player>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Player> input, Game game) {
|
||||
Player targetPlayer = input.getObject();
|
||||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (targetPlayer == null
|
||||
|| firstPlayer == null
|
||||
|| !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
int lifeTotalTargetPlayer = targetPlayer.getLife();
|
||||
int lifeTotalFirstPlayer = firstPlayer.getLife();
|
||||
|
||||
return lifeTotalTargetPlayer > lifeTotalFirstPlayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "player who has more life than he or she does and is his or her opponent";
|
||||
}
|
||||
}
|
||||
|
||||
class OathOfMagesEffect extends OneShotEffect {
|
||||
|
||||
public OathOfMagesEffect() {
|
||||
super(Outcome.Damage);
|
||||
staticText = "that player chooses target player who has more life than he or she does and is his or her opponent. The first player may have Oath of Mages deal 1 damage to the second player";
|
||||
}
|
||||
|
||||
public OathOfMagesEffect(OathOfMagesEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
Player secondPlayer = game.getPlayer(source.getFirstTarget());
|
||||
if (sourceObject == null || firstPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if (firstPlayer.chooseUse(outcome, "Deal one damage to " + secondPlayer.getLogName() + "?", source, game)) {
|
||||
secondPlayer.damage(1, source.getId(), game, false, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OathOfMagesEffect copy() {
|
||||
return new OathOfMagesEffect(this);
|
||||
}
|
||||
}
|
|
@ -65,7 +65,7 @@ public class OathOfScholars extends CardImpl {
|
|||
ability.addTarget(new TargetPlayer(1, 1, false, filter));
|
||||
this.addAbility(ability);
|
||||
originalId = ability.getOriginalId();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,9 +73,9 @@ public class OathOfScholars extends CardImpl {
|
|||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.setControllerId(activePlayer.getId());
|
||||
ability.getTargets().clear();
|
||||
TargetPlayer target = new TargetPlayer(1, 1, false, filter);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,7 @@ class OathOfScholarsPredicate implements ObjectSourcePlayerPredicate<ObjectSourc
|
|||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (targetPlayer == null
|
||||
|| firstPlayer == null
|
||||
|| targetPlayer.getId().equals(firstPlayer.getId())
|
||||
|| !game.getOpponents(targetPlayer.getId()).contains(firstPlayer.getId())) {
|
||||
|| !firstPlayer.hasOpponent(targetPlayer.getId(), game)) {
|
||||
return false;
|
||||
}
|
||||
int countHandTargetPlayer = targetPlayer.getHand().size();
|
||||
|
@ -130,15 +129,11 @@ class OathOfScholarsEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||
Player targetPlayer = game.getPlayer(source.getFirstTarget());
|
||||
Player firstPlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (sourceObject == null
|
||||
|| targetPlayer == null
|
||||
|| firstPlayer == null) {
|
||||
if (sourceObject == null || firstPlayer == null) {
|
||||
return false;
|
||||
}
|
||||
if (firstPlayer.getHand().size() < targetPlayer.getHand().size() // the condition must be checked again on resolution
|
||||
&& firstPlayer.chooseUse(Outcome.AIDontUseIt, "Do you wish to discard your hand and draw 3 cards?", source, game)) {
|
||||
if (firstPlayer.chooseUse(Outcome.AIDontUseIt, "Discard your hand and draw 3 cards?", source, game)) {
|
||||
firstPlayer.discard(firstPlayer.getHand().size(), true, source, game);
|
||||
firstPlayer.drawCards(3, game);
|
||||
return true;
|
||||
|
|
|
@ -40,18 +40,17 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledLandPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -59,11 +58,16 @@ import java.util.UUID;
|
|||
*/
|
||||
public class QuicksilverFountain extends CardImpl {
|
||||
|
||||
public final UUID originalId;
|
||||
|
||||
public QuicksilverFountain(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
|
||||
|
||||
// At the beginning of each player's upkeep, that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true));
|
||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new QuicksilverFountainEffect(), TargetController.ANY, false, true);
|
||||
ability.addTarget(new TargetLandPermanent());
|
||||
originalId = ability.getOriginalId();
|
||||
this.addAbility(ability);
|
||||
|
||||
// At the beginning of each end step, if all lands on the battlefield are Islands, remove all flood counters from them.
|
||||
Condition condition = new AllLandsAreSubtypeCondition(SubType.ISLAND);
|
||||
|
@ -71,8 +75,25 @@ public class QuicksilverFountain extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void adjustTargets(Ability ability, Game game) {
|
||||
if (ability.getOriginalId().equals(originalId)) {
|
||||
Player activePlayer = game.getPlayer(game.getActivePlayerId());
|
||||
if (activePlayer != null) {
|
||||
ability.getTargets().clear();
|
||||
FilterLandPermanent filter = new FilterLandPermanent();
|
||||
filter.add(Predicates.not(new SubtypePredicate(SubType.ISLAND)));
|
||||
filter.add(new ControllerPredicate(TargetController.ACTIVE));
|
||||
TargetLandPermanent target = new TargetLandPermanent(1, 1, filter, false);
|
||||
target.setTargetController(activePlayer.getId());
|
||||
ability.getTargets().add(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public QuicksilverFountain(final QuicksilverFountain card) {
|
||||
super(card);
|
||||
this.originalId = card.originalId;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -83,12 +104,6 @@ public class QuicksilverFountain extends CardImpl {
|
|||
|
||||
class QuicksilverFountainEffect extends OneShotEffect {
|
||||
|
||||
static final private FilterControlledLandPermanent filterNonIslandLand = new FilterControlledLandPermanent("non-Island land");
|
||||
|
||||
static {
|
||||
filterNonIslandLand.add(Predicates.not(new SubtypePredicate(SubType.ISLAND)));
|
||||
}
|
||||
|
||||
public QuicksilverFountainEffect() {
|
||||
super(Outcome.Neutral);
|
||||
staticText = "that player puts a flood counter on target non-Island land he or she controls of his or her choice. That land is an Island for as long as it has a flood counter on it";
|
||||
|
@ -101,19 +116,16 @@ class QuicksilverFountainEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player player = game.getPlayer(targetPointer.getFirst(game, source));
|
||||
Target targetNonIslandLand = new TargetPermanent(filterNonIslandLand);
|
||||
if (player != null) {
|
||||
if (player.choose(Outcome.Neutral, targetNonIslandLand, source.getId(), game)) {
|
||||
Permanent landChosen = game.getPermanent(targetNonIslandLand.getFirstTarget());
|
||||
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
|
||||
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, SubType.ISLAND);
|
||||
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
|
||||
this.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
effect.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
Permanent landChosen = game.getPermanent(source.getFirstTarget());
|
||||
landChosen.addCounters(CounterType.FLOOD.createInstance(), source, game);
|
||||
ContinuousEffect becomesBasicLandTargetEffect = new BecomesBasicLandTargetEffect(Duration.OneUse, SubType.ISLAND);
|
||||
becomesBasicLandTargetEffect.addDependencyType(DependencyType.BecomeIsland);
|
||||
ConditionalContinuousEffect effect = new ConditionalContinuousEffect(becomesBasicLandTargetEffect, new LandHasFloodCounterCondition(this), staticText);
|
||||
this.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
effect.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
game.addEffect(effect, source);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class ShireiShizosCaretaker extends CardImpl {
|
||||
|
||||
public ShireiShizosCaretaker(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add("Spirit");
|
||||
|
||||
|
@ -151,7 +151,7 @@ class ShireiShizosCaretakerEffect extends OneShotEffect {
|
|||
Effect effect = new ShireiShizosCaretakerReturnEffect(shireiId);
|
||||
effect.setText("return that card to the battlefield if {this} is still on the battlefield");
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId()));
|
||||
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(card.getId(), card.getZoneChangeCounter(game)));
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ class StarfieldOfNyxEffect extends ContinuousEffectImpl {
|
|||
static {
|
||||
filter.add(Predicates.not(new SubtypePredicate(SubType.AURA)));
|
||||
filter.add(new AnotherPredicate());
|
||||
filter.add(new OwnerPredicate(TargetController.YOU));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
||||
public StarfieldOfNyxEffect() {
|
||||
|
|
|
@ -40,7 +40,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -50,6 +50,7 @@ import mage.constants.SuperType;
|
|||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.token.TheLocustGodInsectToken;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -105,8 +106,9 @@ class TheLocustGodEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Create delayed triggered ability
|
||||
Effect effect = new ReturnToHandSourceEffect(false, true);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("return {this} to its owner's hand");
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
|
|
|
@ -41,6 +41,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -188,8 +189,9 @@ class TheScarabGodEffect3 extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Create delayed triggered ability
|
||||
Effect effect = new ReturnToHandSourceEffect(false, true);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("return {this} to its owner's hand");
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.abilities.effects.Effect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -56,6 +57,7 @@ import mage.game.events.GameEvent.EventType;
|
|||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -155,8 +157,9 @@ class TheScorpionGodEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
// Create delayed triggered ability
|
||||
Effect effect = new ReturnToHandSourceEffect(false, true);
|
||||
Effect effect = new ReturnToHandTargetEffect();
|
||||
effect.setText("return {this} to its owner's hand");
|
||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
return true;
|
||||
|
|
|
@ -84,7 +84,7 @@ public class Exodus extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Ertai, Wizard Adept", 33, Rarity.RARE, mage.cards.e.ErtaiWizardAdept.class));
|
||||
cards.add(new SetCardInfo("Exalted Dragon", 6, Rarity.RARE, mage.cards.e.ExaltedDragon.class));
|
||||
cards.add(new SetCardInfo("Fade Away", 34, Rarity.COMMON, mage.cards.f.FadeAway.class));
|
||||
cards.add(new SetCardInfo("Fighting Chance", 82, Rarity.RARE, mage.cards.f.FightingChance.class));
|
||||
cards.add(new SetCardInfo("Fighting Chance", 82, Rarity.RARE, mage.cards.f.FightingChance.class));
|
||||
cards.add(new SetCardInfo("Flowstone Flood", 83, Rarity.UNCOMMON, mage.cards.f.FlowstoneFlood.class));
|
||||
cards.add(new SetCardInfo("Forbid", 35, Rarity.UNCOMMON, mage.cards.f.Forbid.class));
|
||||
cards.add(new SetCardInfo("Fugue", 62, Rarity.UNCOMMON, mage.cards.f.Fugue.class));
|
||||
|
@ -108,7 +108,9 @@ public class Exodus extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Necrologia", 68, Rarity.UNCOMMON, mage.cards.n.Necrologia.class));
|
||||
cards.add(new SetCardInfo("Null Brooch", 136, Rarity.RARE, mage.cards.n.NullBrooch.class));
|
||||
cards.add(new SetCardInfo("Oath of Druids", 115, Rarity.RARE, mage.cards.o.OathOfDruids.class));
|
||||
cards.add(new SetCardInfo("Oath of Ghouls", 69, Rarity.RARE, mage.cards.o.OathOfGhouls.class));
|
||||
cards.add(new SetCardInfo("Oath of Lieges", 11, Rarity.RARE, mage.cards.o.OathOfLieges.class));
|
||||
cards.add(new SetCardInfo("Oath of Mages", 90, Rarity.RARE, mage.cards.o.OathOfMages.class));
|
||||
cards.add(new SetCardInfo("Oath of Scholars", 42, Rarity.RARE, mage.cards.o.OathOfScholars.class));
|
||||
cards.add(new SetCardInfo("Ogre Shaman", 91, Rarity.RARE, mage.cards.o.OgreShaman.class));
|
||||
cards.add(new SetCardInfo("Onslaught", 92, Rarity.COMMON, mage.cards.o.Onslaught.class));
|
||||
|
|
|
@ -32,7 +32,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.common.PlayerLostLifeWatcher;
|
||||
|
||||
/**
|
||||
|
@ -49,11 +48,7 @@ public class OpponentsLostLifeCount implements DynamicValue {
|
|||
public int calculate(Game game, UUID controllerId) {
|
||||
PlayerLostLifeWatcher watcher = (PlayerLostLifeWatcher) game.getState().getWatchers().get(PlayerLostLifeWatcher.class.getSimpleName());
|
||||
if (watcher != null) {
|
||||
int amountLifeLost = 0;
|
||||
for (UUID opponentId : game.getOpponents(controllerId)) {
|
||||
amountLifeLost += watcher.getLiveLost(opponentId);
|
||||
}
|
||||
return amountLifeLost;
|
||||
return watcher.getAllOppLifeLost(controllerId);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -78,6 +78,16 @@ public class PlayerLostLifeWatcher extends Watcher {
|
|||
return amountOfLifeLostThisTurn.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
||||
public int getAllOppLifeLost(UUID playerId) {
|
||||
int amount = 0;
|
||||
for (UUID player : this.amountOfLifeLostThisTurn.keySet()) {
|
||||
if (!player.equals(playerId)) {
|
||||
amount += this.amountOfLifeLostThisTurn.get(player);
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int getLiveLostLastTurn(UUID playerId) {
|
||||
return amountOfLifeLostLastTurn.getOrDefault(playerId, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue