Example #1
0
    /// <summary>
    /// Heals the player, and prints to the Battle Log.
    /// </summary>
    /// <param name="battleLog">Battle Log</param>
    public void Heal(BattleLogController battleLog)
    {
        //setup healing range
        int healAmount = Random.Range(25, 50);

        //if already at max health...
        if (health == maxHealth)
        {
            battleLog.AddText("Already at Max health!");
            return;
        }
        else
        {
            //heal the player
            health = Mathf.Min(health + healAmount, maxHealth);
            //remove a herb
            herbs--;



            //print text
            battleLog.AddText(name + " Uses a Healing Herb, healing them for " + healAmount + "!");
            battleLog.AddText(name + " has " + herbs + " herbs left.");
        }
    }
Example #2
0
 /// <summary>
 /// Adds the item's gold value to the player
 /// </summary>
 /// <param name="playerInst">Player instance.</param>
 /// <param name="enemyInst">Enemy instance.</param>
 public void GrabLoot(Player playerInst, Enemy enemyInst, BattleLogController battleLog)
 {
     //add the item's gold value to the player's
     playerInst.gold += gold;
     //print the message.
     battleLog.AddText("Victory!");
     battleLog.AddText("The " + enemyInst.name + " drops a " + name + ", worth " + gold + " GP.");
 }
Example #3
0
    /// <summary>
    /// Perform Damage Calculation and Print Combat Text to the battle Log.
    /// </summary>
    /// <param name="enemyInst">Enemy Instance</param>
    /// <param name="battleLog">Battle Log</param>
    public void Attack(Enemy enemyInst, BattleLogController battleLog)
    {
        //subtract weapon damage from enemy health (use Mathf.Max to make sure the enemy Health doesn't fall below 0)
        enemyInst.health = Mathf.Max(0, enemyInst.health - damage);
        //Update the UI

        battleLog.AddText(name + " Hits the " + enemyInst.name + " for " + damage + " damage!");
    }
Example #4
0
    /// <summary>
    /// Increases the player's damage output when called.
    /// </summary>
    public void DamageBoost(BattleLogController battleLog)
    {
        //setup Damage boost range
        int dmgBoostAmount = Random.Range(2, 10);

        //Boost Damage
        damage += dmgBoostAmount;
        //Print Text
        battleLog.AddText(name + " increases their total damage output by " + dmgBoostAmount + " to " + damage + "!");
    }
Example #5
0
    /// <summary>
    /// Boosts the player's Maximum health when called.
    /// </summary>
    public void MaxHealthBoost(BattleLogController battleLog)
    {
        //setup HP Boost range
        int hpBoostAmount = Random.Range(5, 20);

        //Boost Max HP
        maxHealth += hpBoostAmount;
        //Print Text
        battleLog.AddText(name + " increases their health by " + hpBoostAmount + " to " + maxHealth + "!");
    }
Example #6
0
    /// <summary>
    /// Purchases a Herb.
    /// </summary>
    /// <param name="playerInst">Player instance.</param>
    public void BuyHerb(Player playerInst, BattleLogController battleLog, UIController UI)
    {
        //if the player doesn't have enough GP...
        if (playerInst.gold < herbPrice)
        {
            battleLog.AddText("Not enough GP!");
        }
        else
        {
            //pay the cost of the item
            playerInst.gold -= herbPrice;

            //Update the UI
            UI.UpdatePlayerGP(playerInst);

            //give the player the item
            playerInst.herbs++;
            battleLog.AddText(playerInst.name + " now has " + playerInst.herbs + " Healing Herbs.");
        }
    }
Example #7
0
 /// <summary>
 /// Attack the specified player instance.
 /// </summary>
 /// <param name="playerInst">player instance to attack.</param>
 /// <param name="battleLog">The battleLogController (to display text)</param>
 public void Attack(Player playerInst, BattleLogController battleLog)
 {
     //use Mathf.Max to make sure the player's Health doesn't fall below 0
     playerInst.health = Mathf.Max(0, playerInst.health - damage);
     battleLog.AddText(name + " Hits " + playerInst.name + " for " + damage + " damage!");
 }
Example #8
0
 /// <summary>
 /// Prints a message declaring combat has begun to the Debug Log.
 /// </summary>
 public void Encounter(BattleLogController battleLog)
 {
     //Print to the battle Log
     battleLog.AddText("A " + name + " draws near!");
 }
Example #9
0
    /// <summary>
    /// (ButtonClick) Use Item when clicked.
    /// </summary>
    public void ItemOnClick()
    {
        if (openShop.inCombat)
        {
            //if the player isn't Dead...
            if (!playerIsDead)
            {
                //if the player's out of herbs, tell them as much
                if (player.herbs == 0)
                {
                    SFX.PlayOneShot(audioLibrary[8]);
                    battleLog.AddText(player.name + " is out of Healing Herbs!");
                }

                //if the player's already at max health play the buzzer sound
                else if (player.health == player.maxHealth)
                {
                    SFX.PlayOneShot(audioLibrary[8]);
                    player.Heal(battleLog);
                }
                //otherwise, play the item use sound
                else
                {
                    SFX.PlayOneShot(audioLibrary[5]);
                    player.Heal(battleLog);
                    UI.UpdatePlayerHP(player);
                    UI.UpdatePlayerItem(player);
                }
            }
        }
    }
Example #10
0
 /// <summary>
 /// Displays the shop text when called.
 /// </summary>
 /// <param name="playerInst">Player instance.</param>
 public void VisitShop(Player playerInst, BattleLogController battleLog)
 {
     //Shop Text
     battleLog.AddText(playerInst.name + " Enters the Shop.");
 }