Exemple #1
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(Common.SkillUseState.normal);
            if (ShotToEnemyRestricted(source, skill))
            {
                info.SetSkillUseState(Common.SkillUseState.invalidTarget);
                return(false);
            }
            if (NotCheckDistance(source))
            {
                info.SetSkillUseState(Common.SkillUseState.tooFar);
                return(false);
            }

            float dmgMult = skill.GetFloatInput("dmg_mult");
            float radius  = skill.GetFloatInput("radius");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
                radius  *= 2;
            }

            BaseWeapon          sourceWeapon = source.Weapon();
            MmoMessageComponent message      = source.MmoMessage();
            NebulaObject        targetObject = source.Target().targetObject;
            WeaponHitInfo       hit;

            Hashtable shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                message.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);
                ConcurrentDictionary <string, Item> targets = GetTargets(source, targetObject, radius);
                int counter = 0;
                foreach (var pTarget in targets)
                {
                    var shot2 = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult);
                    message.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot2);
                    counter++;
                    if (counter == 2)
                    {
                        break;
                    }
                }
                return(true);
            }
            else
            {
                message.SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Exemple #2
0
        public void MakeShot()
        {
            if (!ready || !m_Target || !m_Pet || (m_Pet.info == null))
            {
                return;
            }
            if (!m_Target.targetObject)
            {
                return;
            }

            if (m_Pet.info.damageType == Common.WeaponDamageType.damage)
            {
                WeaponHitInfo hit;
                Hashtable     shot = Fire(m_Target.targetObject, out hit);
                if (hit.normalOrMissed)
                {
                    m_Message.SendShot(Common.EventReceiver.ItemSubscriber, shot);
                    ResetTimer();
                }
            }
            else if (m_Pet.info.damageType == Common.WeaponDamageType.heal)
            {
                Hashtable heal = Heal(m_Target.targetObject, GetDamage(false).totalDamage);
                m_Message.SendHeal(Common.EventReceiver.ItemSubscriber, heal);
                ResetTimer();
            }
        }