Package mage.game.events

Examples of mage.game.events.GameEvent


  public PhaseStep getType() {
    return type;
  }

  public void beginStep(Game game, UUID activePlayerId) {
    game.fireEvent(new GameEvent(preStepEvent, null, null, activePlayerId));
  }
View Full Code Here


    if (hasPriority)
      game.playPriority(activePlayerId);
  }

  public void endStep(Game game, UUID activePlayerId) {
    game.fireEvent(new GameEvent(postStepEvent, null, null, activePlayerId));
  }
View Full Code Here

  public void endStep(Game game, UUID activePlayerId) {
    game.fireEvent(new GameEvent(postStepEvent, null, null, activePlayerId));
  }

  public boolean skipStep(Game game, UUID activePlayerId) {
    return game.replaceEvent(new GameEvent(stepEvent, null, null, activePlayerId));
  }
View Full Code Here

    this.life = life;
  }

  @Override
  public int loseLife(int amount, Game game) {
    GameEvent event = new GameEvent(GameEvent.EventType.LOSE_LIFE, playerId, playerId, playerId, amount, false);
    if (!game.replaceEvent(event)) {
      setLife(this.life - amount, game);
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST_LIFE, playerId, playerId, playerId, amount));
      return amount;
    }
View Full Code Here

    return 0;
  }

  @Override
  public void gainLife(int amount, Game game) {
    GameEvent event = new GameEvent(GameEvent.EventType.GAIN_LIFE, playerId, playerId, playerId, amount, false);
    if (!game.replaceEvent(event)) {
      setLife(this.life + amount, game);
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.GAINED_LIFE, playerId, playerId, playerId, amount));
    }
  }
View Full Code Here

    return true;
  }

  @Override
  public boolean replaceEvent(GameEvent event, Ability source, Game game) {
    GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), event.getAmount(), false);
    if (!game.replaceEvent(preventEvent)) {
      int damage = event.getAmount();
      event.setAmount(0);
      game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, source.getFirstTarget(), source.getId(), source.getControllerId(), damage));
    }
View Full Code Here

  }

  @Override
  public int damage(int damage, UUID sourceId, Game game, boolean combatDamage, boolean preventable) {
    if (damage > 0 && canDamage(game.getObject(sourceId))) {
      GameEvent event = new DamagePlayerEvent(playerId, sourceId, playerId, damage, preventable, combatDamage);
      if (!game.replaceEvent(event)) {
        int actualDamage = event.getAmount();
        if (actualDamage > 0) {
          actualDamage = this.loseLife(actualDamage, game);
          Permanent source = game.getPermanent(sourceId);
          if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
            Player player = game.getPlayer(source.getControllerId());
View Full Code Here

    return this.left;
  }

  @Override
  public void lost(Game game) {
    if (!game.replaceEvent(new GameEvent(GameEvent.EventType.LOSES, null, null, playerId))) {
      this.loses = true;
      //20100423 - 603.9
      if (!this.wins)
        game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LOST, null, null, playerId));
      leaveGame(game);
View Full Code Here

    }
  }

  @Override
  public void won(Game game) {
    if (!game.replaceEvent(new GameEvent(GameEvent.EventType.WINS, null, null, playerId))) {
      if (!this.loses) {
        //20100423 - 800.6, 801.16
        if (game.getPlayers().size() > 2) {
          for (UUID opponentId: game.getOpponents(playerId)) {
            game.getPlayer(opponentId).lost(game);
View Full Code Here

  }

  @Override
  public void removeCounters(String name, int amount, Game game) {
    counters.removeCounter(name, amount);
    GameEvent event = GameEvent.getEvent(EventType.COUNTER_REMOVED, objectId, controllerId);
    event.setData(name);
    for (int i = 0; i < amount; i++)
      game.fireEvent(event);
  }
View Full Code Here

TOP

Related Classes of mage.game.events.GameEvent

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.