Esempio n. 1
0
            public DamageMaker(Obj_AI_Base sourceIn, Obj_AI_Base targetIn, GameObject missleIn, SpellData dataIn,
                               bool meleeIn = false)
            {
                Source      = sourceIn;
                Target      = targetIn;
                Missle      = missleIn;
                SData       = dataIn;
                Melee       = !meleeIn;
                CreatedTick = Now;
                IsAutoAtack = SData.IsAutoAttack();

                if (IsAutoAtack)
                {
                    DealDamage = (float)Source.GetAutoAttackDamage(Target, true);
                    if (Source.IsMelee)
                    {
                        Cycle = (int)(Source.AttackDelay * 1000);
                    }
                    else
                    {
                        //var dist = source.Distance(target);
                        Cycle = (int)((Source.AttackDelay * 1000)) /*+ (dist*1000)/sData.MissileSpeed)*/;
                        //Console.WriteLine("cycle: " + cycle);
                    }
                    //Console.WriteLine("cycle: " + source.AttackSpeedMod);
                }
                else
                {
                    Cycle = 0;
                    var client = Source as AIHeroClient;
                    if (client != null)
                    {
                        var tSpell = TargetSpellDatabase.GetByName(SData.Name);
                        if (tSpell == null)
                        {
                            //Console.WriteLine("Unknown targeted spell: " + sData.Name);
                            DealDamage = 0;
                        }
                        else
                        {
                            try
                            {
                                DealDamage = (float)client.GetSpellDamage(Target, tSpell.Spellslot);
                            }
                            catch (Exception)
                            {
                                DealDamage = 0;
                            }
                        }
                    }
                    else
                    {
                        DealDamage = 0;
                    }
                }
            }
Esempio n. 2
0
            public DamageMaker(Obj_AI_Base sourceIn, Obj_AI_Base targetIn, GameObject missleIn, SpellData dataIn, bool meleeIn = false)
            {
                source      = sourceIn;
                target      = targetIn;
                missle      = missleIn;
                sData       = dataIn;
                melee       = !meleeIn;
                createdTick = now;
                isAutoAtack = sData.IsAutoAttack();

                if (isAutoAtack)
                {
                    dealDamage = (float)source.GetAutoAttackDamage(target, true);
                    if (source.IsMelee)
                    {
                        cycle = (int)(source.AttackDelay * 1000);
                    }
                    else
                    {
                        //var dist = source.Distance(target);
                        cycle = (int)((source.AttackDelay * 1000)) /*+ (dist*1000)/sData.MissileSpeed)*/;
                        //Console.WriteLine("cycle: " + cycle);
                    }
                    //Console.WriteLine("cycle: " + source.AttackSpeedMod);
                }
                else
                {
                    cycle = 0;
                    if (source is AIHeroClient)
                    {
                        var tSpell = TargetSpellDatabase.GetByName(sData.Name);
                        if (tSpell == null)
                        {
                            //Console.WriteLine("Unknown targeted spell: " + sData.Name);
                            dealDamage = 0;
                        }
                        else
                        {
                            try
                            {
                                dealDamage = (float)((AIHeroClient)source).GetSpellDamage(target, tSpell.Spellslot);
                            }
                            catch (Exception)
                            {
                                dealDamage = 0;
                            }
                        }
                    }
                    else
                    {
                        dealDamage = 0;
                    }
                }
            }
Esempio n. 3
0
            public DamageMaker(Obj_AI_Base sourceIn, Obj_AI_Base targetIn, GameObject missleIn, SpellData dataIn, bool meleeIn = false)
            {
                source = sourceIn;
                target = targetIn;
                missle = missleIn;
                sData = dataIn;
                melee = !meleeIn;
                createdTick = now;
                isAutoAtack = sData.IsAutoAttack();

                if (isAutoAtack)
                {

                    dealDamage = (float) source.GetAutoAttackDamage(target, true);
                    if (source.IsMelee)
                        cycle = (int) (source.AttackDelay*1000);
                    else
                    {
                        //var dist = source.Distance(target);
                        cycle = (int)((source.AttackDelay * 1000)) /*+ (dist*1000)/sData.MissileSpeed)*/;
                        //Console.WriteLine("cycle: " + cycle);
                    }
                    //Console.WriteLine("cycle: " + source.AttackSpeedMod);
                }
                else
                {
                    cycle = 0;
                    if (source is Obj_AI_Hero)
                    {
                        var tSpell = TargetSpellDatabase.GetByName(sData.Name);
                        if (tSpell == null)
                        {
                            //Console.WriteLine("Unknown targeted spell: " + sData.Name);
                            dealDamage = 0;
                        }
                        else
                        {
                            try
                            {

                                dealDamage = (float)((Obj_AI_Hero)source).GetSpellDamage(target, tSpell.Spellslot);
                            }
                            catch (Exception)
                            {
                                dealDamage = 0;
                            }
                        }
                    }
                    else
                    {
                        dealDamage = 0;
                    }
                }
            }