Trigger RollDie and RollDieOnce for planar die too

This commit is contained in:
Lyu Zong-Hong
2021-07-13 21:58:52 +09:00
parent 4598c67578
commit cd05a8ffe1

View File

@@ -1,5 +1,6 @@
package forge.game;
import java.util.Arrays;
import java.util.Map;
import com.google.common.collect.ImmutableList;
@@ -8,7 +9,7 @@ import forge.game.ability.AbilityKey;
import forge.game.player.Player;
import forge.game.trigger.TriggerType;
/**
/**
* Represents the planar dice for Planechase games.
*
*/
@@ -16,7 +17,7 @@ public enum PlanarDice {
Planeswalk,
Chaos,
Blank;
public static PlanarDice roll(Player roller, PlanarDice riggedResult)
{
PlanarDice res = Blank;
@@ -27,25 +28,37 @@ public enum PlanarDice {
res = Planeswalk;
else if (i == 1)
res = Chaos;
PlanarDice trigRes = res;
if(roller.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.blankIsChaos)
&& res == Blank)
{
trigRes = Chaos;
}
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
runParams.put(AbilityKey.Result, trigRes);
roller.getGame().getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams,false);
// Also run normal RolledDie and RolledDieOnce triggers
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
runParams.put(AbilityKey.Sides, 6);
runParams.put(AbilityKey.Result, 0);
roller.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDie, runParams, false);
runParams = AbilityKey.newMap();
runParams.put(AbilityKey.Player, roller);
runParams.put(AbilityKey.Sides, 6);
runParams.put(AbilityKey.Result, Arrays.asList(0));
roller.getGame().getTriggerHandler().runTrigger(TriggerType.RolledDieOnce, runParams, false);
return res;
}
/**
* Parses a string into an enum member.
* @param string to parse