Ejemplo n.º 1
0
  @Override
  public void onDrawItemForeground(Object data, Batch batch, int x, int y, int width, int height) {
    if (data instanceof AbilityTree) {
      AbilityTree tree = (AbilityTree) data;

      if (((AbilityTree) data).current.current instanceof PassiveAbility) {
        batch.draw(passiveTileBorder, x, y, width, height);
      }

      if (tree.current.needsLevelAnim) {
        Sprite sprite = AssetManager.loadSprite("EffectSprites/Heal/Heal", 0.1f);

        GameScreen.Instance.addSpriteAction(sprite, x + width / 2, y + height / 2, width, height);
        Global.CurrentLevel.player.pendingMessages.add(
            new Message(
                tree.current.current.getName()
                    + " levelled up! (Level "
                    + tree.current.current.getLevel()
                    + ")",
                Color.GOLD));

        levelUpSound.play(Global.CurrentLevel.player.tile[0][0]);

        tree.current.needsLevelAnim = false;
      }
    }
  }
Ejemplo n.º 2
0
  @Override
  public void handleDataClicked(final Object data, InputEvent event, float x, float y) {
    {
      if (GameScreen.Instance.abilityToEquip != null) {
        int index = 0;
        if (data instanceof Integer) {
          index = (Integer) data;
        } else {
          index = Global.CurrentLevel.player.slottedAbilities.indexOf((AbilityTree) data, true);
        }

        while (Global.CurrentLevel.player.slottedAbilities.size <= index) {
          Global.CurrentLevel.player.slottedAbilities.add(null);
        }

        Global.CurrentLevel.player.slottedAbilities.removeIndex(index);
        Global.CurrentLevel.player.slottedAbilities.insert(
            index, GameScreen.Instance.abilityToEquip);
        GameScreen.Instance.abilityToEquip = null;

        if (data instanceof AbilityTree) {
          Item item = new Item();
          item.ability = (AbilityTree) data;

          Global.CurrentLevel.player.tile[0][0].items.add(item);
        }

        GameScreen.Instance.lockContextMenu = false;
        GameScreen.Instance.clearContextMenu();
      } else {
        if (data instanceof AbilityTree
            && ((AbilityTree) data).current.current instanceof ActiveAbility) {
          ActiveAbility aa = (ActiveAbility) ((AbilityTree) data).current.current;

          if (GameScreen.Instance.preparedAbility == aa) {
            GameScreen.Instance.prepareAbility(null);
          } else if (aa.isAvailable()) {
            GameScreen.Instance.prepareAbility(aa);
          }
        }
      }
    }
  }