mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Improve payment test on hybrid shards (#2562)
* Improve payment test on hybrid shards * Clean up --------- Co-authored-by: tool4EvEr <tool4EvEr@192.168.0.59>
This commit is contained in:
@@ -688,10 +688,6 @@ public class ComputerUtilMana {
|
|||||||
ListMultimap<ManaCostShard, SpellAbility> sourcesForShards = getSourcesForShards(cost, sa, ai, test,
|
ListMultimap<ManaCostShard, SpellAbility> sourcesForShards = getSourcesForShards(cost, sa, ai, test,
|
||||||
checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType);
|
checkPlayable, manaSpentToPay, hasConverge, ignoreColor, ignoreType);
|
||||||
|
|
||||||
if (sourcesForShards == null && !purePhyrexian) {
|
|
||||||
return false; // no mana abilities to use for paying
|
|
||||||
}
|
|
||||||
|
|
||||||
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
int testEnergyPool = ai.getCounters(CounterEnumType.ENERGY);
|
||||||
final ManaPool manapool = ai.getManaPool();
|
final ManaPool manapool = ai.getManaPool();
|
||||||
ManaCostShard toPay = null;
|
ManaCostShard toPay = null;
|
||||||
@@ -712,7 +708,7 @@ public class ComputerUtilMana {
|
|||||||
manapool.applyCardMatrix(pay);
|
manapool.applyCardMatrix(pay);
|
||||||
|
|
||||||
for (byte color : ManaAtom.MANATYPES) {
|
for (byte color : ManaAtom.MANATYPES) {
|
||||||
if (manapool.tryPayCostWithColor(color, sa, cost)) {
|
if (manapool.tryPayCostWithColor(color, sa, cost, manaSpentToPay)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -724,6 +720,11 @@ public class ComputerUtilMana {
|
|||||||
if (cost.isPaid()) {
|
if (cost.isPaid()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourcesForShards == null && !purePhyrexian) {
|
||||||
|
return false; // no mana abilities to use for paying
|
||||||
|
}
|
||||||
|
|
||||||
toPay = getNextShardToPay(cost);
|
toPay = getNextShardToPay(cost);
|
||||||
|
|
||||||
boolean lifeInsteadOfBlack = toPay.isBlack() && ai.hasKeyword("PayLifeInsteadOf:B");
|
boolean lifeInsteadOfBlack = toPay.isBlack() && ai.hasKeyword("PayLifeInsteadOf:B");
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost) {
|
public boolean tryPayCostWithColor(byte colorCode, SpellAbility saPaidFor, ManaCostBeingPaid manaCost, List<Mana> manaSpentToPay) {
|
||||||
Mana manaFound = null;
|
Mana manaFound = null;
|
||||||
String restriction = manaCost.getSourceRestriction();
|
String restriction = manaCost.getSourceRestriction();
|
||||||
Collection<Mana> cm = floatingMana.get(colorCode);
|
Collection<Mana> cm = floatingMana.get(colorCode);
|
||||||
@@ -231,7 +231,7 @@ public class ManaPool extends ManaConversionMatrix implements Iterable<Mana> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (manaFound != null && tryPayCostWithMana(saPaidFor, manaCost, manaFound, false)) {
|
if (manaFound != null && tryPayCostWithMana(saPaidFor, manaCost, manaFound, false)) {
|
||||||
saPaidFor.getPayingMana().add(0, manaFound);
|
manaSpentToPay.add(0, manaFound);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -5,10 +5,8 @@ PT:3/4
|
|||||||
K:Vigilance
|
K:Vigilance
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield or attacks, exile a card from a graveyard.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ TrigExile | TriggerDescription$ When CARDNAME enters the battlefield or attacks, exile a card from a graveyard.
|
||||||
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | Secondary$ True | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, exile a card from a graveyard.
|
T:Mode$ Attacks | ValidCard$ Card.Self | Execute$ TrigExile | Secondary$ True | TriggerDescription$ Whenever CARDNAME enters the battlefield or attacks, exile a card from a graveyard.
|
||||||
SVar:TrigExile:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | SelectPrompt$ Select a card from a graveyard | Mandatory$ True | Hidden$ True | Imprint$ True | AILogic$ ExilePreference:MostProminentNonLandNonExiledOwnType
|
SVar:TrigExile:DB$ ChangeZone | Origin$ Graveyard | Destination$ Exile | ChangeType$ Card | ChangeNum$ 1 | SelectPrompt$ Select a card from a graveyard | Mandatory$ True | Hidden$ True | AILogic$ ExilePreference:MostProminentNonLandNonExiledOwnType
|
||||||
S:Mode$ ReduceCost | ValidCard$ Card | Type$ Spell | Amount$ AffectedX | Activator$ You | Description$ Spells you cast cost {1} less to cast for each card type they share with cards exiled with CARDNAME.
|
S:Mode$ ReduceCost | ValidCard$ Card | Type$ Spell | Amount$ AffectedX | Activator$ You | Description$ Spells you cast cost {1} less to cast for each card type they share with cards exiled with CARDNAME.
|
||||||
SVar:AffectedX:Count$TypesSharedWith Imprinted.ExiledWithSource
|
SVar:AffectedX:Count$TypesSharedWith Card.ExiledWithSource
|
||||||
T:Mode$ ChangesZone | Origin$ Battlefield | ValidCard$ Card.Self | Destination$ Any | Execute$ DBCleanup | Static$ True
|
|
||||||
SVar:DBCleanup:DB$ Cleanup | ClearImprinted$ True
|
|
||||||
DeckHints:Ability$Graveyard|Discard
|
DeckHints:Ability$Graveyard|Discard
|
||||||
Oracle:Vigilance\nWhenever Cemetery Prowler enters the battlefield or attacks, exile a card from a graveyard.\nSpells you cast cost {1} less to cast for each card type they share with cards exiled with Cemetery Prowler.
|
Oracle:Vigilance\nWhenever Cemetery Prowler enters the battlefield or attacks, exile a card from a graveyard.\nSpells you cast cost {1} less to cast for each card type they share with cards exiled with Cemetery Prowler.
|
||||||
|
|||||||
@@ -201,7 +201,7 @@ public abstract class InputPayMana extends InputSyncronizedBase {
|
|||||||
|
|
||||||
public void useManaFromPool(byte colorCode) {
|
public void useManaFromPool(byte colorCode) {
|
||||||
// find the matching mana in pool.
|
// find the matching mana in pool.
|
||||||
if (player.getManaPool().tryPayCostWithColor(colorCode, saPaidFor, manaCost)) {
|
if (player.getManaPool().tryPayCostWithColor(colorCode, saPaidFor, manaCost, saPaidFor.getPayingMana())) {
|
||||||
onManaAbilityPaid();
|
onManaAbilityPaid();
|
||||||
showMessage();
|
showMessage();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user