Example #1
0
        void SetStats(Character target)
        {
            //RPGStats.Stats tmp = 0;
            switch (StatusEffects.effect)
            {
            case StatusEffectType.Buff: {
                //target.Str += StatusEffects.amount;
                RPGStats.Stats tmp = FindStatModified(StatusEffects.statBuff, target);
                target.CharaStats[tmp] += StatusEffects.amount;
                break;
            }

            case StatusEffectType.Debuff: {
                RPGStats.Stats tmp = FindStatModified(StatusEffects.statBuff, target);
                target.CharaStats[tmp] -= StatusEffects.amount;
                break;
            }

            case StatusEffectType.Heal: {
                //caps HP to the max so you can't overheal
                target.Hp += StatusEffects.amount;
                if (target.Hp > target.hpStat)
                {
                    target.Hp = target.hpStat;
                }
                //HACK check if in battle so it doesn't try making effect when using potion in inventory
                if (GameController.Instance.state == GameController.EGameStates.Battle)
                {
                    GetScreenLoc tempLoc  = new GetScreenLoc();
                    Vector2      location = tempLoc.getScreenPos(target.transform);
                    if (target.tag == "Enemy")
                    {
                        FloatingTextController.CreateHealEnemyText((StatusEffects.amount).ToString(), location);
                    }
                    else if (target.tag == "Player")
                    {
                        FloatingTextController.CreateHealAllyText((StatusEffects.amount).ToString(), location);
                    }
                }
                break;
            }

            case StatusEffectType.ManaHeal: {
                target.Mp += StatusEffects.amount;
                if (target.Mp > target.mpStat)
                {
                    target.Mp = target.mpStat;
                }
                //HACK check if in battle so it doesn't try making effect when using potion in inventory
                if (GameController.Instance.state == GameController.EGameStates.Battle)
                {
                    GetScreenLoc tempLoc  = new GetScreenLoc();
                    Vector2      location = tempLoc.getScreenPos(target.transform);
                    if (target.tag == "Enemy")
                    {
                        FloatingTextController.CreateHealEnemyText((StatusEffects.amount).ToString(), location);
                    }
                    else if (target.tag == "Player")
                    {
                        FloatingTextController.CreateHealAllyText((StatusEffects.amount).ToString(), location);
                    }
                }

                break;
            }

            default:
                Debug.Log("error");
                break;
            }
        }