mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +00:00
- The AI will now pay Phyrexian mana with life if it can't be payed otherwise and life is above 8.
This commit is contained in:
@@ -653,13 +653,12 @@ public class ComputerUtil {
|
|||||||
// initialize ArrayList list for mana needed
|
// initialize ArrayList list for mana needed
|
||||||
final ArrayList<ArrayList<AbilityMana>> partSources = new ArrayList<ArrayList<AbilityMana>>();
|
final ArrayList<ArrayList<AbilityMana>> partSources = new ArrayList<ArrayList<AbilityMana>>();
|
||||||
final ArrayList<Integer> partPriority = new ArrayList<Integer>();
|
final ArrayList<Integer> partPriority = new ArrayList<Integer>();
|
||||||
final String[] costParts = cost.toString().replace("X ", "").replace("P", "").split(" ");
|
final String[] costParts = cost.toString().replace("X ", "").split(" ");
|
||||||
Boolean foundAllSources = findManaSources(manaAbilityMap, partSources, partPriority, costParts);
|
Boolean foundAllSources = findManaSources(manaAbilityMap, partSources, partPriority, costParts);
|
||||||
if (!foundAllSources) {
|
if (!foundAllSources) {
|
||||||
if (!test) {
|
if (!test) {
|
||||||
// real payment should not arrive here
|
// real payment should not arrive here
|
||||||
throw new RuntimeException("ComputerUtil : payManaCost() cost was not paid for "
|
throw new RuntimeException("ComputerUtil : payManaCost() cost was not paid for " + sa.getSourceCard());
|
||||||
+ sa.getSourceCard().getName());
|
|
||||||
}
|
}
|
||||||
manapool.clearManaPaid(sa, test); // refund any mana taken from mana pool
|
manapool.clearManaPaid(sa, test); // refund any mana taken from mana pool
|
||||||
return false;
|
return false;
|
||||||
@@ -771,14 +770,22 @@ public class ComputerUtil {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} // end of mana ability loop
|
} // end of mana ability loop
|
||||||
|
|
||||||
if (!costPart.isPaid() || cost.isPaid()) {
|
if (!costPart.isPaid() || cost.isPaid()) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
nPriority++;
|
nPriority++;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end of cost parts loop
|
} // end of cost parts loop
|
||||||
|
|
||||||
|
//check for phyrexian mana
|
||||||
|
if (!cost.isPaid() && cost.containsPhyrexianMana() && AllZone.getComputerPlayer().getLife() > 8) {
|
||||||
|
cost.payPhyrexian();
|
||||||
|
if (!test) {
|
||||||
|
AllZone.getComputerPlayer().payLife(2, sa.getSourceCard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
manapool.clearManaPaid(sa, test);
|
manapool.clearManaPaid(sa, test);
|
||||||
// check if paid
|
// check if paid
|
||||||
if (cost.isPaid()) {
|
if (cost.isPaid()) {
|
||||||
@@ -842,6 +849,14 @@ public class ComputerUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (costParts[nPart].contains("P")) { // Phyrexian
|
||||||
|
String newPart = costParts[nPart].replace("/P", "");
|
||||||
|
if (manaAbilityMap.containsKey(newPart)) {
|
||||||
|
srcFound.addAll(manaAbilityMap.get(newPart));
|
||||||
|
} else if (AllZone.getComputerPlayer().getLife() > 8) { //Pay with life
|
||||||
|
partSources.add(nPart, srcFound);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else if (costParts[nPart].length() > 1) { // Hybrid
|
} else if (costParts[nPart].length() > 1) { // Hybrid
|
||||||
final String firstColor = costParts[nPart].substring(0, 1);
|
final String firstColor = costParts[nPart].substring(0, 1);
|
||||||
final String secondColor = costParts[nPart].substring(2);
|
final String secondColor = costParts[nPart].substring(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user