Ejemplo n.º 1
0
 public void AddInventory(EquipmentWrapper e)
 {
     inventory.Add(e);
     strength--;
     agility--;
     constitution--;
     intelligence--;
     if (this == GameState.State.player)
     {
         FlashText.Flash("All Stats: -1", Color.red);
     }
 }
Ejemplo n.º 2
0
 public void RemoveInventory(EquipmentWrapper e)
 {
     if (inventory.Remove(e))
     {
         strength++;
         agility++;
         constitution++;
         intelligence++;
         if (this == GameState.State.player)
         {
             FlashText.Flash("All Stats: +1", Color.green);
         }
     }
 }
Ejemplo n.º 3
0
    IEnumerator BattleStart()
    {
        yield return(new WaitForSeconds(0.1f));

        RefreshStatus(true);
        FlashText.Flash("Fight!", Color.red);
        AudioPlayer.PlayFight();
        yield return(new WaitForSeconds(0.1f));

        battleUI.SetActive(true);
        GameState.State.tournament.gameObject.SetActive(false);
        SwapPopup.Close();
        Inventory.Close();
        Shop.Close();
    }
Ejemplo n.º 4
0
 void SetPlayerAction(EquipmentWrapper e, Equipment.Ability action)
 {
     if (e == null && action == null)
     {
         Inventory.Show(player);
     }
     else
     {
         playerCards.Clear();
         Equipment.Ability playerAction;
         bool remove = false;
         if (action != null)
         {
             playerAction = action;
         }
         else
         {
             remove = !e.NextAction(out playerAction);
         }
         Equipment.Ability enemyAction;
         var ee = enemy.GetAbility(out enemyAction);
         FlashText.Flash(enemyAction.name + "\n\n\n\n" + playerAction.name, Color.white);
         HandleAction(player, enemy, ref playerAction, ref enemyAction, playerAnimation, enemyAnimation);
         HandleAction(enemy, player, ref enemyAction, ref playerAction, enemyAnimation, playerAnimation);
         if (remove)
         {
             FlashText.Flash("Your " + e.equipment.name.ToLower() + " broke!", Color.red);
             player.RemoveEquipment(e);
         }
         if (ee != null)
         {
             enemy.RemoveEquipment(ee);
         }
         if (player.health <= 0 && enemy.health >= player.health)
         {
             StartCoroutine(BattleOver(player));
             return;
         }
         else if (enemy.health <= 0 && player.health > enemy.health)
         {
             StartCoroutine(BattleOver(enemy));
             return;
         }
         reward += 3;
         StartCoroutine(DelayedNextTurn());
     }
 }
Ejemplo n.º 5
0
    void DoDamage(CharacterWrapper c, float amount)
    {
        int rnd = Random.Range(0, c.equipment.Count);

        for (int i = 0; i < c.equipment.Count; i++)
        {
            var e = c.equipment[(rnd + i) % c.equipment.Count];
            if (e.equipment.type == Equipment.Type.armor)
            {
                c.health     -= Mathf.RoundToInt(amount * 0.5f);
                e.durability -= Mathf.RoundToInt(amount * 0.3f);
                if (e.durability <= 0)
                {
                    c.RemoveEquipment(e);
                    if (c == player)
                    {
                        FlashText.Flash("Your " + e.equipment.name.ToLower() + " broke!", Color.red);
                    }
                }
                return;
            }
        }
        c.health -= Mathf.RoundToInt(amount);
    }