mirror of
https://github.com/correl/mage.git
synced 2024-12-25 11:11:16 +00:00
[KHM] Implemented Wolverine Riders
This commit is contained in:
parent
11b8078d96
commit
826e509ee6
3 changed files with 98 additions and 17 deletions
83
Mage.Sets/src/mage/cards/w/WolverineRiders.java
Normal file
83
Mage.Sets/src/mage/cards/w/WolverineRiders.java
Normal file
|
@ -0,0 +1,83 @@
|
|||
package mage.cards.w;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.GainLifeEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.ElfToken;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class WolverineRiders extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent(SubType.ELF, "");
|
||||
|
||||
static {
|
||||
filter.add(AnotherPredicate.instance);
|
||||
}
|
||||
|
||||
public WolverineRiders(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{G}{G}");
|
||||
|
||||
this.subtype.add(SubType.ELF);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// At the beginning of each upkeep, create a 1/1 green Elf Warrior creature token.
|
||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new CreateTokenEffect(new ElfToken()), TargetController.EACH_PLAYER, false
|
||||
));
|
||||
|
||||
// Whenever another Elf enters the battlefield under your control, you gain life equal to its toughness.
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
|
||||
new GainLifeEffect(WolverineRidersValue.instance), filter, "Whenever another Elf " +
|
||||
"enters the battlefield under your control, you gain life equal to its toughness."
|
||||
));
|
||||
}
|
||||
|
||||
private WolverineRiders(final WolverineRiders card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WolverineRiders copy() {
|
||||
return new WolverineRiders(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum WolverineRidersValue implements DynamicValue {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
Permanent permanent = (Permanent) effect.getValue("permanentEnteringBattlefield");
|
||||
return permanent == null ? 0 : permanent.getToughness().getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public WolverineRidersValue copy() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "";
|
||||
}
|
||||
}
|
|
@ -28,5 +28,6 @@ public final class KaldheimCommander extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sage of the Beyond", 6, Rarity.RARE, mage.cards.s.SageOfTheBeyond.class));
|
||||
cards.add(new SetCardInfo("Spectral Deluge", 7, Rarity.RARE, mage.cards.s.SpectralDeluge.class));
|
||||
cards.add(new SetCardInfo("Stoic Farmer", 5, Rarity.RARE, mage.cards.s.StoicFarmer.class));
|
||||
cards.add(new SetCardInfo("Wolverine Riders", 14, Rarity.RARE, mage.cards.w.WolverineRiders.class));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,25 +84,22 @@ public class EntersBattlefieldAllTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
UUID targetId = event.getTargetId();
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
if (permanent != null && filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setValue("permanentEnteringBattlefield", permanent);
|
||||
}
|
||||
if (setTargetPointer != SetTargetPointer.NONE) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
switch (setTargetPointer) {
|
||||
case PLAYER:
|
||||
effect.setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
break;
|
||||
case PERMANENT:
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
this.getEffects().setValue("permanentEnteringBattlefield", permanent);
|
||||
if (setTargetPointer == SetTargetPointer.NONE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
switch (setTargetPointer) {
|
||||
case PLAYER:
|
||||
this.getEffects().setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
break;
|
||||
case PERMANENT:
|
||||
this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue