forked from External/mage
[SNC] Implemented Public Enemy
This commit is contained in:
parent
f07004e27c
commit
dcb893dbf7
2 changed files with 100 additions and 0 deletions
99
Mage.Sets/src/mage/cards/p/PublicEnemy.java
Normal file
99
Mage.Sets/src/mage/cards/p/PublicEnemy.java
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
package mage.cards.p;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class PublicEnemy extends CardImpl {
|
||||
|
||||
public PublicEnemy(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{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()));
|
||||
|
||||
// All creatures attack enchanted creature's controller each combat if able.
|
||||
this.addAbility(new SimpleStaticAbility(new PublicEnemyEffect()));
|
||||
|
||||
// When enchanted creature dies, draw a card.
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(
|
||||
new DrawCardSourceControllerEffect(1), "enchanted creature"
|
||||
));
|
||||
}
|
||||
|
||||
private PublicEnemy(final PublicEnemy card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublicEnemy copy() {
|
||||
return new PublicEnemy(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PublicEnemyEffect extends RequirementEffect {
|
||||
|
||||
PublicEnemyEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "all creatures attack enchanted creature's controller each combat if able";
|
||||
}
|
||||
|
||||
private PublicEnemyEffect(final PublicEnemyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublicEnemyEffect copy() {
|
||||
return new PublicEnemyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID mustAttackDefender(Ability source, Game game) {
|
||||
return Optional.of(source.getSourcePermanentIfItStillExists(game))
|
||||
.filter(Objects::nonNull)
|
||||
.map(Permanent::getAttachedTo)
|
||||
.map(game::getControllerId)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustAttack(Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mustBlock(Game game) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -182,6 +182,7 @@ public final class StreetsOfNewCapenna extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Professional Face-Breaker", 116, Rarity.RARE, mage.cards.p.ProfessionalFaceBreaker.class));
|
||||
cards.add(new SetCardInfo("Psionic Snoop", 53, Rarity.COMMON, mage.cards.p.PsionicSnoop.class));
|
||||
cards.add(new SetCardInfo("Psychic Pickpocket", 54, Rarity.UNCOMMON, mage.cards.p.PsychicPickpocket.class));
|
||||
cards.add(new SetCardInfo("Public Enemy", 55, Rarity.UNCOMMON, mage.cards.p.PublicEnemy.class));
|
||||
cards.add(new SetCardInfo("Pugnacious Pugilist", 117, Rarity.UNCOMMON, mage.cards.p.PugnaciousPugilist.class));
|
||||
cards.add(new SetCardInfo("Pyre-Sledge Arsonist", 118, Rarity.UNCOMMON, mage.cards.p.PyreSledgeArsonist.class));
|
||||
cards.add(new SetCardInfo("Queza, Augur of Agonies", 212, Rarity.UNCOMMON, mage.cards.q.QuezaAugurOfAgonies.class));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue