Fixed rule text generation of Renown.

This commit is contained in:
LevelX2 2015-07-04 19:27:08 +02:00
parent d33f85d04a
commit 1782832d82

View file

@ -22,8 +22,6 @@ import mage.util.CardUtil;
* *
* @author LevelX2 * @author LevelX2
*/ */
public class RenownAbility extends TriggeredAbilityImpl { public class RenownAbility extends TriggeredAbilityImpl {
private int renownValue; private int renownValue;
@ -50,7 +48,7 @@ public class RenownAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkInterveningIfClause(Game game) { public boolean checkInterveningIfClause(Game game) {
return getSourceObject(game) != null && !((Permanent)getSourceObject(game)).isRenown(); return getSourceObject(game) != null && !((Permanent) getSourceObject(game)).isRenown();
} }
@Override @Override
@ -59,11 +57,6 @@ public class RenownAbility extends TriggeredAbilityImpl {
&& ((DamagedPlayerEvent) event).isCombatDamage(); && ((DamagedPlayerEvent) event).isCombatDamage();
} }
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, " + super.getRule();
}
public int getRenownValue() { public int getRenownValue() {
return renownValue; return renownValue;
} }
@ -95,7 +88,7 @@ class BecomeRenownSourceEffect extends OneShotEffect {
if (renownValue == Integer.MAX_VALUE) { if (renownValue == Integer.MAX_VALUE) {
renownValue = source.getManaCostsToPay().getX(); renownValue = source.getManaCostsToPay().getX();
} }
new AddCountersSourceEffect(CounterType.P1P1.createInstance(renownValue),true).apply(game, source); new AddCountersSourceEffect(CounterType.P1P1.createInstance(renownValue), true).apply(game, source);
permanent.setRenown(true); permanent.setRenown(true);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_RENOWN, source.getSourceId(), source.getSourceId(), source.getControllerId(), renownValue)); game.fireEvent(GameEvent.getEvent(GameEvent.EventType.BECOMES_RENOWN, source.getSourceId(), source.getSourceId(), source.getControllerId(), renownValue));
return true; return true;
@ -106,9 +99,9 @@ class BecomeRenownSourceEffect extends OneShotEffect {
private String setText(int renownValue) { private String setText(int renownValue) {
// Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.) // Renown 1 (When this creature deals combat damage to a player, if it isn't renowned, put a +1/+1 counter on it and it becomes renowned.)
StringBuilder sb = new StringBuilder("Renown "); StringBuilder sb = new StringBuilder("Renown ");
sb.append(renownValue == Integer.MAX_VALUE ? "X":renownValue) sb.append(renownValue == Integer.MAX_VALUE ? "X" : renownValue)
.append(". <i>(When this creature deals combat damage to a player, if it isn't renowned, put ") .append(". <i>(When this creature deals combat damage to a player, if it isn't renowned, put ")
.append(renownValue == Integer.MAX_VALUE ? "X":CardUtil.numberToText(renownValue, "a")) .append(renownValue == Integer.MAX_VALUE ? "X" : CardUtil.numberToText(renownValue, "a"))
.append(" +1/+1 counter on it and it becomes renowned.)</i>").toString(); .append(" +1/+1 counter on it and it becomes renowned.)</i>").toString();
return sb.toString(); return sb.toString();
} }