Ejemplo n.º 1
0
        public static void HandleParticle(GameObject ob)
        {
            Obj_GeneralParticleEmitter particle = ob as Obj_GeneralParticleEmitter;
            ParticleInfo info = ParticleDatabase.GetParticleInfo(ob.Name);

            if (info == null && MenuHandler.DebugMenu.GetCheckboxValue("Show Particles"))
            {
                Console.WriteLine("\"" + ob.Name + "\",");
            }
            else
            {
                //known particle
                //this is where the particle handler should be
            }
        }
Ejemplo n.º 2
0
        private static void CreatePolygons()
        {
            //reset polygon list to have no entities
            SpellDatabase.Polygons = new List <CustomPolygon>();

            #region Spells
            foreach (SpellInfo info in SpellDatabase.activeSpells)
            {
                if (info.SpellType == SpellInfo.SpellTypeInfo.CircularSkillshot ||
                    info.SpellType == SpellInfo.SpellTypeInfo.CircularSpell ||
                    info.SpellType == SpellInfo.SpellTypeInfo.CircularSpellWithBuff ||
                    info.SpellType == SpellInfo.SpellTypeInfo.CircularSpellWithDuration ||
                    info.SpellType == SpellInfo.SpellTypeInfo.CircularSkillshotDash)
                {
                    if (info.missile != null)
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateCircularSkillshot(info, info.missile.EndPosition, info.Radius));
                    }
                    else
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateCircularSkillshot(info, info.endPosition, info.Radius));
                    }
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.SelfActive || info.SpellType == SpellInfo.SpellTypeInfo.SelfActiveWithBuff || info.SpellType == SpellInfo.SpellTypeInfo.SelfActiveToggleable || info.SpellType == SpellInfo.SpellTypeInfo.SelfActiveNoDamage || info.SpellType == SpellInfo.SpellTypeInfo.SelfActiveNoDamageWithBuff)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateCircularSkillshot(info, info.caster.Position, info.Radius));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.CircularWall)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateCircularWall(info, info.endPosition, info.Radius, info.SecondRadius));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.LinearSpellWithBuff)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.caster.Position, info.caster.Position.Extend(info.caster.Position + info.caster.Direction, info.Range).To3D((int)info.caster.Position.Z), info.Width));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.LinearSpellWithDuration)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.startPosition, info.endPosition, info.Width));
                }
                if (info.SpellType == SpellInfo.SpellTypeInfo.LinearDash)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.caster.Position, info.endPosition, info.Width));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.LinearSkillshot ||
                         info.SpellType == SpellInfo.SpellTypeInfo.LinearMissile ||
                         info.SpellType == SpellInfo.SpellTypeInfo.LinearSkillshotNoDamage)
                {
                    if (info.missile != null)
                    {
                        //sivir Q and draven R return
                        //Graves Q Does not work likes this
                        //Gnar Q returns to where it started
                        if ((info.MissileName.ToLower().Contains("return") && info.MissileName != "GravesQReturn" && info.MissileName != "GnarQMissileReturn") ||
                            ((info.MissileName == "DravenR" || info.MissileName == "TalonWMissileTwo" || info.MissileName == "TalonRMisTwo") &&
                             info.missile.EndPosition.Distance(info.caster.Position) <= 50))
                        {
                            SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.missile.Position, info.missile.SpellCaster.Position, info.Width));
                        }
                        //ahri rotating w orbs
                        else if (info.MissileName == "AhriFoxFireMissile" || info.MissileName == "AhriFoxFireMissileTwo")
                        {
                            if (info.missile.Position.Distance(info.caster.Position) > 200)
                            {
                                SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.missile.Position, info.endPosition, info.Width));
                            }
                        }
                        else
                        {
                            SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.missile.Position, info.endPosition, info.Width));
                        }
                    }
                    //for on spell cast spells that dont have their missiles created yet.
                    else if (info.MissileName == "" && info.BuffName == "")
                    {
                        //the start position was set to info.caster.position. I changed it to info.startPosition to fix JannaQ. This might affect other spells
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateLinearSkillshot(info, info.caster.Position, info.endPosition, info.Width));
                    }
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.TargetedMissile || info.SpellType == SpellInfo.SpellTypeInfo.AutoAttack)
                {
                    if (info.missile != null)
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateTargetedSpell(info, info.missile.Position, info.target));
                    }
                    else
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateTargetedSpell(info, info.caster.Position, info.target));
                    }
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.TargetedDash)
                {
                    if (info.DashType == SpellInfo.Dashtype.Targeted && info.target != null)
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateTargetedSpell(info, info.caster.Position, info.target));
                    }
                    else if (info.DashType == SpellInfo.Dashtype.TargetedLinear && info.target != null)
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateTargetedSpell(info, info.caster.Position, info.endPosition));
                    }
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.ConeSpell)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateCone(info, info.startPosition, info.endPosition, info.ConeDegrees, info.Range));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.ConeSpellWithBuff)
                {
                    if (info.startingDirection == Vector3.Zero || info.SpellName == "MissFortuneBulletTime")
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateCone(info, info.caster.Position, info.caster.Position.Extend(info.caster.Position + info.caster.Direction, info.Range).To3D((int)info.caster.Position.Z), info.ConeDegrees, info.Range));
                    }
                    else
                    {
                        //camille w
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateCone(info, info.caster.Position, info.caster.Position - (info.startPosition - info.startingDirection), info.ConeDegrees, info.Range));
                    }
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.Wall)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateWall(info, info.startPosition, info.endPosition, info.Width, info.Radius));
                }
                else if (info.SpellType == SpellInfo.SpellTypeInfo.ArcSkillshot)
                {
                    SpellDatabase.Polygons.Add(PolygonCreater.CreateArc(info, info.startPosition, info.endPosition, info.Width));
                }
            }
            #endregion

            #region Particles
            foreach (Obj_GeneralParticleEmitter particle in ObjectManager.Get <Obj_GeneralParticleEmitter>())
            {
                ParticleInfo info = ParticleDatabase.GetParticleInfo(particle.Name);

                if (info != null)
                {
                    info.particle = particle;

                    if (info.CreationTime == -1f)
                    {
                        info.CreationTime = Game.Time;
                    }

                    if (info.SpellType == ParticleInfo.SpellTypeInfo.Wall)
                    {
                        SpellDatabase.Polygons.Add(PolygonCreater.CreateRectangleAroundPoint(info, info.Length, info.Width, particle.Position, info.XOffset, info.YOffset));
                    }
                    else if (info.SpellType == ParticleInfo.SpellTypeInfo.CircularSkillshot)
                    {
                        CustomPolygon poly = PolygonCreater.CreateCircularSkillshot(null, particle.Position, info.Radius);
                        poly.partinfo = info;
                        SpellDatabase.Polygons.Add(poly);
                    }
                    else if (info.SpellType == ParticleInfo.SpellTypeInfo.LinearSkillshot)
                    {
                        if (info.ParticleName == "Illaoi_Base_Q_IndicatorBLU.troy")
                        {
                            Obj_AI_Base tentacle = ObjectManager.Get <Obj_AI_Base>().Where(a => a.Name == "God" && a.Position.Distance(particle.Position) <= 10).OrderBy(a => a.Distance(particle)).FirstOrDefault();

                            if (tentacle != null && (tentacle.BaseSkinName == "Illaoi" || info.CanDraw()))
                            {
                                CustomPolygon poly = PolygonCreater.CreateLinearSkillshot(null, tentacle.Position, tentacle.Position.Extend(tentacle.Position + tentacle.Direction, info.Length).To3D((int)tentacle.Position.Z), info.Width);
                                poly.partinfo = info;
                                SpellDatabase.Polygons.Add(poly);
                            }
                        }
                        else
                        {
                            SpellDatabase.Polygons.Add(PolygonCreater.CreateRectangleAroundPoint(info, info.Length, info.Width, particle.Position, info.XOffset, info.YOffset));
                        }
                    }
                }
            }
            #endregion

            #region Traps
            foreach (Obj_AI_Minion trap in ObjectManager.Get <Obj_AI_Minion>().Where(a => a != null && (a.IsEnemy || MenuHandler.DrawMenu.GetCheckboxValue("Draw Friendly Spells/Missiles")) && !a.IsDead && TrapDatabase.AllTrapNames().Contains(a.Name)))
            {
                CustomPolygon poly = PolygonCreater.CreateCircularSkillshot(null, trap.Position, TrapDatabase.getTrap(trap.Name).Radius);
                poly.trap = trap;
                SpellDatabase.Polygons.Add(poly);
            }
            #endregion

            #region Singed Poisons
            List <ParticleInfo> replacementPoisonList = new List <ParticleInfo>();
            foreach (ParticleInfo info in ParticleDatabase.SingedPoisonTrails)
            {
                if (Game.Time - (info.CreationTime + info.Delay) <= 0)
                {
                    CustomPolygon poly = PolygonCreater.CreateCircularSkillshot(null, info.Position, info.Radius);
                    poly.partinfo = info;
                    SpellDatabase.Polygons.Add(poly);
                    replacementPoisonList.Add(info);
                }
            }
            ParticleDatabase.SingedPoisonTrails = replacementPoisonList;
            #endregion
        }