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

Method updateCombat

forge-game/src/main/java/forge/game/GameView.java:216–235  ·  view source on GitHub ↗
(Combat combat)

Source from the content-addressed store, hash-verified

214 }
215
216 void updateCombat(Combat combat) {
217 if (combat == null) {
218 set(TrackableProperty.CombatView, null);
219 return;
220 }
221
222 final CombatView combatView = new CombatView(combat.getAttackingPlayer().getGame().getTracker());
223 for (final AttackingBand b : combat.getAttackingBands()) {
224 if (b == null) continue;
225 final GameEntity defender = combat.getDefenderByAttacker(b);
226 final List<Card> blockers = combat.getBlockers(b);
227 final boolean isBlocked = b.isBlocked() == Boolean.TRUE;
228 combatView.addAttackingBand(
229 CardView.getCollection(b.getAttackers()),
230 GameEntityView.get(defender),
231 isBlocked ? CardView.getCollection(blockers) : null,
232 CardView.getCollection(blockers));
233 }
234 set(TrackableProperty.CombatView, combatView);
235 }
236
237 //TODO: Find better ways to make this information available to all GUIs without using the Game class
238

Callers 1

updateCombatForViewMethod · 0.45

Calls 12

addAttackingBandMethod · 0.95
getCollectionMethod · 0.95
getMethod · 0.95
getAttackingPlayerMethod · 0.80
getAttackingBandsMethod · 0.80
getDefenderByAttackerMethod · 0.80
getGameMethod · 0.65
setMethod · 0.45
getTrackerMethod · 0.45
getBlockersMethod · 0.45
isBlockedMethod · 0.45
getAttackersMethod · 0.45

Tested by

no test coverage detected