mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
fix Blightwing Bandit (#11282)
This commit is contained in:
parent
1a6bbfa873
commit
25e559dd9d
3 changed files with 22 additions and 16 deletions
|
|
@ -1,9 +1,11 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.common.SpellsCastWatcher;
|
||||
|
||||
/**
|
||||
|
|
@ -15,10 +17,14 @@ public class FirstSpellOpponentsTurnTriggeredAbility extends SpellCastController
|
|||
= new FilterSpell("your first spell during each opponent's turn");
|
||||
|
||||
public FirstSpellOpponentsTurnTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(effect, defaultFilter, optional);
|
||||
this(effect, optional, SetTargetPointer.NONE);
|
||||
}
|
||||
|
||||
private FirstSpellOpponentsTurnTriggeredAbility(final FirstSpellOpponentsTurnTriggeredAbility ability) {
|
||||
public FirstSpellOpponentsTurnTriggeredAbility(Effect effect, boolean optional, SetTargetPointer setTargetPointer) {
|
||||
super(effect, defaultFilter, optional, setTargetPointer);
|
||||
}
|
||||
|
||||
protected FirstSpellOpponentsTurnTriggeredAbility(final FirstSpellOpponentsTurnTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
|
|
@ -30,11 +36,16 @@ public class FirstSpellOpponentsTurnTriggeredAbility extends SpellCastController
|
|||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.getControllerId()) // ignore controller turn
|
||||
|| !super.checkTrigger(event, game)
|
||||
|| !game.getOpponents(this.getControllerId()).contains(game.getActivePlayerId())) {
|
||||
return false;
|
||||
}
|
||||
SpellsCastWatcher watcher = game.getState().getWatcher(SpellsCastWatcher.class);
|
||||
return watcher != null && watcher.getCount(event.getPlayerId()) == 1;
|
||||
if (watcher != null && (watcher.getCount(event.getPlayerId()) == 1) && super.checkTrigger(event, game)) {
|
||||
if (setTargetPointer == SetTargetPointer.PLAYER) { // not handled in super class
|
||||
getAllEffects().setTargetPointer(new FixedTarget(game.getActivePlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,15 +83,16 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.getEffects().setValue("spellCast", spell);
|
||||
switch (setTargetPointer) {
|
||||
case NONE:
|
||||
case PLAYER: // for subclasses only, needs to be handled there
|
||||
break;
|
||||
case SPELL:
|
||||
getEffects().setTargetPointer(new FixedTarget(spell.getId(), game));
|
||||
getAllEffects().setTargetPointer(new FixedTarget(spell.getId(), game));
|
||||
break;
|
||||
case CARD:
|
||||
getEffects().setTargetPointer(new FixedTarget(spell.getCard().getId()));
|
||||
getAllEffects().setTargetPointer(new FixedTarget(spell.getCard().getId()));
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unexpected setTargetPointer " + setTargetPointer);
|
||||
throw new UnsupportedOperationException("Unexpected setTargetPointer in SpellCastControllerTriggeredAbility: " + setTargetPointer);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -114,7 +115,6 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
|
|||
text += " from your " + fromZone.toString().toLowerCase();
|
||||
break;
|
||||
}
|
||||
|
||||
setTriggerPhrase(text + ", ");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue