* Saskia, the Unyielding - Fixed a NPE bug caused the triggered ability.

This commit is contained in:
LevelX2 2016-11-06 23:01:00 +01:00
parent 0db7a0427d
commit 618ee3698b
3 changed files with 16 additions and 15 deletions

View file

@ -106,7 +106,10 @@ class SaskiaTheUnyieldingEffect extends OneShotEffect {
UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player"); UUID playerId = (UUID) game.getState().getValue(source.getSourceId() + "_player");
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null && player.canRespond()) { if (player != null && player.canRespond()) {
player.damage((Integer) this.getValue("damage"), source.getSourceId(), game, false, true); Integer damage = (Integer) this.getValue("damage");
if (damage > 0) {
player.damage(damage, source.getSourceId(), game, false, true);
}
} }
return true; return true;
} }

View file

@ -53,7 +53,7 @@ import mage.target.TargetCard;
public class SatyrWayfinder extends CardImpl { public class SatyrWayfinder extends CardImpl {
public SatyrWayfinder(UUID ownerId, CardSetInfo setInfo) { public SatyrWayfinder(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add("Satyr"); this.subtype.add("Satyr");
this.power = new MageInt(1); this.power = new MageInt(1);
@ -100,7 +100,7 @@ class SatyrWayfinderEffect extends OneShotEffect {
cards.addAll(controller.getLibrary().getTopCards(game, 4)); cards.addAll(controller.getLibrary().getTopCards(game, 4));
boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0; boolean properCardFound = cards.count(filterPutInHand, source.getControllerId(), source.getSourceId(), game) > 0;
if (!cards.isEmpty()) { if (!cards.isEmpty()) {
controller.revealCards(sourceObject.getName(), cards, game); controller.revealCards(sourceObject.getIdName(), cards, game);
TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand); TargetCard target = new TargetCard(Zone.LIBRARY, filterPutInHand);
if (properCardFound if (properCardFound
&& controller.chooseUse(outcome, "Put a land card into your hand?", source, game) && controller.chooseUse(outcome, "Put a land card into your hand?", source, game)

View file

@ -78,19 +78,17 @@ public class DealsDamageToAPlayerAllTriggeredAbility extends TriggeredAbilityImp
Permanent permanent = game.getPermanent(event.getSourceId()); Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) { if (permanent != null) {
if (filter.match(permanent, getSourceId(), getControllerId(), game)) { if (filter.match(permanent, getSourceId(), getControllerId(), game)) {
if (!setTargetPointer.equals(SetTargetPointer.NONE)) { for (Effect effect : this.getEffects()) {
for (Effect effect : this.getEffects()) { effect.setValue("damage", event.getAmount());
effect.setValue("damage", event.getAmount()); switch (setTargetPointer) {
switch (setTargetPointer) { case PLAYER:
case PLAYER: effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
effect.setTargetPointer(new FixedTarget(permanent.getControllerId())); break;
break; case PERMANENT:
case PERMANENT: effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game)));
effect.setTargetPointer(new FixedTarget(permanent.getId(), permanent.getZoneChangeCounter(game))); break;
break;
}
} }
} }
return true; return true;
} }