Phyrexian mana support. NPH: Mutagenic Growth, Dismember.

This commit is contained in:
magenoxx 2011-05-29 23:12:21 +04:00
parent 3daed99bda
commit 84b79000ff
12 changed files with 267 additions and 15 deletions

View file

@ -28,7 +28,8 @@ public class ManaSymbols {
static public void loadImages() {
String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "3", "4", "5", "6", "7", "8", "9", "B", "BG",
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU", "X" /*, "Y", "Z", "slash"*/};
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
"WP", "UP", "BP", "RP", "GP", "X" /*, "Y", "Z", "slash"*/};
for (String symbol : symbols) {
File file = new File(Constants.RESOURCE_PATH_MANA_LARGE + "/" + symbol + ".jpg");
Rectangle r = new Rectangle(11, 11);

View file

@ -114,6 +114,11 @@ public class FeedbackPanel extends javax.swing.JPanel {
break;
}
this.btnSpecial.setVisible(special);
this.btnSpecial.setText("Special");
if (message.contains("P}")) {
this.btnSpecial.setVisible(true);
this.btnSpecial.setText("Pay 2 life");
}
handleOptions(options);
this.revalidate();
this.repaint();

View file

@ -30,9 +30,10 @@ public class ManaSymbols {
static public void loadImages() {
String[] symbols = new String[]{"0", "1", "10", "11", "12", "15", "16", "2", "3", "4", "5", "6", "7", "8", "9", "B", "BG",
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU", "X", "Y", "Z", "slash"};
"BR", "G", "GU", "GW", "R", "RG", "RW", "S", "T", "U", "UB", "UR", "W", "WB", "WU",
"WP", "UP", "BP", "RP", "GP", "X", "Y", "Z", "slash"};
for (String symbol : symbols) {
File file = new File(Constants.RESOURCE_PATH_MANA_LARGE + "/" + symbol + ".jpg");
File file = new File(Constants.RESOURCE_PATH_MANA_MEDIUM + "/" + symbol + ".jpg");
Rectangle r = new Rectangle(11, 11);
try {
Image image = UI.getImageIcon(file.getAbsolutePath()).getImage();

View file

@ -39,6 +39,8 @@ public class GathererSymbols implements Iterable<DownloadJob> {
"W/U", "U/B", "B/R", "R/G", "G/W", "W/B", "U/R", "B/G", "R/W", "G/U",
"2/W", "2/U", "2/B", "2/R", "2/G",
"WP", "UP", "BP", "RP", "GP",
"X", "S", "T", "Q"};
private static final int minNumeric = 0, maxNumeric = 16;

View file

@ -30,17 +30,10 @@ package mage.player.human;
import java.io.Serializable;
import java.util.List;
import mage.abilities.TriggeredAbilities;
import mage.abilities.TriggeredAbility;
import mage.abilities.effects.ReplacementEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.choices.Choice;
import mage.game.draft.Draft;
import mage.players.*;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import mage.Constants.Outcome;
import mage.Constants.RangeOfInfluence;
import mage.Constants.TargetController;
@ -49,18 +42,28 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbility;
import mage.abilities.SpecialAction;
import mage.abilities.TriggeredAbilities;
import mage.abilities.TriggeredAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.costs.mana.PhyrexianManaCost;
import mage.abilities.costs.mana.VariableManaCost;
import mage.abilities.effects.ReplacementEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.decks.Deck;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.filter.common.FilterCreatureForCombat;
import mage.game.Game;
import mage.game.Table;
import mage.game.draft.Draft;
import mage.game.match.Match;
import mage.game.permanent.Permanent;
import mage.game.tournament.Tournament;
import mage.players.Player;
import mage.players.PlayerImpl;
import mage.target.Target;
import mage.target.TargetAmount;
import mage.target.TargetCard;
@ -351,7 +354,20 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
return false;
} else if (response.getUUID() != null) {
playManaAbilities(game);
}
} else if (response.getString() != null && response.getString().equals("special")) {
if (unpaid instanceof ManaCostsImpl) {
ManaCostsImpl<ManaCost> costs = (ManaCostsImpl<ManaCost>) unpaid;
for (ManaCost cost : costs.getUnpaid()) {
if (cost instanceof PhyrexianManaCost) {
PhyrexianManaCost ph = (PhyrexianManaCost)cost;
if (ph.canPay(null, playerId, game)) {
((PhyrexianManaCost)cost).pay(game, null, playerId, false);
}
break;
}
}
}
}
return true;
}

View file

@ -0,0 +1,63 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author nantuko
*/
public class Dismember extends CardImpl<Dismember> {
public Dismember (UUID ownerId) {
super(ownerId, 57, "Dismember", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{BP}{BP}");
this.expansionSetCode = "NPH";
this.color.setBlack(true);
this.getSpellAbility().addEffect(new BoostTargetEffect(-5, -5, Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public Dismember (final Dismember card) {
super(card);
}
@Override
public Dismember copy() {
return new Dismember(this);
}
}

View file

@ -0,0 +1,62 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.newphyrexia;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author nantuko
*/
public class MutagenicGrowth extends CardImpl<MutagenicGrowth> {
public MutagenicGrowth (UUID ownerId) {
super(ownerId, 116, "Mutagenic Growth", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{GP}");
this.expansionSetCode = "NPH";
this.color.setGreen(true);
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 2, Duration.EndOfTurn));
}
public MutagenicGrowth (final MutagenicGrowth card) {
super(card);
}
@Override
public MutagenicGrowth copy() {
return new MutagenicGrowth(this);
}
}

View file

@ -108,6 +108,7 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
setPaid();
return true;
}
Player player = game.getPlayer(controllerId);
assignPayment(player.getManaPool());
while (!isPaid()) {
@ -226,8 +227,9 @@ public class ManaCostsImpl<T extends ManaCost> extends ArrayList<T> implements M
else {
if (Character.isDigit(symbol.charAt(0))) {
this.add((T)new MonoHybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(2))));
}
else {
} else if (symbol.contains("P")) {
this.add((T)new PhyrexianManaCost(ColoredManaSymbol.lookup(symbol.charAt(0))));
} else {
this.add((T)new HybridManaCost(ColoredManaSymbol.lookup(symbol.charAt(0)), ColoredManaSymbol.lookup(symbol.charAt(2))));
}
}

View file

@ -0,0 +1,87 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.costs.mana;
import java.util.UUID;
import mage.Constants.ColoredManaSymbol;
import mage.abilities.SpecialAction;
import mage.abilities.effects.common.DrawCardAllEffect;
import mage.abilities.effects.common.RemoveSpecialActionEffect;
import mage.game.Game;
import mage.players.ManaPool;
import mage.players.Player;
/**
*
* @author nantuko
*/
public class PhyrexianManaCost extends ColoredManaCost {
public PhyrexianManaCost(ColoredManaSymbol mana) {
super(mana);
}
public PhyrexianManaCost(PhyrexianManaCost manaCost) {
super(manaCost);
}
@Override
public void assignPayment(ManaPool pool) {
if (assignColored(pool, this.mana))
return;
}
@Override
public String getText() {
return "{" + mana.toString() + "P}";
}
@Override
public PhyrexianManaCost getUnpaid() {
return this;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return game.getPlayer(controllerId).getLife() > 2;
}
@Override
public boolean pay(Game game, UUID sourceId, UUID controllerId, boolean noMana) {
this.paid = game.getPlayer(controllerId).loseLife(2, game) == 2;
return paid;
}
@Override
public PhyrexianManaCost copy() {
return new PhyrexianManaCost(this);
}
}

View file

@ -259,6 +259,11 @@ $mana{'Black or Red'} = '{B/R}';
$mana{'Blue or Red'} = '{U/R}';
$mana{'Red or Green'} = '{R/G}';
$mana{'Red or White'} = '{R/W}';
$mana{'Phyrexian Green'} = '{GP}';
$mana{'Phyrexian Red'} = '{RP}';
$mana{'Phyrexian Black'} = '{BP}';
$mana{'Phyrexian Blue'} = '{UP}';
$mana{'Phyrexian White'} = '{WP}';
my %manatocolor;
$manatocolor{'Black'} = " this.color.setBlack(true);";
@ -267,6 +272,11 @@ $manatocolor{'Green'} = " this.color.setGreen(true);";
$manatocolor{'Red'} = " this.color.setRed(true);";
$manatocolor{'White'} = " this.color.setWhite(true);";
$manatocolor{'Red or White'} = " this.color.setWhite(true);\n this.color.setRed(true);";
$manatocolor{'Phyrexian Green'} = " this.color.setGreen(true);";
$manatocolor{'Phyrexian Red'} = " this.color.setRed(true);";
$manatocolor{'Phyrexian Black'} = " this.color.setBlack(true);";
$manatocolor{'Phyrexian Blue'} = " this.color.setBlue(true);";
$manatocolor{'Phyrexian White'} = " this.color.setWhite(true);";
my %cardtypes;
$cardtypes{'Artifact'} = "CardType.ARTIFACT";
@ -357,7 +367,10 @@ foreach my $div (@divs) {
$manacost .= "{" . $m . "}";
} else {
die "unknown manacost: " . $m unless defined $mana{$m};
$manacost .= $mana{$m};
print "$m";
print "$manatocolor{$m}";
$findedcolors .= "\n" . $manatocolor{$m};
}
}