MCPcopy Create free account
hub / github.com/Card-Forge/forge / mill

Method mill

forge-game/src/main/java/forge/game/GameAction.java:2660–2693  ·  view source on GitHub ↗
(final PlayerCollection millers, final int numCards, final ZoneType destination, final SpellAbility sa, final Map<AbilityKey, Object> moveParams)

Source from the content-addressed store, hash-verified

2658 }
2659
2660 public CardCollection mill(final PlayerCollection millers, final int numCards, final ZoneType destination, final SpellAbility sa, final Map<AbilityKey, Object> moveParams) {
2661 final boolean showRevealDialog = sa != null && sa.hasParam("ShowMilledCards");
2662
2663 final CardCollection milled = new CardCollection();
2664
2665 for (final Player p : millers) {
2666 if (!p.isInGame()) {
2667 continue;
2668 }
2669
2670 final CardCollectionView milledPlayer = p.mill(numCards, destination, sa, moveParams);
2671 milled.addAll(milledPlayer);
2672
2673 // Reveal the milled cards, so players don't have to manually inspect the
2674 // graveyard to figure out which ones were milled.
2675 String toZoneStr = destination.equals(ZoneType.Graveyard) ? "" : " (" +
2676 Localizer.getInstance().getMessage("lblMilledToZone", destination.getTranslatedName()) + ")";
2677 if (showRevealDialog) {
2678 final String message = Localizer.getInstance().getMessage("lblMilledCards");
2679 final boolean addSuffix = !toZoneStr.isEmpty();
2680 reveal(milledPlayer, destination, p, false, message, addSuffix);
2681 }
2682 game.fireEvent(new GameEventAddLog(GameLogEntryType.ZONE_CHANGE, p + " milled " +
2683 Lang.joinHomogenous(milledPlayer) + toZoneStr + "."));
2684 }
2685
2686 if (!milled.isEmpty()) {
2687 final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
2688 runParams.put(AbilityKey.Cards, milled);
2689 game.getTriggerHandler().runTrigger(TriggerType.MilledAll, runParams, false);
2690 }
2691
2692 return milled;
2693 }
2694
2695 public void dealDamage(final boolean isCombat, final CardDamageTable damageMap, final CardDamageTable preventMap,
2696 final GameEntityCounterTable counterTable, final SpellAbility cause) {

Callers

nothing calls this directly

Calls 15

getInstanceMethod · 0.95
revealMethod · 0.95
joinHomogenousMethod · 0.95
newMapMethod · 0.95
runTriggerMethod · 0.80
getTriggerHandlerMethod · 0.80
getTranslatedNameMethod · 0.65
isEmptyMethod · 0.65
hasParamMethod · 0.45
isInGameMethod · 0.45
addAllMethod · 0.45
equalsMethod · 0.45

Tested by

no test coverage detected