[CMR] Implemented Kamahl's Will

This commit is contained in:
Evan Kranzler 2020-11-02 20:34:34 -05:00
parent fd8d64e162
commit c9170556c1
2 changed files with 104 additions and 0 deletions

View file

@ -0,0 +1,103 @@
package mage.cards.k;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.common.ControlACommanderCondition;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.IndestructibleAbility;
import mage.abilities.keyword.VigilanceAbility;
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.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class KamahlsWill extends CardImpl {
public KamahlsWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{G}");
// Choose one. If you control a commander as you cast this spell, you may choose both.
this.getSpellAbility().getModes().setChooseText(
"Choose one. If you control a commander as you cast this spell, you may choose both."
);
this.getSpellAbility().getModes().setMoreCondition(ControlACommanderCondition.instance);
// Until end of turn, any number of target lands you control become 1/1 Elemental creatures with vigilance, indestructible, and haste. They're still lands.
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(
new CreatureToken(1, 1, "")
.withSubType(SubType.ELEMENTAL)
.withAbility(VigilanceAbility.getInstance())
.withAbility(IndestructibleAbility.getInstance())
.withAbility(HasteAbility.getInstance()),
false, true, Duration.EndOfTurn
).setText("until end of turn, any number of target lands you control become 1/1 Elemental creatures " +
"with vigilance, indestructible, and haste. They're still lands"));
this.getSpellAbility().addTarget(new TargetPermanent(
0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS, false
));
// Choose target creature you don't control. Each creature you control deals damage equal to its power to that creature.
Mode mode = new Mode(new KamahlsWillEffect());
mode.addTarget(new TargetPermanent(StaticFilters.FILTER_CREATURE_YOU_DONT_CONTROL));
this.getSpellAbility().addMode(mode);
}
private KamahlsWill(final KamahlsWill card) {
super(card);
}
@Override
public KamahlsWill copy() {
return new KamahlsWill(this);
}
}
class KamahlsWillEffect extends OneShotEffect {
KamahlsWillEffect() {
super(Outcome.Benefit);
staticText = "choose target creature you don't control. " +
"Each creature you control deals damage equal to its power to that creature";
}
private KamahlsWillEffect(final KamahlsWillEffect effect) {
super(effect);
}
@Override
public KamahlsWillEffect copy() {
return new KamahlsWillEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null) {
return false;
}
for (Permanent creature : game.getBattlefield().getActivePermanents(
StaticFilters.FILTER_CONTROLLED_CREATURE,
source.getControllerId(), source.getSourceId(), game
)) {
if (creature == null || creature.getPower().getValue() < 1) {
continue;
}
permanent.damage(creature.getPower().getValue(), creature.getId(), game);
}
return true;
}
}

View file

@ -116,6 +116,7 @@ public final class CommanderLegends extends ExpansionSet {
cards.add(new SetCardInfo("Jeska's Will", 187, Rarity.RARE, mage.cards.j.JeskasWill.class));
cards.add(new SetCardInfo("Jeska, Thrice Reborn", 186, Rarity.MYTHIC, mage.cards.j.JeskaThriceReborn.class));
cards.add(new SetCardInfo("Jeweled Lotus", 319, Rarity.MYTHIC, mage.cards.j.JeweledLotus.class));
cards.add(new SetCardInfo("Kamahl's Will", 238, Rarity.RARE, mage.cards.k.KamahlsWill.class));
cards.add(new SetCardInfo("Kamahl, Heart of Krosa", 237, Rarity.MYTHIC, mage.cards.k.KamahlHeartOfKrosa.class));
cards.add(new SetCardInfo("Kediss, Emberclaw Familiar", 188, Rarity.UNCOMMON, mage.cards.k.KedissEmberclawFamiliar.class));
cards.add(new SetCardInfo("Keeper of the Accord", 27, Rarity.RARE, mage.cards.k.KeeperOfTheAccord.class));