Esempio n. 1
0
        public static void notifyUpdatedStats(Unit u, bool partial = true)
        {
            //if (u is Monster)
            //    return;
            var us = new SpawnParticle.UpdateStats(u, partial);
            var t = u as Turret;

            if (t != null)
            {
                PacketHandlerManager.getInstace().broadcastPacket(us, Channel.CHL_LOW_PRIORITY, ENet.PacketFlags.Unsequenced);
                return;
            }

            if (!partial)
            {
                PacketHandlerManager.getInstace().broadcastPacketTeam(u.getTeam(), us, Channel.CHL_LOW_PRIORITY, ENet.PacketFlags.Unsequenced);
            }
            else
            {
                PacketHandlerManager.getInstace().broadcastPacketVision(u, us, Channel.CHL_LOW_PRIORITY, ENet.PacketFlags.Unsequenced);
            }
        }
Esempio n. 2
0
        public override void update(long diff)
        {
            if (target == null)
            {
                setToRemove();
                return;
            }

            if (target.isSimpleTarget())
            { // Skillshot
                var objects = map.getObjects();
                foreach (var it in objects)
                {
                    if (isToRemove())
                    {
                        return;
                    }

                    if (collide(it.Value))
                    {
                        if (objectsHit.Contains(it.Value))
                        {
                            continue;
                        }

                        var u = it.Value as Unit;
                        if (u == null)
                        {
                            continue;
                        }

                        if (u.getTeam() == owner.getTeam() && !((flags & (int)SpellFlag.SPELL_FLAG_AffectFriends) > 0))
                        {
                            continue;
                        }

                        if (u.getTeam() != owner.getTeam() && !((flags & (int)SpellFlag.SPELL_FLAG_AffectEnemies) > 0))
                        {
                            continue;
                        }


                        if (u.isDead() && !((flags & (int)SpellFlag.SPELL_FLAG_AffectDead) > 0))
                        {
                            continue;
                        }

                        var m = u as Minion;
                        if (m != null && !((flags & (int)SpellFlag.SPELL_FLAG_AffectMinions) > 0))
                        {
                            continue;
                        }

                        var t = u as Turret;
                        if (t != null && !((flags & (int)SpellFlag.SPELL_FLAG_AffectTurrets) > 0))
                        {
                            continue;
                        }

                        var c = u as Champion;
                        if (c != null && !((flags & (int)SpellFlag.SPELL_FLAG_AffectHeroes) > 0))
                        {
                            continue;
                        }

                        objectsHit.Add(u);
                        originSpell.applyEffects(u, this);
                    }
                }
            }
            else
            {
                var u = target as Unit;
                if (u != null && collide(u))
                { // Autoguided spell
                    if (originSpell != null)
                    {
                        originSpell.applyEffects(u, this);
                    }
                    else
                    { // auto attack
                        owner.autoAttackHit(u);
                        setToRemove();
                    }
                }
            }

            base.update(diff);
        }