Examples of canAttack()


Examples of lineage2.gameserver.model.items.attachment.FlagItemAttachment.canAttack()

    {
      setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
      return;
    }
    FlagItemAttachment attachment = actor.getActiveWeaponFlagAttachment();
    if ((attachment != null) && !attachment.canAttack(actor))
    {
      setIntention(AI_INTENTION_ACTIVE);
      actor.sendActionFailed();
      return;
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature != null) {
      if (creature.canAttack(game)) {
        TargetDefender target = new TargetDefender(game.getCombat().getDefenders(), creature.getControllerId());
        target.setRequired(true);
        Player controller = game.getPlayer(creature.getControllerId());
        while (!target.isChosen())
          controller.chooseTarget(Outcome.Damage, target, source, game);
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

  }

  @Override
  public void declareAttacker(UUID attackerId, UUID defenderId, Game game) {
    Permanent attacker = game.getPermanent(attackerId);
    if (attacker != null && attacker.canAttack(game)) {
      if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, defenderId, attackerId, playerId))) {
        game.getCombat().declareAttacker(attackerId, defenderId, game);
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.ATTACKER_DECLARED, defenderId, attackerId, playerId));
      }
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getSourceId());
    if (creature != null) {
      if (creature.canAttack(game)) {
        TargetDefender target = new TargetDefender(game.getCombat().getDefenders(), creature.getControllerId());
        target.setRequired(true);
        Player controller = game.getPlayer(creature.getControllerId());
        while (!target.isChosen())
          controller.chooseTarget(Outcome.Damage, target, source, game);
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent creature = game.getPermanent(source.getFirstTarget());
    if (creature != null) {
      if (creature.canAttack(game)) {
        game.getCombat().declareAttacker(creature.getId(), source.getControllerId(), game);
      }
    }
    return false;
  }
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

                }
                FilterCreatureForCombat filter = new FilterCreatureForCombat();
                filter.add(new NamePredicate(groups[0]));
                filter.add(Predicates.not(new AttackingPredicate()));
                Permanent attacker = findPermanent(filter, playerId, game);
                if (attacker != null && attacker.canAttack(defenderId, game)) {
                    this.declareAttacker(attacker.getId(), defenderId, game, false);
                }
            }
        }
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

    public void declareAttacker(UUID attackerId, UUID defenderId, Game game, boolean allowUndo) {
        if (allowUndo) {
            setStoredBookmark(game.bookmarkState()); // makes it possible to UNDO a declared attacker with costs from e.g. Propaganda
        }
        Permanent attacker = game.getPermanent(attackerId);
        if (attacker != null && attacker.canAttack(defenderId, game) && attacker.getControllerId().equals(playerId)) {
            if (!game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DECLARE_ATTACKER, defenderId, attackerId, playerId))) {
                game.getCombat().declareAttacker(attackerId, defenderId, game);
            }
        }
    }
View Full Code Here

Examples of mage.game.permanent.Permanent.canAttack()

    public List<Permanent> getAvailableAttackers(UUID defenderId, Game game) {
        FilterCreatureForCombat filter = new FilterCreatureForCombat();
        List<Permanent> attackers = game.getBattlefield().getAllActivePermanents(filter, playerId, game);
        for (Iterator<Permanent> i = attackers.iterator(); i.hasNext();) {
            Permanent entry = i.next();
            if (!entry.canAttack(defenderId, game)) {
                i.remove();
            }
        }
        return attackers;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.