private void addDefender(UUID defenderId, Game game) { if (!defenders.contains(defenderId)) { if (maxAttackers < Integer.MAX_VALUE) { Player defendingPlayer = game.getPlayer(defenderId); if (defendingPlayer != null) { if (defendingPlayer.getMaxAttackedBy() == Integer.MAX_VALUE) { maxAttackers = Integer.MAX_VALUE; } else if (maxAttackers == Integer.MIN_VALUE) { maxAttackers = defendingPlayer.getMaxAttackedBy(); } else { maxAttackers += defendingPlayer.getMaxAttackedBy(); } } } defenders.add(defenderId); for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_PLANESWALKER, defenderId, game)) { defenders.add(permanent.getId()); } } }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { switch (layer) { case RulesEffects: Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { // Change the rule if (controller.getMaxAttackedBy()> maxAttackedBy) { controller.setMaxAttackedBy(maxAttackedBy); } } break; } return false; }
@Override public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { switch (layer) { case RulesEffects: Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { // Change the rule if (controller.getMaxAttackedBy() > maxAttackedBy) { controller.setMaxAttackedBy(maxAttackedBy); } } break; } return false; }
numberCreaturesDefenderAttackedBy.put(defendingPlayer.getId(), defenderAttackedBy); if (defenderAttackedBy.size() >= defendingPlayer.getMaxAttackedBy()) { Player attackingPlayer = game.getPlayer(game.getControllerId(attackerId)); if (attackingPlayer != null && !game.isSimulation()) { game.informPlayer(attackingPlayer, "No more than " + CardUtil.numberToText(defendingPlayer.getMaxAttackedBy()) + " creatures can attack " + defendingPlayer.getLogName());
this.loyaltyUsePerTurn = player.getLoyaltyUsePerTurn(); this.maxHandSize = player.getMaxHandSize(); this.maxAttackedBy = player.getMaxAttackedBy(); this.manaPool = player.getManaPool().copy(); this.turns = player.getTurns();