mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fixed Haunting Wind not working at all (fixes #4104)
This commit is contained in:
parent
302e0ff615
commit
d7a8e7c7e6
2 changed files with 102 additions and 32 deletions
|
@ -29,7 +29,10 @@ package mage.cards.h;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.common.DamageControllerEffect;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -37,19 +40,20 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MarcoMarin
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class HauntingWind extends CardImpl {
|
||||
|
||||
public HauntingWind(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
|
||||
|
||||
// Whenever an artifact becomes tapped or a player activates an artifact's ability without {tap} in its activation cost, Haunting Wind deals 1 damage to that artifact's controller.
|
||||
|
||||
this.addAbility(new AbilityActivatedTriggeredAbility2());
|
||||
this.addAbility(new HauntingWindTriggeredAbility());
|
||||
}
|
||||
|
||||
public HauntingWind(final HauntingWind card) {
|
||||
|
@ -62,36 +66,68 @@ public class HauntingWind extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AbilityActivatedTriggeredAbility2 extends TriggeredAbilityImpl {
|
||||
class HauntingWindTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
AbilityActivatedTriggeredAbility2() {
|
||||
super(Zone.BATTLEFIELD, new DamageControllerEffect(1));
|
||||
HauntingWindTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamageTargetEffect(1));
|
||||
}
|
||||
|
||||
AbilityActivatedTriggeredAbility2(final AbilityActivatedTriggeredAbility2 ability) {
|
||||
HauntingWindTriggeredAbility(final HauntingWindTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityActivatedTriggeredAbility2 copy() {
|
||||
return new AbilityActivatedTriggeredAbility2(this);
|
||||
public HauntingWindTriggeredAbility copy() {
|
||||
return new HauntingWindTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY ||
|
||||
event.getType() == GameEvent.EventType.TAPPED;
|
||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY
|
||||
|| event.getType() == GameEvent.EventType.TAPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent isArtifact = game.getPermanent(event.getSourceId());
|
||||
return isArtifact != null && isArtifact.isArtifact();
|
||||
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (permanent == null || !permanent.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null) {
|
||||
return false;
|
||||
}
|
||||
boolean triggerable = true;
|
||||
for (Cost cost : stackAbility.getCosts()) {
|
||||
if (cost instanceof TapSourceCost) {
|
||||
triggerable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!triggerable) {
|
||||
return false;
|
||||
}
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.TAPPED) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null || !permanent.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an artifact becomes tapped or a player activates an artifact's ability without {tap} in its activation cost, Haunting Wind deals 1 damage to that artifact's controller.";
|
||||
return "Whenever an artifact becomes tapped or a player activates an artifact's ability without {T} in its activation cost, {this} deals 1 damage to that artifact's controller.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ package mage.cards.p;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -37,18 +39,20 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author MarcoMarin
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class Powerleech extends CardImpl {
|
||||
|
||||
public Powerleech(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{G}{G}");
|
||||
|
||||
// Whenever an artifact an opponent controls becomes tapped or an opponent activates an artifact's ability without {tap} in its activation cost, you gain 1 life.
|
||||
this.addAbility(new AbilityActivatedTriggeredAbility3());
|
||||
this.addAbility(new PowerleechTriggeredAbility());
|
||||
}
|
||||
|
||||
public Powerleech(final Powerleech card) {
|
||||
|
@ -60,37 +64,67 @@ public class Powerleech extends CardImpl {
|
|||
return new Powerleech(this);
|
||||
}
|
||||
}
|
||||
class AbilityActivatedTriggeredAbility3 extends TriggeredAbilityImpl {
|
||||
|
||||
AbilityActivatedTriggeredAbility3() {
|
||||
class PowerleechTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
PowerleechTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainLifeEffect(1));
|
||||
}
|
||||
|
||||
AbilityActivatedTriggeredAbility3(final AbilityActivatedTriggeredAbility3 ability) {
|
||||
PowerleechTriggeredAbility(final PowerleechTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbilityActivatedTriggeredAbility3 copy() {
|
||||
return new AbilityActivatedTriggeredAbility3(this);
|
||||
public PowerleechTriggeredAbility copy() {
|
||||
return new PowerleechTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY ||
|
||||
event.getType() == GameEvent.EventType.TAPPED;
|
||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY
|
||||
|| event.getType() == GameEvent.EventType.TAPPED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent isArtifact = game.getPermanent(event.getSourceId());
|
||||
return isArtifact != null && isArtifact.isArtifact() &&
|
||||
!isArtifact.getControllerId().equals(this.getControllerId());
|
||||
|
||||
Player player = game.getPlayer(controllerId);
|
||||
if (player == null) {
|
||||
return false;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId());
|
||||
if (permanent == null || !permanent.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
StackAbility stackAbility = (StackAbility) game.getStack().getStackObject(event.getSourceId());
|
||||
if (stackAbility == null) {
|
||||
return false;
|
||||
}
|
||||
boolean triggerable = true;
|
||||
for (Cost cost : stackAbility.getCosts()) {
|
||||
if (cost instanceof TapSourceCost) {
|
||||
triggerable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!triggerable) {
|
||||
return false;
|
||||
}
|
||||
return player.hasOpponent(permanent.getControllerId(), game);
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.TAPPED) {
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (permanent == null || !permanent.isArtifact()) {
|
||||
return false;
|
||||
}
|
||||
return player.hasOpponent(permanent.getControllerId(), game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever an artifact an opponent controls becomes tapped or an opponent activates an artifact's ability without {tap} in its activation cost, you gain 1 life.";
|
||||
return "Whenever an artifact an opponent controls becomes tapped or an opponent activates an artifact's ability without {T} in its activation cost, you gain 1 life.";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue