Fixed Admiral Beckett Brass trigger
@@ -53,6 +53,7 @@ import mage.filter.predicate.Predicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
+import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetNonlandPermanent;
@@ -85,9 +86,8 @@ public class AdmiralBeckettBrass extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
// At the beginning of your end step, gain control of target nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn.
- Ability ability = new BeginningOfEndStepTriggeredAbility(new GainControlTargetEffect(Duration.Custom)
- .setText("gain control of target nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn"), TargetController.YOU, false);
- ability.addTarget(new TargetNonlandPermanent());
+ Ability ability = new BeginningOfEndStepTriggeredAbility(new GainControlTargetEffect(Duration.Custom), TargetController.YOU, false);
+ ability.addTarget(new TargetNonlandPermanent(new FilterNonlandPermanent("nonland permanent controlled by a player who was dealt combat damage by three or more Pirates this turn")));
originalId = ability.getOriginalId();
this.addAbility(ability, new DamagedByPiratesWatcher());
}
@@ -138,7 +138,8 @@ class DamagedByPiratesWatcher extends Watcher {
@Override
public void watch(GameEvent event, Game game) {
- if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getFlag()) {
+ if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
+ if (((DamagedPlayerEvent) event).isCombatDamage()) {
Permanent creature = game.getPermanentOrLKIBattlefield(event.getSourceId());
if (creature != null && creature.getSubtype(game).contains(SubType.PIRATE)) {
if (damageSourceIds.keySet().contains(event.getTargetId())) {
@@ -151,6 +152,7 @@ class DamagedByPiratesWatcher extends Watcher {
}
}
}
+ }
public boolean damagedByEnoughPirates(UUID sourceId, Game game) {
return damageSourceIds.keySet().contains(sourceId) && damageSourceIds.get(sourceId).size() > 2;
