mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Merge branch 'master' of https://git.cardforge.org/core-developers/forge into ui-card-translation
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -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 source’s 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 source’s 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 source’s 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.)
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user