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

Method saveLKI

forge-game/src/main/java/forge/game/combat/Combat.java:1000–1027  ·  view source on GitHub ↗
(Card lki)

Source from the content-addressed store, hash-verified

998 }
999
1000 public CombatLki saveLKI(Card lki) {
1001 if (!lki.isLKI()) {
1002 lki = CardCopyService.getLKICopy(lki);
1003 }
1004 FCollectionView<AttackingBand> attackersBlocked = null;
1005 final AttackingBand attackingBand = getBandOfAttacker(lki);
1006 final boolean isAttacker = attackingBand != null;
1007 if (isAttacker) {
1008 boolean found = false;
1009 for (AttackingBand ab : attackedByBands.get().values()) {
1010 if (ab.contains(lki)) {
1011 found = true;
1012 break;
1013 }
1014 }
1015 if (!found) {
1016 return null;
1017 }
1018 } else {
1019 attackersBlocked = getAttackingBandsBlockedBy(lki);
1020 if (attackersBlocked.isEmpty()) {
1021 return null; // card was not even in combat
1022 }
1023 }
1024 lkiCache.get().add(lki);
1025 final FCollectionView<AttackingBand> relatedBands = isAttacker ? new FCollection<>(attackingBand) : attackersBlocked;
1026 return new CombatLki(isAttacker, relatedBands);
1027 }
1028}

Callers 2

switchPhaseStateMethod · 0.95
getLKICopyMethod · 0.45

Calls 9

getLKICopyMethod · 0.95
getBandOfAttackerMethod · 0.95
isLKIMethod · 0.80
valuesMethod · 0.80
getMethod · 0.65
containsMethod · 0.65
isEmptyMethod · 0.65
addMethod · 0.65

Tested by

no test coverage detected