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

[YMID] Implement Arms Scavenger and 3 other cards, rework Seek effect #12802

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

Conversation

this.addAbility(TrampleAbility.getInstance());


// When Geistpack Alpha dies, seek a permanent card with mana value equal to the number of lands you control.
Copy link
Member

Choose a reason for hiding this comment

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

miss card hint with lands amount info

super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{G}");

// Seek a basic land card and put it onto the battlefield tapped.
// Then seek a permanent card with mana value equal to the number of lands you control.
Copy link
Member

Choose a reason for hiding this comment

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

Must use one line per ability for rules text as comment for better text and regexp searching by IDE


SettleTheWildsSeekEffect() {
super(Outcome.Benefit);
staticText = "Then seek a permanent card with mana value equal to the number of lands you control.";
Copy link
Member

Choose a reason for hiding this comment

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

Why it's a custom effect instead of standard SeekCardEffect?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, the custom filter isn't actually necessary. You can make a predicate like ManaValueLessThanControlledLandCountPredicate but with equal to instead

this.addAbility(ability);

// +1: Tibalt, Wicked Tormentor deals 4 damage to target creature or planeswalker unless its controller has Tibalt deal 4 damage to them.
// If they do, you may discard a card. If you do, draw a card.
Copy link
Member

Choose a reason for hiding this comment

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

must use one line comment in card

public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
Player player = game.getPlayer(source.getControllerId());
Player controller = game.getPlayer(permanent.getControllerId());
Copy link
Member

Choose a reason for hiding this comment

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

  1. Miss permanent null check
  2. Looks like you wrongly use player and controller (must invert). Also check who does damage and make an answer.

/**
* @author Sidorovich77
*/
public class DraftFromSpellbookThenExileCastThisTurnEffect extends OneShotEffect {
Copy link
Member

Choose a reason for hiding this comment

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

Instead copy paste full code from existing effect -- extends DraftFromSpellbookEffect and override apply method like: "if super.apply then exile/cast"

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe should be a method in Player class Set<Card> draftFromSpellbook(List<String> spellbook, PutCards putCards) to handle the functionality

/**
* @author Sidorovich77
*/
public class DraftFromSpellbookThenExilePlayThisTurnEffect extends OneShotEffect {
Copy link
Member

Choose a reason for hiding this comment

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

@xenohedron
As I remember play and cast now are same due oracle changes few releases ago? If true then no needs in duplicated class

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure there's still a difference - but shouldn't need a duplicated class anyway.

return false;
}
game.informPlayers(controller.getLogName() + " seeks a card from their library");
if (inZone == Zone.BATTLEFIELD) {
Copy link
Member

Choose a reason for hiding this comment

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

New zone code must be part of Player.seekCard method (additional params), not here.

Copy link
Contributor Author

@Sidorovich77 Sidorovich77 Sep 9, 2024

Choose a reason for hiding this comment

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

I've decided to modify SeekCardEffect directly instead of using Player's seekCard() because of next problem.
There are several cards that manipulate those cards that were found through the Seek. For example, Signature Spells or Back-Alley Gardener or such a complex example like Plunderer's Prize.
So it seems that seekCard() method in PlayerImpl should return cards that it has found, for example as Cards interface. Would it be more appropriate way?
image
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, changing the return type of that method to Card or Cards is the way to go (then when you need the boolean result, you check if null/empty)

@github-actions github-actions bot added the tests label Sep 15, 2024
@Sidorovich77
Copy link
Contributor Author

I've added more complex Seek method that returns set of cards to allow further manipulations with sought cards. Rule generation is simple enough, because of variety of rule text in cards with seek. I hope that setText() would be suitable for any case.

@@ -2972,6 +2972,40 @@ public boolean seekCard(FilterCard filter, Ability source, Game game) {
return true;
}

@Override
public Set<Card> seekCard(FilterCard filter, Zone inZone, boolean tapped, int amount, Ability source, Game game) {
Player controller = game.getPlayer(source.getControllerId());
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused, why do you need controller? this is a method in PlayerImpl, so it seems like a redundant param. (If it's not dependent on the player, then it should instead be directly in the apply method of the Effect.)

Consider using PutCards rather than Zone + tapped.

Also, you should be able to simplify the existing seekCard method to call this more general one - don't want to have duplicate code.

/**
* @author Sidorovich77
*/
public class DraftFromSpellbookThenExilePlayThisTurnEffect extends OneShotEffect {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm pretty sure there's still a difference - but shouldn't need a duplicated class anyway.

/**
* @author Sidorovich77
*/
public class DraftFromSpellbookThenExileCastThisTurnEffect extends OneShotEffect {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe should be a method in Player class Set<Card> draftFromSpellbook(List<String> spellbook, PutCards putCards) to handle the functionality

if (permanent == null) {
return false;
}
Player you = game.getPlayer(source.getControllerId());
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for "you" right? it's not used anywhere


SettleTheWildsSeekEffect() {
super(Outcome.Benefit);
staticText = "Then seek a permanent card with mana value equal to the number of lands you control.";
Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed, the custom filter isn't actually necessary. You can make a predicate like ManaValueLessThanControlledLandCountPredicate but with equal to instead

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.

3 participants