mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
- Fixed AI ignoring mana restrictions (Myr Superion etc.).
This commit is contained in:
@@ -28,10 +28,6 @@ public class ManaEffect extends SpellAbilityEffect {
|
|||||||
final Card card = sa.getSourceCard();
|
final Card card = sa.getSourceCard();
|
||||||
|
|
||||||
AbilityManaPart abMana = sa.getManaPart();
|
AbilityManaPart abMana = sa.getManaPart();
|
||||||
//if (!AbilityFactory.checkConditional(sa)) {
|
|
||||||
// resolveDrawback(sa);
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// Spells are not undoable
|
// Spells are not undoable
|
||||||
sa.setUndoable(sa.isAbility() && sa.isUndoable());
|
sa.setUndoable(sa.isAbility() && sa.isUndoable());
|
||||||
|
|||||||
@@ -138,6 +138,11 @@ public class ComputerUtilMana {
|
|||||||
for (final SpellAbility ma : saList) {
|
for (final SpellAbility ma : saList) {
|
||||||
if(ma.getSourceCard() == sa.getSourceCard())
|
if(ma.getSourceCard() == sa.getSourceCard())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
final String typeRes = cost.getSourceRestriction();
|
||||||
|
if( StringUtils.isNotBlank(typeRes) && !ma.getSourceCard().isType(typeRes))
|
||||||
|
continue;
|
||||||
|
|
||||||
if( canPayShardWithSpellAbility(toPay, ai, ma, sa, checkPlayable || !test ) ) {
|
if( canPayShardWithSpellAbility(toPay, ai, ma, sa, checkPlayable || !test ) ) {
|
||||||
saPayment = ma;
|
saPayment = ma;
|
||||||
break;
|
break;
|
||||||
@@ -461,9 +466,14 @@ public class ComputerUtilMana {
|
|||||||
* @return ManaCost
|
* @return ManaCost
|
||||||
*/
|
*/
|
||||||
private static ManaCostBeingPaid calculateManaCost(final SpellAbility sa, final boolean test, final int extraMana) {
|
private static ManaCostBeingPaid calculateManaCost(final SpellAbility sa, final boolean test, final int extraMana) {
|
||||||
final ManaCost mana = sa.getPayCosts() != null ? sa.getPayCosts().getTotalMana() : ManaCost.NO_COST;
|
Cost payCosts = sa.getPayCosts();
|
||||||
|
final ManaCost mana = payCosts != null ? payCosts.getTotalMana() : ManaCost.NO_COST;
|
||||||
|
|
||||||
ManaCostBeingPaid cost = new ManaCostBeingPaid(mana);
|
String restriction = null;
|
||||||
|
if (payCosts != null && payCosts.getCostMana() != null) {
|
||||||
|
restriction = payCosts.getCostMana().getRestiction();
|
||||||
|
}
|
||||||
|
ManaCostBeingPaid cost = new ManaCostBeingPaid(mana, restriction);
|
||||||
cost.applySpellCostChange(sa);
|
cost.applySpellCostChange(sa);
|
||||||
|
|
||||||
final Card card = sa.getSourceCard();
|
final Card card = sa.getSourceCard();
|
||||||
|
|||||||
Reference in New Issue
Block a user