(Player roller, PlanarDice riggedResult)
| 21 | Blank; |
| 22 | |
| 23 | public static PlanarDice roll(Player roller, PlanarDice riggedResult) { |
| 24 | final Game game = roller.getGame(); |
| 25 | int rolls = 1; |
| 26 | int ignore = 0; |
| 27 | |
| 28 | final Map<AbilityKey, Object> repParams = AbilityKey.mapFromAffected(roller); |
| 29 | repParams.put(AbilityKey.Number, rolls); |
| 30 | repParams.put(AbilityKey.Ignore, ignore); |
| 31 | |
| 32 | switch (game.getReplacementHandler().run(ReplacementType.RollPlanarDice, repParams)) { |
| 33 | case NotReplaced: |
| 34 | break; |
| 35 | case Updated: { |
| 36 | rolls = (int) repParams.get(AbilityKey.Number); |
| 37 | ignore = (int) repParams.get(AbilityKey.Ignore); |
| 38 | break; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | List<PlanarDice> results = Lists.newArrayList(); |
| 43 | for (int r = 0; r < rolls; r++) { |
| 44 | PlanarDice thisRoll = Blank; |
| 45 | int i = forge.util.MyRandom.getRandom().nextInt(6); |
| 46 | roller.roll(); |
| 47 | if (riggedResult != null) |
| 48 | thisRoll = riggedResult; |
| 49 | else if (i == 0) |
| 50 | thisRoll = Planeswalk; |
| 51 | else if (i == 1) |
| 52 | thisRoll = Chaos; |
| 53 | results.add(thisRoll); |
| 54 | } |
| 55 | |
| 56 | for (int ig = 0; ig < ignore; ig++) { |
| 57 | results.remove(roller.getController().choosePDRollToIgnore(results)); |
| 58 | } |
| 59 | PlanarDice res = results.get(0); |
| 60 | |
| 61 | final Map<AbilityKey, Object> resRepParams = AbilityKey.mapFromAffected(roller); |
| 62 | resRepParams.put(AbilityKey.Result, res); |
| 63 | |
| 64 | switch (game.getReplacementHandler().run(ReplacementType.PlanarDiceResult, resRepParams)) { |
| 65 | case NotReplaced: |
| 66 | break; |
| 67 | case Updated: { |
| 68 | res = (PlanarDice) resRepParams.get(AbilityKey.Result); |
| 69 | break; |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | Map<AbilityKey, Object> runParams = AbilityKey.mapFromPlayer(roller); |
| 74 | runParams.put(AbilityKey.Result, res); |
| 75 | game.getTriggerHandler().runTrigger(TriggerType.PlanarDice, runParams, false); |
| 76 | |
| 77 | // Also run normal RolledDie and RolledDieOnce triggers |
| 78 | for (int r = 0; r < rolls; r++) { |
| 79 | runParams = AbilityKey.mapFromPlayer(roller); |
| 80 | runParams.put(AbilityKey.Sides, 6); |
no test coverage detected