mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +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;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -14,10 +14,13 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
@ -72,8 +75,11 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (controller != null
|
||||
&& permanent.getControllerId() == source.getControllerId()) {
|
||||
if (object instanceof PermanentCard) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||
return true;
|
||||
|
@ -84,8 +90,18 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (object instanceof Card) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +110,11 @@ class SigardaHostOfHeronsEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
if (object instanceof Card) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentCard;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
* @author noxx
|
||||
|
@ -22,7 +26,7 @@ import mage.game.stack.Spell;
|
|||
public final class TajuruPreserver extends CardImpl {
|
||||
|
||||
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.SHAMAN);
|
||||
|
||||
|
@ -63,24 +67,51 @@ class TajuruPreserverEffect extends ReplacementEffectImpl {
|
|||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isControlledBy(source.getControllerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (controller != null
|
||||
&& permanent.getControllerId() == source.getControllerId()) {
|
||||
if (object instanceof PermanentCard) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard)object).getControllerId())) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,11 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
||||
import static mage.constants.Outcome.Benefit;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
|
@ -63,8 +66,8 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
|||
|
||||
TamiyoCollectorOfTalesRuleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Benefit);
|
||||
staticText = "Spells and abilities your opponents control can't " +
|
||||
"cause you to discard cards or sacrifice permanents";
|
||||
staticText = "Spells and abilities your opponents control can't "
|
||||
+ "cause you to discard cards or sacrifice permanents";
|
||||
}
|
||||
|
||||
private TamiyoCollectorOfTalesRuleEffect(final TamiyoCollectorOfTalesRuleEffect effect) {
|
||||
|
@ -84,26 +87,50 @@ class TamiyoCollectorOfTalesRuleEffect extends ContinuousRuleModifyingEffectImpl
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getPlayerId().equals(source.getControllerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object instanceof PermanentCard) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||
return true;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
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 (game.getOpponents(source.getControllerId()).contains(((PermanentCard) object).getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (object instanceof Spell) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Spell) object).getControllerId())) {
|
||||
return true;
|
||||
if (object instanceof Spell) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Spell) object).getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (object instanceof Card) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Card) object).getOwnerId())) {
|
||||
return true;
|
||||
if (object instanceof Emblem) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((Emblem) object).getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (object instanceof StackAbility) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(((StackAbility) 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,8 +142,8 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
|||
|
||||
TamiyoCollectorOfTalesEffect() {
|
||||
super(Outcome.Benefit);
|
||||
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.";
|
||||
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.";
|
||||
}
|
||||
|
||||
private TamiyoCollectorOfTalesEffect(final TamiyoCollectorOfTalesEffect effect) {
|
||||
|
@ -145,9 +172,9 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
|||
Cards cards2 = new CardsImpl();
|
||||
player.revealCards(source, cards, game);
|
||||
for (Card card : cards.getCards(game)) {
|
||||
if(card.isSplitCard()){
|
||||
if(((SplitCard) card).getLeftHalfCard().getName().equals(choice.getChoice()) ||
|
||||
((SplitCard) card).getRightHalfCard().getName().equals(choice.getChoice())){
|
||||
if (card.isSplitCard()) {
|
||||
if (((SplitCard) card).getLeftHalfCard().getName().equals(choice.getChoice())
|
||||
|| ((SplitCard) card).getRightHalfCard().getName().equals(choice.getChoice())) {
|
||||
cards2.add(card);
|
||||
}
|
||||
}
|
||||
|
@ -160,4 +187,5 @@ class TamiyoCollectorOfTalesEffect extends OneShotEffect {
|
|||
player.moveCards(cards2, Zone.HAND, source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue