MCPcopy Index your code
hub / github.com/Card-Forge/forge / preparePlayerZone

Method preparePlayerZone

forge-game/src/main/java/forge/game/Match.java:200–218  ·  view source on GitHub ↗
(Player player, final ZoneType zoneType, CardPool section, boolean canRandomFoil)

Source from the content-addressed store, hash-verified

198 }
199
200 private static void preparePlayerZone(Player player, final ZoneType zoneType, CardPool section, boolean canRandomFoil) {
201 PlayerZone library = player.getZone(zoneType);
202 List<Card> newLibrary = new ArrayList<>();
203 for (final Entry<PaperCard, Integer> stackOfCards : section) {
204 final PaperCard cp = stackOfCards.getKey();
205 for (int i = 0; i < stackOfCards.getValue(); i++) {
206 final Card card = Card.fromPaperCard(cp, player);
207
208 // Assign card-specific foiling or random foiling on approximately 1:20 cards if enabled
209 if (cp.isFoil() || (canRandomFoil && MyRandom.percentTrue(5))) {
210 card.setRandomFoil();
211 }
212 card.setCollectible(true);
213
214 newLibrary.add(card);
215 }
216 }
217 library.setCards(newLibrary);
218 }
219
220 private void prepareAllZones(final Game game) {
221 // need this code here, otherwise observables fail

Callers 1

prepareAllZonesMethod · 0.95

Calls 10

fromPaperCardMethod · 0.95
isFoilMethod · 0.95
percentTrueMethod · 0.95
setRandomFoilMethod · 0.95
setCollectibleMethod · 0.95
addMethod · 0.65
getZoneMethod · 0.45
getKeyMethod · 0.45
getValueMethod · 0.45
setCardsMethod · 0.45

Tested by

no test coverage detected