-
Notifications
You must be signed in to change notification settings - Fork 782
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
base: master
Are you sure you want to change the base?
Conversation
this.addAbility(TrampleAbility.getInstance()); | ||
|
||
|
||
// When Geistpack Alpha dies, seek a permanent card with mana value equal to the number of lands you control. |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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."; |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Miss permanent null check
- 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 { |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
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()); |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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."; |
There was a problem hiding this comment.
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
https://scryfall.com/card/ymid/55/settle-the-wilds
https://scryfall.com/card/ymid/48/geistpack-alpha
https://scryfall.com/card/ymid/43/tibalt-wicked-tormentor
https://scryfall.com/card/ymid/35/arms-scavenger