mirror of
https://github.com/correl/mage.git
synced 2025-03-12 17:00:08 -09:00
duplicate continuouseffect for vehicles
This commit is contained in:
parent
2630c18e4b
commit
cf6fe27f7d
4 changed files with 59 additions and 73 deletions
|
@ -29,22 +29,23 @@ package mage.cards.a;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureIfVehicleEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -96,35 +97,3 @@ public class AerialModification extends CardImpl {
|
|||
return new AerialModification(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
|
||||
|
||||
private CardType addedType = CardType.CREATURE;
|
||||
|
||||
public BecomesCreatureIfVehicleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types";
|
||||
}
|
||||
|
||||
public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent aura = game.getPermanent(source.getSourceId());
|
||||
if (aura != null && aura.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(aura.getAttachedTo());
|
||||
if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) {
|
||||
enchanted.getCardType().add(addedType);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesCreatureIfVehicleEffect copy() {
|
||||
return new BecomesCreatureIfVehicleEffect(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,22 +29,23 @@ package mage.cards.s;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureIfVehicleEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -95,35 +96,5 @@ public class SiegeModification extends CardImpl {
|
|||
return new SiegeModification(this);
|
||||
}
|
||||
|
||||
private static class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
|
||||
|
||||
private CardType addedType = CardType.CREATURE;
|
||||
|
||||
public BecomesCreatureIfVehicleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types";
|
||||
}
|
||||
|
||||
public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent aura = game.getPermanent(source.getSourceId());
|
||||
if (aura != null && aura.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(aura.getAttachedTo());
|
||||
if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) {
|
||||
enchanted.getCardType().add(addedType);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesCreatureIfVehicleEffect copy() {
|
||||
return new BecomesCreatureIfVehicleEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -125,21 +125,25 @@ public interface MageObject extends MageItem, Serializable {
|
|||
return getSuperType().contains(SuperType.SNOW);
|
||||
}
|
||||
|
||||
default void addSuperType(SuperType superType){
|
||||
default void addSuperType(SuperType superType) {
|
||||
getSuperType().add(superType);
|
||||
}
|
||||
|
||||
default boolean isBasic() { return getSuperType().contains(SuperType.BASIC);}
|
||||
default boolean isBasic() {
|
||||
return getSuperType().contains(SuperType.BASIC);
|
||||
}
|
||||
|
||||
default boolean isWorld() {
|
||||
return getSuperType().contains(SuperType.WORLD);
|
||||
}
|
||||
|
||||
default void addCardType(CardType cardType) {
|
||||
getCardType().add(cardType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether two cards share card types.
|
||||
*
|
||||
*
|
||||
* @param otherCard
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
* Created by IGOUDT on 5-4-2017.
|
||||
*/
|
||||
public class BecomesCreatureIfVehicleEffect extends ContinuousEffectImpl {
|
||||
|
||||
private CardType addedType = CardType.CREATURE;
|
||||
|
||||
public BecomesCreatureIfVehicleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.staticText = "As long as enchanted permanent is a Vehicle, it's a creature in addition to its other types";
|
||||
}
|
||||
|
||||
public BecomesCreatureIfVehicleEffect(final BecomesCreatureIfVehicleEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent aura = game.getPermanent(source.getSourceId());
|
||||
if (aura != null && aura.getAttachedTo() != null) {
|
||||
Permanent enchanted = game.getPermanent(aura.getAttachedTo());
|
||||
if (enchanted != null && enchanted.getSubtype(game).contains("Vehicle")) {
|
||||
enchanted.addCardType(addedType);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesCreatureIfVehicleEffect copy() {
|
||||
return new BecomesCreatureIfVehicleEffect(this);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue