Package mage.game.permanent

Examples of mage.game.permanent.Permanent


      return false;
  }

  @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


    }
  }

  @Override
  public void declareBlocker(UUID blockerId, UUID attackerId, Game game) {
    Permanent blocker = game.getPermanent(blockerId);
    CombatGroup group = game.getCombat().findGroup(attackerId);
    if (blocker != null && group != null && group.canBlock(blocker, game)) {
      group.addBlocker(blockerId, playerId, game);
    }
  }
View Full Code Here

  }

  @Override
  public boolean applies(GameEvent event, Ability source, Game game) {
    if (super.applies(event, source, game)) {
      Permanent permanent = game.getPermanent(event.getTargetId());
      if (permanent != null) {
        if (filter.match(permanent, source.getControllerId(), game))
          return true;
      }
      else {
View Full Code Here

    return new AddPlusOneCountersSourceEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getSourceId());
    if (permanent != null) {
      permanent.addCounters(new PlusOneCounter(amount));
    }
    return true;
  }
View Full Code Here

    return new GainAbilityTargetEffect(this);
  }

  @Override
  public boolean apply(Game game, Ability source) {
    Permanent permanent = game.getPermanent(source.getFirstTarget());
    if (permanent != null) {
      permanent.addAbility(ability.copy());
      return true;
    }
    return false;
  }
View Full Code Here

  }

  @Override
  public boolean apply(Game game, Ability source) {
    if (game.getBattlefield().countAll(filter, source.getControllerId()) == 0) {
      Permanent permanent = game.getPermanent(source.getSourceId());
      if (permanent != null) {
        permanent.setTapped(true);
        return true;
      }
      return false;
    }
    return true;
View Full Code Here

  }

  public void declareAttacker(UUID attackerId, UUID defenderId, Game game) {
    if (!defenders.contains(defenderId))
      return;
    Permanent defender = game.getPermanent(defenderId);
    CombatGroup newGroup = new CombatGroup(defenderId, defender != null);
    newGroup.attackers.add(attackerId);
    Permanent attacker = game.getPermanent(attackerId);
    if (!attacker.getAbilities().containsKey(VigilanceAbility.getInstance().getId()))
      attacker.setTapped(true);
    attacker.setAttacking(true);
    groups.add(newGroup);
  }
View Full Code Here

    attacker.setAttacking(true);
    groups.add(newGroup);
  }

  public void removeFromCombat(UUID creatureId, Game game) {
    Permanent creature = game.getPermanent(creatureId);
    if (creature != null) {
      creature.setAttacking(false);
      creature.setBlocking(0);
      for (CombatGroup group: groups) {
        group.remove(creatureId);
      }
    }
  }
View Full Code Here

      }
    }
  }

  public void endCombat(Game game) {
    Permanent creature;
    for (CombatGroup group: groups) {
      for (UUID attacker: group.attackers) {
        creature = game.getPermanent(attacker);
        if (creature != null) {
          creature.setAttacking(false);
          creature.setBlocking(0);
        }
      }
      for (UUID blocker: group.blockers) {
        creature = game.getPermanent(blocker);
        if (creature != null) {
          creature.setAttacking(false);
          creature.setBlocking(0);
        }
      }
    }
    clear();
  }
View Full Code Here

  }

  @Override
  public boolean apply(Game game, Ability source) {
    for (UUID target: source.getTargets().get(0).getTargets()) {
      Permanent permanent = game.getPermanent(target);
      if (permanent != null) {
        permanent.setTapped(true);
      }
      else {
        return false;
      }
    }
View Full Code Here

TOP

Related Classes of mage.game.permanent.Permanent

Copyright © 2018 www.massapicom. 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.