コード例 #1
0
        protected override void Update()
        {
            if (playerHealth != null && playerHealth.GetPercentage() < 50f)
            {
                playerHealth.GainAttribute(100f);
            }
            if (playerMana != null && playerMana.GetPercentage() < 20f)
            {
                playerMana.GainAttribute(50f);
            }


            Quest quest = Quest.GetByName("Setting out");

            if (questList.HasQuest(quest) && !isFading)
            {
                isFading = true;
                StartCoroutine(EndTutorialFade(1f));
            }
            if (Input.GetKeyDown(KeyCode.Tab))
            {
                quest = Quest.GetByName("Understanding your skills");
                // if (questList.HasObjectiveCompleted(quest, "Use Punch"))
                if (atkCounter == 6 && !questList.HasQuestCompleted("Understanding your skills"))
                {
                    questList.CompleteObjective(quest, "Finish the demonstration");
                    playerGO.GetComponent <PlayerConversant>().Quit();
                }
            }
        }
コード例 #2
0
        public IEnumerator HealAfterLoss()
        {
            yield return(new WaitForSecondsRealtime(3f));

            Mana mana = GetComponent <Mana>();

            mana.GainAttribute(mana.GetMaxAttributeValue());
            Health health = GetComponent <Health>();

            health.GainAttribute(health.GetMaxAttributeValue());
        }
コード例 #3
0
        protected override void BuffStatOverTime()
        {
            float buffDuration = float.Parse(effectDB.GetEffectStat(EffectStat.Duration, fxName));

            if (buffDuration == 0)
            {
                if (effectDB.GetEffectStat(EffectStat.StatsAffected, fxName) == "Mana")
                {
                    selfMana.GainAttribute(float.Parse(effectDB.GetEffectStat(EffectStat.EffectValues, fxName)));
                }
                else
                {
                    float healValue = float.Parse(effectDB.GetEffectStat(EffectStat.EffectValues, fxName));
                    if (int.Parse(effectDB.GetEffectStat(EffectStat.Additive, fxName)) == 0)
                    {
                        healValue *= selfHealth.GetMaxAttributeValue() / 100;
                    }

                    if (healValue < 0)
                    {
                        selfHealth.TakeDamage(Mathf.Abs(healValue), false, false);
                    }
                    else
                    {
                        selfHealth.GainAttribute(healValue);
                    }
                }
                return;
            }

            bool isCoRoutineActive = buffList.ContainsKey(fxID);

            float[] currentFXInfo = GetCurrentFXInfo();
            buffList[fxID] = currentFXInfo;
            if (!isCoRoutineActive)
            {
                StartCoroutine(BuffOverTime(buffDuration));
            }
        }
コード例 #4
0
    public void RestoreAttributes()
    {
        if (playerHealth != null)
        {
            playerHealth.GainAttribute(playerHealth.GetMaxAttributeValue());
        }

        if (playerMana != null)
        {
            playerMana.GainAttribute(playerMana.GetMaxAttributeValue());
        }

        GameObject followerObj = GameObject.FindGameObjectWithTag("Follower");

        if (followerObj != null)
        {
            Mana followerMana = followerObj.GetComponent <Mana>();
            followerMana.GainAttribute(followerMana.GetMaxAttributeValue());
        }
    }
コード例 #5
0
        private void DecideNextAction()
        {
            if (timeSinceLastAttack >= timeBetweenAttacks)
            {
                // actionModifier should probably affect this...
                float foodValue = fullness.DigestFood(digestSpeed);
                // TODO: figure out base mana recovery when stomach is empty
                float manaAmount = Mathf.Max(1, foodValue * manaConversion);
                selfMana.GainAttribute(manaAmount);
                timeSinceLastAttack = 0;
                string chatMessage = null;

                float fullPercent = fullness.GetPercentage();
                // Check for hunger and whether inventory has consumable
                if (fullPercent <= starveValue && consumableIndex.Count > 0)
                {
                    chatMessage = GetItemToEat();
                }
                else if (AttackInQueue())
                {
                    FollowerAttackStats attackStats = attackManager.GetAttackStats(currentAttack);

                    // Check if have mana to cover attack cost
                    if (attackStats.Cost < selfMana.GetAttributeValue())
                    {
                        attackSpeed    = 100 / fighter.GetStat(Stat.AttackSpeed);
                        timeToAct      = attackStats.CastTime * attackSpeed;
                        actionModifier = attackStats.ActionModifier;
                        selfMana.UseMana(attackStats.Cost);
                        timeSinceActionStart = 0;
                        isAttackActive       = true;
                        isEffectOnHit        = attackStats.ApplyEffect == ApplyEffectOn.OnHit;

                        Sprite sprite = followerAttackIconDB.GetSprite(currentAttack);
                        SpawnHitTimer(sprite);
                        CheckEffectActivation(false);

                        if (isFromQueue)
                        {
                            atkQueue.Dequeue();
                        }
                        if (attackStats.isRecastSkill)
                        {
                            float recastTime = attackStats.RecastTimer + timeToAct;
                            skillRecastRoutines[currentAttack] = StartCoroutine(SkillRecast(currentAttack, recastTime));
                        }
                        chatMessage = "Casting " + attackStats.Name;
                    }
                    else
                    {
                        // Message out of mana, extra check for hunger
                        chatMessage    = "I'm OOMing!";
                        actionModifier = 2f;
                        if (fullPercent <= hungerValue && consumableIndex.Count > 0)
                        {
                            chatMessage = GetItemToEat();
                        }
                    }
                }
                // check if under soft cap for hunger
                else if (fullPercent <= hungerValue && consumableIndex.Count > 0)
                {
                    chatMessage = GetItemToEat();
                }
                else
                {
                    chatMessage    = "Nothing to do?";
                    actionModifier = 2f;
                }

                combatLog.SendMessageToChat(chatMessage);
            }
        }