mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
[CLB] Implement Commander Liara Portyr
This commit is contained in:
parent
74c885a331
commit
1cb421ece7
3 changed files with 136 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.MageItem;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -23,6 +24,7 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
// retrieve the number of attackers in triggered effects with getValue
|
||||
public static final String VALUEKEY_NUMBER_ATTACKERS = "number_attackers";
|
||||
public static final String VALUEKEY_NUMBER_DEFENDING_PLAYERS = "number_defending_players";
|
||||
|
||||
private final FilterPermanent filter;
|
||||
private final int minAttackers;
|
||||
|
|
@ -91,6 +93,17 @@ public class AttacksWithCreaturesTriggeredAbility extends TriggeredAbilityImpl {
|
|||
return false;
|
||||
}
|
||||
getEffects().setValue(VALUEKEY_NUMBER_ATTACKERS, attackers.size());
|
||||
getEffects().setValue(
|
||||
VALUEKEY_NUMBER_DEFENDING_PLAYERS,
|
||||
attackers.stream()
|
||||
.map(MageItem::getId)
|
||||
.map(game.getCombat()::getDefenderId)
|
||||
.distinct()
|
||||
.map(game::getPlayer)
|
||||
.filter(Objects::nonNull)
|
||||
.mapToInt(x -> 1)
|
||||
.sum()
|
||||
);
|
||||
if (setTargetPointer) {
|
||||
getEffects().setTargetPointer(new FixedTargets(new ArrayList<>(attackers), game));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue