コード例 #1
0
ファイル: Spell.cs プロジェクト: aash/Singular
 internal CogContext(CastContext cc, SimpleStringDelegate descrtrv)
 {
     if (cc.unit != null)
     {
         loc = cc.unit.Location;
         spell = cc.spell;
         context = cc.context;
         name = cc.name;
         sfr = cc.sfr;
         spell = cc.spell;
         if (descrtrv != null)
         {
             targetDesc = descrtrv(context) + " ";
         }
     }
 }
コード例 #2
0
ファイル: Spell.cs プロジェクト: aash/Singular
        /// <summary>
        /// CastHack following done because CanCast() wants spell as "Metamorphosis: Doom" while Cast() and aura name are "Doom"
        /// </summary>
        /// <param name="castName"></param>
        /// <param name="onUnit"></param>
        /// <param name="requirements"></param>
        /// <returns>true: if spell can be cast, false: if a condition prevents it</returns>
        public static bool CanCastHack(SpellFindResults sfr, WoWUnit unit, bool skipWowCheck = false)
        {
            WoWSpell spell = sfr.Override ?? sfr.Original;
            
            // check range
            if (!CanCastHackInRange( spell, unit))
                return false;

            // check if movement prevents cast
            if (CanCastHackWillOurMovementInterrupt(spell, unit))
                return false;

            if (CanCastHackIsCastInProgress(spell, unit))
                return false;

            if (!CanCastHackHaveEnoughPower(spell, unit))
                return false;

            if (SingularSettings.Instance.DisableSpellsWithCooldown != 0)
            {
                int baseCooldown = GetBaseCooldown(spell);
                if (baseCooldown >= SingularSettings.Instance.DisableSpellsWithCooldown * 1000)
                {
                    if (SingularSettings.DebugSpellCasting)
                        Logger.WriteFile( "CanCast[{0}]: basecooldown of {0} exceeds max allowed user setting of {1} ms", baseCooldown, SingularSettings.Instance.DisableSpellsWithCooldown * 1000);
                    return false;
                }
            }

            // override spell will sometimes always have cancast=false, so check original also
            if (!skipWowCheck && !spell.CanCast && (sfr.Override == null || !sfr.Original.CanCast))
            {
                if (SingularSettings.DebugSpellCasting)
                    Logger.WriteFile( "CanCast[{0}]: spell specific CanCast failed (#{1})", spell.Name, spell.Id);

                return false;
            }

            return true;
        }