mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Fix #9551
This commit is contained in:
parent
752b5d9f33
commit
020503c826
2 changed files with 17 additions and 59 deletions
|
@ -1,24 +1,16 @@
|
||||||
package mage.cards.t;
|
package mage.cards.t;
|
||||||
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.MageObject;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||||
import mage.abilities.effects.common.CantBeTargetedAllEffect;
|
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.Card;
|
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.filter.FilterStackObject;
|
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.filter.predicate.ObjectSourcePlayer;
|
|
||||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
|
||||||
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.stack.StackObject;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -28,18 +20,12 @@ import java.util.UUID;
|
||||||
*/
|
*/
|
||||||
public final class TomikDistinguishedAdvokist extends CardImpl {
|
public final class TomikDistinguishedAdvokist extends CardImpl {
|
||||||
|
|
||||||
private static final FilterStackObject filter = new FilterStackObject();
|
|
||||||
|
|
||||||
static {
|
|
||||||
filter.add(TargetedByOpponentsPredicate.instance);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TomikDistinguishedAdvokist(UUID ownerId, CardSetInfo setInfo) {
|
public TomikDistinguishedAdvokist(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
|
||||||
|
|
||||||
this.addSuperType(SuperType.LEGENDARY);
|
this.addSuperType(SuperType.LEGENDARY);
|
||||||
this.subtype.add(SubType.HUMAN);
|
this.subtype.add(SubType.HUMAN, SubType.ADVISOR);
|
||||||
this.subtype.add(SubType.ADVISOR);
|
this.subtype.add();
|
||||||
this.power = new MageInt(2);
|
this.power = new MageInt(2);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
@ -47,11 +33,7 @@ public final class TomikDistinguishedAdvokist extends CardImpl {
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
// Lands on the battlefield and land cards in graveyards can't be the targets of spells or abilities your opponents control.
|
// Lands on the battlefield and land cards in graveyards can't be the targets of spells or abilities your opponents control.
|
||||||
Ability ability = new SimpleStaticAbility(new CantBeTargetedAllEffect(
|
this.addAbility(new SimpleStaticAbility(new TomikDistinguishedAdvokistTargetEffect()));
|
||||||
StaticFilters.FILTER_LANDS, filter, Duration.WhileOnBattlefield
|
|
||||||
).setText("lands on the battlefield"));
|
|
||||||
ability.addEffect(new TomikDistinguishedAdvokistTargetEffect());
|
|
||||||
this.addAbility(ability);
|
|
||||||
|
|
||||||
// Your opponents can't play land cards from graveyards.
|
// Your opponents can't play land cards from graveyards.
|
||||||
this.addAbility(new SimpleStaticAbility(new TomikDistinguishedAdvokistRestrictionEffect()));
|
this.addAbility(new SimpleStaticAbility(new TomikDistinguishedAdvokistRestrictionEffect()));
|
||||||
|
@ -67,31 +49,11 @@ public final class TomikDistinguishedAdvokist extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TargetedByOpponentsPredicate implements ObjectSourcePlayerPredicate<MageObject> {
|
|
||||||
instance;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
|
||||||
StackObject stackObject = game.getStack().getStackObject(input.getObject().getId());
|
|
||||||
Permanent source = input.getSource().getSourcePermanentOrLKI(game);
|
|
||||||
if (stackObject != null && source != null) {
|
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
|
||||||
return controller != null && game.isOpponent(controller, stackObject.getControllerId());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "targeted spells or abilities your opponents control";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffectImpl {
|
class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffectImpl {
|
||||||
|
|
||||||
TomikDistinguishedAdvokistTargetEffect() {
|
TomikDistinguishedAdvokistTargetEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
staticText = "and land cards in graveyards can't be the targets of spells or abilities your opponents control";
|
staticText = "lands on the battlefield and land cards in graveyards can't be the targets of spells or abilities your opponents control";
|
||||||
}
|
}
|
||||||
|
|
||||||
private TomikDistinguishedAdvokistTargetEffect(final TomikDistinguishedAdvokistTargetEffect effect) {
|
private TomikDistinguishedAdvokistTargetEffect(final TomikDistinguishedAdvokistTargetEffect effect) {
|
||||||
|
@ -103,11 +65,6 @@ class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffe
|
||||||
return new TomikDistinguishedAdvokistTargetEffect(this);
|
return new TomikDistinguishedAdvokistTargetEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checksEventType(GameEvent event, Game game) {
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.TARGET;
|
return event.getType() == GameEvent.EventType.TARGET;
|
||||||
|
@ -115,13 +72,14 @@ class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
Card targetCard = game.getCard(event.getTargetId());
|
UUID targetId = event.getTargetId();
|
||||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
Zone zone = game.getState().getZone(targetId);
|
||||||
|
if (zone != Zone.BATTLEFIELD && zone != Zone.GRAVEYARD) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
Card targetCard = (zone == Zone.BATTLEFIELD ? game.getPermanent(targetId) : game.getCard(targetId));
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
return targetCard != null && stackObject != null && player != null
|
return targetCard != null && player != null && targetCard.isLand(game) && player.hasOpponent(event.getPlayerId(), game);
|
||||||
&& player.hasOpponent(stackObject.getControllerId(), game)
|
|
||||||
&& game.getState().getZone(targetCard.getId()) == Zone.GRAVEYARD
|
|
||||||
&& targetCard.isLand(game);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -811,13 +811,13 @@ public class Spell extends StackObjectImpl implements Card {
|
||||||
UUID copiedSourceId = spellCopy.ability.getSourceId();
|
UUID copiedSourceId = spellCopy.ability.getSourceId();
|
||||||
|
|
||||||
// non-fused spell:
|
// non-fused spell:
|
||||||
// spellAbilities.get(0) is alias (NOT copy) of this.ability
|
// this.spellAbilities.get(0) is alias (NOT copy) of this.ability
|
||||||
// spellAbilities.get(1) is first spliced card (if any)
|
// this.spellAbilities.get(1) is first spliced card (if any)
|
||||||
// fused spell:
|
// fused spell:
|
||||||
// spellAbilities.get(0) is left half
|
// this.spellAbilities.get(0) is left half
|
||||||
// spellAbilities.get(1) is right half
|
// this.spellAbilities.get(1) is right half
|
||||||
// spellAbilities.get(2) is first spliced card (if any)
|
// this.spellAbilities.get(2) is first spliced card (if any)
|
||||||
// for non-fused spell, main spellAbility was already added in constructor and must not be copied again
|
// for non-fused spell, ability was already added to spellAbilities in constructor and must not be copied again
|
||||||
// for fused spell, all of spellAbilities must be copied here
|
// for fused spell, all of spellAbilities must be copied here
|
||||||
boolean skipFirst = (this.ability.getSpellAbilityType() != SpellAbilityType.SPLIT_FUSED);
|
boolean skipFirst = (this.ability.getSpellAbilityType() != SpellAbilityType.SPLIT_FUSED);
|
||||||
for (SpellAbility spellAbility : this.getSpellAbilities()) {
|
for (SpellAbility spellAbility : this.getSpellAbilities()) {
|
||||||
|
|
Loading…
Reference in a new issue