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

Method clearTopLibsCast

forge-game/src/main/java/forge/game/Game.java:1363–1384  ·  view source on GitHub ↗
(SpellAbility sa)

Source from the content-addressed store, hash-verified

1361 }
1362 }
1363 public void clearTopLibsCast(SpellAbility sa) {
1364 // if nothing left to pay
1365 if (sa.getActivatingPlayer().getPaidForSA() == null) {
1366 topLibsCast.clear();
1367 for (Card c : facedownWhileCasting.keySet()) {
1368 // maybe it was discarded as payment?
1369 if (c.isInZone(ZoneType.Hand)) {
1370 c.forceTurnFaceUp();
1371
1372 // If an effect allows or instructs a player to reveal the card as it’s being drawn,
1373 // it’s revealed after the spell becomes cast or the ability becomes activated.
1374 final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
1375 runParams.put(AbilityKey.Number, facedownWhileCasting.get(c));
1376 runParams.put(AbilityKey.Player, c.getOwner());
1377 runParams.put(AbilityKey.CanReveal, true);
1378 // need to hold trigger to clear list first
1379 getTriggerHandler().runTrigger(TriggerType.Drawn, runParams, true);
1380 }
1381 }
1382 facedownWhileCasting.clear();
1383 }
1384 }
1385 public void addFacedownWhileCasting(Card c, int numDrawn) {
1386 facedownWhileCasting.put(c, numDrawn);
1387 }

Callers 1

playAbilityMethod · 0.95

Calls 11

mapFromCardMethod · 0.95
getTriggerHandlerMethod · 0.95
getPaidForSAMethod · 0.80
forceTurnFaceUpMethod · 0.80
runTriggerMethod · 0.80
getMethod · 0.65
getOwnerMethod · 0.65
getActivatingPlayerMethod · 0.45
clearMethod · 0.45
isInZoneMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected