Ejemplo n.º 1
0
    public void OnStartSkill(NetworkMessage netMsg)
    {
        MObjects.StartSkill mObject = netMsg.ReadMessage <MObjects.StartSkill>();

        MobileAgent ma = MobileAgent.list.Find(x => x.id == mObject.id);

        if (ma == null)
        {
            return;
        }

        if (ma.isController)
        {
            if (mObject.skillType == 1) // area Spell
            {
                ma.castingItem.areaFollower = true;

                ParticleSystem.MainModule mm = areaFollower.indicator.main;
                mm.startSize = mObject.skillSize / 2;
            }
        }

        ma.lastSkill = mObject.skillId;
        ma.castingItem.StartCast(mObject.casttime, ma.skills[mObject.skillId], mObject.skillId);

        ma.Stop();
    }
Ejemplo n.º 2
0
    public void SkillRequest(ushort id)
    {
        if (session.killed)
        {
            return;
        }

        if (nextMove > Time.time)
        {
            return;
        }

        if (id >= skills.Length)
        {
            return;
        }

        if (cooldowns[id] > Time.time) // not cooldown yet.
        {
            return;
        }

        if (_hero.heroType == Callipso.HeroType.Player && agentBuff.buff.buffs.Find(x => x.buffType == Buffing.buffTypes.DamagerObject) != null)
        {
            return; // Players cannot use skill while damager object active.
        }
        skillId    = id;
        skillStart = Time.time + skills[id].casttime - (skills[id].casttime * agentLevel.level.Percent_fastercast / 100f);

        Stop();

        /*
         * INFO OTHERS
         * */

        MObjects.StartSkill mObject = new MObjects.StartSkill();
        mObject.id        = (user != null) ? user.connectionId: customId;
        mObject.skillId   = id;
        mObject.casttime  = skills[id].casttime;
        mObject.skillType = (ushort)skills[id].skillType;
        mObject.skillSize = skills[id].collision;

        int _c = session.users.Count;

        for (int i = 0; i < _c; i++)
        {
            if (NetworkServer.connections.Contains(session.users[i]))
            {
                // send the mobject
                NetworkServer.SendToClient(session.users[i].connectionId, MTypes.StartSkill, mObject);
            }
        }
    }