示例#1
0
        private static void CheckSpellCollision()
        {
            if (ObjectCache.menuCache.cache["CheckSpellCollision"].GetValue <bool>() == false)
            {
                return;
            }

            foreach (KeyValuePair <int, Spell> entry in detectedSpells)
            {
                Spell spell = entry.Value;

                var collisionObject = spell.CheckSpellCollision();

                if (collisionObject != null)
                {
                    spell.predictedEndPos = spell.GetSpellProjection(collisionObject.ServerPosition.To2D());

                    if (spell.currentSpellPosition.Distance(collisionObject.ServerPosition)
                        < collisionObject.BoundingRadius + spell.radius)
                    {
                        DelayAction.Add(1, () => DeleteSpell(entry.Key));
                    }
                }
            }
        }
示例#2
0
        private static void CheckSpellCollision()
        {
            if (ObjectCache.menuCache.cache["CheckSpellCollision"].GetValue <bool>() == false)
            {
                return;
            }

            foreach (KeyValuePair <int, Spell> entry in detectedSpells)
            {
                Spell spell           = entry.Value;
                var   collisionObject = spell.CheckSpellCollision();
                if (collisionObject != null)
                {
                    spell.predictedEndPos = spell.GetSpellProjection(collisionObject.ServerPosition.To2D());

                    if (spell.currentSpellPosition.Distance(collisionObject.ServerPosition) <
                        collisionObject.BoundingRadius + spell.radius)
                    {
                        if (!spell.info.hasEndExplosion || spell.spellType != SpellType.Circular)
                        {
                            DelayAction.Add(1, () => DeleteSpell(entry.Key));
                        }
                    }
                }
            }

            foreach (KeyValuePair <int, CollisionCandidate> entry in collisionObjs)
            {
                CollisionCandidate cand = entry.Value;

                var spellTime = cand.spellTime = EvadeUtils.TickCount - cand.startTick - cand.spellInfo.spellDelay;
                if (spellTime >= 0)
                {
                    cand.currentPos = cand.startPos +
                                      (cand.endPos - cand.startPos).Normalized() * cand.spellInfo.projectileSpeed *
                                      (cand.spellTime / 1000);
                }

                var collisionObj = cand.currentPos.To3D().CheckPositionCollision(cand.endPos.To3D(), cand.spellInfo, false);
                if (collisionObj != null)
                {
                    var data = cand.spellInfo.CopyData();
                    data.spellDelay = 0;

                    foreach (KeyValuePair <int, Spell> value in detectedSpells)
                    {
                        Spell spell = value.Value;

                        if (spell.spellType == SpellType.Line && spell.info.hasEndExplosion)
                        {
                            if (spell.info.spellName == cand.spellInfo.spellName)
                            {
                                DelayAction.Add(1, () => DeleteSpell(value.Key)); // delete the skillshot
                            }
                        }
                    }

                    CreateSpellData(cand.candidateHero, cand.startPos.To3D(), collisionObj.ServerPosition,
                                    data, null, 0, true, SpellType.Circular, false, true); // create the explosion

                    collisionObjs.Remove(cand.candidateId);
                    break;
                }

                DelayAction.Add((int)cand.endTime, () => collisionObjs.Remove(cand.candidateId));
            }
        }