mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
[TOR] Implemented Floating Shield
This commit is contained in:
parent
6c60b342a0
commit
bc13b02b8e
2 changed files with 91 additions and 0 deletions
90
Mage.Sets/src/mage/cards/f/FloatingShield.java
Normal file
90
Mage.Sets/src/mage/cards/f/FloatingShield.java
Normal file
|
@ -0,0 +1,90 @@
|
|||
package mage.cards.f;
|
||||
|
||||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.ChooseColorEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.effects.keyword.ProtectionChosenColorAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.ProtectionAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author awjackson
|
||||
*/
|
||||
public final class FloatingShield extends CardImpl {
|
||||
|
||||
public FloatingShield(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Protect));
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// As Floating Shield enters the battlefield, choose a color.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseColorEffect(Outcome.Protect)));
|
||||
|
||||
// Enchanted creature has protection from the chosen color. This effect doesn't remove Floating Shield.
|
||||
this.addAbility(new SimpleStaticAbility(new ProtectionChosenColorAttachedEffect(true)));
|
||||
|
||||
// Sacrifice Floating Shield: Target creature gains protection from the chosen color until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(new FloatingShieldEffect(), new SacrificeSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private FloatingShield(final FloatingShield card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatingShield copy() {
|
||||
return new FloatingShield(this);
|
||||
}
|
||||
}
|
||||
|
||||
class FloatingShieldEffect extends OneShotEffect {
|
||||
|
||||
public FloatingShieldEffect() {
|
||||
super(Outcome.Protect);
|
||||
this.staticText = "target creature gains protection from the chosen color until end of turn";
|
||||
}
|
||||
|
||||
public FloatingShieldEffect(final FloatingShieldEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FloatingShieldEffect copy() {
|
||||
return new FloatingShieldEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
ObjectColor color = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
|
||||
if (color == null) {
|
||||
return false;
|
||||
}
|
||||
game.addEffect(new GainAbilityTargetEffect(ProtectionAbility.from(color)), source);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -77,6 +77,7 @@ public final class Torment extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Far Wanderings", 125, Rarity.COMMON, mage.cards.f.FarWanderings.class));
|
||||
cards.add(new SetCardInfo("Fiery Temper", 97, Rarity.COMMON, mage.cards.f.FieryTemper.class));
|
||||
cards.add(new SetCardInfo("Flash of Defiance", 99, Rarity.COMMON, mage.cards.f.FlashOfDefiance.class));
|
||||
cards.add(new SetCardInfo("Floating Shield", 5, Rarity.COMMON, mage.cards.f.FloatingShield.class));
|
||||
cards.add(new SetCardInfo("Frantic Purification", 6, Rarity.COMMON, mage.cards.f.FranticPurification.class));
|
||||
cards.add(new SetCardInfo("Ghostly Wings", 38, Rarity.COMMON, mage.cards.g.GhostlyWings.class));
|
||||
cards.add(new SetCardInfo("Gloomdrifter", 61, Rarity.UNCOMMON, mage.cards.g.Gloomdrifter.class));
|
||||
|
|
Loading…
Reference in a new issue