-
Notifications
You must be signed in to change notification settings - Fork 784
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 Kaito, Bane of Nightmares #13187
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
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,135 @@ | ||
package mage.cards.k; | ||
|
||
import mage.abilities.Ability; | ||
import mage.abilities.LoyaltyAbility; | ||
import mage.abilities.common.SimpleStaticAbility; | ||
import mage.abilities.condition.Condition; | ||
import mage.abilities.condition.common.MyTurnCondition; | ||
import mage.abilities.decorator.ConditionalContinuousEffect; | ||
import mage.abilities.dynamicvalue.DynamicValue; | ||
import mage.abilities.effects.Effect; | ||
import mage.abilities.effects.common.DrawCardSourceControllerEffect; | ||
import mage.abilities.effects.common.GetEmblemEffect; | ||
import mage.abilities.effects.common.TapTargetEffect; | ||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect; | ||
import mage.abilities.effects.common.counter.AddCountersTargetEffect; | ||
import mage.abilities.effects.keyword.SurveilEffect; | ||
import mage.abilities.hint.common.MyTurnHint; | ||
import mage.abilities.keyword.HexproofAbility; | ||
import mage.abilities.keyword.NinjutsuAbility; | ||
import mage.cards.CardImpl; | ||
import mage.cards.CardSetInfo; | ||
import mage.constants.*; | ||
import mage.counters.CounterType; | ||
import mage.game.Game; | ||
import mage.game.command.emblems.KaitoBaneOfNightmaresEmblem; | ||
import mage.game.permanent.Permanent; | ||
import mage.game.permanent.token.custom.CreatureToken; | ||
import mage.target.common.TargetCreaturePermanent; | ||
import mage.watchers.common.PlayerLostLifeWatcher; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* | ||
* @author jackd149 | ||
*/ | ||
public final class KaitoBaneOfNightmares extends CardImpl { | ||
|
||
public KaitoBaneOfNightmares(UUID ownerId, CardSetInfo setInfo) { | ||
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{B}"); | ||
|
||
this.supertype.add(SuperType.LEGENDARY); | ||
this.subtype.add(SubType.KAITO); | ||
this.setStartingLoyalty(4); | ||
|
||
// Ninjutsu {1}{U}{B} | ||
this.addAbility(new NinjutsuAbility("{1}{U}{B}")); | ||
|
||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect( | ||
new BecomesCreatureSourceEffect( | ||
new CreatureToken(3, 4, "3/4 Ninja creature") | ||
.withSubType(SubType.NINJA) | ||
.withAbility(HexproofAbility.getInstance()), null, Duration.WhileOnBattlefield | ||
), KaitoBaneOfNightmaresCondition.instance, "During your turn, as long as {this} has one or more loyalty counters on him, " + | ||
"he's a 3/4 Ninja creature and has hexproof." | ||
)).addHint(MyTurnHint.instance)); | ||
|
||
// +1: You get an emblem with "Ninjas you control get +1/+1." | ||
this.addAbility(new LoyaltyAbility(new GetEmblemEffect(new KaitoBaneOfNightmaresEmblem()), 1)); | ||
|
||
// 0: Surveil 2. Then draw a card for each opponent who lost life this turn. | ||
Ability ability = new LoyaltyAbility(new SurveilEffect(2), 0); | ||
ability.addEffect(new DrawCardSourceControllerEffect(NumberOfOpponentsWhoLostLife.instance)); | ||
this.addAbility(ability, new PlayerLostLifeWatcher()); | ||
|
||
// -2: Tap target creature. Put two stun counters on it. | ||
Ability minusTwoAbility = new LoyaltyAbility(new TapTargetEffect(), -2); | ||
minusTwoAbility.addEffect(new AddCountersTargetEffect(CounterType.STUN.createInstance(2)) | ||
.setText("Put two stun counters on it")); | ||
minusTwoAbility.addTarget(new TargetCreaturePermanent()); | ||
this.addAbility(minusTwoAbility); | ||
} | ||
|
||
private KaitoBaneOfNightmares(final KaitoBaneOfNightmares card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public KaitoBaneOfNightmares copy() { | ||
return new KaitoBaneOfNightmares(this); | ||
} | ||
} | ||
|
||
enum KaitoBaneOfNightmaresCondition implements Condition { | ||
instance; | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
if (!MyTurnCondition.instance.apply(game, source)){ | ||
return false; | ||
} | ||
|
||
Permanent permanent = game.getPermanent(source.getSourceId()); | ||
|
||
if (permanent == null) { | ||
return false; | ||
} | ||
|
||
int loyaltyCount = permanent.getCounters(game).getCount(CounterType.LOYALTY); | ||
return loyaltyCount > 0; | ||
|
||
} | ||
} | ||
|
||
enum NumberOfOpponentsWhoLostLife implements DynamicValue { | ||
instance; | ||
|
||
@Override | ||
public int calculate(Game game, Ability sourceAbility, Effect effect) { | ||
return this.calculate(game, sourceAbility.getControllerId()); | ||
} | ||
|
||
public int calculate(Game game, UUID controllerId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't bother with this extra sub method, it's not standard style. Put the logic directly in the overridden method, it's okay that it doesn't use all its params |
||
PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); | ||
if (watcher != null) { | ||
return watcher.getNumberOfOpponentsWhoLostLife(controllerId, game); | ||
} | ||
return 0; | ||
} | ||
|
||
@Override | ||
public NumberOfOpponentsWhoLostLife copy() { | ||
return instance; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "1"; | ||
} | ||
|
||
@Override | ||
public String getMessage() { | ||
return "opponent who lost life this turn."; | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
Mage/src/main/java/mage/game/command/emblems/KaitoBaneOfNightmaresEmblem.java
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,31 @@ | ||
package mage.game.command.emblems; | ||
|
||
import mage.abilities.common.SimpleStaticAbility; | ||
import mage.abilities.effects.common.continuous.BoostControlledEffect; | ||
import mage.constants.Duration; | ||
import mage.constants.SubType; | ||
import mage.constants.Zone; | ||
import mage.filter.common.FilterCreaturePermanent; | ||
import mage.game.command.Emblem; | ||
|
||
/** | ||
* @author jackd149 | ||
*/ | ||
public final class KaitoBaneOfNightmaresEmblem extends Emblem { | ||
|
||
public KaitoBaneOfNightmaresEmblem() { | ||
super("Emblem Kaito"); | ||
FilterCreaturePermanent filter = new FilterCreaturePermanent(SubType.NINJA, "Ninjas you control"); | ||
this.getAbilities().add(new SimpleStaticAbility(Zone.COMMAND, new BoostControlledEffect(1, 1, Duration.EndOfGame, filter, false))); | ||
} | ||
|
||
private KaitoBaneOfNightmaresEmblem(final KaitoBaneOfNightmaresEmblem card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public KaitoBaneOfNightmaresEmblem copy() { | ||
return new KaitoBaneOfNightmaresEmblem(this); | ||
} | ||
|
||
} |
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
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.
rename to KaitoBaneOfNightmaresCount - we don't use generic class names if they're specific to a single card like this