mirror of
https://github.com/correl/mage.git
synced 2025-03-17 01:06:26 -09: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("Leviathan");
|
||||||
this.subtype.add("Horror");
|
this.subtype.add("Horror");
|
||||||
|
|
||||||
|
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(7);
|
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) {
|
public NemesisOfReason (final NemesisOfReason card) {
|
||||||
|
@ -71,8 +74,9 @@ public class NemesisOfReason extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class NemesisOfReasonTriggeredAbility extends TriggeredAbilityImpl {
|
class NemesisOfReasonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
NemesisOfReasonTriggeredAbility() {
|
|
||||||
super(Zone.BATTLEFIELD, new PutLibraryIntoGraveTargetEffect(10));
|
NemesisOfReasonTriggeredAbility(Effect effect) {
|
||||||
|
super(Zone.BATTLEFIELD, effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
NemesisOfReasonTriggeredAbility(final NemesisOfReasonTriggeredAbility ability) {
|
NemesisOfReasonTriggeredAbility(final NemesisOfReasonTriggeredAbility ability) {
|
||||||
|
@ -84,11 +88,17 @@ class NemesisOfReasonTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return new NemesisOfReasonTriggeredAbility(this);
|
return new NemesisOfReasonTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
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()) {
|
for (Effect effect : this.getEffects()) {
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
effect.setTargetPointer(new FixedTarget(defenderId));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,10 +108,14 @@ class ThraximundarTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
return new ThraximundarTriggeredAbility(this);
|
return new ThraximundarTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType() == GameEvent.EventType.ATTACKER_DECLARED;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.ATTACKER_DECLARED
|
if (event.getSourceId() == this.getSourceId()) {
|
||||||
&& event.getSourceId() == this.getSourceId()) {
|
|
||||||
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
UUID defender = game.getCombat().getDefendingPlayerId(this.getSourceId(), game);
|
||||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
this.getEffects().get(0).setTargetPointer(new FixedTarget(defender));
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -82,6 +82,9 @@ public class PutLibraryIntoGraveTargetEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getText(Mode mode) {
|
public String getText(Mode mode) {
|
||||||
|
if (staticText != null && !staticText.isEmpty()) {
|
||||||
|
return staticText;
|
||||||
|
}
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
String message = amount.getMessage();
|
String message = amount.getMessage();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue