Merge pull request #6983 from acabaca24/master

Fixed the Ghostly Pilferer triggered ability
This commit is contained in:
LevelX2 2020-08-18 17:27:15 +02:00 committed by GitHub
commit 82fa86cc24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -41,6 +41,10 @@ public final class GhostlyPilferer extends CardImpl {
// Whenever an opponent casts a spell from anywhere other than their hand, draw a card. // Whenever an opponent casts a spell from anywhere other than their hand, draw a card.
this.addAbility(new GhostlyPilfererTriggeredAbility()); this.addAbility(new GhostlyPilfererTriggeredAbility());
/*TODO: I think this way is the optimal way(copied from counter balance):
* this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD,
* new CounterbalanceEffect(), StaticFilters.FILTER_SPELL, true, SetTargetPointer.SPELL));
*/
// Discard a card: Ghostly Pilferer can't be blocked this turn. // Discard a card: Ghostly Pilferer can't be blocked this turn.
this.addAbility(new SimpleActivatedAbility( this.addAbility(new SimpleActivatedAbility(
@ -80,11 +84,9 @@ class GhostlyPilfererTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
if (event.getZone() == Zone.HAND) {
return false;
}
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
return spell != null; return (game.getOpponents(getControllerId()).contains(spell.getControllerId())
&& event.getZone() != Zone.HAND);
} }
@Override @Override