mirror of
https://github.com/correl/mage.git
synced 2024-12-28 11:14:13 +00:00
Fixed Admiral Beckett Brass trigger (#4006)
This commit is contained in:
parent
49f047f700
commit
77110bbc5a
1 changed files with 14 additions and 12 deletions
|
@ -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,15 +138,17 @@ class DamagedByPiratesWatcher extends Watcher {
|
|||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getFlag()) {
|
||||
Permanent creature = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (creature != null && creature.getSubtype(game).contains(SubType.PIRATE)) {
|
||||
if (damageSourceIds.keySet().contains(event.getTargetId())) {
|
||||
damageSourceIds.get(event.getTargetId()).add(creature.getId());
|
||||
} else {
|
||||
Set<UUID> creatureSet = new HashSet();
|
||||
creatureSet.add(creature.getId());
|
||||
damageSourceIds.put(event.getTargetId(), creatureSet);
|
||||
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())) {
|
||||
damageSourceIds.get(event.getTargetId()).add(creature.getId());
|
||||
} else {
|
||||
Set<UUID> creatureSet = new HashSet();
|
||||
creatureSet.add(creature.getId());
|
||||
damageSourceIds.put(event.getTargetId(), creatureSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue