Exemplo n.º 1
0
  public void healVillage() {
    if (GameData.villageHp() >= GameData.maxVillageHp()) {
      showNotif("Your Village Health is full.");
    } else if (healMana <= GameData.mana()) {
      Sfx.playHeal();
      healed = true;
      if (hp10 + GameData.villageHp() > GameData.maxVillageHp()) {
        GameData.setVillageHp(GameData.maxVillageHp());
        // villageHpBar.addAction(scaleTo(1f, 1f, 1f));
      } else {
        GameData.setVillageHp(GameData.villageHp() + hp10);
        // villageHpBar.addAction(scaleBy(0.1f, 0f, 1f));
      }
      if (GameData.mana() - healMana < 0) {
        GameData.setMana(0);
        manaBar.addAction(scaleTo(0f, 1f, 1f));
      } else {
        GameData.setMana(GameData.mana() - healMana);
        lobby.updateLabels();
      }
      mana.setText(GameData.mana() + "/" + GameData.maxMana());
      // villageHp.setText(GameData.villageHp() + "/" + GameData.maxVillageHp());

      closeUi();
    } else {
      showMagicAd();
      int neededMana = healMana - GameData.mana();
      showNotif("Need " + neededMana + " more mana.");
    }
  }
Exemplo n.º 2
0
  public SelectSkill(
      final Label villageHp,
      final Image villageHpBar,
      final Label mana,
      final Image manaBar,
      final Lobby lobby) {
    this.villageHp = villageHp;
    this.villageHpBar = villageHpBar;
    this.mana = mana;
    this.manaBar = manaBar;
    this.lobby = lobby;
    actionManager = new Actor();
    GdxGame.hud_stage.addActor(actionManager);
    mana20 = MathUtils.round(GameData.maxMana() * 0.2f);
    mana10 = MathUtils.round(GameData.maxMana() * 0.1f);
    mana5 = MathUtils.round(GameData.maxMana() * 0.05f);
    hp10 = MathUtils.round(GameData.maxVillageHp() * 0.1f);

    notifTxt = new Label("", Skins.mediumTxt);
    // Create reuseable function for label notif text
    // lock shield and one hit skills
  }