mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 20:28:00 +00:00
- Fixed a miscalculation and related NPE when trying to predict the bonus from Arahbo, Roar of the World.
- Some extra NPE prevention measures in related trigger processing code.
This commit is contained in:
@@ -1308,6 +1308,10 @@ public class ComputerUtilCombat {
|
||||
bonus = bonus.replace("TriggerCount$NumBlockers", "Number$1");
|
||||
} else if (bonus.contains("TriggeredPlayersDefenders$Amount")) { // for Melee
|
||||
bonus = bonus.replace("TriggeredPlayersDefenders$Amount", "Number$1");
|
||||
} else if (bonus.contains("TriggeredAttacker$CardPower")) { // e.g. Arahbo, Roar of the World
|
||||
bonus = bonus.replace("TriggeredAttacker$CardPower", "Number$" + attacker.getNetPower());
|
||||
} else if (bonus.contains("TriggeredAttacker$CardToughness")) { // e.g. Arahbo, Roar of the World
|
||||
bonus = bonus.replace("TriggeredAttacker$CardToughness", "Number$" + attacker.getNetToughness());
|
||||
}
|
||||
power += CardFactoryUtil.xCount(source, bonus);
|
||||
|
||||
|
||||
@@ -824,6 +824,9 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
if (!currentState.getTriggers().isEmpty()) {
|
||||
for (final Trigger t : currentState.getTriggers()) {
|
||||
final SpellAbility sa = t.getTriggeredSA();
|
||||
if (sa == null) {
|
||||
continue;
|
||||
}
|
||||
triggered = sa.hasTriggeringObject(typeIn) ? sa.getTriggeringObject(typeIn) : null;
|
||||
if (triggered != null) {
|
||||
break;
|
||||
|
||||
@@ -656,7 +656,7 @@ public class CardFactoryUtil {
|
||||
* @return a int.
|
||||
*/
|
||||
public static int xCount(final Card c, final String expression) {
|
||||
if (StringUtils.isBlank(expression)) {
|
||||
if (StringUtils.isBlank(expression) || c == null) {
|
||||
return 0;
|
||||
}
|
||||
if (StringUtils.isNumeric(expression)) {
|
||||
|
||||
@@ -5,7 +5,7 @@ PT:5/5
|
||||
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | TriggerZones$ Battlefield | IsPresent$ Card.Self | PresentZone$ Battlefield | Execute$ TrigPump1 | TriggerDescription$ Eminence - At the beginning of combat on your turn, if CARDNAME is in the command zone or on the battlefield, another target Cat you control gets +3/+3 until end of turn.
|
||||
T:Mode$ Phase | Phase$ BeginCombat | ValidPlayer$ You | TriggerZones$ Command | IsPresent$ Card.Self | PresentZone$ Command | Execute$ TrigPump1 | Secondary$ True
|
||||
SVar:TrigPump1:DB$ Pump | ValidTgts$ Creature.Cat+YouCtrl+Other | TgtPrompt$ Select another target Cat you control | NumAtt$ 3 | NumDef$ 3
|
||||
T:Mode$ Attacks | ValidCard$ Creature.Cat+Other+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigPump2 | TriggerDescription$ Whenever another Cat you control attacks, you may pay {1}{G}{W}. If you do, it gains trample and gets +X/+X until end of turn, where X is its power.
|
||||
T:Mode$ Attacks | ValidCard$ Creature.Cat+Other+YouCtrl | TriggerZones$ Battlefield | Execute$ TrigPump2 | References$ X | TriggerDescription$ Whenever another Cat you control attacks, you may pay {1}{G}{W}. If you do, it gains trample and gets +X/+X until end of turn, where X is its power.
|
||||
SVar:TrigPump2:AB$ Pump | Cost$ 1 G W | Defined$ TriggeredAttacker | KW$ Trample | NumAtt$ X | NumDef$ X | References$ X
|
||||
SVar:X:TriggeredAttacker$CardPower
|
||||
SVar:BuffedBy:Cat
|
||||
|
||||
Reference in New Issue
Block a user