mirror of
https://github.com/correl/mage.git
synced 2025-01-13 19:11:33 +00:00
[VOW] Implemented Sigardian Palading
This commit is contained in:
parent
45fc9b305a
commit
8091538bbc
3 changed files with 145 additions and 0 deletions
140
Mage.Sets/src/mage/cards/s/SigardianPaladin.java
Normal file
140
Mage.Sets/src/mage/cards/s/SigardianPaladin.java
Normal file
|
@ -0,0 +1,140 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.abilities.hint.Hint;
|
||||
import mage.abilities.keyword.LifelinkAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class SigardianPaladin extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter
|
||||
= new FilterControlledCreaturePermanent("creature you control with a +1/+1 counter on it");
|
||||
|
||||
static {
|
||||
filter.add(CounterType.P1P1.getPredicate());
|
||||
}
|
||||
|
||||
public SigardianPaladin(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}{W}");
|
||||
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.KNIGHT);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// As long as you've put one or more +1/+1 counters on a creature this turn, Sigardian Paladin has trample and lifelink.
|
||||
Ability ability = new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.WhileOnBattlefield),
|
||||
SigardianPaladinCondition.instance, "as long as you've put " +
|
||||
"one or more +1/+1 counters on a creature this turn, {this} has trample"
|
||||
));
|
||||
ability.addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilitySourceEffect(
|
||||
LifelinkAbility.getInstance(), Duration.WhileOnBattlefield
|
||||
), SigardianPaladinCondition.instance, "and lifelink"
|
||||
));
|
||||
this.addAbility(ability.addHint(SigardianPaladinCondition.getHint()), new SigardianPaladinWatcher());
|
||||
|
||||
// {1}{G}{W}: Target creature you control with a +1/+1 counter on it gains trample and lifelink until end of turn.
|
||||
ability = new SimpleActivatedAbility(
|
||||
new GainAbilityTargetEffect(TrampleAbility.getInstance())
|
||||
.setText("target creature you control with a +1/+1 counter on it gains trample"),
|
||||
new ManaCostsImpl<>("{1}{G}{W}")
|
||||
);
|
||||
ability.addEffect(new GainAbilityTargetEffect(
|
||||
LifelinkAbility.getInstance()
|
||||
).setText("and lifelink until end of turn"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private SigardianPaladin(final SigardianPaladin card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SigardianPaladin copy() {
|
||||
return new SigardianPaladin(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum SigardianPaladinCondition implements Condition {
|
||||
instance;
|
||||
private static final Hint hint = new ConditionHint(
|
||||
instance, "You've put one or more +1/+1 counters on a creature this turn"
|
||||
);
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return SigardianPaladinWatcher.checkPlayer(source.getControllerId(), game);
|
||||
}
|
||||
|
||||
public static Hint getHint() {
|
||||
return hint;
|
||||
}
|
||||
}
|
||||
|
||||
class SigardianPaladinWatcher extends Watcher {
|
||||
|
||||
private final Set<UUID> playerSet = new HashSet<>();
|
||||
|
||||
SigardianPaladinWatcher() {
|
||||
super(WatcherScope.GAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void watch(GameEvent event, Game game) {
|
||||
if (event.getType() != GameEvent.EventType.COUNTER_ADDED
|
||||
|| playerSet.contains(event.getPlayerId())
|
||||
|| !event.getData().equals(CounterType.P1P1.getName())) {
|
||||
return;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
playerSet.add(event.getPlayerId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
super.reset();
|
||||
playerSet.clear();
|
||||
}
|
||||
|
||||
static boolean checkPlayer(UUID playerId, Game game) {
|
||||
return game.getState()
|
||||
.getWatcher(SigardianPaladinWatcher.class)
|
||||
.playerSet
|
||||
.contains(playerId);
|
||||
}
|
||||
}
|
|
@ -154,6 +154,7 @@ public final class InnistradCrimsonVow extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Scattered Thoughts", 74, Rarity.COMMON, mage.cards.s.ScatteredThoughts.class));
|
||||
cards.add(new SetCardInfo("Shattered Sanctum", 264, Rarity.RARE, mage.cards.s.ShatteredSanctum.class));
|
||||
cards.add(new SetCardInfo("Sigarda's Imprisonment", 35, Rarity.COMMON, mage.cards.s.SigardasImprisonment.class));
|
||||
cards.add(new SetCardInfo("Sigardian Paladin", 247, Rarity.UNCOMMON, mage.cards.s.SigardianPaladin.class));
|
||||
cards.add(new SetCardInfo("Sorin the Mirthless", 131, Rarity.MYTHIC, mage.cards.s.SorinTheMirthless.class));
|
||||
cards.add(new SetCardInfo("Splendid Reclamation", 221, Rarity.RARE, mage.cards.s.SplendidReclamation.class));
|
||||
cards.add(new SetCardInfo("Stensia Uprising", 178, Rarity.RARE, mage.cards.s.StensiaUprising.class));
|
||||
|
|
|
@ -28,6 +28,10 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
|
|||
private UUID durationPlayerId;
|
||||
private boolean sameStep;
|
||||
|
||||
public GainAbilityTargetEffect(Ability ability) {
|
||||
this(ability, Duration.EndOfTurn);
|
||||
}
|
||||
|
||||
public GainAbilityTargetEffect(Ability ability, Duration duration) {
|
||||
this(ability, duration, null);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue