mirror of
https://github.com/magefree/mage.git
synced 2026-01-24 20:29:19 -08:00
Fixed Tomik, Distinguished Advokist that it cause wrong class cast error with lands;
This commit is contained in:
parent
d98b0ca1a6
commit
eea55c2f76
3 changed files with 38 additions and 20 deletions
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
|
|
@ -16,7 +15,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
|
@ -30,7 +29,6 @@ import mage.watchers.common.AttackedThisTurnWatcher;
|
|||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class TaigamOjutaiMaster extends CardImpl {
|
||||
|
|
@ -57,8 +55,8 @@ public final class TaigamOjutaiMaster extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Instant, sorcery, and Dragon spells you control can't be countered.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeCounteredControlledEffect(filter, new FilterStackObject(), Duration.WhileOnBattlefield)));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeCounteredControlledEffect(filter, StaticFilters.FILTER_SPELL_OR_ABILITY, Duration.WhileOnBattlefield)));
|
||||
|
||||
// Whenever you cast an instant or sorcery spell from your hand, if Taigam, Ojutai Master attacked this turn, that spell gains rebound.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(new TaigamOjutaiMasterTriggeredAbility(),
|
||||
AttackedThisTurnSourceCondition.instance,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.t;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
|
|
@ -13,9 +14,10 @@ import mage.constants.*;
|
|||
import mage.filter.FilterObject;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
|
||||
|
|
@ -26,13 +28,6 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class TomikDistinguishedAdvokist extends CardImpl {
|
||||
|
||||
private static final FilterObject filter
|
||||
= new FilterStackObject();
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.OPPONENT));
|
||||
}
|
||||
|
||||
public TomikDistinguishedAdvokist(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}");
|
||||
|
||||
|
|
@ -46,6 +41,8 @@ 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.
|
||||
FilterObject filter = new FilterStackObject();
|
||||
filter.add(new TargetedByOpponentsPredicate(this.getId()));
|
||||
Ability ability = new SimpleStaticAbility(new CantBeTargetedAllEffect(
|
||||
StaticFilters.FILTER_LANDS, filter, Duration.WhileOnBattlefield
|
||||
).setText("lands on the battlefield"));
|
||||
|
|
@ -66,6 +63,31 @@ public final class TomikDistinguishedAdvokist extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class TargetedByOpponentsPredicate implements Predicate<MageObject> {
|
||||
|
||||
private final UUID sourceId;
|
||||
|
||||
public TargetedByOpponentsPredicate(UUID sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
StackObject stackObject = game.getStack().getStackObject(input.getId());
|
||||
Permanent source = game.getPermanentOrLKIBattlefield(this.sourceId);
|
||||
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() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue