mirror of
https://github.com/magefree/mage.git
synced 2026-01-09 20:32:06 -08:00
a few more getId fixes
This commit is contained in:
parent
07a916bf37
commit
50faf41e33
3 changed files with 67 additions and 46 deletions
|
|
@ -1,44 +1,44 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class SquirrelMob extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.SQUIRREL, "");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
private static final DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
|
||||
|
||||
public SquirrelMob(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}{G}");
|
||||
this.subtype.add(SubType.SQUIRREL);
|
||||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
// Squirrel Mob gets +1/+1 for each other Squirrel on the battlefield.
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("other Squirrel");
|
||||
filter.add(SubType.SQUIRREL.getPredicate());
|
||||
filter.add(Predicates.not(new PermanentIdPredicate(this.getId())));
|
||||
DynamicValue xValue = new PermanentsOnBattlefieldCount(filter);
|
||||
Effect effect = new BoostSourceEffect(xValue, xValue, Duration.WhileOnBattlefield, false);
|
||||
effect.setText("{this} gets +1/+1 for each other Squirrel on the battlefield");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostSourceEffect(
|
||||
xValue, xValue, Duration.WhileOnBattlefield, false
|
||||
).setText("{this} gets +1/+1 for each other Squirrel on the battlefield")));
|
||||
}
|
||||
|
||||
private SquirrelMob(final SquirrelMob card) {
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterObject;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
|
@ -28,6 +28,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}");
|
||||
|
||||
|
|
@ -41,8 +47,6 @@ 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"));
|
||||
|
|
@ -63,18 +67,13 @@ public final class TomikDistinguishedAdvokist extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class TargetedByOpponentsPredicate implements Predicate<MageObject> {
|
||||
|
||||
private final UUID sourceId;
|
||||
|
||||
public TargetedByOpponentsPredicate(UUID sourceId) {
|
||||
this.sourceId = sourceId;
|
||||
}
|
||||
enum TargetedByOpponentsPredicate implements ObjectSourcePlayerPredicate<MageObject> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(MageObject input, Game game) {
|
||||
StackObject stackObject = game.getStack().getStackObject(input.getId());
|
||||
Permanent source = game.getPermanentOrLKIBattlefield(this.sourceId);
|
||||
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
||||
StackObject stackObject = game.getStack().getStackObject(input.getObject().getId());
|
||||
Permanent source = game.getPermanentOrLKIBattlefield(input.getSourceId());
|
||||
if (stackObject != null && source != null) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
return controller != null && game.isOpponent(controller, stackObject.getControllerId());
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package mage.cards.v;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
|
|
@ -11,10 +12,15 @@ import mage.abilities.effects.common.continuous.BoostAllEffect;
|
|||
import mage.abilities.keyword.KickerAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.PermanentIdPredicate;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.SaprolingToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -24,6 +30,13 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class VerdelothTheAncient extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter
|
||||
= new FilterCreaturePermanent("Saproling creatures and other Treefolk creatures");
|
||||
|
||||
static {
|
||||
filter.add(VerdelothTheAncientPredicate.instance);
|
||||
}
|
||||
|
||||
public VerdelothTheAncient(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
|
|
@ -36,20 +49,15 @@ public final class VerdelothTheAncient extends CardImpl {
|
|||
this.addAbility(new KickerAbility("{X}"));
|
||||
|
||||
// Saproling creatures and other Treefolk creatures get +1/+1.
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("Saproling creatures and other Treefolk creatures");
|
||||
filter.add(Predicates.or(
|
||||
Predicates.and(SubType.TREEFOLK.getPredicate(), Predicates.not(new PermanentIdPredicate(this.getId()))),
|
||||
SubType.SAPROLING.getPredicate())
|
||||
);
|
||||
filter.add(Predicates.not(new PermanentIdPredicate(this.getId())));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostAllEffect(
|
||||
1, 1, Duration.WhileOnBattlefield, filter, false
|
||||
)));
|
||||
|
||||
// When Verdeloth the Ancient enters the battlefield, if it was kicked, create X 1/1 green Saproling creature tokens.
|
||||
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new SaprolingToken(), GetKickerXValue.instance), false);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, KickedCondition.instance,
|
||||
"When {this} enters the battlefield, if it was kicked, create X 1/1 green Saproling creature tokens."));
|
||||
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new EntersBattlefieldTriggeredAbility(
|
||||
new CreateTokenEffect(new SaprolingToken(), GetKickerXValue.instance), false
|
||||
), KickedCondition.instance, "When {this} enters the battlefield, " +
|
||||
"if it was kicked, create X 1/1 green Saproling creature tokens."));
|
||||
}
|
||||
|
||||
private VerdelothTheAncient(final VerdelothTheAncient card) {
|
||||
|
|
@ -60,4 +68,18 @@ public final class VerdelothTheAncient extends CardImpl {
|
|||
public VerdelothTheAncient copy() {
|
||||
return new VerdelothTheAncient(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum VerdelothTheAncientPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
MageObject obj = input.getObject();
|
||||
if (obj.getId().equals(input.getSourceId())) {
|
||||
return obj.hasSubtype(SubType.SAPROLING, game);
|
||||
}
|
||||
return obj.hasSubtype(SubType.TREEFOLK, game)
|
||||
|| obj.hasSubtype(SubType.SAPROLING, game);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue