Some minor rework.

This commit is contained in:
LevelX2 2016-10-14 08:43:31 +02:00
parent 09531d938c
commit a766cafac6
2 changed files with 29 additions and 31 deletions

View file

@ -51,11 +51,10 @@ import mage.players.Player;
public class WarCadence extends CardImpl { public class WarCadence extends CardImpl {
public WarCadence(UUID ownerId, CardSetInfo setInfo) { public WarCadence(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{R}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}");
// {X}{R}: This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls. // {X}{R}: This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WarCadenceReplacementEffect(), new ManaCostsImpl("{X}{R}") )); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WarCadenceReplacementEffect(), new ManaCostsImpl("{X}{R}")));
} }
@ -73,12 +72,12 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl {
DynamicValue xCosts = new ManacostVariableValue(); DynamicValue xCosts = new ManacostVariableValue();
WarCadenceReplacementEffect ( ) { WarCadenceReplacementEffect() {
super(Duration.EndOfTurn, Outcome.Neutral); super(Duration.EndOfTurn, Outcome.Neutral);
staticText = "This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls"; staticText = "This turn, creatures can't block unless their controller pays {X} for each blocking creature he or she controls";
} }
WarCadenceReplacementEffect ( WarCadenceReplacementEffect effect ) { WarCadenceReplacementEffect(WarCadenceReplacementEffect effect) {
super(effect); super(effect);
} }
@ -88,10 +87,10 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl {
if (player != null) { if (player != null) {
int amount = xCosts.calculate(game, source, this); int amount = xCosts.calculate(game, source, this);
if (amount > 0) { if (amount > 0) {
String mana = new StringBuilder("{").append(amount).append("}").toString(); String mana = "{" + amount + "}";
ManaCostsImpl cost = new ManaCostsImpl(mana); ManaCostsImpl cost = new ManaCostsImpl(mana);
if ( cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game)
player.chooseUse(Outcome.Benefit, new StringBuilder("Pay ").append(mana).append(" to declare blocker?").toString(), source, game) ) { && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare blocker?", source, game)) {
if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) {
return false; return false;
} }
@ -106,7 +105,7 @@ class WarCadenceReplacementEffect extends ReplacementEffectImpl {
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARE_BLOCKER; return event.getType() == GameEvent.EventType.DECLARE_BLOCKER;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
return true; return true;

View file

@ -34,9 +34,9 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.DynamicValue; import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ReplacementEffectImpl;
import mage.constants.CardType;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
@ -46,23 +46,22 @@ import mage.players.Player;
/** /**
* *
* *
* @author HCrescent * @author HCrescent original code by LevelX2 edited from War Cadence
* original code by LevelX2 edited from War Cadence
*/ */
public class WarTax extends CardImpl { public class WarTax extends CardImpl {
public WarTax(UUID ownerId, CardSetInfo setInfo) { public WarTax(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{U}");
// {X}{U}: This turn, creatures can't attack unless their controller pays {X} for each attacking creature he or she controls. // {X}{U}: This turn, creatures can't attack unless their controller pays {X} for each attacking creature he or she controls.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WarTaxReplacementEffect(), new ManaCostsImpl("{X}{U}") )); this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new WarTaxReplacementEffect(), new ManaCostsImpl("{X}{U}")));
} }
public WarTax(final WarTax card) { public WarTax(final WarTax card) {
super(card); super(card);
} }
@Override @Override
public WarTax copy() { public WarTax copy() {
return new WarTax(this); return new WarTax(this);
@ -70,28 +69,28 @@ public class WarTax extends CardImpl {
} }
class WarTaxReplacementEffect extends ReplacementEffectImpl { class WarTaxReplacementEffect extends ReplacementEffectImpl {
DynamicValue xCosts = new ManacostVariableValue(); DynamicValue xCosts = new ManacostVariableValue();
WarTaxReplacementEffect ( ) { WarTaxReplacementEffect() {
super(Duration.EndOfTurn, Outcome.Neutral); super(Duration.EndOfTurn, Outcome.Neutral);
staticText = "This turn, creatures can't attack unless their controller pays {X} for each attacking creature he or she controls"; staticText = "This turn, creatures can't attack unless their controller pays {X} for each attacking creature he or she controls";
} }
WarTaxReplacementEffect ( WarTaxReplacementEffect effect ) { WarTaxReplacementEffect(WarTaxReplacementEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) { public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Player player = game.getPlayer(event.getPlayerId()); Player player = game.getPlayer(event.getPlayerId());
if (player != null) { if (player != null) {
int amount = xCosts.calculate(game, source, this); int amount = xCosts.calculate(game, source, this);
if (amount > 0) { if (amount > 0) {
String mana = new StringBuilder("{").append(amount).append("}").toString(); String mana = "{" + amount + "}";
ManaCostsImpl cost = new ManaCostsImpl(mana); ManaCostsImpl cost = new ManaCostsImpl(mana);
if ( cost.canPay(source, source.getSourceId(), event.getPlayerId(), game) && if (cost.canPay(source, source.getSourceId(), event.getPlayerId(), game)
player.chooseUse(Outcome.Benefit, new StringBuilder("Pay").append(mana).append(" to declare attacker?").toString(), source, game) ) { && player.chooseUse(Outcome.Benefit, "Pay " + mana + " to declare attacker?", source, game)) {
if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) { if (cost.payOrRollback(source, game, source.getSourceId(), event.getPlayerId())) {
return false; return false;
} }
@ -101,19 +100,19 @@ class WarTaxReplacementEffect extends ReplacementEffectImpl {
} }
return false; return false;
} }
@Override @Override
public boolean checksEventType(GameEvent event, Game game) { public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER; return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
} }
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
return true; return true;
} }
@Override @Override
public WarTaxReplacementEffect copy() { public WarTaxReplacementEffect copy() {
return new WarTaxReplacementEffect(this); return new WarTaxReplacementEffect(this);
} }
} }