Merge pull request #13 from magefree/master

update
This commit is contained in:
Li REN 2013-06-20 08:58:36 -07:00
commit 16c2258f13
22 changed files with 607 additions and 69 deletions

View file

@ -206,21 +206,26 @@ public class PlayerPanelExt extends javax.swing.JPanel {
}
}
this.avatar.setText(player.getName());
String priorityTimeValue = getPriorityTimeLeftString(player);
this.timer.setCount(player.getPriorityTimeLeft());
this.avatar.setTopText(priorityTimeValue);
if (player.getPriorityTimeLeft() != Integer.MAX_VALUE) {
String priorityTimeValue = getPriorityTimeLeftString(player);
this.timer.setCount(player.getPriorityTimeLeft());
this.avatar.setTopText(priorityTimeValue);
}
this.btnPlayer.setText(player.getName());
if (player.isActive()) {
this.avatar.setBorder(greenBorder);
this.btnPlayer.setBorder(greenBorder);
this.timer.resume();
} else if (player.hasLeft()) {
this.avatar.setBorder(redBorder);
this.btnPlayer.setBorder(redBorder);
this.timer.pause();
} else {
this.avatar.setBorder(emptyBorder);
this.btnPlayer.setBorder(emptyBorder);
}
if (player.hasPriority()) {
this.timer.resume();
} else {
this.timer.pause();
}

View file

@ -54,6 +54,7 @@ public class PlayerView implements Serializable {
private int libraryCount;
private int handCount;
private boolean isActive;
private boolean hasPriority;
private boolean hasLeft;
private ManaPoolView manaPool;
private SimpleCardsView graveyard = new SimpleCardsView();
@ -74,6 +75,7 @@ public class PlayerView implements Serializable {
this.handCount = player.getHand().size();
this.manaPool = new ManaPoolView(player.getManaPool());
this.isActive = (player.getId().equals(state.getActivePlayerId()));
this.hasPriority = player.getId().equals(state.getPriorityPlayerId());
this.hasLeft = player.hasLeft();
for (Card card: player.getGraveyard().getCards(game)) {
graveyard.put(card.getId(), new SimpleCardView(card.getId(), card.getExpansionSetCode(), card.getCardNumber(), card.getUsesVariousArt(), card.isFaceDown()));
@ -197,4 +199,8 @@ public class PlayerView implements Serializable {
public int getPriorityTimeLeft() {
return priorityTimeLeft;
}
public boolean hasPriority() {
return hasPriority;
}
}

View file

@ -0,0 +1,54 @@
/*
* 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.sets.fifthdawn;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class ArcboundWanderer extends mage.sets.modernmasters.ArcboundWanderer {
public ArcboundWanderer(UUID ownerId) {
super(ownerId);
this.cardNumber = 103;
this.expansionSetCode = "5DN";
this.rarity = Rarity.UNCOMMON;
}
public ArcboundWanderer(final ArcboundWanderer card) {
super(card);
}
@Override
public ArcboundWanderer copy() {
return new ArcboundWanderer(this);
}
}

View file

@ -56,7 +56,7 @@ public class BatonOfCourage extends CardImpl<BatonOfCourage> {
// Flash
this.addAbility(FlashAbility.getInstance());
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// Remove a charge counter from Baton of Courage: Target creature gets +1/+1 until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)));
ability.addTarget(new TargetCreaturePermanent());

View file

@ -51,7 +51,7 @@ public class ClearwaterGoblet extends CardImpl<ClearwaterGoblet> {
this.expansionSetCode = "5DN";
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// At the beginning of your upkeep, you may gain life equal to the number of charge counters on Clearwater Goblet.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new GainLifeEffect(new CountersCount(CounterType.CHARGE)), TargetController.YOU, true));
}

View file

@ -58,7 +58,7 @@ public class EngineeredExplosives extends CardImpl<EngineeredExplosives> {
this.expansionSetCode = "5DN";
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// {2}, Sacrifice Engineered Explosives: Destroy each nonland permanent with converted mana cost equal to the number of charge counters on Engineered Explosives.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new EngineeredExplosivesEffect(), new ManaCostsImpl("{2}"));
ability.addCost(new SacrificeSourceCost());

View file

@ -56,7 +56,7 @@ public class SawtoothThresher extends CardImpl<SawtoothThresher> {
this.toughness = new MageInt(1);
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// Remove two +1/+1 counters from Sawtooth Thresher: Sawtooth Thresher gets +4/+4 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(4, 4, Duration.EndOfTurn), new RemoveCountersSourceCost(CounterType.P1P1.createInstance(2))));
}

View file

@ -49,7 +49,7 @@ public class SkyreachManta extends CardImpl<SkyreachManta> {
this.toughness = new MageInt(0);
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// Flying
this.addAbility(FlyingAbility.getInstance());
}

View file

@ -0,0 +1,54 @@
/*
* 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.sets.futuresight;
import java.util.UUID;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class Epochrasite extends mage.sets.modernmasters.Epochrasite {
public Epochrasite(UUID ownerId) {
super(ownerId);
this.cardNumber = 162;
this.expansionSetCode = "FUT";
this.rarity = Rarity.RARE;
}
public Epochrasite(final Epochrasite card) {
super(card);
}
@Override
public Epochrasite copy() {
return new Epochrasite(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.sets.lorwyn;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class WarrenPilferers extends mage.sets.modernmasters.WarrenPilferers {
public WarrenPilferers(UUID ownerId) {
super(ownerId);
this.cardNumber = 146;
this.expansionSetCode = "LRW";
}
public WarrenPilferers(final WarrenPilferers card) {
super(card);
}
@Override
public WarrenPilferers copy() {
return new WarrenPilferers(this);
}
}

View file

@ -0,0 +1,63 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.keyword.ModularAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
*
* @author LevelX2
*/
public class ArcboundWanderer extends CardImpl<ArcboundWanderer> {
public ArcboundWanderer(UUID ownerId) {
super(ownerId, 200, "Arcbound Wanderer", Rarity.COMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{6}");
this.expansionSetCode = "MMA";
this.subtype.add("Golem");
this.power = new MageInt(0);
this.toughness = new MageInt(0);
// Modular-Sunburst
this.addAbility(new ModularAbility(this,0,true));
}
public ArcboundWanderer(final ArcboundWanderer card) {
super(card);
}
@Override
public ArcboundWanderer copy() {
return new ArcboundWanderer(this);
}
}

View file

@ -0,0 +1,87 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.condition.common.CastFromHandCondition;
import mage.abilities.condition.common.InvertCondition;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.ExileSourceEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.watchers.common.CastFromHandWatcher;
/**
*
* @author LevelX2
*/
public class Epochrasite extends CardImpl<Epochrasite> {
public Epochrasite(UUID ownerId) {
super(ownerId, 205, "Epochrasite", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT, CardType.CREATURE}, "{2}");
this.expansionSetCode = "MMA";
this.subtype.add("Construct");
this.power = new MageInt(1);
this.toughness = new MageInt(1);
this.addWatcher(new CastFromHandWatcher());
// Epochrasite enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand.
this.addAbility(new EntersBattlefieldAbility(
new AddCountersSourceEffect(CounterType.P1P1.createInstance(3)),
new InvertCondition(new CastFromHandCondition()), true,
"{this} enters the battlefield with three +1/+1 counters on it if you didn't cast it from your hand",""));
// When Epochrasite dies, exile it with three time counters on it and it gains suspend.
Ability ability = new DiesTriggeredAbility(new ExileSourceEffect());
ability.addEffect(new AddCountersSourceEffect(CounterType.TIME.createInstance(3), new StaticValue(0), false, true));
ability.addEffect(new GainAbilitySourceEffect(new SuspendAbility(3, null, this), Duration.OneUse, true));
this.addAbility(ability);
}
public Epochrasite(final Epochrasite card) {
super(card);
}
@Override
public Epochrasite copy() {
return new Epochrasite(this);
}
}

View file

@ -0,0 +1,113 @@
/*
* 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.sets.modernmasters;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.GainAbilitySourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author LevelX2
*/
public class WarrenPilferers extends CardImpl<WarrenPilferers> {
public WarrenPilferers(UUID ownerId) {
super(ownerId, 103, "Warren Pilferers", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{B}");
this.expansionSetCode = "MMA";
this.subtype.add("Goblin");
this.subtype.add("Rogue");
this.color.setBlack(true);
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// When Warren Pilferers enters the battlefield, return target creature card from your graveyard to your hand. If that card is a Goblin card, Warren Pilferers gains haste until end of turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new WarrenPilferersReturnEffect(), false);
ability.addTarget(new TargetCardInYourGraveyard(new FilterCreatureCard("creature card from your graveyard")));
this.addAbility(ability);
}
public WarrenPilferers(final WarrenPilferers card) {
super(card);
}
@Override
public WarrenPilferers copy() {
return new WarrenPilferers(this);
}
}
class WarrenPilferersReturnEffect extends OneShotEffect<WarrenPilferersReturnEffect> {
public WarrenPilferersReturnEffect() {
super(Outcome.ReturnToHand);
staticText = "return target creature card from your graveyard to your hand. If that card is a Goblin card, Warren Pilferers gains haste until end of turn";
}
public WarrenPilferersReturnEffect(final WarrenPilferersReturnEffect effect) {
super(effect);
}
@Override
public WarrenPilferersReturnEffect copy() {
return new WarrenPilferersReturnEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card card = game.getCard(source.getFirstTarget());
if (card != null) {
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
if (card.getSubtype().contains("Goblin")) {
game.addEffect(new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.EndOfTurn), source);
}
return true;
}
return false;
}
}

View file

@ -57,7 +57,7 @@ public class EtchedOracle extends CardImpl<EtchedOracle> {
this.toughness = new MageInt(0);
// Sunburst (This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// {1}, Remove four +1/+1 counters from Etched Oracle: Target player draws three cards.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardTargetEffect(3), new ManaCostsImpl("{1}"));
ability.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance(4)));

View file

@ -47,7 +47,7 @@ public class PentadPrism extends CardImpl<PentadPrism> {
this.expansionSetCode = "HOP";
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
// Remove a charge counter from Pentad Prism: Add one mana of any color to your mana pool.
this.addAbility(new AnyColorManaAbility(new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1))));
}

View file

@ -48,7 +48,7 @@ public class SuntouchedMyr extends CardImpl<SuntouchedMyr> {
this.toughness = new MageInt(0);
// Sunburst
this.addAbility(new SunburstAbility());
this.addAbility(new SunburstAbility(this));
}
public SuntouchedMyr(final SuntouchedMyr card) {

View file

@ -30,6 +30,7 @@ package mage.abilities.effects.common.continious;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
@ -44,6 +45,8 @@ import mage.game.permanent.Permanent;
public class GainAbilitySourceEffect extends ContinuousEffectImpl<GainAbilitySourceEffect> {
protected Ability ability;
// shall a card gain the ability (otherwise permanent)
private boolean onCard;
/**
* Add ability with Duration.WhileOnBattlefield
@ -54,14 +57,20 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl<GainAbilitySou
}
public GainAbilitySourceEffect(Ability ability, Duration duration) {
this(ability, duration, false);
}
public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
staticText = "{this} gains \"" + ability.getRule() + "\" " + duration.toString();
this.onCard = onCard;
}
public GainAbilitySourceEffect(final GainAbilitySourceEffect effect) {
super(effect);
this.ability = effect.ability.copy();
this.onCard = effect.onCard;
}
@Override
@ -71,10 +80,20 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl<GainAbilitySou
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addAbility(ability, source.getSourceId(), game);
return true;
if (onCard) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
// add ability to card only once
card.addAbility(ability);
discard();
return true;
}
} else {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.addAbility(ability, source.getSourceId(), game);
return true;
}
}
return false;
}

View file

@ -33,6 +33,7 @@ import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -44,8 +45,9 @@ import mage.players.Player;
public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffect> {
private Counter counter;
protected boolean informPlayers;
protected DynamicValue amount;
private boolean informPlayers;
private DynamicValue amount;
private boolean putOnCard;
public AddCountersSourceEffect(Counter counter) {
this(counter, false);
@ -55,17 +57,23 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
this(counter, new StaticValue(0), informPlayers);
}
public AddCountersSourceEffect(Counter counter, DynamicValue amount, boolean informPlayers) {
this(counter, amount, informPlayers, false);
}
/**
*
* @param counter
* @param amount this amount will be added to the counter instances
* @param informPlayers
* @param informPlayers
* @param putOnCard - counters have to be put on a card instead of a permanent
*/
public AddCountersSourceEffect(Counter counter, DynamicValue amount, boolean informPlayers) {
public AddCountersSourceEffect(Counter counter, DynamicValue amount, boolean informPlayers, boolean putOnCard) {
super(Outcome.Benefit);
this.counter = counter.copy();
this.informPlayers = informPlayers;
this.amount = amount;
this.putOnCard = putOnCard;
setText();
}
@ -76,25 +84,45 @@ public class AddCountersSourceEffect extends OneShotEffect<AddCountersSourceEffe
}
this.informPlayers = effect.informPlayers;
this.amount = effect.amount;
this.putOnCard = effect.putOnCard;
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if (counter != null) {
Counter newCounter = counter.copy();
newCounter.add(amount.calculate(game, source));
permanent.addCounters(newCounter, game);
if (informPlayers) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(new StringBuilder(player.getName()).append(" puts ").append(newCounter.getCount()).append(" ").append(newCounter.getName().toLowerCase()).append(" counter on ").append(permanent.getName()).toString());
if (putOnCard) {
Card card = game.getCard(source.getSourceId());
if (card != null) {
if (counter != null) {
Counter newCounter = counter.copy();
newCounter.add(amount.calculate(game, source));
card.addCounters(newCounter, game);
if (informPlayers) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(new StringBuilder(player.getName()).append(" puts ").append(newCounter.getCount()).append(" ").append(newCounter.getName().toLowerCase()).append(" counter on ").append(card.getName()).toString());
}
}
}
return true;
}
} else {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if (counter != null) {
Counter newCounter = counter.copy();
newCounter.add(amount.calculate(game, source));
permanent.addCounters(newCounter, game);
if (informPlayers) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
game.informPlayers(new StringBuilder(player.getName()).append(" puts ").append(newCounter.getCount()).append(" ").append(newCounter.getName().toLowerCase()).append(" counter on ").append(permanent.getName()).toString());
}
}
}
return true;
}
}
return true;
return false;
}
private void setText() {

View file

@ -1,8 +1,5 @@
package mage.abilities.keyword;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
@ -11,6 +8,9 @@ import mage.abilities.effects.EntersBattlefieldEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -42,17 +42,30 @@ public class ModularAbility extends DiesTriggeredAbility {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
private int amount;
private boolean sunburst;
public ModularAbility(Card card, int amount) {
this(card, amount, false);
}
public ModularAbility(Card card, int amount, boolean sunburst) {
super(new ModularDistributeCounterEffect(), true);
this.addTarget(new TargetArtifactPermanent(filter));
this.amount = amount;
card.addAbility(new ModularStaticAbility(amount));
this.sunburst = sunburst;
if (sunburst) {
Ability ability = new SunburstAbility(card);
ability.setRuleVisible(false);
card.addAbility(ability);
} else {
card.addAbility(new ModularStaticAbility(amount));
}
}
public ModularAbility(ModularAbility ability) {
super(ability);
this.amount = ability.amount;
this.sunburst = ability.sunburst;
}
@Override
@ -71,19 +84,31 @@ public class ModularAbility extends DiesTriggeredAbility {
@Override
public String getRule() {
return "Modular " + amount + " <i>(This enters the battlefield with " + amount + " +1/+1 counter on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>";
StringBuilder sb = new StringBuilder("Modular");
if (sunburst) {
sb.append("-Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
} else {
sb.append(" ").append(amount).append(" <i>(This enters the battlefield with ")
.append(amount).append(" +1/+1 counter on it. When it dies, you may put its +1/+1 counters on target artifact creature.)</i>");
}
return sb.toString();
}
}
class ModularStaticAbility extends StaticAbility<ModularStaticAbility> {
private String ruleText;
public ModularStaticAbility(int amount) {
super(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new AddCountersSourceEffect(CounterType.P1P1.createInstance(amount))));
ruleText = new StringBuilder("This enters the battlefield with ").append(amount).append(" +1/+1 counter on it.").toString();
this.setRuleVisible(false);
}
public ModularStaticAbility(final ModularStaticAbility ability) {
super(ability);
this.ruleText = ability.ruleText;
}
@Override
@ -93,7 +118,7 @@ class ModularStaticAbility extends StaticAbility<ModularStaticAbility> {
@Override
public String getRule() {
return "";
return ruleText;
}
}

View file

@ -33,6 +33,7 @@ import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.SunburstCount;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.Counter;
@ -49,12 +50,18 @@ import mage.players.Player;
public class SunburstAbility extends EntersBattlefieldAbility{
public SunburstAbility(){
private final static String ruleCreature ="Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)</i>";
private final static String ruleNonCreature ="Sunburst <i>(This enters the battlefield with a charge counter on it for each color of mana spent to cast it.)</i>";
private boolean isCreature;
public SunburstAbility(Card card){
super(new SunburstEffect(),"");
isCreature = card.getCardType().contains(CardType.CREATURE);
}
public SunburstAbility(final SunburstAbility ability){
super(ability);
this.isCreature = ability.isCreature;
}
@ -65,7 +72,7 @@ public class SunburstAbility extends EntersBattlefieldAbility{
@Override
public String getRule() {
return "Sunburst <i>(This enters the battlefield with a +1/+1 counter on it for each color of mana spent to cast it.)</i>";
return isCreature ? ruleCreature : ruleNonCreature;
}
@ -114,5 +121,4 @@ class SunburstEffect extends OneShotEffect<SunburstEffect> {
return new SunburstEffect(this);
}
}
}

View file

@ -42,7 +42,6 @@ import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.condition.common.SuspendedCondition;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.decorator.ConditionalTriggeredAbility;
@ -139,24 +138,37 @@ import mage.players.Player;
public class SuspendAbility extends ActivatedAbilityImpl<SuspendAbility> {
private String ruleText;
private boolean gainedTemporary;
/**
* Gives the card the SuspendAbility
*
* @param suspend - amount of time counters
* @param cost - null is used for temporary gained suspend ability
* @param card - card that has the suspend ability
*/
public SuspendAbility(int suspend, ManaCost cost, Card card) {
super(Zone.HAND, new SuspendExileEffect(suspend), cost);
this.usesStack = false;
ruleText = new StringBuilder("Suspend ").append(suspend).append(" - ").append(cost.getText())
.append(" <i>(Rather than cast this card from your hand, pay ")
.append(cost.getText())
.append(" and exile it with ")
.append(suspend == 1 ? "a time counter":suspend + " time counters")
.append(" on it.")
.append(" At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.")
.append(card.getCardType().contains(CardType.CREATURE)? " If you play it this way and it's a creature, it gains haste until you lose control of it.":"")
.append(")</i>")
.toString();
StringBuilder sb = new StringBuilder("Suspend ");
if (cost != null) {
sb.append(suspend).append(" - ").append(cost.getText())
.append(" <i>(Rather than cast this card from your hand, pay ")
.append(cost.getText())
.append(" and exile it with ")
.append(suspend == 1 ? "a time counter":suspend + " time counters")
.append(" on it.")
.append(" At the beginning of your upkeep, remove a time counter. When the last is removed, cast it without paying its mana cost.")
.append(card.getCardType().contains(CardType.CREATURE)? " If you play it this way and it's a creature, it gains haste until you lose control of it.":"")
.append(")</i>");
} else {
gainedTemporary = true;
}
ruleText = sb.toString();
if (card.getManaCost().isEmpty()) {
setRuleAtTheTop(true);
}
}
// add triggered ability to remove the counter from the card
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), TargetController.YOU, false),
@ -164,19 +176,13 @@ public class SuspendAbility extends ActivatedAbilityImpl<SuspendAbility> {
"At the beginning of your upkeep, if this card is suspended, remove a time counter from it.");
ability.setRuleVisible(false);
card.addAbility(ability);
// add triggered ability that casts the suspended card, if all counters are removed
card.addAbility(new SuspendPlayCardAbility(card.getCardType().contains(CardType.CREATURE)));
// if it's a creature card, add Haste ability
if (card.getCardType().contains(CardType.CREATURE)) {
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new GainHasteEffect(Duration.WhileOnBattlefield));
ability.setRuleVisible(false);
card.addAbility(ability);
}
}
public SuspendAbility(SuspendAbility ability) {
super(ability);
this.ruleText = ability.getRule();
this.gainedTemporary = ability.gainedTemporary;
}
@Override
@ -196,6 +202,10 @@ public class SuspendAbility extends ActivatedAbilityImpl<SuspendAbility> {
return ruleText;
}
public boolean isGainedTemporary() {
return gainedTemporary;
}
@Override
public SuspendAbility copy() {
return new SuspendAbility(this);
@ -252,6 +262,9 @@ class SuspendPlayCardAbility extends TriggeredAbilityImpl<SuspendPlayCardAbility
public SuspendPlayCardAbility(boolean isCreature) {
super(Zone.EXILED, new SuspendPlayCardEffect(isCreature));
if (isCreature) {
this.addEffect(new GainHasteEffect());
}
setRuleVisible(false);
}
@ -286,8 +299,7 @@ class SuspendPlayCardEffect extends OneShotEffect<SuspendPlayCardEffect> {
public SuspendPlayCardEffect(boolean isCreature) {
super(Outcome.PutCardInPlay);
this.staticText = new StringBuilder("play it without paying its mana cost if able. If you can't, it remains removed from the game")
.append(isCreature ? ". If you play it this way and it's a creature, it gains haste until you lose control of it":"").toString();
this.staticText = "play it without paying its mana cost if able. If you can't, it remains removed from the game";
}
public SuspendPlayCardEffect(final SuspendPlayCardEffect effect) {
@ -301,9 +313,23 @@ class SuspendPlayCardEffect extends OneShotEffect<SuspendPlayCardEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Card card = game.getCard(source.getSourceId());
if (player != null && card != null) {
// remove temporary suspend ability (used e.g. for Epochrasite)
Ability abilityToRemove = null;
for (Ability ability : card.getAbilities()) {
if (ability instanceof SuspendAbility) {
if (((SuspendAbility)ability).isGainedTemporary()) {
abilityToRemove = ability;
}
}
}
if (abilityToRemove != null) {
card.getAbilities().remove(abilityToRemove);
}
// cast the card for free
player.cast(card.getSpellAbility(), game, true);
}
return false;
@ -314,8 +340,8 @@ class GainHasteEffect extends ContinuousEffectImpl<GainHasteEffect> {
private UUID suspendController;
public GainHasteEffect(Duration duration) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
public GainHasteEffect() {
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
staticText = "If you play it this way and it's a creature, it gains haste until you lose control of it";
}
@ -336,11 +362,11 @@ class GainHasteEffect extends ContinuousEffectImpl<GainHasteEffect> {
}
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
if (suspendController.equals(source.getControllerId()) && !used) { // used stores if the control changed
if (suspendController.equals(source.getControllerId())) {
permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
return true;
} else {
used = true;
this.discard();
}
}
return false;

View file

@ -106,7 +106,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
protected boolean passedTurn;
protected int turns;
protected int storedBookmark = -1;
protected int priorityTimeLeft;
protected int priorityTimeLeft = Integer.MAX_VALUE;
/**
* This indicates that player passed all turns until his own turn starts.