mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
- Added Opal Titan and Opal Acrolith.
This commit is contained in:
parent
d4bf09b035
commit
22364300ee
3 changed files with 657 additions and 362 deletions
144
Mage.Sets/src/mage/cards/o/OpalAcrolith.java
Normal file
144
Mage.Sets/src/mage/cards/o/OpalAcrolith.java
Normal file
|
@ -0,0 +1,144 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceMatchesFilterCondition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.TokenImpl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class OpalAcrolith extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("creature spell");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public OpalAcrolith(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}");
|
||||
|
||||
// Whenever an opponent casts a creature spell, if Opal Acrolith is an enchantment, Opal Acrolith becomes a 2/4 Soldier creature.
|
||||
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(new BecomesCreatureSourceEffect(new OpalAcrolithSoldier(), "", Duration.WhileOnBattlefield, true, false),
|
||||
filter, false);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT),
|
||||
"Whenever an opponent casts a creature spell, if Opal Acrolith is an enchantment, Opal Acrolith becomes a 2/4 Soldier creature."));
|
||||
|
||||
// {0}: Opal Acrolith becomes an enchantment.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesEnchantmentSourceEffect(CardType.ENCHANTMENT), new ManaCostsImpl("{0}")));
|
||||
|
||||
}
|
||||
|
||||
public OpalAcrolith(final OpalAcrolith card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpalAcrolith copy() {
|
||||
return new OpalAcrolith(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BecomesEnchantmentSourceEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||
|
||||
public BecomesEnchantmentSourceEffect(CardType cardType) {
|
||||
super(Duration.Custom, Outcome.AddAbility);
|
||||
staticText = "Opal Acrolith becomes an Enchantment";
|
||||
dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||
|
||||
}
|
||||
|
||||
public BecomesEnchantmentSourceEffect(final BecomesEnchantmentSourceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesEnchantmentSourceEffect copy() {
|
||||
return new BecomesEnchantmentSourceEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
permanent.getCardType().clear();
|
||||
permanent.getSubtype(game).clear();
|
||||
if (!permanent.getCardType().contains(CardType.ENCHANTMENT)) {
|
||||
permanent.getCardType().add(CardType.ENCHANTMENT);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return Layer.TypeChangingEffects_4 == layer;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class OpalAcrolithSoldier extends TokenImpl {
|
||||
|
||||
public OpalAcrolithSoldier() {
|
||||
super("Soldier", "2/4 Ape creature");
|
||||
cardType.add(CardType.CREATURE);
|
||||
subtype.add(SubType.SOLDIER);
|
||||
power = new MageInt(2);
|
||||
toughness = new MageInt(4);
|
||||
}
|
||||
|
||||
public OpalAcrolithSoldier(final OpalAcrolithSoldier token) {
|
||||
super(token);
|
||||
}
|
||||
|
||||
public OpalAcrolithSoldier copy() {
|
||||
return new OpalAcrolithSoldier(this);
|
||||
}
|
||||
}
|
149
Mage.Sets/src/mage/cards/o/OpalTitan.java
Normal file
149
Mage.Sets/src/mage/cards/o/OpalTitan.java
Normal file
|
@ -0,0 +1,149 @@
|
|||
package mage.cards.o;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObjectReference;
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
||||
import mage.abilities.condition.common.SourceMatchesFilterCondition;
|
||||
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.common.continuous.SourceEffect;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import static mage.constants.Layer.AbilityAddingRemovingEffects_6;
|
||||
import static mage.constants.Layer.PTChangingEffects_7;
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SetTargetPointer;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterSpell;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.Spell;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class OpalTitan extends CardImpl {
|
||||
|
||||
private static final FilterSpell filter = new FilterSpell("creature spell");
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
}
|
||||
|
||||
public OpalTitan(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}");
|
||||
|
||||
// When an opponent casts a creature spell, if Opal Titan is an enchantment, Opal Titan becomes a 4/4 Giant creature with protection from each of that spell's colors.
|
||||
TriggeredAbility ability = new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD, new OpalTitanBecomesCreatureEffect(),
|
||||
filter, false, SetTargetPointer.SPELL);
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(ability, new SourceMatchesFilterCondition(StaticFilters.FILTER_ENCHANTMENT_PERMANENT),
|
||||
"When an opponent casts a creature spell, if Opal Titan is an enchantment, Opal Titan becomes a 4/4 Giant creature with protection from each of that spell's colors."));
|
||||
|
||||
}
|
||||
|
||||
public OpalTitan(final OpalTitan card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpalTitan copy() {
|
||||
return new OpalTitan(this);
|
||||
}
|
||||
}
|
||||
|
||||
class OpalTitanBecomesCreatureEffect extends ContinuousEffectImpl implements SourceEffect {
|
||||
|
||||
public OpalTitanBecomesCreatureEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BecomeCreature);
|
||||
setText();
|
||||
this.addDependencyType(DependencyType.BecomeCreature);
|
||||
}
|
||||
|
||||
public OpalTitanBecomesCreatureEffect(final OpalTitanBecomesCreatureEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpalTitanBecomesCreatureEffect copy() {
|
||||
return new OpalTitanBecomesCreatureEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
affectedObjectList.add(new MageObjectReference(source.getSourceId(), game));
|
||||
Spell creatureSpellCast = game.getSpell(targetPointer.getFirst(game, source));
|
||||
if (creatureSpellCast != null
|
||||
&& creatureSpellCast.getColor(game).hasColor()) {
|
||||
game.getState().setValue("opalTitanColor" + source.getSourceId(), creatureSpellCast.getColor(game));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = affectedObjectList.get(0).getPermanent(game);
|
||||
if (permanent != null) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
permanent.getCardType().clear();
|
||||
permanent.addCardType(CardType.CREATURE);
|
||||
permanent.getSubtype(game).add(SubType.GIANT);
|
||||
}
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
if (((ObjectColor) game.getState().getValue("opalTitanColor" + source.getSourceId())) != null) {
|
||||
for (ObjectColor color : ((ObjectColor) game.getState().getValue("opalTitanColor" + source.getSourceId())).getColors()) {
|
||||
if (!permanent.getAbilities().contains(ProtectionAbility.from(color))) {
|
||||
permanent.addAbility(ProtectionAbility.from(color));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if ((sublayer == SubLayer.CharacteristicDefining_7a)
|
||||
|| (sublayer == SubLayer.SetPT_7b)) {
|
||||
permanent.getPower().setValue(4);
|
||||
permanent.getToughness().setValue(4);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
this.discard();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void setText() {
|
||||
staticText = duration.toString() + " {this} becomes a 4/4 Giant creature with protection from each of that spell's colors";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.PTChangingEffects_7
|
||||
|| layer == Layer.AbilityAddingRemovingEffects_6
|
||||
|| layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
}
|
|
@ -204,9 +204,11 @@ public final class UrzasSaga extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("No Rest for the Wicked", 142, Rarity.UNCOMMON, mage.cards.n.NoRestForTheWicked.class));
|
||||
cards.add(new SetCardInfo("Noetic Scales", 304, Rarity.RARE, mage.cards.n.NoeticScales.class));
|
||||
cards.add(new SetCardInfo("Okk", 204, Rarity.RARE, mage.cards.o.Okk.class));
|
||||
cards.add(new SetCardInfo("Opal Acrolith", 22, Rarity.UNCOMMON, mage.cards.o.OpalAcrolith.class));
|
||||
cards.add(new SetCardInfo("Opal Archangel", 23, Rarity.RARE, mage.cards.o.OpalArchangel.class));
|
||||
cards.add(new SetCardInfo("Opal Caryatid", 24, Rarity.COMMON, mage.cards.o.OpalCaryatid.class));
|
||||
cards.add(new SetCardInfo("Opal Gargoyle", 25, Rarity.COMMON, mage.cards.o.OpalGargoyle.class));
|
||||
cards.add(new SetCardInfo("Opal Titan", 26, Rarity.RARE, mage.cards.o.OpalTitan.class));
|
||||
cards.add(new SetCardInfo("Oppression", 143, Rarity.RARE, mage.cards.o.Oppression.class));
|
||||
cards.add(new SetCardInfo("Order of Yawgmoth", 144, Rarity.UNCOMMON, mage.cards.o.OrderOfYawgmoth.class));
|
||||
cards.add(new SetCardInfo("Pacifism", 27, Rarity.COMMON, mage.cards.p.Pacifism.class));
|
||||
|
|
Loading…
Reference in a new issue