mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[SNC] Implemented Witness Protection
This commit is contained in:
parent
cdea80ad40
commit
c451ae88c7
2 changed files with 120 additions and 0 deletions
119
Mage.Sets/src/mage/cards/w/WitnessProtection.java
Normal file
119
Mage.Sets/src/mage/cards/w/WitnessProtection.java
Normal file
|
@ -0,0 +1,119 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.ObjectColor;
|
||||
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.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class WitnessProtection extends CardImpl {
|
||||
|
||||
public WitnessProtection(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
|
||||
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
// Enchant creature
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
this.addAbility(new EnchantAbility(auraTarget.getTargetName()));
|
||||
|
||||
// Enchanted creature loses all abilities and is a green and white Citizen creature with base power and toughness 1/1 named Legitimate Businessperson.
|
||||
this.addAbility(new SimpleStaticAbility(new WitnessProtectionEffect()));
|
||||
}
|
||||
|
||||
private WitnessProtection(final WitnessProtection card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WitnessProtection copy() {
|
||||
return new WitnessProtection(this);
|
||||
}
|
||||
}
|
||||
|
||||
class WitnessProtectionEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static final ObjectColor color = new ObjectColor("GW");
|
||||
|
||||
WitnessProtectionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "enchanted creature loses all abilities and is a green and white Citizen creature " +
|
||||
"with base power and toughness 1/1 named Legitimate Businessperson";
|
||||
}
|
||||
|
||||
private WitnessProtectionEffect(final WitnessProtectionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WitnessProtectionEffect copy() {
|
||||
return new WitnessProtectionEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent enchantment = source.getSourcePermanentIfItStillExists(game);
|
||||
if (enchantment == null) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
switch (layer) {
|
||||
case TextChangingEffects_3:
|
||||
permanent.setName("Legitimate Businessperson");
|
||||
return true;
|
||||
case TypeChangingEffects_4:
|
||||
permanent.removeAllCardTypes(game);
|
||||
permanent.addCardType(game, CardType.CREATURE);
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.addSubType(game, SubType.CITIZEN);
|
||||
return true;
|
||||
case ColorChangingEffects_5:
|
||||
permanent.getColor(game).setColor(color);
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
return true;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(1);
|
||||
permanent.getToughness().setValue(1);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
switch (layer) {
|
||||
case TextChangingEffects_3:
|
||||
case TypeChangingEffects_4:
|
||||
case ColorChangingEffects_5:
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
case PTChangingEffects_7:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -84,6 +84,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Urabrask, Heretic Praetor", 129, Rarity.MYTHIC, mage.cards.u.UrabraskHereticPraetor.class));
|
||||
cards.add(new SetCardInfo("Vivien on the Hunt", 162, Rarity.MYTHIC, mage.cards.v.VivienOnTheHunt.class));
|
||||
cards.add(new SetCardInfo("Waterfront District", 259, Rarity.COMMON, mage.cards.w.WaterfrontDistrict.class));
|
||||
cards.add(new SetCardInfo("Witness Protection", 66, Rarity.COMMON, mage.cards.w.WitnessProtection.class));
|
||||
cards.add(new SetCardInfo("Xander's Lounge", 260, Rarity.RARE, mage.cards.x.XandersLounge.class));
|
||||
cards.add(new SetCardInfo("Ziatora's Proving Ground", 261, Rarity.RARE, mage.cards.z.ZiatorasProvingGround.class));
|
||||
cards.add(new SetCardInfo("Ziatora, the Incinerator", 231, Rarity.MYTHIC, mage.cards.z.ZiatoraTheIncinerator.class));
|
||||
|
|
Loading…
Reference in a new issue