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 java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
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.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -37,19 +40,20 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
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 class HauntingWind extends CardImpl {
|
||||||
|
|
||||||
public HauntingWind(UUID ownerId, CardSetInfo setInfo) {
|
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.
|
// 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 HauntingWindTriggeredAbility());
|
||||||
this.addAbility(new AbilityActivatedTriggeredAbility2());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HauntingWind(final HauntingWind card) {
|
public HauntingWind(final HauntingWind card) {
|
||||||
|
@ -62,36 +66,68 @@ public class HauntingWind extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AbilityActivatedTriggeredAbility2 extends TriggeredAbilityImpl {
|
class HauntingWindTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
AbilityActivatedTriggeredAbility2() {
|
HauntingWindTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new DamageControllerEffect(1));
|
super(Zone.BATTLEFIELD, new DamageTargetEffect(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
AbilityActivatedTriggeredAbility2(final AbilityActivatedTriggeredAbility2 ability) {
|
HauntingWindTriggeredAbility(final HauntingWindTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbilityActivatedTriggeredAbility2 copy() {
|
public HauntingWindTriggeredAbility copy() {
|
||||||
return new AbilityActivatedTriggeredAbility2(this);
|
return new HauntingWindTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY ||
|
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY
|
||||||
event.getType() == GameEvent.EventType.TAPPED;
|
|| event.getType() == GameEvent.EventType.TAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent isArtifact = game.getPermanent(event.getSourceId());
|
if (event.getType() == GameEvent.EventType.ACTIVATED_ABILITY) {
|
||||||
return isArtifact != null && isArtifact.isArtifact();
|
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
|
@Override
|
||||||
public String getRule() {
|
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 java.util.UUID;
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
import mage.abilities.costs.Cost;
|
||||||
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.effects.common.GainLifeEffect;
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
@ -37,18 +39,20 @@ import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.game.stack.StackAbility;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author MarcoMarin
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public class Powerleech extends CardImpl {
|
public class Powerleech extends CardImpl {
|
||||||
|
|
||||||
public Powerleech(UUID ownerId, CardSetInfo setInfo) {
|
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.
|
// 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) {
|
public Powerleech(final Powerleech card) {
|
||||||
|
@ -60,37 +64,67 @@ public class Powerleech extends CardImpl {
|
||||||
return new Powerleech(this);
|
return new Powerleech(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
class AbilityActivatedTriggeredAbility3 extends TriggeredAbilityImpl {
|
|
||||||
|
|
||||||
AbilityActivatedTriggeredAbility3() {
|
class PowerleechTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
|
PowerleechTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new GainLifeEffect(1));
|
super(Zone.BATTLEFIELD, new GainLifeEffect(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
AbilityActivatedTriggeredAbility3(final AbilityActivatedTriggeredAbility3 ability) {
|
PowerleechTriggeredAbility(final PowerleechTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbilityActivatedTriggeredAbility3 copy() {
|
public PowerleechTriggeredAbility copy() {
|
||||||
return new AbilityActivatedTriggeredAbility3(this);
|
return new PowerleechTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY ||
|
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY
|
||||||
event.getType() == GameEvent.EventType.TAPPED;
|
|| event.getType() == GameEvent.EventType.TAPPED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
Permanent isArtifact = game.getPermanent(event.getSourceId());
|
Player player = game.getPlayer(controllerId);
|
||||||
return isArtifact != null && isArtifact.isArtifact() &&
|
if (player == null) {
|
||||||
!isArtifact.getControllerId().equals(this.getControllerId());
|
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
|
@Override
|
||||||
public String getRule() {
|
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