Beispiel #1
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

            float time   = skill.GetFloatInput("time");
            float dmgPc  = skill.GetFloatInput("dmg_pc");
            float healPc = skill.GetFloatInput("heal_pc");

            bool mastery = RollMastery(source);

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

            //DamagableObject targetDamagable = source.GetComponent<PlayerTarget>().targetObject.GetComponent<DamagableObject>();

            //source.GetComponent<PlayerSkills>().AddDamageHealReceiver(new PlayerSkills.DamageReceiver { damagePercent = dmgPc, expireTime = Time.curtime() + time, target = targetDamagable });

            Buff hbuff = new Buff(skill.id + "_heal", null, BonusType.increase_healing_speed_on_pc, time, healPc);
            Buff dbuff = new Buff(skill.id + "_dmg", null, BonusType.increase_damage_on_pc, time, dmgPc);

            source.Bonuses().SetBuff(hbuff, source);
            source.Bonuses().SetBuff(dbuff, source);

            return(true);
        }
Beispiel #2
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

            bool castOnTarget = true;

            if (source.Target().hasTarget)
            {
                if (FriendTargetInvalid(source))
                {
                    castOnTarget = false;
                }
                else
                {
                    if (NotCheckDistance(source))
                    {
                        info.SetSkillUseState(Common.SkillUseState.tooFar);
                        return(false);
                    }
                }
            }
            else
            {
                castOnTarget = false;
            }


            float optimalDistancePc   = skill.data.Inputs.Value <float>("optimal_distance_pc");
            float optimalDistanceTime = skill.data.Inputs.Value <float>("optimal_distance_time");

            bool mastery = RollMastery(source);

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

            if (castOnTarget)
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_optimal_distance_on_pc, optimalDistanceTime, optimalDistancePc);
                source.Target().targetObject.Bonuses().SetBuff(buff, source);
                info.Add((int)SPC.Target, source.Target().targetObject.Id);
                info.Add((int)SPC.TargetType, source.Target().targetObject.Type);
            }
            else
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_optimal_distance_on_pc, optimalDistanceTime, optimalDistancePc);
                source.Bonuses().SetBuff(buff, source);
                info.Add((int)SPC.Target, source.Id);
                info.Add((int)SPC.TargetType, source.Type);
            }
            return(true);
        }
Beispiel #3
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (NotEnemyCheck(source, skill, info))
            {
                return(false);
            }

            var sourceBonuses = source.Bonuses();
            var targetObject  = source.Target().targetObject;
            var targetBonuses = targetObject.Bonuses();

            sourceBonuses.RemoveAnyPositiveBuff();
            targetBonuses.RemoveAnyPositiveBuff();

            float critDamagePc = skill.GetFloatInput("crit_dmg_pc");
            float critChancePc = skill.GetFloatInput("crit_chance_pc");
            float time         = skill.GetFloatInput("time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            Buff critDamageBuff = new Buff(skill.id, null, Common.BonusType.increase_crit_damage_on_pc, time, critDamagePc);
            Buff critChanceBuff = new Buff(skill.id, null, Common.BonusType.increase_crit_chance_on_cnt, time, critChancePc);

            sourceBonuses.SetBuff(critDamageBuff, source);
            sourceBonuses.SetBuff(critChanceBuff, source);
            return(true);
        }
Beispiel #4
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(Common.SkillUseState.normal);
            float time = skill.GetFloatInput("time");
            float hpPc = skill.GetFloatInput("hp_pc");


            bool mastery = RollMastery(source);

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

            //source.Skills().Set41C(time, hpPc);
            source.Bonuses().SetBuff(new Buff(skill.idInt.ToString(), null, Common.BonusType.buff_41c, time, hpPc), source);
            return(true);
        }
Beispiel #5
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            float radius   = skill.GetFloatInput("radius");
            float dmgPc    = skill.GetFloatInput("dmg_pc");
            float dmgTime  = skill.GetFloatInput("dmg_time");
            float dronPc   = skill.GetFloatInput("dron_pc");
            float dronTime = skill.GetFloatInput("dron_time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgPc    *= 2;
                dronTime *= 2;
            }

            ActionOnEnemyTargets((item) => {
                Buff buff = new Buff(skill.id, null, Common.BonusType.decrease_damage_on_pc, dmgTime, dmgPc);
                item.Bonuses().SetBuff(buff, source);
            }, source, source, radius);

            Buff dronBuff = new Buff(skill.id, null, Common.BonusType.increase_dron_strength_on_pc, dronTime, dronPc);

            source.Bonuses().SetBuff(dronBuff, source);
            return(true);
        }
Beispiel #6
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float hpSpeed     = skill.GetDataInput <float>("hp_speed", 0f);
            float hpSpeedTime = skill.GetDataInput <float>("hp_speed_time", 0f);
            float speedPc     = skill.GetDataInput <float>("speed_pc", 0f);
            float speedTime   = skill.GetDataInput <float>("speed_time", 0f);

            bool mastery = RollMastery(source);

            if (mastery)
            {
                hpSpeedTime *= 2;
                speedTime   *= 2;
            }

            var bonuses = source.Bonuses();

            if (bonuses)
            {
                Buff healingBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_healing_speed_on_pc, hpSpeedTime, hpSpeed);
                Buff speedBuff   = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, speedTime, speedPc);
                bonuses.SetBuff(healingBuff, source);
                bonuses.SetBuff(speedBuff, source);
            }
            return(true);
        }
Beispiel #7
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var damagable = source.Damagable();

            float hpPc       = skill.GetFloatInput("hp_pc");
            float hpTime     = skill.GetFloatInput("hp_time");
            float hpBuffPc   = skill.GetFloatInput("hpbuff_pc");
            float hpBuffTime = skill.GetFloatInput("hpbuff_time");

            float  hpForSec = damagable.maximumHealth * hpPc / hpTime;
            string id       = source.Id + skill.data.Id.ToString();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                hpForSec   *= 2;
                hpBuffTime *= 2;
            }

            damagable.SetRestoreHPPerSec(hpForSec, hpTime, id);



            Buff buff = new Buff(skill.id, null, Common.BonusType.increase_healing_speed_on_pc, hpBuffTime, hpBuffPc);

            source.Bonuses().SetBuff(buff, source);
            return(true);
        }
Beispiel #8
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            float hpRestorePc = skill.GetFloatInput("hp_restore_pc");
            float maxHpPc     = skill.GetFloatInput("max_hp_pc");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                maxHpPc     *= 2;
                hpRestorePc *= 2;
            }

            var   damagable  = source.Damagable();
            float restoredHp = hpRestorePc * damagable.baseMaximumHealth;

            damagable.RestoreHealth(source, restoredHp);

            var skills = source.Skills();

            Buff buff = new Buff(skill.data.Id.ToString(), source, Common.BonusType.increase_max_hp_on_pc, -1, maxHpPc, () => {
                return(true);
            }, skill.data.Id);

            source.Bonuses().SetBuff(buff, source);
            return(true);
        }
Beispiel #9
0
        //private static readonly ILogger log = LogManager.GetCurrentClassLogger();

        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

            float pc      = skill.GetFloatInput("hpdmg_pc");
            float time    = skill.GetFloatInput("time");
            var   bonuses = source.Bonuses();

            bool mastery = RollMastery(source);

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

            Buff damageBuff  = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_damage_on_pc, time, pc);
            Buff healingBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_healing_on_pc, time, pc);

            //log.InfoFormat("set damage and healing buff {0}:{1} green", pc, time);
            bonuses.SetBuff(damageBuff, source);
            bonuses.SetBuff(healingBuff, source);
            return(true);
        }
Beispiel #10
0
        private void RemoveEnergyBuff(NebulaObject target, int skillID)
        {
            string buffID = target.Id + skillID;

            if (target != null && target.Bonuses() != null)
            {
                target.GetComponent <PlayerBonuses>().RemoveBuff(BonusType.decrease_max_energy_on_cnt, buffID);
            }
        }
Beispiel #11
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(Common.SkillUseState.normal);

            bool castOnTarget = true;

            if (source.Target().hasTarget)
            {
                if (FriendTargetInvalid(source))
                {
                    info.SetSkillUseState(Common.SkillUseState.invalidTarget);
                    castOnTarget = false;
                }
                else
                {
                    if (NotCheckDistance(source))
                    {
                        info.SetSkillUseState(Common.SkillUseState.tooFar);
                        castOnTarget = false;
                    }
                }
            }
            else
            {
                castOnTarget = false;
            }

            float hpPc   = skill.GetFloatInput("hp_pc");
            float hpTime = skill.GetFloatInput("hp_time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                hpTime *= 2;
                hpPc   *= 2;
                info.SetMastery(true);
            }
            else
            {
                info.SetMastery(false);
            }
            //source.Skills().Set415(hpTime, hpPc);

            if (castOnTarget)
            {
                source.Target().targetObject.Bonuses().SetBuff(new Buff(skill.data.Id.ToString() + source.Id, null, Common.BonusType.increase_healing_speed_on_pc, hpTime, hpPc), source);
            }
            else
            {
                source.Bonuses().SetBuff(new Buff(skill.data.Id.ToString() + source.Id, null, Common.BonusType.increase_healing_speed_on_pc, hpTime, hpPc), source);
            }

            return(true);
        }
Beispiel #12
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 speedPc   = skill.GetFloatInput("speed_pc");
            float speedTime = skill.GetFloatInput("speed_time");
            float radius    = skill.GetFloatInput("radius");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult   *= 2;
                speedTime *= 2;
            }
            var           sourceWeapon  = source.Weapon();
            var           sourceBonuses = source.Bonuses();
            WeaponHitInfo hit;
            var           shot = sourceWeapon.Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);
                Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, speedTime, speedPc);
                sourceBonuses.SetBuff(buff, source);

                foreach (var ally in GetHealTargets(source, source, radius))
                {
                    Buff buff2 = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, speedTime, speedPc);
                    ally.Value.Bonuses().SetBuff(buff2, source);
                }
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Beispiel #13
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            if (NotEnemyCheck(source, skill, info))
            {
                ResetCounter();
                return(false);
            }


            var dmgMult = skill.GetFloatInput("dmg_mult");
            var hpPc    = skill.GetFloatInput("hp_pc");
            var hpTime  = skill.GetFloatInput("hp_time");

            mUseCounter++;
            if (source.Skills().lastSkill != skill.data.Id)
            {
                mUseCounter = 0;
            }

            mUseCounter = Mathf.Clamp(mUseCounter, 0, 2);
            dmgMult     = ModifyDamageMult(dmgMult);

            bool mastery = RollMastery(source);

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

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

            if (hit.normalOrMissed)
            {
                Buff buff = new Buff(skill.id, null, Common.BonusType.increase_healing_speed_on_pc, hpTime, hpPc);
                source.Bonuses().SetBuff(buff, source);
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Beispiel #14
0
        private void SetEnergyDebuff(NebulaObject target, int skillID, float energyMOD)
        {
            string buffID = target.Id + skillID;

            if (target != null)
            {
                if (target.Skills() && target.Bonuses())
                {
                    Buff buff = new Buff(buffID, target, BonusType.decrease_max_energy_on_cnt, -1, energyMOD, () => true, skillID);

                    target.GetComponent <PlayerBonuses>().SetBuff(buff, buff.owner);
                }
            }
        }
Beispiel #15
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (NotEnemyCheck(source, skill, info))
            {
                return(false);
            }
            var           targetObject  = source.Target().targetObject;
            var           sourceWeapon  = source.Weapon();
            var           sourceBonuses = source.Bonuses();
            WeaponHitInfo hit;

            float dmgMult   = skill.GetFloatInput("dmg_mult");
            float speedPc   = skill.GetFloatInput("speed_pc");
            float speedTime = skill.GetFloatInput("speed_time");
            float radius    = skill.GetFloatInput("radius");

            bool mastery = RollMastery(source);

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

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

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

                var items = GetTargets(source, targetObject, radius);
                foreach (var pItem in items)
                {
                    var  item        = pItem.Value;
                    var  itemBonuses = item.Bonuses();
                    Buff speedDebuff = new Buff(skill.id, null, Common.BonusType.decrease_speed_on_pc, speedTime, speedPc);
                    itemBonuses.SetBuff(speedDebuff, source);
                }
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Beispiel #16
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float resistPc   = skill.GetFloatInput("resist_pc");
            float resistTime = skill.GetFloatInput("resist_time");
            bool  mastery    = RollMastery(source);

            if (mastery)
            {
                resistTime *= 2;
            }

            Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_pc, resistTime, resistPc);

            source.Bonuses().SetBuff(buff, source);
            return(true);
        }
Beispiel #17
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 critDmgPc   = skill.GetFloatInput("crit_dmg_mult");
            float critDmgTime = skill.GetFloatInput("crit_dmg_time");

            var weapon  = source.Weapon();
            var bonuses = source.Bonuses();

            bool mastery = RollMastery(source);

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

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

            if (hit.normalOrMissed)
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_crit_damage_on_pc, critDmgTime, critDmgPc);
                bonuses.SetBuff(buff, source);
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Beispiel #18
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var sourceTarget = source.Target();

            bool  settedOnTarget = false;
            float time           = skill.GetFloatInput("time");
            bool  mastery        = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            if (sourceTarget.targetObject)
            {
                var targetCharacter = sourceTarget.targetObject.Character();
                if (targetCharacter)
                {
                    var sourceCharacter = source.Character();
                    if (sourceCharacter.RelationTo(targetCharacter) == Common.FractionRelation.Friend)
                    {
                        var sourceWeapon = source.Weapon();
                        if (source.transform.DistanceTo(sourceTarget.targetObject.transform) <= sourceWeapon.optimalDistance)
                        {
                            var targetBonuses = sourceTarget.targetObject.Bonuses();
                            if (targetBonuses)
                            {
                                Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.speed_debuff_immunity, time);
                                targetBonuses.SetBuff(buff, source);
                                settedOnTarget = true;
                            }
                        }
                    }
                }
            }

            if (!settedOnTarget)
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.speed_debuff_immunity, time);
                source.Bonuses().SetBuff(buff, source);
            }
            return(true);
        }
Beispiel #19
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);
            }

            var           targetObject  = source.Target().targetObject;
            var           sourceWeapon  = source.Weapon();
            var           sourceBonuses = source.Bonuses();
            WeaponHitInfo hit;
            float         dmgMult = skill.GetFloatInput("dmg_mult");
            float         hpPc    = skill.GetFloatInput("hp_pc");

            bool mastery = RollMastery(source);

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

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

            if (hit.normalOrMissed)
            {
                sourceWeapon.Heal(source, source.Damagable().maximumHealth *hpPc);
                source.MmoMessage().SendShot(Common.EventReceiver.OwnerAndSubscriber, shot);
                return(true);
            }
            else
            {
                source.MmoMessage().SendShot(Common.EventReceiver.ItemOwner, shot);
                return(false);
            }
        }
Beispiel #20
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

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

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            source.Damagable().SetIgnoreDamage(time);
            Buff blockWeaponDebuff = new Buff(skill.id, null, Common.BonusType.block_weapon, time);

            source.Bonuses().SetBuff(blockWeaponDebuff, source);
            return(true);
        }
Beispiel #21
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (ShotToEnemyRestricted(source, skill))
            {
                return(false);
            }

            var targetObject = source.Target().targetObject;
            var sourceShip   = source.GetComponent <BaseShip>();
            var targetShip   = targetObject.GetComponent <BaseShip>();

            if ((!sourceShip) || (!targetShip))
            {
                return(false);
            }

            var sourceBonuses = source.Bonuses();
            var targetBonuses = targetObject.Bonuses();

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

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            //decrated skill do nothing (only for icons)
            Buff sourceDebuff = new Buff(skill.id, null, Common.BonusType.block_resist, time);

            sourceBonuses.SetBuff(sourceDebuff, source);
            sourceShip.BlockResist(time);

            //decorated skill do nothing (only for icons)
            Buff targetDebuff = new Buff(skill.id, null, Common.BonusType.block_resist, time);

            targetBonuses.SetBuff(targetDebuff, source);
            targetShip.BlockResist(time);
            return(true);
        }
Beispiel #22
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            var ship = source.PlayerShip();

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

            float hpPc      = skill.GetFloatInput("hp_pc");
            float maxResist = skill.GetFloatInput("max_resist");
            float speedPc   = skill.GetFloatInput("speed_pc");
            float time      = skill.GetFloatInput("time");

            var damagable = source.Damagable();

            var bonuses = source.Bonuses();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            if (damagable.health < damagable.maximumHealth * hpPc)
            {
                float currentResistance    = ship.commonResist;
                float resistanceDifference = Mathf.ClampLess(maxResist - currentResistance, 0f);
                Buff  buff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, time, resistanceDifference);
                bonuses.SetBuff(buff, source);
            }

            Buff speedBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_speed_on_pc, time, speedPc);

            bonuses.SetBuff(speedBuff, source);
            return(true);
        }
Beispiel #23
0
        public override bool CheckExpire(NebulaObject contextObject)
        {
            var bonuses = contextObject.Bonuses();

            if (CommonUtils.SecondsFrom1970() > expireTime)
            {
                bonuses.RemoveBuffs(BonusType.increase_exp_on_pc);
                return(true);
            }
            else
            {
                var result = bonuses.Contains(BonusType.increase_exp_on_pc, "ExpTimedEffect", m_EffectTag);

                switch (result)
                {
                case BuffSearchResult.NotContains: {
                    //s_Log.InfoFormat("Not contains buff: create new".Color(LogColor.orange));
                    RecreateBonus(bonuses);
                }
                break;

                case BuffSearchResult.ContainsWithDifferentTag: {
                    //s_Log.InfoFormat("Contains buff with different tag: remove old and create new buff".Color(LogColor.orange));
                    bonuses.RemoveBuffs(BonusType.increase_exp_on_pc);
                    RecreateBonus(bonuses);
                }
                break;

                case BuffSearchResult.Contains: {
                    //s_Log.InfoFormat("already contains same buff: do nothing".Color(LogColor.orange));
                }
                break;
                }
                return(false);
            }
        }
Beispiel #24
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float cdPc      = skill.GetFloatInput("cd_pc");
            float cdTime    = skill.GetFloatInput("cd_time");
            float speedPc   = skill.GetFloatInput("speed_pc");
            float speedTime = skill.GetFloatInput("speed_time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                cdTime    *= 2;
                speedTime *= 2;
            }

            Buff cdBuff        = new Buff(skill.id, null, Common.BonusType.decrease_cooldown_on_pc, cdTime, cdPc);
            Buff speedBuff     = new Buff(skill.id, null, Common.BonusType.increase_speed_on_pc, speedTime, speedPc);
            var  sourceBonuses = source.Bonuses();

            sourceBonuses.SetBuff(cdBuff, source);
            sourceBonuses.SetBuff(speedBuff, source);
            return(true);
        }
Beispiel #25
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(Common.SkillUseState.normal);

            bool castOnTarget = true;

            if (source.Target().hasTarget)
            {
                if (FriendTargetInvalid(source))
                {
                    castOnTarget = false;
                }
                else
                {
                    if (NotCheckDistance(source))
                    {
                        info.SetSkillUseState(Common.SkillUseState.tooFar);
                        return(false);
                    }
                }
            }
            else
            {
                castOnTarget = false;
            }


            float dmgMult        = skill.GetFloatInput("dmg_mult");
            var   weapon         = source.Weapon();
            float damage         = weapon.GetDamage().totalDamage;
            float absorbedDamage = dmgMult * damage;

            //NebulaObject target = null;
            //if(CheckForHealAlly(source)) {
            //    target = source.Target().targetObject;
            //} else {
            //    target = source;
            //}

            bool mastery = RollMastery(source);

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

            if (castOnTarget)
            {
                source.Target().targetObject.Bonuses().SetAbsrobBuff(absorbedDamage, source);
            }
            else
            {
                source.Bonuses().SetAbsrobBuff(absorbedDamage, source);
            }

            //target.Damagable().SetAbsorbDamage(absorbedDamage);
            return(true);
        }
Beispiel #26
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            var targetObject = source.Target().targetObject;

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

            var weapon = source.Weapon();

            if (Mathf.Approximately(weapon.HitProbTo(targetObject), 0f))
            {
                log.InfoFormat("Skill {0} error: hit prob is 0", skill.data.Id.ToString("X8"));
                return(false);
            }

            float dmgMult          = skill.GetFloatInput("dmg_mult");
            float critChanceForBot = skill.GetFloatInput("crit_chance");
            float maxCrit          = skill.GetFloatInput("max_crit");
            float time             = skill.GetFloatInput("time");
            float radius           = skill.GetFloatInput("radius");

            var character = source.Character();


            var targets = source.mmoWorld().GetItems((item) => {
                var damagable     = item.Damagable();
                var itemCharacter = item.Character();
                if (damagable && itemCharacter)
                {
                    var relation = character.RelationTo(itemCharacter);
                    if (relation == FractionRelation.Enemy || relation == FractionRelation.Neutral)
                    {
                        if (targetObject.transform.DistanceTo(item.transform) <= radius)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            });

            bool mastery = RollMastery(source);

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

            foreach (var pTarget in targets)
            {
                WeaponHitInfo hit;
                var           shot = weapon.Fire(pTarget.Value, out hit, skill.data.Id, dmgMult, forceShot: true);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shot);
            }

            float critChanceBuffValue = Mathf.Clamp(targets.Count * critChanceForBot, 0, maxCrit);

            if (!Mathf.Approximately(0f, critChanceBuffValue))
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_crit_chance_on_cnt, time, critChanceBuffValue);
                source.Bonuses().SetBuff(buff, source);
            }
            return(true);
        }
Beispiel #27
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 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);
            }
        }
Beispiel #28
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (!source)
            {
                return(false);
            }

            int   dronCount = skill.data.Inputs.Value <int>("dron_count");
            float dmgMult   = skill.data.Inputs.Value <float>("dron_dmg_mult");

            var sourceCharacter = source.GetComponent <CharacterObject>();
            var sourceWeapon    = source.GetComponent <BaseWeapon>();
            var sourceBonuses   = source.Bonuses();


            var items = (source.world as MmoWorld).GetItems((item) => {
                var itemCharacter = item.GetComponent <CharacterObject>();
                var itemDamagable = item.GetComponent <DamagableObject>();
                if (itemCharacter && itemDamagable)
                {
                    if (sourceCharacter.RelationTo(itemCharacter) == FractionRelation.Enemy)
                    {
                        if (sourceWeapon.HitProbTo(item) >= 0.01f)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            });


            int itemCount = items.Count;

            if (itemCount == 0)
            {
                return(false);
            }


            int counter = 0;

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
            }

            foreach (var itemPair in items)
            {
                if (counter >= Math.Min(dronCount, itemCount))
                {
                    break;
                }

                WeaponHitInfo hit;
                dmgMult = dmgMult * (1f + sourceBonuses.dronStrengthPcBonus) + sourceBonuses.dronStrengthCntBonus;

                var shotInfo = sourceWeapon.Fire(itemPair.Value, out hit, skill.data.Id, dmgMult);
                if (hit.normalOrMissed)
                {
                    source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                }
                counter++;
            }
            return(true);
        }
Beispiel #29
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(Common.SkillUseState.normal);

            bool castOnTarget = true;

            if (source.Target().hasTarget)
            {
                if (FriendTargetInvalid(source))
                {
                    castOnTarget = false;
                }
                else
                {
                    if (NotCheckDistance(source))
                    {
                        info.SetSkillUseState(Common.SkillUseState.tooFar);
                        return(false);
                    }
                }
            }
            else
            {
                castOnTarget = false;
            }
            float time    = skill.GetFloatInput("time");
            bool  mastery = RollMastery(source);

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

            string id = GetBuffId(skill, source);

            if (castOnTarget)
            {
                var sourceTarget = source.Target();
                sourceTarget.targetObject.Bonuses().SetBuff(new Buff(id, null, Common.BonusType.block_debuff, time, 1), source);
                info.Add((int)SPC.Target, sourceTarget.targetId);
                info.Add((int)SPC.TargetType, sourceTarget.targetType);
            }
            else
            {
                source.Bonuses().SetBuff(new Buff(id, null, Common.BonusType.block_debuff, time, 1), source);
                info.Add((int)SPC.Target, source.Id);
                info.Add((int)SPC.TargetType, source.Type);
            }


            /*
             * if(!CheckForShotFriend(source, skill)) {
             *  return false;
             * }
             *
             * var targetBonuses = source.GetComponent<PlayerTarget>().targetObject.GetComponent<PlayerBonuses>();
             * targetBonuses.RemoveBuffs(Common.BonusType.decrease_resist_on_cnt);
             * targetBonuses.RemoveBuffs(Common.BonusType.decrease_resist_on_pc);*/

            return(true);
        }
Beispiel #30
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            info.SetSkillUseState(Common.SkillUseState.normal);

            bool castOnTarget = true;

            if (source.Target().hasTarget)
            {
                if (FriendTargetInvalid(source))
                {
                    info.SetSkillUseState(Common.SkillUseState.invalidTarget);
                    //return false;
                    castOnTarget = false;
                }
                else
                {
                    if (NotCheckDistance(source))
                    {
                        info.SetSkillUseState(Common.SkillUseState.tooFar);
                        //return false;
                        castOnTarget = false;
                    }
                }
            }
            else
            {
                castOnTarget = false;
            }

            float healMult   = skill.GetFloatInput("heal_mult");
            float resistPc   = skill.GetFloatInput("resist_pc");
            float resistTime = skill.GetFloatInput("resist_time");


            float damage  = source.Weapon().GetDamage().totalDamage;
            float healing = damage * healMult;

            bool mastery = RollMastery(source);

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

            NebulaObject targetObject = null;

            if (castOnTarget)
            {
                targetObject = source.Target().targetObject;
                var heal = source.Weapon().Heal(targetObject, healing, skill.data.Id);
                source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal);
                Buff resistBuff = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, resistTime, resistPc);
                targetObject.Bonuses().SetBuff(resistBuff, source);
            }

            targetObject = source;
            var heal2 = source.Weapon().Heal(targetObject, healing, skill.data.Id);

            source.MmoMessage().SendHeal(Common.EventReceiver.OwnerAndSubscriber, heal2);
            Buff resistBuff2 = new Buff(skill.data.Id.ToString(), null, Common.BonusType.increase_resist_on_cnt, resistTime, resistPc);

            targetObject.Bonuses().SetBuff(resistBuff2, source);


            return(true);
        }