Merge branch 'master' of https://git.cardforge.org/core-developers/forge into ui-card-translation

This commit is contained in:
Peter
2019-08-15 08:06:37 +02:00
4 changed files with 16 additions and 9 deletions

View File

@@ -941,6 +941,10 @@ public class PlayerControllerAi extends PlayerController {
final Card source = sa.getHostCard();
final Ability emptyAbility = new AbilityStatic(source, cost, sa.getTargetRestrictions()) { @Override public void resolve() { } };
emptyAbility.setActivatingPlayer(player);
emptyAbility.setTriggeringObjects(sa.getTriggeringObjects());
for (String sVar : sa.getSVars()) {
emptyAbility.setSVar(sVar, sa.getSVar(sVar));
}
if (ComputerUtilCost.willPayUnlessCost(sa, player, cost, alreadyPaid, allPayers) && ComputerUtilCost.canPayCost(emptyAbility, player)) {
ComputerUtil.playNoStack(player, emptyAbility, game); // AI needs something to resolve to pay that cost
return true;

View File

@@ -17,6 +17,7 @@
*/
package forge.game.cost;
import forge.game.ability.AbilityUtils;
import forge.game.card.Card;
import forge.game.card.CardCollectionView;
import forge.game.card.CardLists;
@@ -95,7 +96,10 @@ public class CostSacrifice extends CostPartWithList {
CardCollectionView typeList = activator.getCardsIn(ZoneType.Battlefield);
typeList = CardLists.getValidCards(typeList, this.getType().split(";"), activator, source, ability);
final Integer amount = this.convertAmount();
Integer amount = this.convertAmount();
if (amount == null) {
amount = AbilityUtils.calculateAmount(source, getAmount(), ability);
}
typeList = CardLists.filter(typeList, CardPredicates.canBeSacrificedBy(ability));

View File

@@ -3,10 +3,8 @@ ManaCost:5 B B
Types:Creature Demon
PT:6/6
K:Flying
T:Mode$ DamageDone | ValidSource$ Card.OppCtrl | ValidTarget$ Card.Self | TriggerZones$ Battlefield | Execute$ TrigSacrifice | TriggerDescription$ Whenever a source an opponent controls deals damage to CARDNAME, that sources controller loses that much life unless they sacrifice that many permanents.
SVar:TrigSacrifice:DB$ Sacrifice | Defined$ TriggeredSourceController | SacValid$ Permanent | Amount$ X | References$ X | StrictAmount$ True | OptionalSacrifice$ True | RememberSacrificed$ True | SubAbility$ DBCurseDamage
SVar:DBCurseDamage:DB$ DealDamage | Defined$ TriggeredSourceController | NumDmg$ X | References$ X | ConditionDefined$ Remembered | ConditionPresent$ Card | ConditionCompare$ EQ0 | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True
T:Mode$ DamageDone | ValidSource$ Card.OppCtrl | ValidTarget$ Card.Self | TriggerZones$ Battlefield | Execute$ DBLoseLife | TriggerDescription$ Whenever a source an opponent controls deals damage to CARDNAME, that sources controller loses that much life unless they sacrifice that many permanents.
SVar:DBLoseLife:DB$ LoseLife | Defined$ TriggeredSourceController | LifeAmount$ X | References$ X | UnlessCost$ Sac<X/Permanent> | UnlessPayer$ TriggeredSourceController
SVar:X:TriggerCount$DamageAmount
K:Madness:3 B B
Oracle:Flying\nWhenever a source an opponent controls deals damage to Archfiend of Spite, that sources controller loses that much life unless they sacrifice that many permanents.\nMadness {3}{B}{B} (If you discard this card, discard it into exile. When you do, cast it for its madness cost or put it into your graveyard.)

View File

@@ -569,10 +569,11 @@ public class HumanPlay {
return true;
}
else if (part instanceof CostSacrifice) {
int amount = Integer.parseInt(((CostSacrifice)part).getAmount());
CardCollectionView list = CardLists.getValidCards(p.getCardsIn(ZoneType.Battlefield), part.getType().split(";"), p, source, sourceAbility);
boolean hasPaid = payCostPart(controller, sourceAbility, (CostPartWithList)part, amount, list, "sacrifice." + orString);
if (!hasPaid) { return false; }
PaymentDecision pd = part.accept(hcd);
if (pd == null)
return false;
else
part.payAsDecided(p, pd, sourceAbility);
}
else if (part instanceof CostGainControl) {
int amount = Integer.parseInt(((CostGainControl)part).getAmount());