@Override public ActivationStatus canActivate(UUID playerId, Game game) { PlayerLostLifeWatcher watcher = game.getState().getWatcher(PlayerLostLifeWatcher.class); if (watcher != null && watcher.getAllOppLifeLost(playerId, game) > 0) { return super.canActivate(playerId, game); } return ActivationStatus.getFalse(); }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { ActivationStatus activationStatus = super.canActivate(playerId, game); if (activationStatus.canActivate()) { Card card = game.getCard(getSourceId()); if (card != null) { // Cards with no Mana Costs cant't be flashbacked (e.g. Ancestral Vision) if (card.getManaCost().isEmpty()) { return ActivationStatus.getFalse(); } // Flashback can never cast a split card by Fuse, because Fuse only works from hand if (card.isSplitCard()) { if (((SplitCard) card).getLeftHalfCard().getName().equals(abilityName)) { return ((SplitCard) card).getLeftHalfCard().getSpellAbility().canActivate(playerId, game); } else if (((SplitCard) card).getRightHalfCard().getName().equals(abilityName)) { return ((SplitCard) card).getRightHalfCard().getSpellAbility().canActivate(playerId, game); } } return card.getSpellAbility().canActivate(playerId, game); } } return activationStatus; }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { // check if controller or teammate has already cast a spell this turn CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); if (watcher != null) { Player player = game.getPlayer(playerId); if (player != null) { for (UUID playerToCheckId : game.getState().getPlayersInRange(playerId, game)) { if (!player.hasOpponent(playerToCheckId, game)) { if (watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(playerToCheckId) > 0) { return super.canActivate(playerId, game); } } } } } return ActivationStatus.getFalse(); }
private boolean spliceSpellCanBeActivated(Ability source, Game game) { // check if spell can be activated (protection problem not solved because effect will be used from the base spell?) Card card = game.getCard(source.getSourceId()); if (card != null) { if (card.getManaCost().isEmpty()) { // e.g. Evermind return card.getSpellAbility().spellCanBeActivatedRegularlyNow(source.getControllerId(), game); } else { return card.getSpellAbility().canActivate(source.getControllerId(), game).canActivate(); } } return false; } }
if (mana.enough(avail)) { SpellAbility ability = card.getSpellAbility(); if (ability != null && ability.canActivate(playerId, game).canActivate() && game.getContinuousEffects().preventedByRuleModification(GameEvent.getEvent(GameEvent.EventType.CAST_SPELL, ability.getSourceId(), ability.getSourceId(), playerId), ability, game, true)) { if (card.getCardType().contains(CardType.INSTANT)
private void playRemoval(List<UUID> creatures, Game game) { for (UUID creatureId : creatures) { for (Card card : this.playableInstant) { if (card.getSpellAbility().canActivate(playerId, game).canActivate()) { for (Effect effect : card.getSpellAbility().getEffects()) { if (effect.getOutcome() == Outcome.DestroyPermanent || effect.getOutcome() == Outcome.ReturnToHand) { if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) { if (this.activateAbility(card.getSpellAbility(), game)) { return; } } } } } } } }
@Override public ActivationStatus canActivate(UUID playerId, Game game) { if (super.canActivate(playerId, game).canActivate()) { Player controller = game.getPlayer(this.getControllerId()); if (controller != null) { for (Permanent creature : game.getBattlefield().getActivePermanents(new FilterControlledCreaturePermanent(), this.getControllerId(), this.getSourceId(), game)) { ManaCost costToPay = CardUtil.reduceCost(emergeCost.copy(), creature.getConvertedManaCost()); if (costToPay.canPay(this, this.getSourceId(), this.getControllerId(), game)) { return ActivationStatus.getTrue(); } } } } return ActivationStatus.getFalse(); }
private void playDamage(List<UUID> creatures, Game game) { for (UUID creatureId : creatures) { Permanent creature = game.getPermanent(creatureId); for (Card card : this.playableInstant) { if (card.getSpellAbility().canActivate(playerId, game).canActivate()) { for (Effect effect : card.getSpellAbility().getEffects()) { if (effect instanceof DamageTargetEffect) { if (card.getSpellAbility().getTargets().get(0).canTarget(creatureId, card.getSpellAbility(), game)) { if (((DamageTargetEffect) effect).getAmount() > (creature.getPower().getValue() - creature.getDamage())) { if (this.activateAbility(card.getSpellAbility(), game)) { return; } } } } } } } } }
if (!playableNonInstant.isEmpty()) { for (Card card : playableNonInstant) { if (card.getSpellAbility().canActivate(playerId, game).canActivate()) { if (this.activateAbility(card.getSpellAbility(), game)) { return true;