@Override public Abilities<ActivatedManaAbilityImpl> getAvailableActivatedManaAbilities(Zone zone, Game game) { return stream() .filter(ability -> ability instanceof ActivatedManaAbilityImpl) .filter(ability -> ability.getZone().match(zone)) .filter(ability -> (((ActivatedManaAbilityImpl) ability).canActivate(ability.getControllerId(), game).canActivate())) .map(ability -> (ActivatedManaAbilityImpl) ability) .collect(Collectors.toCollection(AbilitiesImpl::new)); }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int count = 0; for (CombatGroup combatGroup : game.getCombat().getGroups()) { if (combatGroup.getDefenderId().equals(sourceAbility.getControllerId())) { count += combatGroup.getAttackers().size(); } } return count * 3; }
@Override public boolean apply(Game game, Ability source) { int damage = 0; for (UUID opponentId: game.getOpponents(source.getControllerId())) { damage += game.getPlayer(opponentId).damage(3, source.getSourceId(), game, false, true); } game.getPlayer(source.getControllerId()).gainLife(damage, game, source); return true; }
@Override public boolean applies(Ability abilityToModify, Ability source, Game game) { if (abilityToModify instanceof SpellAbility) { if (abilityToModify.isControlledBy(source.getControllerId())) { return SpellAbilityCastMode.FLASHBACK.equals(((SpellAbility) abilityToModify).getSpellAbilityCastMode()); } } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { int value = game.getBattlefield().count(filter, sourceAbility.getSourceId(), sourceAbility.getControllerId(), game); if (multiplier != null) { value *= multiplier; } return value; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.gainLife(player.getLife(), game, source); return true; } return false; }
@Override public int calculate(Game game, Ability sourceAbility, Effect effect) { if (sourceAbility != null) { Player controller = game.getPlayer(sourceAbility.getControllerId()); if (controller != null) { return controller.getHand().size(); } } return 0; }
@Override public boolean apply(Game game, Ability source) { PlayerAttackedStepWatcher watcher = game.getState().getWatcher(PlayerAttackedStepWatcher.class); return watcher != null && watcher.getNumberAttackingCurrentStep(source.getControllerId()) > 0; }
@Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { Permanent permanent = ((EntersTheBattlefieldEvent) event).getTarget(); if (permanent != null && (permanent.isCreature() || permanent.isArtifact())) { return true; } } return false; }
@Override public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); if (player != null) { player.getManaPool().addMana(getMana(game, source), game, source); } return true; }
@Override public boolean apply(Game game, Ability source) { int sumPower = 0; for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) { sumPower += permanent.getPower().getValue(); } return sumPower >= 8; }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Token token = new SoldierToken(); token.putOntoBattlefield(1, game, source.getSourceId(), opponentId); } return true; } }
@Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent creature = ((EntersTheBattlefieldEvent) event).getTarget(); return creature != null && creature.isControlledBy(source.getControllerId()) && creature.isCreature() && creature.hasSubtype(SubType.WARRIOR, game) && !event.getTargetId().equals(source.getSourceId()); }
@Override public boolean apply(Game game, Ability source) { Permanent target = game.getBattlefield().getPermanent(source.getFirstTarget()); if (target != null) { if (filter.match(target, source.getSourceId(), source.getControllerId(), game)) { return true; } } return false; } }
@Override public boolean apply(Game game, Ability source) { FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("Eldrazi Spawn"); filter.add(new SubtypePredicate(SubType.ELDRAZI)); filter.add(new SubtypePredicate(SubType.SPAWN)); EldraziSpawnToken token = new EldraziSpawnToken(); int count = game.getBattlefield().countAll(filter, source.getControllerId(), game) > 0 ? 3 : 1; token.putOntoBattlefield(count, game, source.getSourceId(), source.getControllerId()); return true; } }
@Override public boolean apply(Game game, Ability source) { for (UUID opponentId : game.getOpponents(source.getControllerId())) { Player opponent = game.getPlayer(opponentId); if (opponent != null) { opponent.moveCards(opponent.getLibrary().getTopCards(game, 7), Zone.GRAVEYARD, source, game); } } return true; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { CreateTokenEffect effect = new CreateTokenEffect(new ElementalToken("OGW", 1, true), 2); effect.apply(game, source); effect.exileTokensCreatedAtNextEndStep(game, source); return true; } return false; } }
@Override public boolean replaceEvent(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); Player opponent = game.getPlayer(event.getPlayerId()); if (controller != null && opponent != null) { controller.drawCards(1, game, event.getAppliedEffects()); opponent.drawCards(1, game, event.getAppliedEffects()); return true; } return false; }
@Override public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); if (controller != null) { int result = controller.rollDice(game, 6); if (result == 6) { new SacrificeSourceEffect().apply(game, source); return (new CreateTokenEffect(new GiantChickenToken(), 1)).apply(game, source); } } return false; }
@Override public boolean apply(Game game, Ability source) { SpecialAction newAction = (SpecialAction) action.copy(); newAction.setSourceId(source.getSourceId()); newAction.setControllerId(source.getControllerId()); newAction.getTargets().addAll(source.getTargets()); game.getState().getSpecialActions().add(newAction); return true; }