-
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
[DSK] Implement Grab the Prize #13049
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8c4ce40
Merge pull request #1 from magefree/master
Jamaninja 13fbb51
[DSK] Implement Grab the Prize
Jamaninja ef55472
Merge pull request #2 from magefree/master
Jamaninja 2a75b1e
Grab the Prize - Added missing comment
Jamaninja 7c80c9e
Merge remote-tracking branch 'origin/master'
Jamaninja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package mage.cards.g; | ||
|
||
import java.util.Collection; | ||
import java.util.UUID; | ||
|
||
import mage.abilities.Ability; | ||
import mage.abilities.condition.Condition; | ||
import mage.abilities.costs.common.DiscardCardCost; | ||
import mage.abilities.decorator.ConditionalOneShotEffect; | ||
import mage.abilities.effects.common.DrawCardSourceControllerEffect; | ||
import mage.abilities.effects.common.DamagePlayersEffect; | ||
import mage.cards.CardImpl; | ||
import mage.cards.CardSetInfo; | ||
import mage.constants.CardType; | ||
import mage.constants.TargetController; | ||
import mage.game.Game; | ||
import mage.util.CardUtil; | ||
|
||
/** | ||
* @author Jamaninja | ||
*/ | ||
public final class GrabThePrize extends CardImpl { | ||
|
||
public GrabThePrize(UUID ownerId, CardSetInfo setInfo) { | ||
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{R}"); | ||
|
||
// As an additional cost to cast this spell, discard a card. | ||
this.getSpellAbility().addCost(new DiscardCardCost()); | ||
|
||
// Draw two cards. | ||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2)); | ||
|
||
// If the discarded card wasn't a land card, {this} deals two damage to each opponent. | ||
this.getSpellAbility().addEffect(new ConditionalOneShotEffect( | ||
new DamagePlayersEffect(2, TargetController.OPPONENT), | ||
GrabThePrizeCondition.instance, | ||
"If the discarded card wasn't a land card, {this} deals two damage to each opponent.")); | ||
} | ||
|
||
private GrabThePrize(final GrabThePrize card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public GrabThePrize copy() { | ||
return new GrabThePrize(this); | ||
} | ||
} | ||
|
||
enum GrabThePrizeCondition implements Condition { | ||
instance; | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
return CardUtil.castStream(source.getCosts().stream(), DiscardCardCost.class) | ||
.map(DiscardCardCost::getCards) | ||
.flatMap(Collection::stream) | ||
.anyMatch(card -> !card.isLand(game)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 comment with full ability text
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.
Sorry, this was my first card. Should I include the comment in a commit the next time I upload 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.
You can edit and add commit to your version, it will be available in that PR too.