Minor most tooltip related changes.

This commit is contained in:
LevelX2 2015-10-11 11:19:50 +02:00
parent 673cd6b38a
commit 8dad1eeb13
26 changed files with 253 additions and 237 deletions

View file

@ -25,20 +25,19 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.shadowmoor;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.ObjectColor;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.FearAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
/**
@ -47,19 +46,25 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class AphoticWisps extends CardImpl {
public AphoticWisps (UUID ownerId) {
public AphoticWisps(UUID ownerId) {
super(ownerId, 55, "Aphotic Wisps", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{B}");
this.expansionSetCode = "SHM";
// Target creature becomes black and gains fear until end of turn. (It can't be blocked except by artifact creatures and/or black creatures.)
// Target creature becomes black and gains fear until end of turn. (It can't be blocked except by artifact creatures and/or black creatures.)
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(FearAbility.getInstance(), Duration.EndOfTurn));
Effect effect = new BecomesColorTargetEffect(ObjectColor.BLACK, Duration.EndOfTurn);
effect.setText("Target creature becomes black");
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityTargetEffect(FearAbility.getInstance(), Duration.EndOfTurn);
effect.setText("and gains fear until end of turn");
this.getSpellAbility().addEffect(effect);
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
effect = new DrawCardSourceControllerEffect(1);
effect.setText("<br>Draw a card");
this.getSpellAbility().addEffect(effect);
}
public AphoticWisps (final AphoticWisps card) {
public AphoticWisps(final AphoticWisps card) {
super(card);
}
@ -69,4 +74,3 @@ public class AphoticWisps extends CardImpl {
}
}

View file

@ -45,12 +45,12 @@ import mage.target.TargetPlayer;
/**
*
* @author jeffwadsworth
*
*/
public class DrownerInitiate extends CardImpl {
private static final FilterSpell filter = new FilterSpell("a blue spell");
static {
filter.add(new ColorPredicate(ObjectColor.BLUE));
}
@ -65,10 +65,10 @@ public class DrownerInitiate extends CardImpl {
this.toughness = new MageInt(1);
// Whenever a player casts a blue spell, you may pay {1}. If you do, target player puts the top two cards of his or her library into his or her graveyard.
Ability ability = new SpellCastAllTriggeredAbility(new DoIfCostPaid(new PutLibraryIntoGraveTargetEffect(2), new ManaCostsImpl("{1}")), filter, true);
Ability ability = new SpellCastAllTriggeredAbility(new DoIfCostPaid(new PutLibraryIntoGraveTargetEffect(2), new ManaCostsImpl("{1}")), filter, false);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
}
public DrownerInitiate(final DrownerInitiate card) {

View file

@ -72,7 +72,7 @@ public class LeechBonder extends CardImpl {
// Leech Bonder enters the battlefield with two -1/-1 counters on it.
this.addAbility(new EntersBattlefieldAbility(new AddCountersSourceEffect(CounterType.M1M1.createInstance(2))));
// {U}, {untap}: Move a counter from target creature onto a second target creature.
// {U}, {untap}: Move a counter from target creature onto another target creature.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LeechBonderEffect(), new ManaCostsImpl("{U}"));
ability.addCost(new UntapSourceCost());
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature to remove counter from")));

View file

@ -29,19 +29,16 @@ package mage.sets.shadowmoor;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.AttacksOrBlocksTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -57,7 +54,10 @@ public class WickerWarcrawler extends CardImpl {
this.toughness = new MageInt(6);
// Whenever Wicker Warcrawler attacks or blocks, put a -1/-1 counter on it at end of combat.
this.addAbility(new AttacksOrBlocksTriggeredAbility(new WickerWarcrawlerEffect(), false));
Effect effect = new AddCountersSourceEffect(CounterType.M1M1.createInstance(), true);
effect.setText("put a -1/-1 counter on it at end of combat");
DelayedTriggeredAbility ability = new AtTheEndOfCombatDelayedTriggeredAbility(effect);
this.addAbility(new AttacksOrBlocksTriggeredAbility(new CreateDelayedTriggeredAbilityEffect(ability, false, false), false));
}
@ -70,35 +70,3 @@ public class WickerWarcrawler extends CardImpl {
return new WickerWarcrawler(this);
}
}
class WickerWarcrawlerEffect extends OneShotEffect {
WickerWarcrawlerEffect() {
super(Outcome.Detriment);
staticText = "put a -1/-1 counter on {this} at the end of combat";
}
WickerWarcrawlerEffect(final WickerWarcrawlerEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent wickerWarcrawler = game.getPermanent(source.getSourceId());
if (wickerWarcrawler != null) {
AtTheEndOfCombatDelayedTriggeredAbility delayedAbility = new AtTheEndOfCombatDelayedTriggeredAbility(new AddCountersTargetEffect(CounterType.M1M1.createInstance()));
delayedAbility.setSourceId(source.getSourceId());
delayedAbility.setControllerId(source.getControllerId());
delayedAbility.setSourceObject(source.getSourceObject(game), game);
delayedAbility.getEffects().get(0).setTargetPointer(new FixedTarget(source.getSourceId()));
game.addDelayedTriggeredAbility(delayedAbility);
return true;
}
return false;
}
@Override
public WickerWarcrawlerEffect copy() {
return new WickerWarcrawlerEffect(this);
}
}

View file

@ -122,12 +122,5 @@ class ShowAndTellEffect extends OneShotEffect {
}
}
return controller.moveCards(cardsToPutIntoPlay, Zone.BATTLEFIELD, source, game, false, false, true, null);
// for (Card card : cardsToPutIntoPlay) {
// Player player = game.getPlayer(card.getOwnerId());
// if (player != null) {
// player.putOntoBattlefieldWithInfo(card, game, Zone.HAND, source.getSourceId());
// }
// }
// return true;
}
}

View file

@ -32,7 +32,6 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.Effect;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
@ -53,8 +52,7 @@ public class FeralContest extends CardImpl {
super(ownerId, 100, "Feral Contest", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{G}");
this.expansionSetCode = "WWK";
// Put a +1/+1 counter on target creature you control.
// Put a +1/+1 counter on target creature you control.
this.getSpellAbility().addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
// Another target creature blocks it this turn if able.
@ -88,7 +86,7 @@ class FeralContestEffect extends RequirementEffect {
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getTargets().get(1).getFirstTarget())) {
return permanent.canBlock(source.getFirstTarget(), game);
}
@ -116,4 +114,3 @@ class FeralContestEffect extends RequirementEffect {
}
}

View file

@ -33,8 +33,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.condition.common.KickedCondition;
import mage.abilities.costs.OptionalAdditionalCost;
import mage.abilities.costs.OptionalAdditionalCostImpl;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
@ -56,7 +54,7 @@ import mage.target.common.TargetOpponent;
*/
public class BloodTribute extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped Vampire you control");
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
static {
filter.add(Predicates.not(new TappedPredicate()));
@ -67,20 +65,18 @@ public class BloodTribute extends CardImpl {
super(ownerId, 81, "Blood Tribute", Rarity.RARE, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
this.expansionSetCode = "ZEN";
// Kicker - Tap an untapped Vampire you control.
OptionalAdditionalCost cost = new OptionalAdditionalCostImpl("Kicker-","",new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true)));
this.addAbility(new KickerAbility(cost));
this.addAbility(new KickerAbility(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))));
// Target opponent loses half his or her life, rounded up.
this.getSpellAbility().addTarget(new TargetOpponent());
this.getSpellAbility().addEffect(new BloodTributeLoseLifeEffect());
// If Blood Tribute was kicked, you gain life equal to the life lost this way.
Effect effect = new ConditionalOneShotEffect(
new BloodTributeGainLifeEffect(),
KickedCondition.getInstance(),
"If Blood Tribute was kicked, you gain life equal to the life lost this way");
"If {this} was kicked, you gain life equal to the life lost this way");
this.getSpellAbility().addEffect(effect);
}

View file

@ -2,17 +2,25 @@ package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
public class AttacksOrBlocksTriggeredAbility extends TriggeredAbilityImpl {
protected String startText = "Whenever";
public AttacksOrBlocksTriggeredAbility(Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect, optional);
if (effect instanceof CreateDelayedTriggeredAbilityEffect) {
startText = "When";
}
}
public AttacksOrBlocksTriggeredAbility(final AttacksOrBlocksTriggeredAbility ability) {
super(ability);
this.startText = ability.startText;
}
@Override
@ -22,8 +30,9 @@ public class AttacksOrBlocksTriggeredAbility extends TriggeredAbilityImpl {
@Override
public String getRule() {
return "When {this} attacks or blocks, " + super.getRule();
return startText + " {this} attacks or blocks, " + super.getRule();
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED || event.getType() == GameEvent.EventType.BLOCKER_DECLARED;

View file

@ -25,20 +25,18 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs;
import mage.game.Game;
/**
* Alternative costs
*
*
* @author LevelX2
*
*
* @param <T>
*/
public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends CostsImpl<Cost> implements AlternativeCost2 {
public class AlternativeCost2Impl<T extends AlternativeCost2Impl<T>> extends CostsImpl<Cost> implements AlternativeCost2 {
protected String name;
protected String reminderText;
@ -72,6 +70,7 @@ public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends Co
public String getName() {
return this.name;
}
/**
* Returns the complete text for the addional cost or if onlyCost is true
* only the pure text for the included native cost
@ -84,7 +83,7 @@ public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends Co
if (onlyCost) {
return getText();
} else {
return new StringBuffer(name != null ? name: "").append(delimiter != null ? delimiter: "").append(getText()).toString();
return (name != null ? name : "") + (delimiter != null ? delimiter : "") + getText();
}
}
@ -103,20 +102,20 @@ public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends Co
}
/**
* Returns a text suffix for the game log, that can be added to
* the cast message.
* Returns a text suffix for the game log, that can be added to the cast
* message.
*
* @param position - if there are multiple costs, it's the postion the cost is set (starting with 0)
* @param position - if there are multiple costs, it's the postion the cost
* is set (starting with 0)
* @return
*/
@Override
public String getCastSuffixMessage(int position) {
StringBuilder sb = new StringBuilder(position > 0 ? " and ":"").append(" with ");
StringBuilder sb = new StringBuilder(position > 0 ? " and " : "").append(" with ");
sb.append(name);
return sb.toString();
return sb.toString();
}
/**
* If the player intends to pay the cost, the cost will be activated
*
@ -124,7 +123,9 @@ public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends Co
@Override
public void activate() {
activated = true;
};
}
;
/**
* Reset the activate and count information
@ -142,9 +143,11 @@ public class AlternativeCost2Impl <T extends AlternativeCost2Impl<T>> extends Co
* @return
*/
@Override
public boolean isActivated(Game game){
public boolean isActivated(Game game) {
return activated;
};
}
;
@Override
public AlternativeCost2Impl copy() {

View file

@ -1,14 +1,14 @@
package mage.abilities.costs;
import java.util.UUID;
import mage.abilities.Ability;
import mage.game.Game;
import mage.target.Targets;
import java.util.UUID;
public class CompositeCost implements Cost {
private Cost firstCost;
private Cost secondCost;
private final Cost firstCost;
private final Cost secondCost;
private String description;
public CompositeCost(Cost firstCost, Cost secondCost, String description) {
@ -28,6 +28,11 @@ public class CompositeCost implements Cost {
throw new RuntimeException("Not supported method");
}
@Override
public void setText(String text) {
this.description = text;
}
@Override
public String getText() {
return description;

View file

@ -1,31 +1,30 @@
/*
* 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.
*/
* 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.abilities.costs;
import java.io.Serializable;
@ -37,12 +36,21 @@ import mage.target.Targets;
public interface Cost extends Serializable {
UUID getId();
String getText();
void setText(String text);
boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game);
boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana);
boolean isPaid();
void clearPaid();
void setPaid();
Targets getTargets();
Cost copy();

View file

@ -1,31 +1,30 @@
/*
* 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.
*/
* 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.abilities.costs;
import java.util.UUID;
@ -57,6 +56,7 @@ public abstract class CostImpl implements Cost {
return text;
}
@Override
public void setText(String text) {
this.text = text;
}

View file

@ -1,31 +1,30 @@
/*
* 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.
*/
* 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.abilities.costs;
import java.util.ArrayList;
@ -44,12 +43,16 @@ import mage.target.Targets;
*/
public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T> {
public CostsImpl() {}
protected String text = null;
public CostsImpl() {
}
public CostsImpl(final CostsImpl<T> costs) {
for (Cost cost: costs) {
this.add((T)cost.copy());
for (Cost cost : costs) {
this.add((T) cost.copy());
}
this.text = costs.text;
}
@Override
@ -57,20 +60,28 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
throw new RuntimeException("Not supported method");
}
@Override
public void setText(String text) {
this.text = text;
}
@Override
public String getText() {
if (text != null) {
return text;
}
if (this.size() == 0) {
return "";
}
StringBuilder sbText = new StringBuilder();
for (T cost: this) {
String text = cost.getText();
if (text != null && !text.isEmpty()) {
sbText.append(Character.toUpperCase(text.charAt(0))).append(text.substring(1)).append(", ");
for (T cost : this) {
String textCost = cost.getText();
if (textCost != null && !textCost.isEmpty()) {
sbText.append(Character.toUpperCase(textCost.charAt(0))).append(textCost.substring(1)).append(", ");
}
}
if (sbText.length() > 1){
if (sbText.length() > 1) {
sbText.setLength(sbText.length() - 2);
}
return sbText.toString();
@ -78,7 +89,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
for (T cost: this) {
for (T cost : this) {
if (!cost.canPay(ability, sourceId, controllerId, game)) {
return false;
}
@ -101,7 +112,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
@Override
public boolean isPaid() {
for (T cost: this) {
for (T cost : this) {
if (!(cost instanceof VariableManaCost) && !cost.isPaid()) {
return false;
}
@ -111,14 +122,14 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
@Override
public void clearPaid() {
for (T cost: this) {
for (T cost : this) {
cost.clearPaid();
}
}
@Override
public void setPaid() {
for (T cost: this) {
for (T cost : this) {
cost.setPaid();
}
}
@ -126,7 +137,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
@Override
public Costs<T> getUnpaid() {
Costs<T> unpaid = new CostsImpl<>();
for (T cost: this) {
for (T cost : this) {
if (!cost.isPaid()) {
unpaid.add(cost);
}
@ -140,17 +151,17 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
return unpaid.get(0);
}
return null;
}
}
@Override
public List<VariableCost> getVariableCosts() {
List<VariableCost> variableCosts = new ArrayList<>();
for (T cost: this) {
for (T cost : this) {
if (cost instanceof VariableCost) {
variableCosts.add((VariableCost) cost);
}
if (cost instanceof ManaCosts) {
variableCosts.addAll(((ManaCosts)cost).getVariableCosts());
variableCosts.addAll(((ManaCosts) cost).getVariableCosts());
}
}
return variableCosts;
@ -159,7 +170,7 @@ public class CostsImpl<T extends Cost> extends ArrayList<T> implements Costs<T>
@Override
public Targets getTargets() {
Targets targets = new Targets();
for (T cost: this) {
for (T cost : this) {
if (cost.getTargets() != null) {
targets.addAll(cost.getTargets());
}

View file

@ -50,7 +50,7 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
this.activated = false;
this.name = name;
this.delimiter = delimiter;
this.reminderText = new StringBuilder("<i>").append(reminderText).append("</i>").toString();
this.reminderText = "<i>(" + reminderText + ")</i>";
this.activatedCounter = 0;
this.add((Cost) cost);
}
@ -81,7 +81,7 @@ public class OptionalAdditionalCostImpl<T extends OptionalAdditionalCostImpl> ex
if (onlyCost) {
return getText();
} else {
return new StringBuffer(name).append(delimiter).append(getText()).toString();
return name + delimiter + getText();
}
}

View file

@ -37,8 +37,8 @@ import mage.target.Targets;
public class OrCost implements Cost {
private Cost firstCost;
private Cost secondCost;
private final Cost firstCost;
private final Cost secondCost;
private String description;
// which cost was slected to pay
private Cost selectedCost;
@ -61,6 +61,11 @@ public class OrCost implements Cost {
throw new RuntimeException("Not supported method");
}
@Override
public void setText(String text) {
this.description = text;
}
@Override
public String getText() {
return description;

View file

@ -77,6 +77,11 @@ public abstract class VariableCostImpl implements Cost, VariableCost {
this.amountPaid = cost.amountPaid;
}
@Override
public void setText(String text) {
this.text = text;
}
@Override
public String getText() {
return text;

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,21 +20,20 @@
* 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.abilities.costs.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
@ -44,23 +43,23 @@ import mage.target.common.TargetCardInHand;
* @author BetaSteward_at_googlemail.com
*/
public class DiscardTargetCost extends CostImpl {
List<Card> cards = new ArrayList<>();
protected boolean randomDiscard;
public DiscardTargetCost(TargetCardInHand target) {
this(target, false);
}
public DiscardTargetCost(TargetCardInHand target, boolean randomDiscard) {
this.addTarget(target);
this.randomDiscard = randomDiscard;
this.text = "Discard " + target.getTargetName();
this.text = "discard " + target.getTargetName();
}
public DiscardTargetCost(DiscardTargetCost cost) {
super(cost);
for (Card card: cost.cards) {
for (Card card : cost.cards) {
this.cards.add(card.copy());
}
this.randomDiscard = cost.randomDiscard;
@ -74,11 +73,11 @@ public class DiscardTargetCost extends CostImpl {
return false;
}
int amount = this.getTargets().get(0).getNumberOfTargets();
if (randomDiscard) {
if (randomDiscard) {
this.cards.addAll(player.discard(amount, true, ability, game).getCards(game));
} else {
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
for (UUID targetId: targets.get(0).getTargets()) {
if (targets.choose(Outcome.Discard, controllerId, sourceId, game)) {
for (UUID targetId : targets.get(0).getTargets()) {
Card card = player.getHand().get(targetId, game);
if (card == null) {
return false;
@ -94,7 +93,7 @@ public class DiscardTargetCost extends CostImpl {
@Override
public void clearPaid() {
super.clearPaid();
super.clearPaid();
cards.clear();
}

View file

@ -51,6 +51,7 @@ import mage.util.ManaUtil;
public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements ManaCosts<T> {
protected UUID id;
protected String text = null;
private static Map<String, ManaCosts> costs = new HashMap<>();
@ -372,8 +373,16 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
return this.id;
}
@Override
public void setText(String text) {
this.text = text;
}
@Override
public String getText() {
if (text != null) {
return text;
}
if (this.size() == 0) {
return "";
}

View file

@ -1,16 +1,16 @@
/*
* 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
@ -20,12 +20,11 @@
* 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.abilities.effects.common;
import mage.abilities.Ability;
@ -51,6 +50,7 @@ public class DrawCardTargetEffect extends OneShotEffect {
public DrawCardTargetEffect(int amount) {
this(new StaticValue(amount));
}
public DrawCardTargetEffect(int amount, boolean optional) {
this(new StaticValue(amount), optional);
}
@ -117,7 +117,7 @@ public class DrawCardTargetEffect extends OneShotEffect {
if (upTo) {
sb.append("up to ");
}
sb.append(CardUtil.numberToText(amount.toString())).append(" card");
sb.append(CardUtil.numberToText(amount.toString(), "a")).append(" card");
try {
if (Integer.parseInt(amount.toString()) > 1) {
sb.append("s");
@ -133,5 +133,4 @@ public class DrawCardTargetEffect extends OneShotEffect {
return sb.toString();
}
}

View file

@ -44,14 +44,14 @@ import mage.target.targetpointer.FixedTarget;
*
* @author LevelX2
*/
public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
Duration duration;
/**
* This effect let the controller choose one or more colors the target will
* become to.
* Use effect.setText() if case you use a targetPointer, otherwise the rule text will be empty.
* become to. Use effect.setText() if case you use a targetPointer,
* otherwise the rule text will be empty.
*
* @param duration
*/
@ -81,8 +81,9 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
if (!controller.canRespond()) {
return false;
}
if (!game.isSimulation())
if (!game.isSimulation()) {
game.informPlayers(target.getName() + ": " + controller.getLogName() + " has chosen " + choiceColor.getChoice());
}
if (choiceColor.getColor().isBlack()) {
sb.append("B");
} else if (choiceColor.getColor().isBlue()) {
@ -119,7 +120,7 @@ public class BecomesColorOrColorsTargetEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() > 0) {
sb.append("target ");
sb.append(mode.getTargets().get(0).getMessage());
sb.append(mode.getTargets().get(0).getFilter().getMessage());
sb.append(" becomes the color or colors of your choice");
if (duration.toString().length() > 0) {
sb.append(" ").append(duration.toString());

View file

@ -63,8 +63,8 @@ import mage.players.Player;
public class BuybackAbility extends StaticAbility implements OptionalAdditionalSourceCosts {
private static final String keywordText = "Buyback";
private static final String reminderTextCost = "<i>(You may {cost} in addition to any other costs as you cast this spell. If you do, put this card into your hand as it resolves.)</i>";
private static final String reminderTextMana = "<i>(You may pay an additional {cost} as you cast this spell. If you do, put this card into your hand as it resolves.)</i>";
private static final String reminderTextCost = "You may {cost} in addition to any other costs as you cast this spell. If you do, put this card into your hand as it resolves.";
private static final String reminderTextMana = "You may pay an additional {cost} as you cast this spell. If you do, put this card into your hand as it resolves.";
protected OptionalAdditionalCost buybackCost;
public BuybackAbility(String manaString) {

View file

@ -113,8 +113,9 @@ public class ConspireAbility extends StaticAbility implements OptionalAdditional
reminderText = "As you cast this spell, you may tap two untapped creatures you control that share a color with it. When you do, copy it and you may choose a new targets for the copy.)";
break;
}
conspireCost = new OptionalAdditionalCostImpl(keywordText, "-", reminderText,
new TapTargetCost(new TargetControlledPermanent(2, 2, filter, true)));
Cost cost = new TapTargetCost(new TargetControlledPermanent(2, 2, filter, true));
cost.setText("");
conspireCost = new OptionalAdditionalCostImpl(keywordText, " ", reminderText, cost);
addSubAbility(new ConspireTriggeredAbility(conspireId));
}

View file

@ -59,7 +59,7 @@ import mage.players.Player;
public class EntwineAbility extends StaticAbility implements OptionalAdditionalModeSourceCosts {
private static final String keywordText = "Entwine";
private static final String reminderText = "<i> (Choose both if you pay the entwine cost.)</i>";
private static final String reminderText = "Choose both if you pay the entwine cost.";
protected OptionalAdditionalCost additionalCost;
public EntwineAbility(String manaString) {

View file

@ -85,8 +85,8 @@ import mage.players.Player;
public class KickerAbility extends StaticAbility implements OptionalAdditionalSourceCosts {
protected static final String KICKER_KEYWORD = "Kicker";
protected static final String KICKER_REMINDER_MANA = "(You may pay an additional {cost} as you cast this spell.)";
protected static final String KICKER_REMINDER_COST = "(You may {cost} in addition to any other costs as you cast this spell.)";
protected static final String KICKER_REMINDER_MANA = "You may pay an additional {cost} as you cast this spell.";
protected static final String KICKER_REMINDER_COST = "You may {cost} in addition to any other costs as you cast this spell.";
protected Map<String, Integer> activations = new HashMap<>(); // zoneChangeCounter, activations

View file

@ -56,7 +56,7 @@ import mage.players.Player;
public class ReplicateAbility extends StaticAbility implements OptionalAdditionalSourceCosts {
private static final String keywordText = "Replicate";
private static final String reminderTextMana = "<i>(When you cast this spell, copy it for each time you paid its replicate cost. You may choose new targets for the copies.)</i>";
private static final String reminderTextMana = "When you cast this spell, copy it for each time you paid its replicate cost. You may choose new targets for the copies.";
protected OptionalAdditionalCost additionalCost;
public ReplicateAbility(Card card, String manaString) {

View file

@ -28,6 +28,7 @@
package mage.abilities.keyword;
import mage.abilities.SpellAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.cards.Card;
import mage.constants.SpellAbilityType;
@ -44,7 +45,9 @@ public class RetraceAbility extends SpellAbility {
public RetraceAbility(Card card) {
super(card.getManaCost(), card.getName() + " with retrace", Zone.GRAVEYARD, SpellAbilityType.BASE_ALTERNATE);
this.getCosts().addAll(card.getSpellAbility().getCosts().copy());
this.addCost(new DiscardTargetCost(new TargetCardInHand(new FilterLandCard())));
Cost cost = new DiscardTargetCost(new TargetCardInHand(new FilterLandCard()));
cost.setText("");
this.addCost(cost);
this.getEffects().addAll(card.getSpellAbility().getEffects().copy());
this.getTargets().addAll(card.getSpellAbility().getTargets().copy());
this.getChoices().addAll(card.getSpellAbility().getChoices().copy());