mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
Fixed cards with "Spells and abilities your opponents control can't cause you to sacrifice permanents".
This commit is contained in:
parent
db9bdfdd5c
commit
5c15400f02
3 changed files with 118 additions and 38 deletions
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
package mage.cards.s;
|
package mage.cards.s;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
@ -14,10 +14,13 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.command.Emblem;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
import mage.game.permanent.PermanentCard;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.game.stack.StackAbility;
|
import mage.game.stack.StackAbility;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
|
@ -72,8 +75,11 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
if (controller != null
|
||||||
|
&& permanent.getControllerId() == source.getControllerId()) {
|
||||||
if (object instanceof PermanentCard) {
|
if (object instanceof PermanentCard) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -84,8 +90,18 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (object instanceof Card) {
|
if (object instanceof Emblem) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((Emblem) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof Ability) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Ability) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof SpellAbility) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((SpellAbility) object).getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,6 +110,11 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (object instanceof Card) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +1,24 @@
|
||||||
|
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ReplacementEffectImpl;
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.command.Emblem;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.PermanentCard;
|
import mage.game.permanent.PermanentCard;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
|
import mage.game.stack.StackAbility;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author noxx
|
* @author noxx
|
||||||
|
@ -22,7 +26,7 @@ import mage.game.stack.Spell;
|
||||||
public final class TajuruPreserver extends CardImpl {
|
public final class TajuruPreserver extends CardImpl {
|
||||||
|
|
||||||
public TajuruPreserver(UUID ownerId, CardSetInfo setInfo) {
|
public TajuruPreserver(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
|
||||||
this.subtype.add(SubType.ELF);
|
this.subtype.add(SubType.ELF);
|
||||||
this.subtype.add(SubType.SHAMAN);
|
this.subtype.add(SubType.SHAMAN);
|
||||||
|
|
||||||
|
@ -71,16 +75,43 @@ class TajuruPreserverEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
|
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
if (controller != null
|
||||||
|
&& permanent.getControllerId() == source.getControllerId()) {
|
||||||
if (object instanceof PermanentCard) {
|
if (object instanceof PermanentCard) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (object instanceof Spell) {
|
if (object instanceof Spell) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((Spell)object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((Spell) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof Emblem) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Emblem) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof Ability) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Ability) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof SpellAbility) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((SpellAbility) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof StackAbility) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((StackAbility) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof Card) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,8 +22,11 @@ import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInYourGraveyard;
|
import mage.target.common.TargetCardInYourGraveyard;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import mage.abilities.SpellAbility;
|
||||||
|
|
||||||
import static mage.constants.Outcome.Benefit;
|
import static mage.constants.Outcome.Benefit;
|
||||||
|
import mage.game.command.Emblem;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
|
@ -63,8 +66,8 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
|
|
||||||
TamiyoCollectorOfTalesRuleEffect() {
|
TamiyoCollectorOfTalesRuleEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Benefit);
|
super(Duration.WhileOnBattlefield, Benefit);
|
||||||
staticText = "Spells and abilities your opponents control can't " +
|
staticText = "Spells and abilities your opponents control can't "
|
||||||
"cause you to discard cards or sacrifice permanents";
|
+ "cause you to discard cards or sacrifice permanents";
|
||||||
}
|
}
|
||||||
|
|
||||||
private TamiyoCollectorOfTalesRuleEffect(final TamiyoCollectorOfTalesRuleEffect effect) {
|
private TamiyoCollectorOfTalesRuleEffect(final TamiyoCollectorOfTalesRuleEffect effect) {
|
||||||
|
@ -84,8 +87,16 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
MageObject object = game.getObject(event.getSourceId());
|
MageObject object = game.getObject(event.getSourceId());
|
||||||
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
|
Card cardInHand = game.getCard(event.getTargetId());
|
||||||
|
if (controller != null) {
|
||||||
|
if (permanent != null
|
||||||
|
&& permanent.getControllerId() == source.getControllerId()
|
||||||
|
|| cardInHand != null
|
||||||
|
&& cardInHand.getOwnerId() == source.getControllerId()) {
|
||||||
|
|
||||||
if (object instanceof PermanentCard) {
|
if (object instanceof PermanentCard) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -96,8 +107,18 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (object instanceof Card) {
|
if (object instanceof Emblem) {
|
||||||
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
if (game.getOpponents(source.getControllerId()).contains(((Emblem) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof Ability) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Ability) object).getControllerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (object instanceof SpellAbility) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((SpellAbility) object).getControllerId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,6 +127,12 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (object instanceof Card) {
|
||||||
|
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -115,8 +142,8 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
||||||
|
|
||||||
TamiyoCollectorOfTalesEffect() {
|
TamiyoCollectorOfTalesEffect() {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
staticText = "Choose a nonland card name, then reveal the top four cards of your library. " +
|
staticText = "Choose a nonland card name, then reveal the top four cards of your library. "
|
||||||
"Put all cards with the chosen name from among them into your hand and the rest into your graveyard.";
|
+ "Put all cards with the chosen name from among them into your hand and the rest into your graveyard.";
|
||||||
}
|
}
|
||||||
|
|
||||||
private TamiyoCollectorOfTalesEffect(final TamiyoCollectorOfTalesEffect effect) {
|
private TamiyoCollectorOfTalesEffect(final TamiyoCollectorOfTalesEffect effect) {
|
||||||
|
@ -145,9 +172,9 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
||||||
Cards cards2 = new CardsImpl();
|
Cards cards2 = new CardsImpl();
|
||||||
player.revealCards(source, cards, game);
|
player.revealCards(source, cards, game);
|
||||||
for (Card card : cards.getCards(game)) {
|
for (Card card : cards.getCards(game)) {
|
||||||
if(card.isSplitCard()){
|
if (card.isSplitCard()) {
|
||||||
if(((SplitCard) card).getLeftHalfCard().getName().equals(choice.getChoice()) ||
|
if (((SplitCard) card).getLeftHalfCard().getName().equals(choice.getChoice())
|
||||||
((SplitCard) card).getRightHalfCard().getName().equals(choice.getChoice())){
|
|| ((SplitCard) card).getRightHalfCard().getName().equals(choice.getChoice())) {
|
||||||
cards2.add(card);
|
cards2.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,4 +187,5 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
||||||
player.moveCards(cards2, Zone.HAND, source, game);
|
player.moveCards(cards2, Zone.HAND, source, game);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue