Package mage.game.events

Examples of mage.game.events.DamagedPlayerEvent


          Permanent source = game.getPermanent(sourceId);
          if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
            Player player = game.getPlayer(source.getControllerId());
            player.gainLife(actualDamage, game);
          }
          game.fireEvent(new DamagedPlayerEvent(playerId, sourceId, playerId, actualDamage, combatDamage));
//          game.fireEvent(GameEvent.getEvent(GameEvent.EventType.DAMAGED_PLAYER, playerId, sourceId, playerId, actualDamage));
//          if (combatDamage)
//            game.fireEvent(GameEvent.getEvent(GameEvent.EventType.COMBAT_DAMAGED_PLAYER, playerId, sourceId, playerId, actualDamage));
//          else
//            game.fireEvent(GameEvent.getEvent(GameEvent.EventType.NONCOMBAT_DAMAGED_PLAYER, playerId, sourceId, playerId, actualDamage));
View Full Code Here


    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == EventType.DAMAGED_PLAYER && event instanceof DamagedPlayerEvent) {
            if (sourceId.equals(event.getSourceId())) {
                DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
                if (damageEvent.isCombatDamage()) {
                    UUID playerUUID = event.getTargetId();
                    Integer damage = damageToPlayer.get(playerUUID);
                    if(damage == null){
                        damage = 0;
                    }
                    damage += damageEvent.getAmount();
                    damageToPlayer.put(playerUUID, damage);
                    Player player = game.getPlayer(playerUUID);
                    MageObject commander = game.getObject(sourceId);
                    if (player != null && commander != null){
                        game.informPlayers(commander.getLogName() + " did " + damage + " combat damage to " + player.getName() + " during the game.");
View Full Code Here

    }

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event instanceof DamagedPlayerEvent) {
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            Permanent p = game.getPermanent(event.getSourceId());
            if (damageEvent.isCombatDamage() && p != null && p.getAttachments().contains(this.getSourceId())) {
                return true;
            }
        }
        return false;
    }
View Full Code Here

                Player controller = game.getPlayer(this.getControllerId());
                if (controller == null || !game.isOpponent(controller, event.getPlayerId())) {
                    return false;
                }
            }
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
            Permanent p = game.getPermanent(event.getSourceId());
            if ((!onlyCombat || damageEvent.isCombatDamage())
                    && p != null && p.getAttachments().contains(this.getSourceId())) {
                if (setFixedTargetPointer) {
                    for (Effect effect : this.getEffects()) {
                        effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
                    }
View Full Code Here

    @Override
    public boolean checkTrigger(GameEvent event, Game game) {
        if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER && event.getSourceId().equals(this.sourceId)
                && game.getOpponents(this.getControllerId()).contains(event.getTargetId())) {
            if (onlyCombat && event instanceof DamagedPlayerEvent) {
                DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
                if (!damageEvent.isCombatDamage()) {
                    return false;
                }
            }
            for (Effect effect : getEffects()) {
                effect.setTargetPointer(new FixedTarget(event.getTargetId()));
View Full Code Here

    public void watch(GameEvent event, Game game) {
        if (condition == true) { //no need to check - condition has already occured
            return;
        }
        if (event.getType() == GameEvent.EventType.DAMAGED_PLAYER) {
            DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
            if (game.getPlayer(this.getControllerId()).hasOpponent(damageEvent.getPlayerId(), game)) {
                condition = true;
            }
        }
    }
View Full Code Here

    }

    @Override
    public void watch(GameEvent event, Game game) {
        if (event.getType() == EventType.DAMAGED_PLAYER) {
            DamagedPlayerEvent dEvent = (DamagedPlayerEvent) event;
            if (dEvent.isCombatDamage()) {
                Permanent creature = game.getPermanent(dEvent.getSourceId());
                if (creature != null && !allSubtypes.contains(creature.getControllerId())) {
                    if (creature.getAbilities().containsKey(ChangelingAbility.getInstance().getId())) {
                        allSubtypes.add(creature.getControllerId());
                    } else {
                        Set<String> subtypes = damagingSubtypes.get(creature.getControllerId());
View Full Code Here

                    }
                    if (source != null && source.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
                        Player player = game.getPlayer(source.getControllerId());
                        player.gainLife(actualDamage, game);
                    }
                    game.fireEvent(new DamagedPlayerEvent(playerId, sourceId, playerId, actualDamage, combatDamage));
                    return actualDamage;
                }
            }
        }
        return 0;
View Full Code Here

  }

  @Override
  public boolean checkTrigger(GameEvent event, Game game) {
    if (event instanceof DamagedPlayerEvent) {
      DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
      if (!damageEvent.isCombatDamage() && game.getOpponents(controllerId).contains(event.getTargetId())) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

            player.addCounters(CounterType.POISON.createInstance(actualDamage), game);
            if (damageSource != null && damageSource.getAbilities().containsKey(LifelinkAbility.getInstance().getId())) {
                Player controlPlayer = game.getPlayer(damageSource.getControllerId());
                controlPlayer.gainLife(actualDamage, game);
            }
            game.fireEvent(new DamagedPlayerEvent(damageEvent.getPlayerId(), damageEvent.getSourceId(), damageEvent.getPlayerId(), actualDamage, damageEvent.isCombatDamage()));
        }
        return true;
    }
View Full Code Here

TOP

Related Classes of mage.game.events.DamagedPlayerEvent

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.