[LCC] Implement Contest of Claws (#11630)

This commit is contained in:
jimga150 2024-01-10 23:29:55 -05:00 committed by GitHub
parent 978258cef5
commit 3b29733aec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1,92 @@
package mage.cards.c;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.keyword.DiscoverEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author jimga150
*/
public final class ContestOfClaws extends CardImpl {
public ContestOfClaws(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}");
// Target creature you control deals damage equal to its power to another target creature. If excess damage was dealt this way, discover X, where X is that excess damage.
this.getSpellAbility().addEffect(new ContestOfClawsDamageEffect());
Target target = new TargetControlledCreaturePermanent().setTargetTag(1);
this.getSpellAbility().addTarget(target);
Target target2 = new TargetCreaturePermanent(StaticFilters.FILTER_ANOTHER_CREATURE_TARGET_2).setTargetTag(2);
this.getSpellAbility().addTarget(target2);
}
private ContestOfClaws(final ContestOfClaws card) {
super(card);
}
@Override
public ContestOfClaws copy() {
return new ContestOfClaws(this);
}
}
// Based on Fall of the Hammer and Lacerate Flesh
class ContestOfClawsDamageEffect extends OneShotEffect {
public ContestOfClawsDamageEffect() {
super(Outcome.PlayForFree);
this.staticText = "Target creature you control deals damage equal to its power to another target creature. " +
"If excess damage was dealt this way, discover X, where X is that excess damage.";
}
private ContestOfClawsDamageEffect(final ContestOfClawsDamageEffect effect) {
super(effect);
}
@Override
public ContestOfClawsDamageEffect copy() {
return new ContestOfClawsDamageEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent ownCreature = game.getPermanent(source.getFirstTarget());
Permanent targetCreature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (ownCreature == null || targetCreature == null) {
return false;
}
int damage = ownCreature.getPower().getValue();
int lethalDamage = targetCreature.getLethalDamage(source.getSourceId(), game);
targetCreature.damage(damage, ownCreature.getId(), source, game, false, true);
if (damage < lethalDamage){
return true;
}
int discoverValue = damage - lethalDamage;
Player player = game.getPlayer(source.getControllerId());
if (player == null){
// If somehow this case is hit, the damage still technically happened, so i guess it applied?
return true;
}
DiscoverEffect.doDiscover(player, discoverValue, game, source);
return true;
}
}

View file

@ -76,6 +76,7 @@ public final class LostCavernsOfIxalanCommander extends ExpansionSet {
cards.add(new SetCardInfo("Command Tower", 325, Rarity.COMMON, mage.cards.c.CommandTower.class));
cards.add(new SetCardInfo("Commander's Sphere", 301, Rarity.COMMON, mage.cards.c.CommandersSphere.class));
cards.add(new SetCardInfo("Commit // Memory", 147, Rarity.RARE, mage.cards.c.CommitMemory.class));
cards.add(new SetCardInfo("Contest of Claws", 12, Rarity.RARE, mage.cards.c.ContestOfClaws.class));
cards.add(new SetCardInfo("Coralhelm Commander", 148, Rarity.RARE, mage.cards.c.CoralhelmCommander.class));
cards.add(new SetCardInfo("Cordial Vampire", 189, Rarity.RARE, mage.cards.c.CordialVampire.class));
cards.add(new SetCardInfo("Corsair Captain", 149, Rarity.RARE, mage.cards.c.CorsairCaptain.class));