コード例 #1
0
ファイル: InputDamage.cs プロジェクト: OlegGelezcov/neb
 public InputDamage(NebulaObject source, WeaponDamage damage, DamageParams damageParams = null)
 {
     m_Damager = source;
     m_Damage  = damage;
     if (m_Damager)
     {
         var sourceCharacter = source.Character();
         if (sourceCharacter)
         {
             m_Workshop = (Workshop)sourceCharacter.workshop;
             m_Level    = sourceCharacter.level;
         }
         else
         {
             m_Workshop = Workshop.Arlen;
             m_Level    = 1;
         }
         var sourceRaceable = source.Raceable();
         if (sourceRaceable)
         {
             m_Race = (Race)sourceRaceable.race;
         }
         else
         {
             m_Race = Race.None;
         }
     }
     else
     {
         m_Workshop = Workshop.Arlen;
         m_Level    = 1;
         m_Race     = Race.None;
     }
     m_DamageParams = damageParams;
 }
コード例 #2
0
ファイル: Skill_00000404.cs プロジェクト: OlegGelezcov/neb
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var targetObject = source.Target().targetObject;

            if (!targetObject)
            {
                return(false);
            }

            float moveDmgPc = skill.GetFloatInput("move_dmg_pc");
            float time      = skill.GetFloatInput("time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            if (targetObject.IsPlayer() && targetObject.Raceable().race == source.Raceable().race)
            {
                if (source.transform.DistanceTo(targetObject.transform) <= source.Weapon().optimalDistance)
                {
                    source.Skills().Set404(time, moveDmgPc);
                    info.Add((int)SPC.Id, targetObject.Id);
                    return(true);
                }
            }
            return(false);
        }
コード例 #3
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 areaDmgMult = skill.GetFloatInput("dmg_area_mult");
            float radius      = skill.GetFloatInput("radius");

            var weapon    = source.Weapon();
            var character = source.Character();
            var raceable  = source.Raceable();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
            }
            WeaponHitInfo hit;
            var           shot = weapon.Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);

                var targets = GetTargets(source, source.Target().targetObject, radius);

                var genWeapDmg = weapon.GenerateDamage();
                genWeapDmg.Mult(areaDmgMult);
                InputDamage inpDamage = new InputDamage(source, genWeapDmg);
                if (mastery)
                {
                    //inpDamage.SetDamage(inpDamage.damage * 2);
                    inpDamage.Mult(2);
                }
                foreach (var pTarget in targets)
                {
                    pTarget.Value.Damagable().ReceiveDamage(inpDamage);
                }
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
コード例 #4
0
ファイル: Skill_0000042E.cs プロジェクト: OlegGelezcov/neb
        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 dmgAreaMult = skill.GetFloatInput("dmg_area_mult");
            float dmgPc       = skill.GetFloatInput("dmg_pc");
            float dmgTime     = skill.GetFloatInput("dmg_time");
            int   stackCount  = skill.GetIntInput("stack_count");
            float radius      = skill.GetFloatInput("radius");

            var sourceWeapon    = source.Weapon();
            var sourceBonuses   = source.Bonuses();
            var sourceMessage   = source.MmoMessage();
            var sourceCharacter = source.Character();
            var sourceRace      = source.Raceable();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult     *= 2;
                dmgAreaMult *= 2;
                dmgTime     *= 2;
            }

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

            if (hit.normalOrMissed)
            {
                sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);

                var genDmg = sourceWeapon.GenerateDamage();
                genDmg.Mult(dmgAreaMult);
                InputDamage inpDamage = new InputDamage(source, genDmg);

                foreach (var pTarget in GetTargets(source, source.Target().targetObject, radius))
                {
                    pTarget.Value.Damagable().ReceiveDamage(inpDamage);
                    if (sourceBonuses.GetBuffCountWithTag(Common.BonusType.increase_damage_on_pc, skill.data.Id) < stackCount)
                    {
                        Buff buff = new Buff(Guid.NewGuid().ToString(), null, Common.BonusType.increase_damage_on_pc, dmgTime, dmgPc);
                        buff.SetTag(skill.data.Id);
                        sourceBonuses.SetBuff(buff, source);
                    }
                }
                return(true);
            }
            else
            {
                sourceMessage.SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
コード例 #5
0
ファイル: Skill_0000044D.cs プロジェクト: OlegGelezcov/neb
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var weapon = source.Weapon();

            var targets = GetTargets(source, source, weapon.optimalDistance);

            if (targets.Count == 0)
            {
                return(false);
            }

            ConcurrentBag <Item> filteredTargets = new ConcurrentBag <Item>();

            foreach (var pItem in targets)
            {
                filteredTargets.Add(pItem.Value);
                if (filteredTargets.Count >= 3)
                {
                    break;
                }
            }

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

            float damagePerTarget = dmgMult / filteredTargets.Count;
            var   sourceMessage   = source.MmoMessage();

            var sourceCharacter = source.Character();
            var sourceRace      = source.Raceable();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                damagePerTarget *= 2;
                dmgAreaMult     *= 2;
            }

            foreach (var target in filteredTargets)
            {
                WeaponHitInfo hit;
                var           shot = weapon.Fire(target, out hit, skill.data.Id, damagePerTarget);
                if (hit.normalOrMissed)
                {
                    sourceMessage.SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);

                    var nearItems = GetTargets(source, target, radius);

                    WeaponDamage wd = weapon.GenerateDamage();
                    wd.Mult(dmgAreaMult);
                    InputDamage inpDamage = new InputDamage(source, wd);
                    foreach (var pNear in nearItems)
                    {
                        if (NoId(filteredTargets, pNear.Key))
                        {
                            pNear.Value.Damagable().ReceiveDamage(inpDamage);
                        }
                    }
                }
                else
                {
                    sourceMessage.SendShot(Common.EventReceiver.ItemOwner, shot);
                }
            }
            return(true);
        }
コード例 #6
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            float dmgMult         = skill.GetFloatInput("dmg_mult");
            float dmgTimedMult    = skill.GetFloatInput("dmg_timed_mult");
            float time            = skill.GetFloatInput("time");
            var   sourceCharacter = source.Character();
            var   sourceRaceable  = source.Raceable();

            info.SetSkillUseState(SkillUseState.normal);
            if (ShotToEnemyRestricted(source, skill))
            {
                info.SetSkillUseState(SkillUseState.invalidTarget);
                return(false);
            }
            if (NotCheckDistance(source))
            {
                info.SetSkillUseState(SkillUseState.tooFar);
                return(false);
            }

            WeaponHitInfo hit;

            var   sourceWeapon = source.Weapon();
            float baseDamage   = sourceWeapon.GetDamage().totalDamage;
            float timedDamage  = baseDamage * dmgTimedMult;

            //float secondDamage = baseDamage * dmgAreaMult;

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult     *= 2;
                timedDamage *= 2;
                info.SetMastery(true);
            }
            else
            {
                info.SetMastery(false);
            }

            var shot = source.Weapon().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);

                source.Target().targetObject.Damagable().SetTimedDamage(time, timedDamage / time, sourceWeapon.myWeaponBaseType, skill.idInt);

                /*
                 * WeaponDamage sInpWeapDmg = new WeaponDamage(sourceWeapon.myWeaponBaseType);
                 * sInpWeapDmg.SetBaseTypeDamage(secondDamage);
                 * InputDamage inpDamage = new InputDamage(source, sInpWeapDmg);
                 * if(mastery) {
                 *  inpDamage.Mult(2);
                 *  //inpDamage.SetDamage(inpDamage.damage * 2);
                 * }
                 * foreach(var pitem in GetTargets(source, source.Target().targetObject, radius)) {
                 *  pitem.Value.Damagable().ReceiveDamage(inpDamage);
                 * }*/
                return(true);
            }

            return(false);
        }