mirror of
https://github.com/correl/mage.git
synced 2024-12-25 19:25:41 +00:00
Fixed a bug of BloodSeeker not applying its effect to the correct target.
This commit is contained in:
parent
a200afabe5
commit
ae838c315c
1 changed files with 47 additions and 2 deletions
|
@ -28,13 +28,21 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.Constants;
|
||||
import mage.Constants.CardType;
|
||||
import mage.Constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.target.TargetPlayer;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -51,7 +59,9 @@ public class BloodSeeker extends CardImpl<BloodSeeker> {
|
|||
this.color.setBlack(true);
|
||||
this.power = new MageInt(1);
|
||||
this.toughness = new MageInt(1);
|
||||
CreatureEntersBattlefieldTriggeredAbility ability = new CreatureEntersBattlefieldTriggeredAbility(new LoseLifeTargetEffect(1), true, true);
|
||||
|
||||
// Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life.
|
||||
Ability ability = new BloodSeekerTriggeredAbility();
|
||||
ability.addTarget(new TargetPlayer());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -65,3 +75,38 @@ public class BloodSeeker extends CardImpl<BloodSeeker> {
|
|||
return new BloodSeeker(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BloodSeekerTriggeredAbility extends TriggeredAbilityImpl<BloodSeekerTriggeredAbility> {
|
||||
BloodSeekerTriggeredAbility() {
|
||||
super(Constants.Zone.BATTLEFIELD, new LoseLifeTargetEffect(1), true);
|
||||
}
|
||||
|
||||
BloodSeekerTriggeredAbility(final BloodSeekerTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BloodSeekerTriggeredAbility copy() {
|
||||
return new BloodSeekerTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD && game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
|
||||
Card card = zEvent.getTarget();
|
||||
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature enters the battlefield under an opponent's control, you may have that player lose 1 life.";
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue