mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-13 01:08:06 +00:00
Trigger RollDie and RollDieOnce for planar die too
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package forge.game;
|
package forge.game;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@@ -8,7 +9,7 @@ import forge.game.ability.AbilityKey;
|
|||||||
import forge.game.player.Player;
|
import forge.game.player.Player;
|
||||||
import forge.game.trigger.TriggerType;
|
import forge.game.trigger.TriggerType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the planar dice for Planechase games.
|
* Represents the planar dice for Planechase games.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -16,7 +17,7 @@ public enum PlanarDice {
|
|||||||
Planeswalk,
|
Planeswalk,
|
||||||
Chaos,
|
Chaos,
|
||||||
Blank;
|
Blank;
|
||||||
|
|
||||||
public static PlanarDice roll(Player roller, PlanarDice riggedResult)
|
public static PlanarDice roll(Player roller, PlanarDice riggedResult)
|
||||||
{
|
{
|
||||||
PlanarDice res = Blank;
|
PlanarDice res = Blank;
|
||||||
@@ -27,25 +28,37 @@ public enum PlanarDice {
|
|||||||
res = Planeswalk;
|
res = Planeswalk;
|
||||||
else if (i == 1)
|
else if (i == 1)
|
||||||
res = Chaos;
|
res = Chaos;
|
||||||
|
|
||||||
|
|
||||||
PlanarDice trigRes = res;
|
PlanarDice trigRes = res;
|
||||||
|
|
||||||
if(roller.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.blankIsChaos)
|
if(roller.getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.blankIsChaos)
|
||||||
&& res == Blank)
|
&& res == Blank)
|
||||||
{
|
{
|
||||||
trigRes = Chaos;
|
trigRes = Chaos;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||||
runParams.put(AbilityKey.Player, roller);
|
runParams.put(AbilityKey.Player, roller);
|
||||||
runParams.put(AbilityKey.Result, trigRes);
|
runParams.put(AbilityKey.Result, trigRes);
|
||||||
roller.getGame().getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams,false);
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a string into an enum member.
|
* Parses a string into an enum member.
|
||||||
* @param string to parse
|
* @param string to parse
|
||||||
|
|||||||
Reference in New Issue
Block a user