Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DFT] Implement Custom Effect Cards #13407

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

Jmlundeen
Copy link
Contributor

For #13033
This implements cards that have custom effects. This also adds a change to the Exhaust ability to remove reminder text on the rule. [[Loot, the Pathfinder]] has multiple exhaust abilities and the reminder text is unnecessary for all of them.

  • Guidelight Optimizer
  • Loot, the Pathfinder
  • Momentum Breaker
  • Oildeep Gearhulk
  • Radiant Lotus
  • Sita Varma, Masked Racer
  • Skyseer's Chariot
  • Skyserpent Seeker
  • TuneUp


// Exhaust -- {G}, {T}: Add three mana of any one color.
this.addAbility(new ExhaustAbility(new AddManaOfAnyColorEffect(3),
new CompositeCost(new ManaCostsImpl<>("{G}"), new TapSourceCost(), "{G}, {T}")));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

composite

this.addAbility(new ExhaustAbility(new DrawCardSourceControllerEffect(3),
new CompositeCost(new ManaCostsImpl<>("{U}"), new TapSourceCost(), "{U}, {T}"),false));
// Exhaust -- {R}, {T}: Loot deals 3 damage to any target.
this.addAbility(new ExhaustAbility(new DamageTargetEffect(3),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Miss target definition

// Exhaust -- {U}, {T}: Draw three cards.
this.addAbility(new ExhaustAbility(new DrawCardSourceControllerEffect(3),
new CompositeCost(new ManaCostsImpl<>("{U}"), new TapSourceCost(), "{U}, {T}"),false));
// Exhaust -- {R}, {T}: Loot deals 3 damage to any target.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For info: use empty line between abilities for better code style

// {2}, Sacrifice this enchantment: You gain life equal to your speed.
Effect gainLifeEffect = new GainLifeEffect(ControllerSpeedCount.instance).setText("You gain life equal to your speed");
Ability ability = (new SimpleActivatedAbility(gainLifeEffect,
new CompositeCost(new ManaCostsImpl<>("{2}"), new SacrificeSourceCost(), "{2}, Sacrifice this enchantment")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

composite

));
filter.add(new ControllerIdPredicate(opponent));
if (game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game).isEmpty()) {
player.discard(1, false, false, source, game);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s wrong logic. There are effects that can “protect” from sacrificing like Sigarda, Host of Herons or Assault Suit. So player can have permanents but can’t sacrifice it.

There is no way to filter such permanents.

I recommend to use another code order:

  • choose target for sacrifice (1 target require, not 0-1);
  • try to sacrifice it;
  • on fail make a discard.

There are possible some cheating for a players to choose “protected” permanent instead non-protected, but it’s ok (e.g. limitation of game engine).

Sacrifice target example:
IMG_1200


controller.lookAtCards(targetPlayer.getName() + " Hand", targetPlayer.getHand(), game);
TargetCard chosenCard = new TargetCardInHand(0, 1, new FilterCard("card to discard"));
if (controller.choose(outcome, targetPlayer.getHand(), chosenCard, source, game)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outcome.Discard is better here, may help AI to choose most powerful card from opponent’s hand.

class RadiantLotusEffect extends OneShotEffect {

public RadiantLotusEffect() {
super(Outcome.Benefit);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend to add Outcome.AIDontUseIt - it will save AI from it. Card must be used for complex combos, but AI can’t work good with color and mana predicted abilities.

@JayDi85
Copy link
Member

JayDi85 commented Mar 11, 2025

All other cards are fine here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants