mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Myr Superion added (no restrictions imposed on AI)
This commit is contained in:
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -7029,6 +7029,7 @@ res/cardsfolder/m/myr_reservoir.txt -text
|
||||
res/cardsfolder/m/myr_retriever.txt svneol=native#text/plain
|
||||
res/cardsfolder/m/myr_servitor.txt -text
|
||||
res/cardsfolder/m/myr_sire.txt svneol=native#text/plain
|
||||
res/cardsfolder/m/myr_superion.txt -text
|
||||
res/cardsfolder/m/myr_turbine.txt svneol=native#text/plain
|
||||
res/cardsfolder/m/myr_welder.txt -text
|
||||
res/cardsfolder/m/myrsmith.txt svneol=native#text/plain
|
||||
|
||||
@@ -3,6 +3,7 @@ ManaCost:2 G G
|
||||
Types:Creature Lizard
|
||||
Text:(NOTE: "Spend only mana produced by basic lands to cast Imperiosaur." is not implemented.)
|
||||
PT:5/5
|
||||
K:FullCost:Mana<2 G G\Basic>
|
||||
SVar:Picture:http://resources.wizards.com/magic/cards/fut/en-us/card130634.jpg
|
||||
Oracle:Spend only mana produced by basic lands to cast Imperiosaur.
|
||||
SetInfo:FUT Uncommon
|
||||
9
res/cardsfolder/m/myr_superion.txt
Normal file
9
res/cardsfolder/m/myr_superion.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
Name:Myr Superion
|
||||
ManaCost:2
|
||||
Types:Artifact Creature Myr
|
||||
PT:5/6
|
||||
SVar:FullCost:Mana<2\Creature>
|
||||
SVar:RemRandomDeck:True
|
||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/myr_superion.jpg
|
||||
Oracle:Spend only mana produced by creatures to cast Myr Superion.
|
||||
SetInfo:NPH Rare
|
||||
@@ -118,7 +118,7 @@ public class CostPartMana extends CostPart {
|
||||
@Override
|
||||
public final boolean payHuman(final SpellAbility ability, final GameState game) {
|
||||
final Card source = ability.getSourceCard();
|
||||
ManaCostBeingPaid toPay = new ManaCostBeingPaid(getManaToPay());
|
||||
ManaCostBeingPaid toPay = new ManaCostBeingPaid(getManaToPay(), restriction);
|
||||
|
||||
boolean xWasBilled = false;
|
||||
if (this.getAmountOfX() > 0 && !ability.getSVar("X").equals("Count$xPaid")) { // announce X will overwrite whatever was in card script
|
||||
|
||||
@@ -97,6 +97,7 @@ public class ManaCostBeingPaid {
|
||||
private int cntX = 0;
|
||||
private final ArrayList<String> manaNeededToAvoidNegativeEffect = new ArrayList<String>();
|
||||
private final ArrayList<String> manaPaidToAvoidNegativeEffect = new ArrayList<String>();
|
||||
private final String sourceRestriction;
|
||||
|
||||
// manaCost can be like "0", "3", "G", "GW", "10", "3 GW", "10 GW"
|
||||
// or "split hybrid mana" like "2/G 2/G", "2/B 2/B 2/B"
|
||||
@@ -111,12 +112,14 @@ public class ManaCostBeingPaid {
|
||||
* a {@link java.lang.String} object.
|
||||
*/
|
||||
public ManaCostBeingPaid(String sCost) {
|
||||
this("0".equals(sCost) || "C".equals(sCost) || sCost.isEmpty() ? null : new ManaCost(new ManaCostParser(sCost)));
|
||||
this("0".equals(sCost) || "C".equals(sCost) || sCost.isEmpty() ? ManaCost.ZERO : new ManaCost(new ManaCostParser(sCost)));
|
||||
}
|
||||
|
||||
public ManaCostBeingPaid(ManaCost manaCost) {
|
||||
if ( null == manaCost )
|
||||
return;
|
||||
this(manaCost, null);
|
||||
}
|
||||
public ManaCostBeingPaid(ManaCost manaCost, String srcRestriction) {
|
||||
sourceRestriction = srcRestriction;
|
||||
|
||||
for (ManaCostShard shard : manaCost.getShards()) {
|
||||
if (shard == ManaCostShard.X) {
|
||||
@@ -861,4 +864,8 @@ public class ManaCostBeingPaid {
|
||||
|
||||
return usableColors;
|
||||
}
|
||||
|
||||
public String getSourceRestriction() {
|
||||
return sourceRestriction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,11 +52,6 @@ public class ManaPool {
|
||||
|
||||
/** Constant <code>map</code>. */
|
||||
private static final Map<String, Integer> MAP = new HashMap<String, Integer>();
|
||||
|
||||
/** Constant <code>colors="WUBRG"</code>. */
|
||||
public static final String COLORS = "WUBRG";
|
||||
/** Constant <code>mcolors="1WUBRG"</code>. */
|
||||
public static final String M_COLORS = "1WUBRG";
|
||||
private final Player owner;
|
||||
|
||||
/**
|
||||
@@ -228,7 +223,7 @@ public class ManaPool {
|
||||
* a {@link forge.card.spellability.SpellAbility} object.
|
||||
* @return a {@link forge.card.mana.Mana} object.
|
||||
*/
|
||||
private Mana getMana(final String manaStr, final SpellAbility saBeingPaidFor) {
|
||||
private Mana getMana(final String manaStr, final SpellAbility saBeingPaidFor, String restriction) {
|
||||
final ArrayList<Mana> pool = this.floatingMana;
|
||||
|
||||
//System.out.format("ManaStr='%s' ...", manaStr);
|
||||
@@ -249,6 +244,9 @@ public class ManaPool {
|
||||
continue;
|
||||
}
|
||||
|
||||
if( StringUtils.isNotBlank(restriction) && !thisMana.getSourceCard().isType(restriction) )
|
||||
continue;
|
||||
|
||||
// prefer colorless mana to spend
|
||||
int weight = thisMana.isColorless() ? 5 : 0;
|
||||
|
||||
@@ -438,7 +436,7 @@ public class ManaPool {
|
||||
for(String part : splitCost) {
|
||||
int loops = StringUtils.isNumeric(part) ? Integer.parseInt(part) : 1;
|
||||
for(int i = 0; i < loops; i++ ) {
|
||||
final Mana mana = this.getMana(part, saBeingPaidFor);
|
||||
final Mana mana = this.getMana(part, saBeingPaidFor, manaCost.getSourceRestriction());
|
||||
if (mana != null) {
|
||||
manaCost.payMana(mana);
|
||||
manaPaid.add(mana);
|
||||
@@ -466,27 +464,24 @@ public class ManaPool {
|
||||
* a {@link java.lang.String} object.
|
||||
* @return a {@link forge.card.mana.ManaCostBeingPaid} object.
|
||||
*/
|
||||
public final ManaCostBeingPaid payManaFromPool(final SpellAbility saBeingPaidFor, final ManaCostBeingPaid manaCost, final String manaStr) {
|
||||
public final void payManaFromPool(final SpellAbility saBeingPaidFor, final ManaCostBeingPaid manaCost, final String manaStr) {
|
||||
if (manaStr.trim().equals("") || manaCost.isPaid()) {
|
||||
return manaCost;
|
||||
return;
|
||||
}
|
||||
|
||||
final ArrayList<Mana> manaPaid = saBeingPaidFor.getPayingMana();
|
||||
|
||||
// get a mana of this type from floating, bail if none available
|
||||
final Mana mana = this.getMana(manaStr, saBeingPaidFor);
|
||||
final Mana mana = this.getMana(manaStr, saBeingPaidFor, manaCost.getSourceRestriction());
|
||||
if (mana == null) {
|
||||
return manaCost; // no matching mana in the pool
|
||||
return; // no matching mana in the pool
|
||||
}
|
||||
else if (manaCost.isNeeded(mana)) {
|
||||
manaCost.payMana(mana);
|
||||
manaPaid.add(mana);
|
||||
this.removeManaFrom(this.floatingMana, mana);
|
||||
if (mana.addsNoCounterMagic() && saBeingPaidFor.getSourceCard() != null) {
|
||||
saBeingPaidFor.getSourceCard().setCanCounter(false);
|
||||
}
|
||||
manaCost.payMana(mana);
|
||||
saBeingPaidFor.getPayingMana().add(mana);
|
||||
this.removeManaFrom(this.floatingMana, mana);
|
||||
if (mana.addsNoCounterMagic() && saBeingPaidFor.getSourceCard() != null) {
|
||||
saBeingPaidFor.getSourceCard().setCanCounter(false);
|
||||
}
|
||||
}
|
||||
return manaCost;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,6 +3,9 @@ package forge.control.input;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import forge.Card;
|
||||
import forge.CardUtil;
|
||||
import forge.Constant;
|
||||
@@ -54,7 +57,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
}
|
||||
|
||||
public void selectManaPool(String color) {
|
||||
useManaFromPool(color, this.manaCost);
|
||||
useManaFromPool(color);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,6 +116,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
*
|
||||
* @return ManaCost the amount of mana remaining to be paid after the mana is activated
|
||||
*/
|
||||
protected void useManaFromPool(String color) { useManaFromPool(color, manaCost); }
|
||||
protected void useManaFromPool(String color, ManaCostBeingPaid manaCost) {
|
||||
ManaPool mp = player.getManaPool();
|
||||
|
||||
@@ -122,7 +126,7 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
manaStr = CardUtil.getShortColor(color);
|
||||
}
|
||||
|
||||
this.manaCost = mp.payManaFromPool(saPaidFor, manaCost, manaStr);
|
||||
mp.payManaFromPool(saPaidFor, manaCost, manaStr);
|
||||
|
||||
onManaAbilityPlayed(null);
|
||||
showMessage();
|
||||
@@ -147,7 +151,6 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final StringBuilder cneeded = new StringBuilder();
|
||||
final StringBuilder colorRequired = new StringBuilder();
|
||||
boolean choice = true;
|
||||
@@ -166,6 +169,10 @@ public abstract class InputPayManaBase extends InputSyncronizedBase implements I
|
||||
List<SpellAbility> abilities = new ArrayList<SpellAbility>();
|
||||
// you can't remove unneeded abilities inside a for(am:abilities) loop :(
|
||||
|
||||
final String typeRes = manaCost.getSourceRestriction();
|
||||
if( StringUtils.isNotBlank(typeRes) && !card.isType(typeRes))
|
||||
return;
|
||||
|
||||
for (SpellAbility ma : card.getManaAbility()) {
|
||||
ma.setActivatingPlayer(player);
|
||||
AbilityManaPart m = null;
|
||||
|
||||
Reference in New Issue
Block a user