mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
[STX] Implemented Silverquill Silencer
This commit is contained in:
parent
b156e3b137
commit
1d4fc1369a
3 changed files with 98 additions and 22 deletions
78
Mage.Sets/src/mage/cards/s/SilverquillSilencer.java
Normal file
78
Mage.Sets/src/mage/cards/s/SilverquillSilencer.java
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
package mage.cards.s;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||||
|
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.ChooseACardNameEffect;
|
||||||
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.LoseLifeTargetEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SetTargetPointer;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.filter.FilterSpell;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayer;
|
||||||
|
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class SilverquillSilencer extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterSpell filter = new FilterSpell("a spell with the chosen name");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(SilverquillSilencerPredicate.instance);
|
||||||
|
}
|
||||||
|
|
||||||
|
public SilverquillSilencer(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{B}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.HUMAN);
|
||||||
|
this.subtype.add(SubType.CLERIC);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
|
// As Silverquill Silencer enters the battlefield, choose a nonland card name.
|
||||||
|
this.addAbility(new AsEntersBattlefieldAbility(
|
||||||
|
new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.NON_LAND_NAME)
|
||||||
|
));
|
||||||
|
|
||||||
|
// Whenever an opponent casts a spell with the chosen name, they lose 3 life and you draw a card.
|
||||||
|
Ability ability = new SpellCastOpponentTriggeredAbility(
|
||||||
|
Zone.BATTLEFIELD, new LoseLifeTargetEffect(3).setText("they lose 3 life"),
|
||||||
|
filter, false, SetTargetPointer.PLAYER
|
||||||
|
);
|
||||||
|
ability.addEffect(new DrawCardSourceControllerEffect(1).concatBy("and you"));
|
||||||
|
this.addAbility(ability);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SilverquillSilencer(final SilverquillSilencer card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SilverquillSilencer copy() {
|
||||||
|
return new SilverquillSilencer(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SilverquillSilencerPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
||||||
|
String cardName = (String) game.getState().getValue(
|
||||||
|
input.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY
|
||||||
|
);
|
||||||
|
return CardUtil.haveSameNames(input.getObject().getName(), cardName);
|
||||||
|
}
|
||||||
|
}
|
|
@ -204,6 +204,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Silverquill Campus", 273, Rarity.COMMON, mage.cards.s.SilverquillCampus.class));
|
cards.add(new SetCardInfo("Silverquill Campus", 273, Rarity.COMMON, mage.cards.s.SilverquillCampus.class));
|
||||||
cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class));
|
cards.add(new SetCardInfo("Silverquill Command", 232, Rarity.RARE, mage.cards.s.SilverquillCommand.class));
|
||||||
cards.add(new SetCardInfo("Silverquill Pledgemage", 233, Rarity.COMMON, mage.cards.s.SilverquillPledgemage.class));
|
cards.add(new SetCardInfo("Silverquill Pledgemage", 233, Rarity.COMMON, mage.cards.s.SilverquillPledgemage.class));
|
||||||
|
cards.add(new SetCardInfo("Silverquill Silencer", 234, Rarity.RARE, mage.cards.s.SilverquillSilencer.class));
|
||||||
cards.add(new SetCardInfo("Snow Day", 53, Rarity.UNCOMMON, mage.cards.s.SnowDay.class));
|
cards.add(new SetCardInfo("Snow Day", 53, Rarity.UNCOMMON, mage.cards.s.SnowDay.class));
|
||||||
cards.add(new SetCardInfo("Solve the Equation", 54, Rarity.UNCOMMON, mage.cards.s.SolveTheEquation.class));
|
cards.add(new SetCardInfo("Solve the Equation", 54, Rarity.UNCOMMON, mage.cards.s.SolveTheEquation.class));
|
||||||
cards.add(new SetCardInfo("Soothsayer Adept", 55, Rarity.COMMON, mage.cards.s.SoothsayerAdept.class));
|
cards.add(new SetCardInfo("Soothsayer Adept", 55, Rarity.COMMON, mage.cards.s.SoothsayerAdept.class));
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
package mage.abilities.common;
|
package mage.abilities.common;
|
||||||
|
|
||||||
import mage.abilities.TriggeredAbilityImpl;
|
import mage.abilities.TriggeredAbilityImpl;
|
||||||
|
@ -58,29 +57,27 @@ public class SpellCastOpponentTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
if (!game.getPlayer(this.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||||
if (spell != null && filter.match(spell, game)) {
|
if (spell == null || !filter.match(spell, getSourceId(), getControllerId(), game)) {
|
||||||
if (setTargetPointer != SetTargetPointer.NONE) {
|
return false;
|
||||||
for (Effect effect : this.getEffects()) {
|
}
|
||||||
switch (setTargetPointer) {
|
switch (setTargetPointer) {
|
||||||
|
case NONE:
|
||||||
|
break;
|
||||||
case SPELL:
|
case SPELL:
|
||||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
getEffects().setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
break;
|
break;
|
||||||
case PLAYER:
|
case PLAYER:
|
||||||
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
|
getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("Value of SetTargetPointer not supported!");
|
throw new UnsupportedOperationException("Value of SetTargetPointer not supported!");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getRule() {
|
public String getRule() {
|
||||||
|
|
Loading…
Reference in a new issue