mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Fix DealsDamageToOpponentTriggeredAbility unconditionally overwriting the targets of any effects added to it.
This fixes at least Charnelhoard Wurm, and possibly other similar abilities.
This commit is contained in:
parent
a2e1e2e614
commit
6d90539b7b
7 changed files with 20 additions and 12 deletions
|
@ -58,7 +58,7 @@ public class FungalShambler extends CardImpl {
|
|||
// Whenever Fungal Shambler deals damage to an opponent, you draw a card and that opponent discards a card.
|
||||
Effect effect = new DrawCardSourceControllerEffect(1);
|
||||
effect.setText("you draw a card");
|
||||
Ability ability = new DealsDamageToOpponentTriggeredAbility(effect, false);
|
||||
Ability ability = new DealsDamageToOpponentTriggeredAbility(effect, false, false, true);
|
||||
effect = new DiscardTargetEffect(1);
|
||||
effect.setText("and that opponent discards a card");
|
||||
ability.addEffect(effect);
|
||||
|
|
|
@ -55,7 +55,7 @@ public class HydraOmnivore extends CardImpl {
|
|||
this.toughness = new MageInt(8);
|
||||
|
||||
// Whenever Hydra Omnivore deals combat damage to an opponent, it deals that much damage to each other opponent.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new HydraOmnivoreEffect(), false, true));
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new HydraOmnivoreEffect(), false, true, true));
|
||||
}
|
||||
|
||||
public HydraOmnivore(final HydraOmnivore card) {
|
||||
|
|
|
@ -62,7 +62,7 @@ public class NicolBolas extends CardImpl {
|
|||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new SacrificeSourceUnlessPaysEffect(new ManaCostsImpl("{U}{B}{R}")), TargetController.YOU, false));
|
||||
|
||||
// Whenever Nicol Bolas deals damage to an opponent, that player discards his or her hand.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardHandTargetEffect("that player"), false));
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardHandTargetEffect("that player"), false, false, true));
|
||||
}
|
||||
|
||||
public NicolBolas(final NicolBolas card) {
|
||||
|
|
|
@ -54,7 +54,7 @@ public class HypnoticSpecter extends CardImpl {
|
|||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// Whenever Hypnotic Specter deals damage to an opponent, that player discards a card at random.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1, true)));
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1, true), false, false, true));
|
||||
}
|
||||
|
||||
public HypnoticSpecter(final HypnoticSpecter card) {
|
||||
|
|
|
@ -53,7 +53,7 @@ public class WeiNightRaiders extends CardImpl {
|
|||
// Horsemanship
|
||||
this.addAbility(HorsemanshipAbility.getInstance());
|
||||
// Whenever Wei Night Raiders deals damage to an opponent, that player discards a card.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false));
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false, false, true));
|
||||
}
|
||||
|
||||
public WeiNightRaiders(final WeiNightRaiders card) {
|
||||
|
|
|
@ -51,7 +51,7 @@ public class ZhangLiaoHeroOfHefei extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Whenever Zhang Liao, Hero of Hefei deals damage to an opponent, that opponent discards a card.
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false));
|
||||
this.addAbility(new DealsDamageToOpponentTriggeredAbility(new DiscardTargetEffect(1), false, false, true));
|
||||
}
|
||||
|
||||
public ZhangLiaoHeroOfHefei(final ZhangLiaoHeroOfHefei card) {
|
||||
|
|
|
@ -40,24 +40,30 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*/
|
||||
public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
boolean onlyCombat;
|
||||
private final boolean onlyCombat, setTargetPointer;
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect) {
|
||||
this(effect, false, false);
|
||||
this(effect, false, false, false);
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, optional, false);
|
||||
this(effect, optional, false, false);
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat) {
|
||||
this(effect, optional, onlyCombat, false);
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(Effect effect, boolean optional, boolean onlyCombat, boolean setTargetPointer) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.onlyCombat = onlyCombat;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
public DealsDamageToOpponentTriggeredAbility(final DealsDamageToOpponentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.onlyCombat = ability.onlyCombat;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -80,10 +86,12 @@ public class DealsDamageToOpponentTriggeredAbility extends TriggeredAbilityImpl
|
|||
return false;
|
||||
}
|
||||
}
|
||||
if(setTargetPointer) {
|
||||
for (Effect effect : getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
effect.setValue("damage", event.getAmount());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue