mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
* Nemesis of Reason - Fixed IndexOutOfBoundsException.
This commit is contained in:
parent
50250176ed
commit
5c6629919f
3 changed files with 26 additions and 9 deletions
|
@ -54,10 +54,13 @@ public class NemesisOfReason extends CardImpl {
|
|||
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()) ) {
|
||||
if (event.getSourceId().equals(this.getSourceId()) ) {
|
||||
UUID defenderId = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setTargetPointer(new FixedTarget(defenderId));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue