Esempio n. 1
0
 public void AddResultEntry(SkillResultEntry entry)
 {
     Current = entry;
     SkillEntries.Add(entry);
     if (entry.Type != SkillResultType.Dodge && entry.Type != SkillResultType.Miss)
     {
         HasHit = true;
     }
     if (entry.IsZeroed)
     {
         HasZeroHealth = true;
     }
 }
Esempio n. 2
0
        public BaseCombatAiComponent()
        {
            Listen(OnStart, () =>
            {
                SkillEntries = new List <NpcSkillEntry>();

                Listen(GameObject.OnStart, async() =>
                {
                    SkillComponent = GameObject.GetComponent <SkillComponent>();

                    DestructibleComponent = GameObject.GetComponent <DestructibleComponent>();

                    QuickBuildComponent = GameObject.GetComponent <QuickBuildComponent>();

                    Stats = GameObject.GetComponent <DestroyableComponent>();

                    foreach (var skillEntry in SkillComponent.DefaultSkillSet)
                    {
                        await using var ctx = new CdClientContext();

                        var skillInfo = await ctx.SkillBehaviorTable.FirstAsync(
                            s => s.SkillID == skillEntry.SkillId
                            );

                        await SkillComponent.CalculateSkillAsync((int)skillEntry.SkillId, true);

                        SkillEntries.Add(new NpcSkillEntry
                        {
                            SkillId         = skillEntry.SkillId,
                            Cooldown        = false,
                            AbilityCooldown = skillInfo.Cooldown ?? 1
                        });
                    }

                    Zone.Update(GameObject, async delta =>
                    {
                        await CalculateCombat(delta);
                    }, 1);
                });
Esempio n. 3
0
        public async void StartCombatAI()
        {
            SkillComponent        = GameObject.GetComponent <SkillComponent>();
            DestructibleComponent = GameObject.GetComponent <DestructibleComponent>();
            QuickBuildComponent   = GameObject.GetComponent <QuickBuildComponent>();
            Stats = GameObject.GetComponent <DestroyableComponent>();

            foreach (var skillEntry in SkillComponent.DefaultSkillSet)
            {
                var skillInfo = await ClientCache.FindAsync <SkillBehavior>(skillEntry.SkillId);

                SkillEntries.Add(new NpcSkillEntry
                {
                    SkillId         = skillEntry.SkillId,
                    Cooldown        = 0,
                    AbilityCooldown = (skillInfo.Cooldown ?? 1) * 1000,
                    Tree            = await BehaviorTree.FromSkillAsync((int)skillEntry.SkillId)
                });
            }

            Zone.Update(GameObject, delta => CalculateCombat(delta), 1);
        }