mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
fixed triggered abilities which trigger off of "one or more creatures" dealing damage not working with double strike
This commit is contained in:
parent
9170df1344
commit
626a8b55b8
3 changed files with 35 additions and 39 deletions
|
@ -1,24 +1,17 @@
|
||||||
|
|
||||||
package mage.cards.j;
|
package mage.cards.j;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.DelayedTriggeredAbility;
|
import mage.abilities.DelayedTriggeredAbility;
|
||||||
import mage.abilities.LoyaltyAbility;
|
import mage.abilities.LoyaltyAbility;
|
||||||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
import mage.abilities.effects.common.DrawDiscardControllerEffect;
|
||||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.DamagedPlayerEvent;
|
import mage.game.events.DamagedPlayerEvent;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -26,8 +19,11 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.JaceCunningCastawayIllusionToken;
|
import mage.game.permanent.token.JaceCunningCastawayIllusionToken;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class JaceCunningCastaway extends CardImpl {
|
public final class JaceCunningCastaway extends CardImpl {
|
||||||
|
@ -50,7 +46,7 @@ public final class JaceCunningCastaway extends CardImpl {
|
||||||
this.addAbility(new LoyaltyAbility(new JaceCunningCastawayCopyEffect(), -5));
|
this.addAbility(new LoyaltyAbility(new JaceCunningCastawayCopyEffect(), -5));
|
||||||
}
|
}
|
||||||
|
|
||||||
public JaceCunningCastaway(final JaceCunningCastaway card) {
|
private JaceCunningCastaway(final JaceCunningCastaway card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,12 +58,12 @@ public final class JaceCunningCastaway extends CardImpl {
|
||||||
|
|
||||||
class JaceCunningCastawayEffect1 extends OneShotEffect {
|
class JaceCunningCastawayEffect1 extends OneShotEffect {
|
||||||
|
|
||||||
public JaceCunningCastawayEffect1() {
|
JaceCunningCastawayEffect1() {
|
||||||
super(Outcome.DrawCard);
|
super(Outcome.DrawCard);
|
||||||
this.staticText = "Whenever one or more creatures you control deal combat damage to a player this turn, draw a card, then discard a card";
|
this.staticText = "Whenever one or more creatures you control deal combat damage to a player this turn, draw a card, then discard a card";
|
||||||
}
|
}
|
||||||
|
|
||||||
public JaceCunningCastawayEffect1(final JaceCunningCastawayEffect1 effect) {
|
private JaceCunningCastawayEffect1(final JaceCunningCastawayEffect1 effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,13 +82,13 @@ class JaceCunningCastawayEffect1 extends OneShotEffect {
|
||||||
|
|
||||||
class JaceCunningCastawayDamageTriggeredAbility extends DelayedTriggeredAbility {
|
class JaceCunningCastawayDamageTriggeredAbility extends DelayedTriggeredAbility {
|
||||||
|
|
||||||
List<UUID> damagedPlayerIds = new ArrayList<>();
|
private final List<UUID> damagedPlayerIds = new ArrayList<>();
|
||||||
|
|
||||||
public JaceCunningCastawayDamageTriggeredAbility() {
|
JaceCunningCastawayDamageTriggeredAbility() {
|
||||||
super(new DrawDiscardControllerEffect(1, 1), Duration.EndOfTurn, false);
|
super(new DrawDiscardControllerEffect(1, 1), Duration.EndOfTurn, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public JaceCunningCastawayDamageTriggeredAbility(final JaceCunningCastawayDamageTriggeredAbility ability) {
|
private JaceCunningCastawayDamageTriggeredAbility(final JaceCunningCastawayDamageTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +100,7 @@ class JaceCunningCastawayDamageTriggeredAbility extends DelayedTriggeredAbility
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||||
|| event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST;
|
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,7 +115,7 @@ class JaceCunningCastawayDamageTriggeredAbility extends DelayedTriggeredAbility
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST) {
|
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) {
|
||||||
damagedPlayerIds.clear();
|
damagedPlayerIds.clear();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -138,7 +134,7 @@ class JaceCunningCastawayCopyEffect extends OneShotEffect {
|
||||||
this.staticText = "Create two tokens that are copies of {this}, except they're not legendary";
|
this.staticText = "Create two tokens that are copies of {this}, except they're not legendary";
|
||||||
}
|
}
|
||||||
|
|
||||||
JaceCunningCastawayCopyEffect(final JaceCunningCastawayCopyEffect effect) {
|
private JaceCunningCastawayCopyEffect(final JaceCunningCastawayCopyEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,12 +146,12 @@ class JaceCunningCastawayCopyEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent permanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent == null) {
|
||||||
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 2);
|
return false;
|
||||||
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
|
||||||
effect.setIsntLegendary(true);
|
|
||||||
return effect.apply(game, source);
|
|
||||||
}
|
}
|
||||||
return false;
|
CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, false, 2);
|
||||||
|
effect.setTargetPointer(new FixedTarget(source.getSourceId(), game));
|
||||||
|
effect.setIsntLegendary(true);
|
||||||
|
return effect.apply(game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ class KeeperOfFablesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||||
|| event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST;
|
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -80,7 +80,7 @@ class KeeperOfFablesTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST) {
|
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) {
|
||||||
damagedPlayerIds.clear();
|
damagedPlayerIds.clear();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,9 +1,6 @@
|
||||||
|
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
import mage.abilities.effects.common.CreateTokenEffect;
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
@ -18,8 +15,11 @@ import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.ThopterColorlessToken;
|
import mage.game.permanent.token.ThopterColorlessToken;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author fireshoes
|
* @author fireshoes
|
||||||
*/
|
*/
|
||||||
public final class ThopterSpyNetwork extends CardImpl {
|
public final class ThopterSpyNetwork extends CardImpl {
|
||||||
|
@ -34,7 +34,7 @@ public final class ThopterSpyNetwork extends CardImpl {
|
||||||
this.addAbility(new ThopterSpyNetworkDamageTriggeredAbility());
|
this.addAbility(new ThopterSpyNetworkDamageTriggeredAbility());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThopterSpyNetwork(final ThopterSpyNetwork card) {
|
private ThopterSpyNetwork(final ThopterSpyNetwork card) {
|
||||||
super(card);
|
super(card);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ public final class ThopterSpyNetwork extends CardImpl {
|
||||||
|
|
||||||
class ThopterSpyNetworkUpkeepTriggeredAbility extends TriggeredAbilityImpl {
|
class ThopterSpyNetworkUpkeepTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
public ThopterSpyNetworkUpkeepTriggeredAbility() {
|
ThopterSpyNetworkUpkeepTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new CreateTokenEffect(new ThopterColorlessToken(), 1), false);
|
super(Zone.BATTLEFIELD, new CreateTokenEffect(new ThopterColorlessToken(), 1), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThopterSpyNetworkUpkeepTriggeredAbility(final ThopterSpyNetworkUpkeepTriggeredAbility ability) {
|
private ThopterSpyNetworkUpkeepTriggeredAbility(final ThopterSpyNetworkUpkeepTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,13 +82,13 @@ class ThopterSpyNetworkUpkeepTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
class ThopterSpyNetworkDamageTriggeredAbility extends TriggeredAbilityImpl {
|
class ThopterSpyNetworkDamageTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
List<UUID> damagedPlayerIds = new ArrayList<>();
|
private final List<UUID> damagedPlayerIds = new ArrayList<>();
|
||||||
|
|
||||||
public ThopterSpyNetworkDamageTriggeredAbility() {
|
ThopterSpyNetworkDamageTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false);
|
super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThopterSpyNetworkDamageTriggeredAbility(final ThopterSpyNetworkDamageTriggeredAbility ability) {
|
private ThopterSpyNetworkDamageTriggeredAbility(final ThopterSpyNetworkDamageTriggeredAbility ability) {
|
||||||
super(ability);
|
super(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ class ThopterSpyNetworkDamageTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER
|
||||||
|| event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST;
|
|| event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -115,7 +115,7 @@ class ThopterSpyNetworkDamageTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event.getType() == GameEvent.EventType.END_COMBAT_STEP_POST) {
|
if (event.getType() == GameEvent.EventType.COMBAT_DAMAGE_STEP_POST) {
|
||||||
damagedPlayerIds.clear();
|
damagedPlayerIds.clear();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue