示例#1
0
        public async Task ExecTurn()
        {
            if (HasEffect(EffectType.Confused))
            {
                int r = UnityEngine.Random.Range(0, skillWheel.Length);
                for (int i = 0; i <= r; ++i)
                {
                    await IncrementSkillsSlot();
                }
            }

            if (HasEffect(EffectType.Inapt))
            {
                while (!skillWheel[_skillIndex].IsIncompetence)
                {
                    await IncrementSkillsSlot();
                }
            }

            if (HasEffect(EffectType.Disciplined) && skillWheel[_skillIndex].IsIncompetence)
            {
                await IncrementSkillsSlot();
            }

            Skill skill = skillWheel[_skillIndex];

            if (HasEffect(EffectType.Dizzy))
            {
                skillWheelShouldTick = false;
            }
            else
            {
                //force target
                if (_hasForcedTarget)
                {
                    skill.ForceTarget(_forcedTarget);
                    _hasForcedTarget = false;
                    _forcedTarget    = null;
                }

                //calculate chances of miss and critical hit, and merciless effect

                // Play and wait for skillAnimation to finish
                await SkillPreHitAnimation(skill.animationName);

                // Execute the skill
                await skill.Execute(this);

                if (skill.IsIncompetence && HasEffect(EffectType.Cursed))
                {
                    await TakeDamage(10000000f);
                }

                if (HasEffect(EffectType.Exalted))
                {
                    await IncrementSkillsSlot();

                    skill = skillWheel[_skillIndex];
                    await SkillPreHitAnimation(skill.animationName);

                    await skill.Execute(this);

                    if (skill.IsIncompetence && HasEffect(EffectType.Cursed))
                    {
                        await TakeDamage(10000000f);
                    }
                }
            }

            // Apply effects at the end of the turn
            for (var i = statusEffects.Count - 1; i >= 0; --i)
            {
                await statusEffects[i].TurnEnd();
            }

            // Increment skillIndex ONLY if effects did not affect the wheel
            if (skillWheelShouldTick)
            {
                await IncrementSkillsSlot();
            }

            skillWheelShouldTick = true;
        }
示例#2
0
 public void ForceTarget(CharacterControl target)
 {
     _hasForcedTarget = true;
     _forcedTarget    = target;
 }