mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09:00
Implemented One with the Stars
This commit is contained in:
parent
14744ef85b
commit
18ca3bcff9
2 changed files with 96 additions and 0 deletions
Mage.Sets/src/mage
95
Mage.Sets/src/mage/cards/o/OneWithTheStars.java
Normal file
95
Mage.Sets/src/mage/cards/o/OneWithTheStars.java
Normal file
|
@ -0,0 +1,95 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class OneWithTheStars extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("creature or enchantment");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.CREATURE),
|
||||
new CardTypePredicate(CardType.ENCHANTMENT)
|
||||
));
|
||||
}
|
||||
|
||||
public OneWithTheStars(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature or enchantment
|
||||
TargetPermanent auraTarget = new TargetPermanent(filter);
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// Enchanted permanent is an enchantment and loses all other card types.
|
||||
this.addAbility(new SimpleStaticAbility(new OneWithTheStarsEffect()));
|
||||
}
|
||||
|
||||
private OneWithTheStars(final OneWithTheStars card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OneWithTheStars copy() {
|
||||
return new OneWithTheStars(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OneWithTheStarsEffect extends ContinuousEffectImpl {
|
||||
|
||||
OneWithTheStarsEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Detriment);
|
||||
this.staticText = "Enchanted permanent is an enchantment and loses all other card types.";
|
||||
}
|
||||
|
||||
private OneWithTheStarsEffect(final OneWithTheStarsEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OneWithTheStarsEffect copy() {
|
||||
return new OneWithTheStarsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment == null || enchantment.getAttachedTo() == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
permanent.getCardType().clear();
|
||||
permanent.addCardType(CardType.ENCHANTMENT);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -88,6 +88,7 @@ public final class TherosBeyondDeath extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Omen of the Forge", 145, Rarity.COMMON, mage.cards.o.OmenOfTheForge.class));
|
||||
cards.add(new SetCardInfo("Omen of the Sea", 58, Rarity.COMMON, mage.cards.o.OmenOfTheSea.class));
|
||||
cards.add(new SetCardInfo("Omen of the Sun", 30, Rarity.COMMON, mage.cards.o.OmenOfTheSun.class));
|
||||
cards.add(new SetCardInfo("One with the Stars", 59, Rarity.UNCOMMON, mage.cards.o.OneWithTheStars.class));
|
||||
cards.add(new SetCardInfo("Ox of Agonas", 147, Rarity.MYTHIC, mage.cards.o.OxOfAgonas.class));
|
||||
cards.add(new SetCardInfo("Pharika's Spawn", 112, Rarity.UNCOMMON, mage.cards.p.PharikasSpawn.class));
|
||||
cards.add(new SetCardInfo("Pious Wayfarer", 32, Rarity.COMMON, mage.cards.p.PiousWayfarer.class));
|
||||
|
|
Loading…
Add table
Reference in a new issue