コード例 #1
0
ファイル: PlayerClass.cs プロジェクト: BUFORD/Funky
        //Base class for each individual class!
        protected PlayerClass()
        {
            HotBar.RefreshHotbar();
            HotBar.RefreshPassives();
            HotBar.UpdateRepeatAbilityTimes();

            Skill healthPotionSkill = new DrinkHealthPotion();
            AbilityLogicConditions.CreateAbilityLogicConditions(ref healthPotionSkill);
            HealthPotionAbility = (DrinkHealthPotion)healthPotionSkill;

            LastUsedAbility = DefaultAttack;
            PowerPrime = DefaultAttack;
            Logger.DBLog.InfoFormat("[Funky] Finished Creating Player Class");
        }
コード例 #2
0
ファイル: Skill.cs プロジェクト: BUFORD/Funky
 public static void UsePower(ref Skill ability)
 {
     if (!ability.ExecutionType.HasFlag(AbilityExecuteFlags.RemoveBuff))
     {
         ability.SuccessUsed = ZetaDia.Me.UsePower(ability.Power, ability.TargetPosition, ability.WorldID, ability.TargetACDGUID);
     }
     else
     {
         ZetaDia.Me.GetBuff(ability.Power).Cancel();
         ability.SuccessUsed = true;
     }
 }
コード例 #3
0
ファイル: Skill.cs プロジェクト: BUFORD/Funky
        public static void SetupAbilityForUse(ref Skill ability, bool Destructible = false)
        {
            ability.MinimumRange = ability.Range;
            ability.TargetPosition_ = Vector3.Zero;
            ability._targetAcdguid = -1;
            ability.WaitLoopsBefore_ = ability.WaitVars.PreLoops;
            ability.WaitLoopsAfter_ = ability.WaitVars.PostLoops;
            ability.CanCastFlags = PowerManager.CanCastFlags.None;
            ability.SuccessUsed_ = null;
            ability.Target_ = null;
            ability.preActivationFinished = false;
            ability.ActivationFinished = false;
            ability.postActivationFinished = false;

            //Destructible Setup
            if (Destructible)
            {
                if (!ability.IsRanged)
                    ability.MinimumRange = 8f;
                else
                    ability.MinimumRange = 30f;

                bool LocationalAttack = (CacheIDLookup.hashDestructableLocationTarget.Contains(Bot.Targeting.Cache.CurrentTarget.SNOID)
                                                  || DateTime.Now.Subtract(PowerCacheLookup.dictAbilityLastFailed[ability.Power]).TotalMilliseconds < 1000);

                if (LocationalAttack)
                {
                    Vector3 attacklocation = Bot.Targeting.Cache.CurrentTarget.Position;

                    if (!ability.IsRanged)
                    {
                        //attacklocation=MathEx.CalculatePointFrom(Bot.Character_.Data.Position,Bot.Target.CurrentTarget.Position, 0.25f);
                        attacklocation = MathEx.GetPointAt(Bot.Character.Data.Position, 0.50f, Navigation.FindDirection(Bot.Character.Data.Position, Bot.Targeting.Cache.CurrentTarget.Position, true));
                    }
                    else
                    {
                        attacklocation = MathEx.GetPointAt(Bot.Targeting.Cache.CurrentTarget.Position, 1f, Navigation.FindDirection(Bot.Targeting.Cache.CurrentTarget.Position, Bot.Character.Data.Position, true));
                    }

                    attacklocation.Z = Navigation.MGP.GetHeight(attacklocation.ToVector2());
                    ability.TargetPosition = attacklocation;
                }
                else
                {
                    ability.TargetACDGUID = Bot.Targeting.Cache.CurrentTarget.AcdGuid.Value;
                }

                return;
            }

            if (ability.LastConditionPassed == ConditionCriteraTypes.Cluster)
            {
                CacheUnit ClusterUnit;
                //Cluster Target -- Aims for Centeroid Unit
                if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.ClusterTarget) && CheckClusterConditions(ability.ClusterConditions)) //Cluster ACDGUID
                {
                    ClusterUnit = Bot.Targeting.Cache.Clusters.AbilityClusterCache(ability.ClusterConditions)[0].GetNearestUnitToCenteroid();
                    ability.TargetACDGUID = ClusterUnit.AcdGuid.Value;
                    ability.Target_ = ClusterUnit;
                    return;
                }
                //Cluster Location -- Aims for Center of Cluster
                if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.ClusterLocation) && CheckClusterConditions(ability.ClusterConditions)) //Cluster Target Position
                {
                    ability.TargetPosition = (Vector3)Bot.Targeting.Cache.Clusters.AbilityClusterCache(ability.ClusterConditions)[0].Midpoint;
                    return;
                }
                //Cluster Target Nearest -- Gets nearest unit in cluster as target.
                if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.ClusterTargetNearest) && CheckClusterConditions(ability.ClusterConditions)) //Cluster Target Position
                {
                    ClusterUnit = Bot.Targeting.Cache.Clusters.AbilityClusterCache(ability.ClusterConditions)[0].ListUnits[0];
                    ability.TargetACDGUID = ClusterUnit.AcdGuid.Value;
                    ability.Target_ = ClusterUnit;
                    return;
                }
            }

            if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.Location)) //Current Target Position
            {
                ability.TargetPosition = Bot.Targeting.Cache.CurrentTarget.Position;
                ability.Target_ = Bot.Targeting.Cache.CurrentUnitTarget;
            }
            else if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.Self)) //Current Bot Position
                ability.TargetPosition = Bot.Character.Data.Position;
            else if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.ZigZagPathing)) //Zig-Zag Pathing
            {
                Bot.NavigationCache.vPositionLastZigZagCheck = Bot.Character.Data.Position;
                if (Bot.Character.Class.ShouldGenerateNewZigZagPath())
                    Bot.Character.Class.GenerateNewZigZagPath();

                ability.TargetPosition = Bot.NavigationCache.vSideToSideTarget;
            }
            else if (ability.ExecutionType.HasFlag(AbilityExecuteFlags.Target)) //Current Target ACDGUID
            {
                ability.Target_ = Bot.Targeting.Cache.CurrentUnitTarget;
                ability.TargetACDGUID = Bot.Targeting.Cache.CurrentTarget.AcdGuid.Value;
            }
        }
コード例 #4
0
ファイル: PlayerClass.cs プロジェクト: BUFORD/Funky
        ///<summary>
        ///Searches for any abilities that have set the OutOfCombat Movement Criteria.
        ///</summary>
        internal Vector3 FindOutOfCombatMovementPower(out Skill MovementAbility, Vector3 Destination)
        {
            MovementAbility = null;
            foreach (var item in Abilities.Values.Where(A => A.FOutOfCombatMovement != null))
            {

                if (item.CheckPreCastConditionMethod())
                {
                    Vector3 AbilityTargetVector = item.FOutOfCombatMovement.Invoke(Destination);
                    if (AbilityTargetVector != Vector3.Zero)
                    {
                        MovementAbility = item;
                        return AbilityTargetVector;
                    }
                }
            }
            return Vector3.Zero;
        }
コード例 #5
0
ファイル: PlayerClass.cs プロジェクト: BUFORD/Funky
 ///<summary>
 ///Returns a power for Combat Buffing.
 ///</summary>
 internal bool FindCombatBuffPower(out Skill BuffAbility)
 {
     BuffAbility = null;
     foreach (var item in Abilities.Values.Where(A => A.IsBuff && A.UseageType.HasFlag(AbilityUseage.Combat | AbilityUseage.Anywhere)))
     {
         if (item.CheckPreCastConditionMethod())
         {
             if (item.CheckCombatConditionMethod())
             {
                 BuffAbility = item;
                 Skill.SetupAbilityForUse(ref BuffAbility);
                 return true;
             }
         }
     }
     return false;
 }
コード例 #6
0
ファイル: PlayerClass.cs プロジェクト: BUFORD/Funky
 ///<summary>
 ///Returns a power for Buffing.
 ///</summary>
 internal bool FindBuffPower(out Skill BuffAbility)
 {
     BuffAbility = null;
     foreach (var item in Abilities.Values.Where(A => A.IsBuff))
     {
         if (item.CheckPreCastConditionMethod())
         {
             if (item.CheckBuffConditionMethod())
             {
                 BuffAbility = item;
                 Skill.SetupAbilityForUse(ref BuffAbility);
                 return true;
             }
         }
     }
     return false;
 }
コード例 #7
0
ファイル: PlayerClass.cs プロジェクト: BUFORD/Funky
        internal void AbilitySuccessfullyUsed(Skill ability, bool reorderAbilities)
        {
            if (ability.IsCombat)
            {
                LastUsedACombatAbility = DateTime.Now;
            }

            LastUsedAbility = ability;

            //Only Sort When Non-Channeling!
            if (reorderAbilities)
                SortedAbilities = Abilities.Values.OrderByDescending(a => a.Priority).ThenByDescending(a => a.LastUsedMilliseconds).ToList();
        }