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;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
import mage.abilities.effects.common.CantBeTargetedAllEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
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.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -28,18 +20,12 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class TomikDistinguishedAdvokist extends CardImpl {
|
||||
|
||||
private static final FilterStackObject filter = new FilterStackObject();
|
||||
|
||||
static {
|
||||
filter.add(TargetedByOpponentsPredicate.instance);
|
||||
}
|
||||
|
||||
public TomikDistinguishedAdvokist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
|
||||
|
||||
this.addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ADVISOR);
|
||||
this.subtype.add(SubType.HUMAN, SubType.ADVISOR);
|
||||
this.subtype.add();
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(3);
|
||||
|
||||
|
@ -47,11 +33,7 @@ public final class TomikDistinguishedAdvokist extends CardImpl {
|
|||
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.
|
||||
Ability ability = new SimpleStaticAbility(new CantBeTargetedAllEffect(
|
||||
StaticFilters.FILTER_LANDS, filter, Duration.WhileOnBattlefield
|
||||
).setText("lands on the battlefield"));
|
||||
ability.addEffect(new TomikDistinguishedAdvokistTargetEffect());
|
||||
this.addAbility(ability);
|
||||
this.addAbility(new SimpleStaticAbility(new TomikDistinguishedAdvokistTargetEffect()));
|
||||
|
||||
// Your opponents can't play land cards from graveyards.
|
||||
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 {
|
||||
|
||||
TomikDistinguishedAdvokistTargetEffect() {
|
||||
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) {
|
||||
|
@ -103,11 +65,6 @@ class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffe
|
|||
return new TomikDistinguishedAdvokistTargetEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.TARGET;
|
||||
|
@ -115,13 +72,14 @@ class TomikDistinguishedAdvokistTargetEffect extends ContinuousRuleModifyingEffe
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Card targetCard = game.getCard(event.getTargetId());
|
||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||
UUID targetId = event.getTargetId();
|
||||
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());
|
||||
return targetCard != null && stackObject != null && player != null
|
||||
&& player.hasOpponent(stackObject.getControllerId(), game)
|
||||
&& game.getState().getZone(targetCard.getId()) == Zone.GRAVEYARD
|
||||
&& targetCard.isLand(game);
|
||||
return targetCard != null && player != null && targetCard.isLand(game) && player.hasOpponent(event.getPlayerId(), game);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -811,13 +811,13 @@ public class Spell extends StackObjectImpl implements Card {
|
|||
UUID copiedSourceId = spellCopy.ability.getSourceId();
|
||||
|
||||
// non-fused spell:
|
||||
// spellAbilities.get(0) is alias (NOT copy) of this.ability
|
||||
// spellAbilities.get(1) is first spliced card (if any)
|
||||
// this.spellAbilities.get(0) is alias (NOT copy) of this.ability
|
||||
// this.spellAbilities.get(1) is first spliced card (if any)
|
||||
// fused spell:
|
||||
// spellAbilities.get(0) is left half
|
||||
// spellAbilities.get(1) is right half
|
||||
// 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
|
||||
// this.spellAbilities.get(0) is left half
|
||||
// this.spellAbilities.get(1) is right half
|
||||
// this.spellAbilities.get(2) is first spliced card (if any)
|
||||
// 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
|
||||
boolean skipFirst = (this.ability.getSpellAbilityType() != SpellAbilityType.SPLIT_FUSED);
|
||||
for (SpellAbility spellAbility : this.getSpellAbilities()) {
|
||||
|
|
Loading…
Reference in a new issue