* Nemesis of Reason - Fixed IndexOutOfBoundsException.

This commit is contained in:
LevelX2 2015-06-11 00:31:17 +02:00
parent 50250176ed
commit 5c6629919f
3 changed files with 26 additions and 9 deletions

View file

@ -53,11 +53,14 @@ public class NemesisOfReason extends CardImpl {
this.expansionSetCode = "ARB";
this.subtype.add("Leviathan");
this.subtype.add("Horror");
this.power = new MageInt(3);
this.toughness = new MageInt(7);
this.addAbility(new NemesisOfReasonTriggeredAbility());
// Whenever Nemesis of Reason attacks, defending player puts the top ten cards of his or her library into his or her graveyard.
Effect effect = new PutLibraryIntoGraveTargetEffect(10);
effect.setText("defending player puts the top ten cards of his or her library into his or her graveyard");
this.addAbility(new NemesisOfReasonTriggeredAbility(effect));
}
public NemesisOfReason (final NemesisOfReason card) {
@ -71,8 +74,9 @@ public class NemesisOfReason extends CardImpl {
}
class NemesisOfReasonTriggeredAbility extends TriggeredAbilityImpl {
NemesisOfReasonTriggeredAbility() {
super(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(10));
NemesisOfReasonTriggeredAbility(Effect effect) {
super(Zone.BATTLEFIELD, effect);
}
NemesisOfReasonTriggeredAbility(final NemesisOfReasonTriggeredAbility ability) {
@ -84,11 +88,17 @@ class NemesisOfReasonTriggeredAbility extends TriggeredAbilityImpl {
return new NemesisOfReasonTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED && event.getSourceId().equals(this.getSourceId()) ) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
if (event.getSourceId().equals(this.getSourceId()) ) {
UUID defenderId = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(defenderId));
}
return true;
}

View file

@ -108,10 +108,14 @@ class ThraximundarTriggeredAbility extends TriggeredAbilityImpl {
return new ThraximundarTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED
&& event.getSourceId() == this.getSourceId()) {
if (event.getSourceId() == this.getSourceId()) {
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
return true;

View file

@ -82,6 +82,9 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
@Override
public String getText(Mode mode) {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
String message = amount.getMessage();