Merge pull request #4008 from theelk801/master

bug fixes
This commit is contained in:
theelk801 2017-09-16 23:22:18 -04:00 committed by GitHub
commit 81fc60370b
2 changed files with 16 additions and 14 deletions

View file

@ -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);
}
}
}
}

View file

@ -29,7 +29,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.keyword.ExploreSourceEffect;
import mage.abilities.keyword.VigilanceAbility;
import mage.cards.CardImpl;
@ -55,7 +55,7 @@ public class SunriseSeeker extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// When Sunrise Seeker enters the battlefield, it explores.
this.addAbility(new EntersBattlefieldAbility(new ExploreSourceEffect()));
this.addAbility(new EntersBattlefieldTriggeredAbility(new ExploreSourceEffect()));
}
public SunriseSeeker(final SunriseSeeker card) {