mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
Merge branch 'differentColors' into 'master'
Add Different colors to combo mana See merge request core-developers/forge!1600
This commit is contained in:
@@ -41,6 +41,7 @@ public final class ColorSet implements Comparable<ColorSet>, Iterable<Byte>, Ser
|
|||||||
private static final long serialVersionUID = 794691267379929080L;
|
private static final long serialVersionUID = 794691267379929080L;
|
||||||
|
|
||||||
private final byte myColor;
|
private final byte myColor;
|
||||||
|
public byte getMyColor() { return myColor; }
|
||||||
private final float orderWeight;
|
private final float orderWeight;
|
||||||
|
|
||||||
private static final ColorSet[] cache = new ColorSet[32];
|
private static final ColorSet[] cache = new ColorSet[32];
|
||||||
|
|||||||
@@ -58,7 +58,11 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
if (abMana.isComboMana()) {
|
if (abMana.isComboMana()) {
|
||||||
for (Player p : tgtPlayers) {
|
for (Player p : tgtPlayers) {
|
||||||
int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(card, sa.getParam("Amount"), sa) : 1;
|
int amount = sa.hasParam("Amount") ? AbilityUtils.calculateAmount(card, sa.getParam("Amount"), sa) : 1;
|
||||||
if (tgt == null || p.canBeTargetedBy(sa)) {
|
if (tgt != null && !p.canBeTargetedBy(sa)) {
|
||||||
|
// Illegal target. Skip.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Player activator = sa.getActivatingPlayer();
|
Player activator = sa.getActivatingPlayer();
|
||||||
String express = abMana.getExpressChoice();
|
String express = abMana.getExpressChoice();
|
||||||
String[] colorsProduced = abMana.getComboColors().split(" ");
|
String[] colorsProduced = abMana.getComboColors().split(" ");
|
||||||
@@ -71,25 +75,28 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
} else {
|
} else {
|
||||||
colorOptions = ColorSet.fromNames(MagicColor.Constant.ONLY_COLORS);
|
colorOptions = ColorSet.fromNames(MagicColor.Constant.ONLY_COLORS);
|
||||||
}
|
}
|
||||||
final ColorSet fullOptions = colorOptions;
|
boolean differentChoice = abMana.getOrigProduced().contains("Different");
|
||||||
for (int nMana = 1; nMana <= amount; nMana++) {
|
ColorSet fullOptions = colorOptions;
|
||||||
|
for (int nMana = 0; nMana < amount; nMana++) {
|
||||||
String choice = "";
|
String choice = "";
|
||||||
if (colorsNeeded != null && colorsNeeded.length >= nMana) { // select from express choices if possible
|
if (colorsNeeded != null && colorsNeeded.length > nMana) { // select from express choices if possible
|
||||||
colorOptions = ColorSet
|
colorOptions = ColorSet
|
||||||
.fromMask(fullOptions.getColor() & ManaAtom.fromName(colorsNeeded[nMana - 1]));
|
.fromMask(fullOptions.getColor() & ManaAtom.fromName(colorsNeeded[nMana]));
|
||||||
}
|
}
|
||||||
if (colorOptions.isColorless() && colorsProduced.length > 0) {
|
if (colorOptions.isColorless() && colorsProduced.length > 0) {
|
||||||
// If we just need generic mana, no reason to ask the controller for a choice,
|
// If we just need generic mana, no reason to ask the controller for a choice,
|
||||||
// just use the first possible color.
|
// just use the first possible color.
|
||||||
choice = colorsProduced[0];
|
choice = colorsProduced[differentChoice ? nMana : 0];
|
||||||
} else {
|
} else {
|
||||||
byte chosenColor = activator.getController().chooseColor("Select Mana to Produce", sa, colorOptions);
|
byte chosenColor = activator.getController().chooseColor("Select Mana to Produce", sa, colorOptions);
|
||||||
if (chosenColor == 0)
|
if (chosenColor == 0)
|
||||||
throw new RuntimeException("ManaEffect::resolve() /*combo mana*/ - " + activator + " color mana choice is empty for " + card.getName());
|
throw new RuntimeException("ManaEffect::resolve() /*combo mana*/ - " + activator + " color mana choice is empty for " + card.getName());
|
||||||
|
|
||||||
|
fullOptions = ColorSet.fromMask(fullOptions.getMyColor() - chosenColor);
|
||||||
choice = MagicColor.toShortString(chosenColor);
|
choice = MagicColor.toShortString(chosenColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nMana != 1) {
|
if (nMana > 0) {
|
||||||
choiceString.append(" ");
|
choiceString.append(" ");
|
||||||
}
|
}
|
||||||
choiceString.append(choice);
|
choiceString.append(choice);
|
||||||
@@ -104,10 +111,13 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
abMana.setExpressChoice(choiceString.toString());
|
abMana.setExpressChoice(choiceString.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (abMana.isAnyMana()) {
|
else if (abMana.isAnyMana()) {
|
||||||
for (Player p : tgtPlayers) {
|
for (Player p : tgtPlayers) {
|
||||||
if (tgt == null || p.canBeTargetedBy(sa)) {
|
if (tgt != null && !p.canBeTargetedBy(sa)) {
|
||||||
|
// Illegal target. Skip.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Player act = sa.getActivatingPlayer();
|
Player act = sa.getActivatingPlayer();
|
||||||
// AI color choice is set in ComputerUtils so only human players need to make a choice
|
// AI color choice is set in ComputerUtils so only human players need to make a choice
|
||||||
|
|
||||||
@@ -131,10 +141,13 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
abMana.setExpressChoice(choice);
|
abMana.setExpressChoice(choice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if (abMana.isSpecialMana()) {
|
else if (abMana.isSpecialMana()) {
|
||||||
for (Player p : tgtPlayers) {
|
for (Player p : tgtPlayers) {
|
||||||
if (tgt == null || p.canBeTargetedBy(sa)) {
|
if (tgt != null && !p.canBeTargetedBy(sa)) {
|
||||||
|
// Illegal target. Skip.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
String type = abMana.getOrigProduced().split("Special ")[1];
|
String type = abMana.getOrigProduced().split("Special ")[1];
|
||||||
|
|
||||||
if (type.equals("EnchantedManaCost")) {
|
if (type.equals("EnchantedManaCost")) {
|
||||||
@@ -174,7 +187,6 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (final Player player : tgtPlayers) {
|
for (final Player player : tgtPlayers) {
|
||||||
abMana.produceMana(GameActionUtil.generatedMana(sa), player, sa);
|
abMana.produceMana(GameActionUtil.generatedMana(sa), player, sa);
|
||||||
|
|||||||
@@ -431,58 +431,22 @@ public class AbilityManaPart implements java.io.Serializable {
|
|||||||
return this.lastManaProduced;
|
return this.lastManaProduced;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* isSnow.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
public final boolean isSnow() {
|
public final boolean isSnow() {
|
||||||
return this.getSourceCard().isSnow();
|
return this.getSourceCard().isSnow();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* isAnyMana.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
public boolean isAnyMana() {
|
public boolean isAnyMana() {
|
||||||
return this.getOrigProduced().contains("Any");
|
return this.getOrigProduced().contains("Any");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* isComboMana.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
public boolean isComboMana() {
|
public boolean isComboMana() {
|
||||||
return this.getOrigProduced().contains("Combo");
|
return this.getOrigProduced().contains("Combo");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* isSpecialMana.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
public boolean isSpecialMana() {
|
public boolean isSpecialMana() {
|
||||||
return this.getOrigProduced().contains("Special");
|
return this.getOrigProduced().contains("Special");
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* canProduce.
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @param s
|
|
||||||
* a {@link java.lang.String} object.
|
|
||||||
* @return a boolean.
|
|
||||||
*/
|
|
||||||
public final boolean canProduce(final String s) {
|
public final boolean canProduce(final String s) {
|
||||||
return canProduce(s, null);
|
return canProduce(s, null);
|
||||||
}
|
}
|
||||||
|
|||||||
7
forge-gui/res/cardsfolder/f/firemind_vessel.txt
Normal file
7
forge-gui/res/cardsfolder/f/firemind_vessel.txt
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Name:Firemind Vessel
|
||||||
|
ManaCost:4
|
||||||
|
Types:Artifact
|
||||||
|
K:CARDNAME enters the battlefield tapped.
|
||||||
|
A:AB$ Mana | Cost$ T | Amount$ 2 | Produced$ Combo AnyDifferent | SpellDescription$ Add two mana of different colors.
|
||||||
|
AI:RemoveDeck:All
|
||||||
|
Oracle:Firemind Vessel enters the battlefield tapped.\n{T}: Add two mana of different colors.
|
||||||
9
forge-gui/res/cardsfolder/i/interplanar_beacon.txt
Normal file
9
forge-gui/res/cardsfolder/i/interplanar_beacon.txt
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Name:Interplanar Beacon
|
||||||
|
ManaCost:
|
||||||
|
Types:Land
|
||||||
|
T:Mode$ SpellCast | ValidCard$ Planeswalker | ValidActivatingPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigGainLife | TriggerDescription$ Whenever you cast a planeswalker spell, you gain 1 life.
|
||||||
|
SVar:TrigGainLife:DB$GainLife | Defined$ You | LifeAmount$ 1
|
||||||
|
A:AB$ Mana | Cost$ T | Produced$ C | SpellDescription$ Add {C}.
|
||||||
|
A:AB$ Mana | Cost$ 1 T | Produced$ Combo AnyDifferent | Amount$ 2 | RestrictValid$ Spell.Planeswalker | SpellDescription$ Add two mana of different colors. Spend this mana only to cast planeswalker spells.
|
||||||
|
AI:RemoveDeck:All
|
||||||
|
Oracle:Whenever you cast a planeswalker spell, you gain 1 life.\n{T}: Add {C}.\n{1}, {T}: Add two mana of different colors. Spend this mana only to cast planeswalker spells.
|
||||||
@@ -3,5 +3,6 @@ ManaCost:2
|
|||||||
Types:Artifact
|
Types:Artifact
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME enters the battlefield, draw a card.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigDraw | TriggerDescription$ When CARDNAME enters the battlefield, draw a card.
|
||||||
SVar:TrigDraw:DB$Draw | Defined$ You | NumCards$ 1
|
SVar:TrigDraw:DB$Draw | Defined$ You | NumCards$ 1
|
||||||
A:AB$ Mana | Cost$ 2 T Sac<1/CARDNAME> | Produced$ Any | Amount$ 2 | SpellDescription$ Add two mana of different colors.
|
A:AB$ Mana | Cost$ 2 T Sac<1/CARDNAME> | Produced$ Combo AnyDifferent | Amount$ 2 | SpellDescription$ Add two mana of different colors.
|
||||||
|
AI:RemoveDeck:All
|
||||||
Oracle:When Guild Globe enters the battlefield, draw a card.\n{2}, {T}, Sacrifice Guild Globe: Add two mana of different colors.
|
Oracle:When Guild Globe enters the battlefield, draw a card.\n{2}, {T}, Sacrifice Guild Globe: Add two mana of different colors.
|
||||||
|
|||||||
Reference in New Issue
Block a user