Examples of Permanent


Examples of mage.game.permanent.Permanent

    //20100423 - 800.4a
    this.hand.clear();
    this.graveyard.clear();
    this.library.clear();
    for (Iterator<Permanent> it = game.getBattlefield().getAllPermanents().iterator(); it.hasNext();) {
      Permanent perm = it.next();
      if (perm.getOwnerId().equals(playerId)) {
        if (perm.getAttachedTo() != null) {
          Permanent attachedTo = game.getPermanent(perm.getAttachedTo());
          if (attachedTo != null)
            attachedTo.removeAttachment(perm.getId(), game);
        }
        it.remove();
      }
    }
    for (Iterator<StackObject> it = game.getStack().iterator(); it.hasNext();) {
      StackObject object = it.next();
      if (object.getControllerId().equals(playerId)) {
        it.remove();
      }
    }
    for (Iterator<Permanent> it = game.getBattlefield().getAllPermanents().iterator(); it.hasNext();) {
      Permanent perm = it.next();
      if (perm.getControllerId().equals(playerId)) {
        perm.moveToExile(null, "", null, game);
      }
    }
  }
View Full Code Here

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

Examples of mage.game.permanent.Permanent

    }
  }

  @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

Examples of mage.game.permanent.Permanent

  }

  @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

Examples of mage.game.permanent.Permanent

    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

Examples of mage.game.permanent.Permanent

    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

Examples of mage.game.permanent.Permanent

  }

  @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

Examples of mage.game.permanent.Permanent

  }

  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

Examples of mage.game.permanent.Permanent

    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

Examples of mage.game.permanent.Permanent

      }
    }
  }

  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
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.