Open doctorpangloss opened 7 years ago
Doomguard summons a Silverware Golem twice from your hand, as long as there is one copy, and go about its business discarding cards otherwise. It's extremely mysterious to me why it is broken based on the code below:
@Override protected boolean fire(GameEvent event, Entity host) { DiscardEvent discardEvent = (DiscardEvent) event; EntityReference target = (EntityReference) desc.get(EventTriggerArg.TARGET); if (target == EntityReference.SELF && discardEvent.getCard() != host) { return false; } return true; }
I changed the code to this, and fixed the bug.
@Override protected boolean fire(GameEvent event, Entity host) { DiscardEvent discardEvent = (DiscardEvent) event; EntityReference target = (EntityReference) desc.get(EventTriggerArg.TARGET); TargetPlayer targetPlayer = (TargetPlayer) desc.get(EventTriggerArg.TARGET_PLAYER); final int owner = host.getOwner(); boolean targetPlayerSatisfied = targetPlayer == null || (targetPlayer == TargetPlayer.SELF && owner == event.getTargetPlayerId()) || (targetPlayer == TargetPlayer.OWNER && owner == event.getTargetPlayerId()); boolean targetSatisfied = target == null; if (target != null) { List<Entity> resolvedTargets = event.getGameContext().resolveTarget(event.getGameContext().getPlayer(owner), host, target); targetSatisfied = resolvedTargets != null && resolvedTargets.stream().anyMatch(e -> e.getId() == discardEvent.getCard().getId()); } return targetPlayerSatisfied && targetSatisfied; }
The code above was updated to pass all tests.
Doomguard summons a Silverware Golem twice from your hand, as long as there is one copy, and go about its business discarding cards otherwise. It's extremely mysterious to me why it is broken based on the code below:
I changed the code to this, and fixed the bug.