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
Implement Dungeon Master and Nira, Hellkite Duelist #5995
Closed
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
05fecc3
Implement Dungeon Master and Nira Hellkite Duelist
jmharmon 977638c
Implement Nira, Helllkite Duelist
jmharmon 20b9967
Implement Fighter and Dungeon Master sub types
jmharmon 321ec5b
Implement Dungeon Master
jmharmon a6aad04
Implement Dungeon Master Skeleton token
jmharmon bc01c6d
Implement Dungeon Master Cleric token
jmharmon 932b380
Implement Dungeon Master Wizard token
jmharmon 680950e
Implement Dungeon Master Fighter token
jmharmon 60066e4
Implement Dungeon Master Rogue token
jmharmon File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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,144 @@ | ||
package mage.cards.d; | ||
|
||
import mage.abilities.Ability; | ||
import mage.abilities.LoyaltyAbility; | ||
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility; | ||
import mage.abilities.effects.OneShotEffect; | ||
import mage.abilities.effects.common.CreateTokenEffect; | ||
import mage.abilities.effects.common.CreateTokenTargetEffect; | ||
import mage.cards.CardImpl; | ||
import mage.cards.CardSetInfo; | ||
import mage.constants.CardType; | ||
import mage.constants.Outcome; | ||
import mage.constants.SubType; | ||
import mage.constants.SuperType; | ||
import mage.game.Game; | ||
import mage.game.permanent.token.*; | ||
import mage.game.turn.TurnMod; | ||
import mage.players.Player; | ||
import mage.target.Target; | ||
import mage.target.common.TargetOpponent; | ||
|
||
import java.util.Random; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author jmharmon | ||
*/ | ||
|
||
public final class DungeonMaster extends CardImpl { | ||
|
||
public DungeonMaster(UUID ownerId, CardSetInfo setInfo) { | ||
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{W}{U}"); | ||
|
||
this.addSuperType(SuperType.LEGENDARY); | ||
this.subtype.add(SubType.DUNGEON_MASTER); | ||
|
||
Random rnd = new Random(); | ||
int number = 0; | ||
number = rnd.nextInt(4)+2; | ||
|
||
if (number == 2) { | ||
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(2)); | ||
} | ||
else if (number == 3) { | ||
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(3)); | ||
} | ||
else if (number == 4) { | ||
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(4)); | ||
} | ||
else if (number == 5) { | ||
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5)); | ||
} | ||
|
||
// +1: Target opponent creates a 1/1 black Skeleton creature token with “When this creature dies, each opponent gains 2 life.” | ||
LoyaltyAbility ability = new LoyaltyAbility(new CreateTokenTargetEffect(new SkeletonToken2()), 1); | ||
Target target = new TargetOpponent(); | ||
ability.addTarget(target); | ||
this.addAbility(ability); | ||
|
||
// +1: Roll a d20. If you roll a 1, skip your next turn. If you roll a 12 or higher, draw a card. | ||
LoyaltyAbility ability2 = new LoyaltyAbility(new DungeonMasterRollDieEffect(), 1); | ||
this.addAbility(ability2); | ||
|
||
// −6: You get an adventuring party. (Your party is a 3/3 red Fighter with first strike, a 1/1 white Cleric with lifelink, a 2/2 black Rogue with hexproof, and a 1/1 blue Wizard with flying.) | ||
LoyaltyAbility ability3 = new LoyaltyAbility(new DungeonMasterAdventuringPartyEffect(), -6); | ||
this.addAbility(ability3); | ||
} | ||
|
||
public DungeonMaster(final DungeonMaster card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public DungeonMaster copy() { | ||
return new DungeonMaster(this); | ||
} | ||
} | ||
|
||
class DungeonMasterRollDieEffect extends OneShotEffect { | ||
|
||
public DungeonMasterRollDieEffect() { | ||
super(Outcome.DrawCard); | ||
staticText = "Roll a d20. If you roll a 1, skip your next turn. If you roll a 12 or higher, draw a card"; | ||
} | ||
|
||
public DungeonMasterRollDieEffect(final DungeonMasterRollDieEffect effect) { | ||
super(effect); | ||
} | ||
|
||
@Override | ||
public DungeonMasterRollDieEffect copy() { | ||
return new DungeonMasterRollDieEffect(this); | ||
} | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
Player controller = game.getPlayer(source.getControllerId()); | ||
if (controller != null) { | ||
int amount = controller.rollDice(game, 20); | ||
if (amount == 1) { | ||
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), true)); | ||
} | ||
else if (amount >= 12) { | ||
controller.drawCards(1, game); | ||
} | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
|
||
class DungeonMasterAdventuringPartyEffect extends OneShotEffect { | ||
|
||
public DungeonMasterAdventuringPartyEffect() { | ||
super(Outcome.PutCreatureInPlay); | ||
this.staticText = "You get an adventuring party. (Your party is a 3/3 red Fighter with first strike, a 1/1 white Cleric with lifelink, a 2/2 black Rogue with hexproof, and a 1/1 blue Wizard with flying.)"; | ||
} | ||
|
||
public DungeonMasterAdventuringPartyEffect(final DungeonMasterAdventuringPartyEffect effect) { | ||
super(effect); | ||
} | ||
|
||
@Override | ||
public DungeonMasterAdventuringPartyEffect copy() { | ||
return new DungeonMasterAdventuringPartyEffect(this); | ||
} | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
Player controller = game.getPlayer(source.getControllerId()); | ||
if (controller != null) { | ||
CreateTokenEffect effect = new CreateTokenEffect(new FighterToken(), 1); | ||
effect.apply(game, source); | ||
CreateTokenEffect effect1 = new CreateTokenEffect(new ClericToken(), 1); | ||
effect1.apply(game,source); | ||
CreateTokenEffect effect2 = new CreateTokenEffect(new RogueToken(), 1); | ||
effect2.apply(game, source); | ||
CreateTokenEffect effect3 = new CreateTokenEffect(new WizardToken2(), 1); | ||
effect3.apply(game, source); | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
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,100 @@ | ||
package mage.cards.n; | ||
|
||
import mage.MageInt; | ||
import mage.abilities.Ability; | ||
import mage.abilities.common.EntersBattlefieldAbility; | ||
import mage.abilities.effects.ReplacementEffectImpl; | ||
import mage.abilities.keyword.FlashAbility; | ||
import mage.abilities.keyword.FlyingAbility; | ||
import mage.abilities.keyword.HasteAbility; | ||
import mage.abilities.keyword.TrampleAbility; | ||
import mage.cards.CardImpl; | ||
import mage.cards.CardSetInfo; | ||
import mage.constants.*; | ||
import mage.game.Game; | ||
import mage.game.events.GameEvent; | ||
import mage.players.Player; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* @author jmharmon | ||
*/ | ||
|
||
public final class NiraHellkiteDuelist extends CardImpl { | ||
|
||
public NiraHellkiteDuelist(UUID ownerId, CardSetInfo setInfo) { | ||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}{R}{G}"); | ||
|
||
this.addSuperType(SuperType.LEGENDARY); | ||
this.subtype.add(SubType.DRAGON); | ||
|
||
this.power = new MageInt(6); | ||
this.toughness = new MageInt(6); | ||
|
||
// Flash | ||
this.addAbility(FlashAbility.getInstance()); | ||
|
||
// Flying, trample, haste | ||
this.addAbility(FlyingAbility.getInstance()); | ||
this.addAbility(TrampleAbility.getInstance()); | ||
this.addAbility(HasteAbility.getInstance()); | ||
|
||
// When Nira, Hellkite Duelist enters the battlefield, the next time you would lose the game this turn, instead draw three cards and your life total becomes 5. | ||
this.addAbility(new EntersBattlefieldAbility(new NiraHellkiteDuelistEffect(), false)); | ||
} | ||
|
||
public NiraHellkiteDuelist(final NiraHellkiteDuelist card) { | ||
super(card); | ||
} | ||
|
||
@Override | ||
public NiraHellkiteDuelist copy() { | ||
return new NiraHellkiteDuelist(this); | ||
} | ||
} | ||
|
||
class NiraHellkiteDuelistEffect extends ReplacementEffectImpl { | ||
|
||
public NiraHellkiteDuelistEffect() { | ||
super(Duration.EndOfTurn, Outcome.Benefit); | ||
staticText = "the next time you would lose the game this turn, instead draw three cards and your life total becomes 5"; | ||
} | ||
|
||
public NiraHellkiteDuelistEffect(final NiraHellkiteDuelistEffect effect) { | ||
super(effect); | ||
} | ||
|
||
@Override | ||
public NiraHellkiteDuelistEffect copy() { | ||
return new NiraHellkiteDuelistEffect(this); | ||
} | ||
|
||
@Override | ||
public boolean apply(Game game, Ability source) { | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean replaceEvent(GameEvent event, Ability source, Game game) { | ||
Player player = game.getPlayer(event.getPlayerId()); | ||
if (player != null) { | ||
player.drawCards(3, game); | ||
player.setLife(5, game, source); | ||
} | ||
return true; | ||
} | ||
|
||
@Override | ||
public boolean checksEventType(GameEvent event, Game game) { | ||
return event.getType() == GameEvent.EventType.LOSES; | ||
} | ||
|
||
@Override | ||
public boolean applies(GameEvent event, Ability source, Game game) { | ||
if (event.getPlayerId().equals(source.getControllerId())) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
Mage/src/main/java/mage/game/permanent/token/ClericToken.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.permanent.token; | ||
|
||
import mage.MageInt; | ||
import mage.abilities.keyword.LifelinkAbility; | ||
import mage.constants.CardType; | ||
import mage.constants.SubType; | ||
|
||
/** | ||
* @author jmharmon | ||
*/ | ||
|
||
public final class ClericToken extends TokenImpl { | ||
|
||
public ClericToken() { | ||
super("Cleric", "1/1 white Cleric creature token with lifelink"); | ||
cardType.add(CardType.CREATURE); | ||
color.setWhite(true); | ||
subtype.add(SubType.CLERIC); | ||
power = new MageInt(1); | ||
toughness = new MageInt(1); | ||
addAbility(LifelinkAbility.getInstance()); | ||
} | ||
|
||
public ClericToken(final ClericToken token) { | ||
super(token); | ||
} | ||
|
||
public ClericToken copy() { | ||
return new ClericToken(this); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Mage/src/main/java/mage/game/permanent/token/FighterToken.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.permanent.token; | ||
|
||
import mage.MageInt; | ||
import mage.abilities.keyword.FirstStrikeAbility; | ||
import mage.constants.CardType; | ||
import mage.constants.SubType; | ||
|
||
/** | ||
* @author jmharmon | ||
*/ | ||
|
||
public final class FighterToken extends TokenImpl { | ||
|
||
public FighterToken(){ | ||
super("Fighter", "3/3 red Fighter creature token with first strike"); | ||
cardType.add(CardType.CREATURE); | ||
color.setRed(true); | ||
subtype.add(SubType.FIGHTER); | ||
power = new MageInt(3); | ||
toughness = new MageInt(3); | ||
addAbility(FirstStrikeAbility.getInstance()); | ||
} | ||
|
||
public FighterToken(final FighterToken token) { | ||
super(token); | ||
} | ||
|
||
public FighterToken copy() { | ||
return new FighterToken(this); | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
Mage/src/main/java/mage/game/permanent/token/RogueToken.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.permanent.token; | ||
|
||
import mage.MageInt; | ||
import mage.abilities.keyword.HexproofAbility; | ||
import mage.constants.CardType; | ||
import mage.constants.SubType; | ||
|
||
/** | ||
* @author jmharmon | ||
*/ | ||
|
||
public final class RogueToken extends TokenImpl { | ||
|
||
public RogueToken() { | ||
super("Rogue", "2/2 black Rogue creature token with hexproof"); | ||
cardType.add(CardType.CREATURE); | ||
color.setBlack(true); | ||
subtype.add(SubType.ROGUE); | ||
power = new MageInt(2); | ||
toughness = new MageInt(2); | ||
addAbility(HexproofAbility.getInstance()); | ||
} | ||
|
||
public RogueToken(final RogueToken token) { | ||
super(token); | ||
} | ||
|
||
public RogueToken copy() { | ||
return new RogueToken(this); | ||
} | ||
} |
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.
Use xmage's
RandomUtil.nextInt()
, not java