mirror of
https://github.com/correl/mage.git
synced 2025-04-10 09:11:04 -09:00
[AFR] Implemented Djinni Windseeker
This commit is contained in:
parent
50336a0718
commit
41cbb7580a
4 changed files with 176 additions and 0 deletions
Mage.Sets/src/mage
Mage/src/main/java/mage/abilities/effects/common
Utils
52
Mage.Sets/src/mage/cards/d/DjinniWindseeker.java
Normal file
52
Mage.Sets/src/mage/cards/d/DjinniWindseeker.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
package mage.cards.d;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.RollDieWithResultTableEffect;
|
||||||
|
import mage.abilities.effects.keyword.ScryEffect;
|
||||||
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.SubType;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class DjinniWindseeker extends CardImpl {
|
||||||
|
|
||||||
|
public DjinniWindseeker(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||||
|
|
||||||
|
this.subtype.add(SubType.DJINN);
|
||||||
|
this.power = new MageInt(3);
|
||||||
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// Flying
|
||||||
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// When Djinni Windseeker enters the battlefield, roll a d20.
|
||||||
|
RollDieWithResultTableEffect effect = new RollDieWithResultTableEffect();
|
||||||
|
this.addAbility(new EntersBattlefieldTriggeredAbility(effect));
|
||||||
|
|
||||||
|
// 1-9 | Scry 1.
|
||||||
|
effect.addTableEntry(1, 9, new ScryEffect(1, false));
|
||||||
|
|
||||||
|
// 10-19 | Scry 2.
|
||||||
|
effect.addTableEntry(10, 19, new ScryEffect(2, false));
|
||||||
|
|
||||||
|
// 20 | Scry 3.
|
||||||
|
effect.addTableEntry(20, 20, new ScryEffect(3, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
private DjinniWindseeker(final DjinniWindseeker card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DjinniWindseeker copy() {
|
||||||
|
return new DjinniWindseeker(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,6 +47,7 @@ public final class AdventuresInTheForgottenRealms extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Den of the Bugbear", 254, Rarity.RARE, mage.cards.d.DenOfTheBugbear.class));
|
cards.add(new SetCardInfo("Den of the Bugbear", 254, Rarity.RARE, mage.cards.d.DenOfTheBugbear.class));
|
||||||
cards.add(new SetCardInfo("Devoted Paladin", 11, Rarity.COMMON, mage.cards.d.DevotedPaladin.class));
|
cards.add(new SetCardInfo("Devoted Paladin", 11, Rarity.COMMON, mage.cards.d.DevotedPaladin.class));
|
||||||
cards.add(new SetCardInfo("Displacer Beast", 54, Rarity.UNCOMMON, mage.cards.d.DisplacerBeast.class));
|
cards.add(new SetCardInfo("Displacer Beast", 54, Rarity.UNCOMMON, mage.cards.d.DisplacerBeast.class));
|
||||||
|
cards.add(new SetCardInfo("Djinni Windseeker", 55, Rarity.COMMON, mage.cards.d.DjinniWindseeker.class));
|
||||||
cards.add(new SetCardInfo("Dragon Turtle", 56, Rarity.RARE, mage.cards.d.DragonTurtle.class));
|
cards.add(new SetCardInfo("Dragon Turtle", 56, Rarity.RARE, mage.cards.d.DragonTurtle.class));
|
||||||
cards.add(new SetCardInfo("Drizzt Do'Urden", 220, Rarity.RARE, mage.cards.d.DrizztDoUrden.class));
|
cards.add(new SetCardInfo("Drizzt Do'Urden", 220, Rarity.RARE, mage.cards.d.DrizztDoUrden.class));
|
||||||
cards.add(new SetCardInfo("Dueling Rapier", 140, Rarity.COMMON, mage.cards.d.DuelingRapier.class));
|
cards.add(new SetCardInfo("Dueling Rapier", 140, Rarity.COMMON, mage.cards.d.DuelingRapier.class));
|
||||||
|
|
|
@ -0,0 +1,122 @@
|
||||||
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.Effects;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public class RollDieWithResultTableEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
private final int sides;
|
||||||
|
private final List<TableEntry> resultsTable = new ArrayList<>();
|
||||||
|
|
||||||
|
public RollDieWithResultTableEffect() {
|
||||||
|
this(20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RollDieWithResultTableEffect(int sides) {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.sides = sides;
|
||||||
|
}
|
||||||
|
|
||||||
|
private RollDieWithResultTableEffect(final RollDieWithResultTableEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.sides = effect.sides;
|
||||||
|
for (TableEntry tableEntry : effect.resultsTable) {
|
||||||
|
this.resultsTable.add(tableEntry.copy());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public RollDieWithResultTableEffect copy() {
|
||||||
|
return new RollDieWithResultTableEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
if (player == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int result = player.rollDice(source, game, sides);
|
||||||
|
for (TableEntry tableEntry : this.resultsTable) {
|
||||||
|
if (tableEntry.matches(result)) {
|
||||||
|
tableEntry.apply(game, source);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getText(Mode mode) {
|
||||||
|
StringBuilder sb = new StringBuilder("roll a d").append(sides).append('.');
|
||||||
|
for (TableEntry tableEntry : this.resultsTable) {
|
||||||
|
sb.append("<br>");
|
||||||
|
if (tableEntry.min == tableEntry.max) {
|
||||||
|
sb.append(tableEntry.max);
|
||||||
|
sb.append(' ');
|
||||||
|
} else {
|
||||||
|
sb.append(tableEntry.min);
|
||||||
|
sb.append('-');
|
||||||
|
sb.append(tableEntry.max);
|
||||||
|
sb.append(" | ");
|
||||||
|
}
|
||||||
|
sb.append(CardUtil.getTextWithFirstCharUpperCase(tableEntry.effects.getText(mode)));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final class TableEntry {
|
||||||
|
private final int min;
|
||||||
|
private final int max;
|
||||||
|
private final Effects effects;
|
||||||
|
|
||||||
|
private TableEntry(int min, int max, Effect... effects) {
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
this.effects = new Effects(effects);
|
||||||
|
}
|
||||||
|
|
||||||
|
private TableEntry(final TableEntry tableEntry) {
|
||||||
|
this.min = tableEntry.min;
|
||||||
|
this.max = tableEntry.max;
|
||||||
|
this.effects = tableEntry.effects.copy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private TableEntry copy() {
|
||||||
|
return new TableEntry(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean matches(int result) {
|
||||||
|
return result >= min && result <= max;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void apply(Game game, Ability source) {
|
||||||
|
for (Effect effect : effects) {
|
||||||
|
if (effect instanceof OneShotEffect) {
|
||||||
|
effect.apply(game, source);
|
||||||
|
} else if (effect instanceof ContinuousEffect) {
|
||||||
|
game.addEffect(((ContinuousEffect) effect), source);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTableEntry(int min, int max, Effect... effects) {
|
||||||
|
this.resultsTable.add(new TableEntry(min, max, effects));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -218,6 +218,7 @@ my $strong = "<strong>";
|
||||||
$cardAbilities =~ s/$strong/$empty/g;
|
$cardAbilities =~ s/$strong/$empty/g;
|
||||||
$strong = "</strong>";
|
$strong = "</strong>";
|
||||||
$cardAbilities =~ s/$strong/$empty/g;
|
$cardAbilities =~ s/$strong/$empty/g;
|
||||||
|
$cardAbilities =~ s/\&/\|/g;
|
||||||
|
|
||||||
my @abilities = split('\$', $cardAbilities);
|
my @abilities = split('\$', $cardAbilities);
|
||||||
foreach my $ability (@abilities) {
|
foreach my $ability (@abilities) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue