public string GetKillOtherPlayerMessage(PlayerCharacterObject player, NebulaObject enemy)
        {
            MmoWorld       world          = player.nebulaObject.mmoWorld();
            RaceableObject playerRaceable = player.GetComponent <RaceableObject>();

            PlayerCharacterObject enemyCharacter = enemy.GetComponent <PlayerCharacterObject>();
            RaceableObject        enemyRaceable  = enemy.GetComponent <RaceableObject>();

            string systemName     = world.Resource().Zones.GetZoneName(world.Name);
            string playerName     = player.characterName;
            string playerRaceName = world.Resource().Zones.GetRaceName(playerRaceable.getRace());

            string sourceCoalitionName = player.guildName;

            if (sourceCoalitionName == null)
            {
                sourceCoalitionName = string.Empty;
            }

            string enemyName     = enemyCharacter.characterName;
            string enemyRaceName = world.Resource().Zones.GetRaceName(enemyRaceable.getRace());

            string enemyCoalitionName = enemyCharacter.guildName;

            if (enemyCoalitionName == null)
            {
                enemyCoalitionName = string.Empty;
            }

            return(string.Format("scm11:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enrace={5};encoal={6}",
                                 world.Name, playerName, playerRaceable.race, sourceCoalitionName,
                                 enemyName, enemyRaceable.race, enemyCoalitionName));
        }
示例#2
0
        public void OnEnemyDeath(NebulaObject enemy)
        {
            logger.Info($"{LOG_TAG}: enemy was killed {enemy.getItemType()}=>{enemy.Id}");

            if (enemy.getItemType() == ItemType.Bot)
            {
                var botComponent = enemy.GetComponent <BotObject>();
                if (botComponent?.getSubType() == BotItemSubType.StandardCombatNpc)
                {
                    var enemyCharacterObject = enemy.GetComponent <CharacterObject>();
                    if (enemyCharacterObject != null)
                    {
                        Workshop eClass        = (Workshop)enemyCharacterObject.workshop;
                        int      eLevel        = enemyCharacterObject.level;
                        var      shipComponent = enemy.GetComponent <BotShip>();
                        if (shipComponent != null)
                        {
                            ObjectColor eColor = NebulaEnumUtils.GetColorForDifficulty(shipComponent.difficulty);
                            KilledNpc = new QuestKilledNpc(eLevel, eClass, eColor, botComponent.botGroup);
                            TryCompleteQuest(sendUpdate: true);
                        }
                    }
                }
            }
        }
示例#3
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float dmgMult       = skill.data.Inputs.Value <float>("dmg_mult");
            float dmgPerSecPC   = skill.data.Inputs.Value <float>("dmg_per_sec_pc");
            float dmgPerSecTime = skill.data.Inputs.Value <float>("dmg_per_sec_time");

            string id = skill.data.Id.ToString();

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

            var sourceWeapon = source.GetComponent <BaseWeapon>();

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
            }

            WeaponHitInfo hit;
            var           shotInfo = sourceWeapon.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                var targ = source.GetComponent <PlayerTarget>().targetObject;
                if (targ)
                {
                    if (mastery)
                    {
                        dmgPerSecTime *= 2;
                    }

                    targ.GetComponent <DamagableObject>().SetTimedDamage(dmgPerSecTime, hit.actualDamage.totalDamage * dmgPerSecPC, sourceWeapon.myWeaponBaseType, skill.idInt);
                }
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }
示例#4
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (!source)
            {
                log.InfoFormat("Skill {0} error: source invalid", skill.data.Id.ToString("X8"));
                return(false);
            }

            float  buffDamagePercent  = skill.data.Inputs.Value <float>("b_dmg_pc");
            float  buffDamageInterval = skill.data.Inputs.Value <float>("b_dmg_interval");
            float  damageMult         = skill.data.Inputs.Value <float>("dmg_mult");
            string id = source.Id + skill.data.Id;

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

            bool mastery = RollMastery(source);

            if (mastery)
            {
                damageMult *= 2;
            }
            WeaponHitInfo hit;
            var           shotInfo = source.Weapon().GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, damageMult);

            if (hit.normalOrMissed)
            {
                if (mastery)
                {
                    buffDamageInterval *= 2;
                }
                Buff damageBuff = new Buff(id, null, BonusType.increase_damage_on_pc, buffDamageInterval, buffDamagePercent);
                source.GetComponent <PlayerBonuses>().SetBuff(damageBuff, source);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                log.InfoFormat("Skill {0} error: hit to target not allowed", skill.data.Id.ToString("X8"));
                return(false);
            }
        }
示例#5
0
        protected bool CheckForShotFriend(NebulaObject source, PlayerSkill skill)
        {
            var sourceTarget = source.GetComponent <PlayerTarget>();

            if (!sourceTarget.hasTarget)
            {
                log.InfoFormat("Skill {0} error: source don't have target", skill.data.Id.ToString("X8"));
                return(false);
            }
            if (!sourceTarget.targetObject)
            {
                log.InfoFormat("Skill {0} error: source target object invalid", skill.data.Id.ToString("X8"));
                return(false);
            }
            var sourceWeapon = source.GetComponent <BaseWeapon>();

            if (!sourceWeapon)
            {
                log.InfoFormat("Skill {0} error: source don't has weapon", skill.data.Id.ToString("X8"));
                return(false);
            }
            //if (Mathf.Approximately(sourceWeapon.HitProbTo(sourceTarget.nebulaObject), 0f)) {
            //    log.InfoFormat("Skill {0} error: hit prob is 0", skill.data.Id.ToString("X8"));
            //    return false;
            //}

            var targetBonuses = sourceTarget.targetObject.GetComponent <PlayerBonuses>();

            if (!targetBonuses)
            {
                log.InfoFormat("Skill {0} error: target don't has Bonuses component", skill.data.Id.ToString("X8"));
                return(false);
            }

            var sourceCharacter = source.GetComponent <CharacterObject>();
            var targetCharacter = sourceTarget.targetObject.GetComponent <CharacterObject>();

            if (!sourceTarget || !targetCharacter)
            {
                log.InfoFormat("Skill {0} error: source or target don't has character component", skill.data.Id.ToString("X8"));
                return(false);
            }


            if (sourceCharacter.RelationTo(targetCharacter) == FractionRelation.Enemy)
            {
                log.InfoFormat("Skill {0} error: source and target in friend fraction, source fraction = {1}, target fraction = {2}",
                               skill.data.Id.ToString("X8"), (FractionType)(byte)sourceCharacter.fraction, (FractionType)(byte)targetCharacter.fraction);
                return(false);
            }
            return(true);
        }
示例#6
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            if (!source)
            {
                return(false);
            }
            float dmgMult       = skill.data.Inputs.Value <float>("dmg_mult");
            float critDmgPc     = skill.data.Inputs.Value <float>("crit_dmg_pc");
            float critDmgPcTime = skill.data.Inputs.Value <float>("crit_dmg_pc_time");

            var sourceBonuses = source.GetComponent <PlayerBonuses>();
            var sourceWeapon  = source.GetComponent <BaseWeapon>();

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

            bool mastery = RollMastery(source);

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

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

            if (hit.normalOrMissed)
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_crit_damage_on_pc, critDmgPcTime, critDmgPc);
                sourceBonuses.SetBuff(buff, source);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }
示例#7
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float dmgMult    = skill.data.Inputs.Value <float>("dmg_mult");
            float resistPc   = skill.data.Inputs.Value <float>("resist_pc");
            float resistTime = skill.data.Inputs.Value <float>("resist_time");

            string debuffID = skill.data.Id.ToString();

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

            var sourceWeapon  = source.GetComponent <BaseWeapon>();
            var targetBonuses = source.GetComponent <PlayerTarget>().targetObject.GetComponent <PlayerBonuses>();

            WeaponHitInfo hit;
            bool          mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
            }

            var shotInfo = sourceWeapon.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                if (mastery)
                {
                    resistTime *= 2;
                }
                Buff resistDebuff = new Buff(debuffID, null, BonusType.decrease_resist_on_pc, resistTime, resistPc);
                targetBonuses.SetBuff(resistDebuff, source);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }
示例#8
0
        //private static readonly ILogger log = LogManager.GetCurrentClassLogger();

        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            //log.Info("USE 3E9");
            info = new Hashtable();
            float decreaseSpeedPercent = skill.data.Inputs.Value <float>("decrease_speed_pc");
            float dmgMult = skill.data.Inputs.Value <float>("dmg_mult");

            string id = source.Id + skill.data.Id;

            info.SetSkillUseState(SkillUseState.normal);
            if (!CheckForShotEnemy(source, skill))
            {
                info.SetSkillUseState(SkillUseState.invalidTarget);
                return(false);
            }

            if (NotCheckDistance(source))
            {
                info.SetSkillUseState(SkillUseState.tooFar);
                return(false);
            }

            if (RollMastery(source))
            {
                dmgMult *= 2;
            }

            WeaponHitInfo hit;
            var           sourceWeapon  = source.Weapon();
            var           targetBonuses = source.Target().targetObject.Bonuses();

            var shotInfo = sourceWeapon.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                //log.Info("HIT ALLOWED");
                float speedCount  = source.GetComponent <MovableObject>().normalSpeed *decreaseSpeedPercent;
                Buff  speedDebuff = new Buff(id, null, BonusType.decrease_speed_on_cnt, skill.data.Durability, speedCount);
                targetBonuses.SetBuff(speedDebuff, source);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                log.Info("HIT NOT ALLOWED");
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                log.InfoFormat("Skill {0} error: hit to target not allowed", skill.data.Id.ToString("X8"));
                return(false);
            }
        }
示例#9
0
        /// <summary>
        /// When enemy death we are send chat message to all player about this event if
        /// 1) enemy is orange NPC
        /// 2) i kill other player
        /// </summary>
        /// <param name="enemy">Enemy who was killed</param>
        public void OnEnemyDeath(NebulaObject enemy)
        {
            try {
                //log.InfoFormat(string.Format("PlayerCharacter:OnEnemyDeath()->{0}", enemy.Id));

                switch (enemy.getItemType())
                {
                case ItemType.Bot: {
                    BotObject botObject = enemy.GetComponent <BotObject>();
                    if (botObject != null)
                    {
                        switch (botObject.getSubType())
                        {
                        case BotItemSubType.Drill:
                        case BotItemSubType.Outpost:
                        case BotItemSubType.MainOutpost: {
                            mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                            break;
                        }

                        case BotItemSubType.StandardCombatNpc: {
                            ShipWeapon enemyWeapon = enemy.GetComponent <ShipWeapon>();
                            BotShip    enemyShip   = enemy.GetComponent <BotShip>();

                            if (enemyWeapon != null && enemyShip != null)
                            {
                                if (enemyWeapon.weaponDifficulty == Difficulty.boss || enemyWeapon.weaponDifficulty == Difficulty.boss2 ||
                                    enemyShip.difficulty == Difficulty.boss || enemyShip.difficulty == Difficulty.boss2)
                                {
                                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillStandardNPCMessage(this, enemy));
                                }
                            }
                        }
                        break;
                        }
                    }
                }
                break;

                case ItemType.Avatar: {
                    mPlayer.application.updater.SendChatBroadcast(m_ChatComposer.GetKillOtherPlayerMessage(this, enemy));
                }
                break;
                }
            } catch (System.Exception exception) {
                log.InfoFormat("PlayerCharacter.OnEnemyDeath() exception: {0}", exception.Message);
                log.InfoFormat(exception.StackTrace);
            }
        }
示例#10
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            if (!source)
            {
                return(false);
            }
            float dmgDebuffPc   = skill.data.Inputs.Value <float>("dmg_debuff_pc");
            float dmgDebuffTime = skill.data.Inputs.Value <float>("dmg_debuff_time");
            float dmgBuffPc     = skill.data.Inputs.Value <float>("dmg_buff_pc");
            float radius        = skill.data.Inputs.Value <float>("radius");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgDebuffTime *= 2;
            }

            var sourceBonuses = source.GetComponent <PlayerBonuses>();
            var sourceChar    = source.GetComponent <CharacterObject>();

            var items = (source.world as MmoWorld).GetItems((it) => {
                if (it.GetComponent <PlayerBonuses>() && it.GetComponent <CharacterObject>())
                {
                    float dist = source.transform.DistanceTo(it.transform);
                    if (dist < radius)
                    {
                        if (sourceChar.RelationTo(it.GetComponent <CharacterObject>()) == FractionRelation.Enemy)
                        {
                            return(true);
                        }
                    }
                }
                return(false);
            });

            foreach (var p in items)
            {
                Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.decrease_damage_on_pc, dmgDebuffTime, dmgDebuffPc);
                p.Value.GetComponent <PlayerBonuses>().SetBuff(buff, source);
            }

            Buff dmgBuff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_damage_on_pc, dmgDebuffTime, dmgBuffPc);

            sourceBonuses.SetBuff(dmgBuff, source);
            return(true);
        }
示例#11
0
        public static string ObjectString(this NebulaObject obj)
        {
            ItemType type = (ItemType)obj.Type;

            switch (type)
            {
            case ItemType.Avatar:
                return("[player]");

            case ItemType.Bot: {
                var botObject = obj.GetComponent <BotObject>();
                if (botObject != null)
                {
                    return(string.Format("[{0}:{1}]", ItemType.Bot, (BotItemSubType)botObject.botSubType));
                }
                else
                {
                    return(string.Format("[unknow bot]"));
                }
            }

            default:
                return("[" + type.ToString() + "]");
            }
        }
示例#12
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

            if (!source)
            {
                return(false);
            }
            var damagable = source.GetComponent <DamagableObject>();

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

            float hpPc = skill.GetFloatInput("hp_pc");
            float hp   = hpPc * damagable.maximumHealth;
            //damagable.SetHealth(damagable.health + hp);
            bool mastery = RollMastery(source);

            if (mastery)
            {
                hp *= 2;
                info.SetMastery(true);
            }
            else
            {
                info.SetMastery(false);
            }
            //damagable.RestoreHealth(source, hp);
            //source.Weapon().HealSelf(hp, skill.idInt);
            source.MmoMessage().SendHeal(EventReceiver.OwnerAndSubscriber, source.Weapon().HealSelf(hp, skill.idInt));
            return(true);
        }
示例#13
0
        private void Collect(NebulaObject ichest)
        {
            if (!m_Collected)
            {
                m_ChestObjects.Dequeue();
                if (m_ChestObjects.Count == 0)
                {
                    m_Collected = true;
                }
                //m_Collected = true;

                var player = pet.owner.GetComponent <MmoActor>();
                var chest  = ichest.GetComponent <ChestComponent>();
                if (player != null && chest != null)
                {
                    ConcurrentBag <ServerInventoryItem> addedObjects;
                    bool status = player.Inventory.AddAllFromChest(chest, player.nebulaObject.Id, out addedObjects);
                    pet.nebulaObject.MmoMessage().SendCollectChest(new System.Collections.Hashtable {
                        { (int)SPC.Target, ichest.Id },
                        { (int)SPC.TargetType, ichest.Type },
                        { (int)SPC.Status, status }
                    });
                    if (status)
                    {
                        player.EventOnInventoryUpdated();
                    }
                }
            }
        }
示例#14
0
        public void OnBuffSetted(Buff buff, NebulaObject source)
        {
            if (source != null && noTarget && (nebulaObject.getItemType() != ItemType.Avatar))
            {
                if (BuffUtils.IsDebuff(buff.buffType))
                {
                    if (nebulaObject.IsBot())
                    {
                        var weap            = GetComponent <BaseWeapon>();
                        var character       = GetComponent <CharacterObject>();
                        var sourceCharacter = source.GetComponent <CharacterObject>();

                        if (weap != null && character != null && sourceCharacter != null)
                        {
                            var relation = character.RelationTo(sourceCharacter);

                            if (relation == FractionRelation.Enemy || relation == FractionRelation.Neutral)
                            {
                                SetTarget(source);
                            }
                        }
                    }
                }
            }
        }
示例#15
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

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

            float speedPc   = skill.data.Inputs.Value <float>("speed_pc");
            float speedTime = skill.data.Inputs.Value <float>("speed_time");

            bool mastery = RollMastery(source);

            if (mastery)
            {
                speedTime *= 2;
                speedPc   *= 2.0f;
                info.SetMastery(true);
            }
            else
            {
                info.SetMastery(false);
            }

            Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_speed_on_pc, speedTime, speedPc);

            source.GetComponent <PlayerBonuses>().SetBuff(buff, source);
            return(true);
        }
示例#16
0
        private bool AddToGroup(NebulaObject obj, List <NebulaObject> groupObjects)
        {
            var character = obj.GetComponent <PlayerCharacterObject>();

            if (character != null && character.hasGroup)
            {
                if (false == ContainsGroupObject(groupObjects, obj))
                {
                    groupObjects.Add(obj);
                }

                foreach (var member in character.group.members)
                {
                    NebulaObject go;
                    if (obj.mmoWorld().TryGetObject((byte)ItemType.Avatar, member.Value.gameRefID, out go))
                    {
                        if (false == ContainsGroupObject(groupObjects, go))
                        {
                            groupObjects.Add(go);
                        }
                    }
                }
                return(true);
            }
            return(false);
        }
示例#17
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            if (!source)
            {
                return(false);
            }
            var sourceBonuses = source.GetComponent <PlayerBonuses>();

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

            string buffID            = source.Id + skill.data.Id;
            float  buffSpeedPercent  = skill.data.Inputs.Value <float>("b_speed_pc");
            float  buffSpeedInterval = skill.data.Inputs.Value <float>("b_speed_interval");
            bool   mastery           = RollMastery(source);

            if (mastery)
            {
                buffSpeedInterval *= 2;
            }

            Buff speedBuff = new Buff(buffID, null, BonusType.increase_speed_on_pc, buffSpeedInterval, buffSpeedPercent);

            sourceBonuses.SetBuff(speedBuff, source);
            return(true);
        }
示例#18
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            float  hpPercent = skill.data.Inputs.Value <float>("hp_pc");
            string id        = source.Id + skill.data.Id;

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

            var sourceDamagable = source.GetComponent <DamagableObject>();

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

            //sourceDamagable.SetHealth(Mathf.Clamp( sourceDamagable.health + sourceDamagable.baseMaximumHealth * hpPercent, 0f, sourceDamagable.maximumHealth));
            bool mastery = RollMastery(source);

            if (mastery)
            {
                hpPercent *= 2;
            }
            sourceDamagable.RestoreHealth(source, sourceDamagable.baseMaximumHealth * hpPercent);
            return(true);
        }
示例#19
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

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

            var bonuses = source.GetComponent <PlayerBonuses>();

            float time   = skill.data.Inputs.Value <float>("time");
            float timePc = skill.data.Inputs.Value <float>("time_pc");

            float mult = 1f - timePc;

            bonuses.MultInterval(BonusType.decrease_speed_on_cnt, mult);
            bonuses.MultInterval(BonusType.decrease_speed_on_pc, mult);

            bool mastery = RollMastery(source);

            if (mastery)
            {
                time *= 2;
            }

            Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.decrease_time_of_negative_speed_buffs, time, mult);

            bonuses.SetBuff(buff, source);
            return(true);
        }
示例#20
0
        public Hashtable GetPetAtWorld(string itemId)
        {
            var          world   = player.nebulaObject.mmoWorld();
            NebulaObject petItem = null;

            if (false == world.TryGetObject((byte)ItemType.Bot, itemId, out petItem))
            {
                return(CreateResponse(RPCErrorCode.ItemNotFound));
            }
            var petComponent = petItem.GetComponent <PetObject>();

            if (false == petComponent)
            {
                return(CreateResponse(RPCErrorCode.ComponentNotFound));
            }

            if (petComponent.info == null)
            {
                return(CreateResponse(RPCErrorCode.UnknownError));
            }

            var info   = petComponent.info.GetInfo(player.resource);
            var result = CreateResponse(RPCErrorCode.Ok);

            result.Add((int)SPC.Info, info);
            return(result);
        }
示例#21
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();


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

            float speedTime = skill.data.Inputs.Value <float>("speed_time");
            bool  mastery   = RollMastery(source);

            if (mastery)
            {
                speedTime *= 2;
            }

            var movable = source.GetComponent <PlayerTarget>().targetObject.GetComponent <MovableObject>();

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

            movable.SetStopTimer(speedTime);
            return(true);
        }
示例#22
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

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

            float dmgMult = skill.data.Inputs.Value <float>("dmg_mult");
            float hpPc    = skill.data.Inputs.Value <float>("hp_pc");

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

            if (targetDamagable.health > targetDamagable.maximumHealth * hpPc)
            {
                return(false);
            }

            bool mastery = RollMastery(source);

            if (mastery)
            {
                dmgMult *= 2;
            }

            WeaponHitInfo hit;
            var           shotInfo = source.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }
示例#23
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();

            float dmgMult     = skill.data.Inputs.Value <float>("dmg_mult");
            float hpRestorPc  = skill.data.Inputs.Value <float>("hp_restor_pc");
            float hpRestorDur = skill.data.Inputs.Value <float>("hp_restor_dur");

            string id = source.Id + skill.data.Id.ToString();

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

            var sourceWeapon = source.GetComponent <BaseWeapon>();

            WeaponHitInfo hit;
            var           shotInfo = sourceWeapon.GetComponent <BaseWeapon>().Fire(out hit, skill.data.Id, dmgMult);

            if (hit.normalOrMissed)
            {
                //Buff hpRestorBuff = new Buff(id, null, BonusType.restore_hp_on_pc_for_sec, hpRestorDur, hpRestorPc);
                //source.GetComponent<PlayerBonuses>().SetBuff(hpRestorBuff);
                var damagable = source.GetComponent <DamagableObject>();
                if (RollMastery(source))
                {
                    hpRestorDur *= 2;
                }
                damagable.SetRestoreHPPerSec(hpRestorPc * damagable.maximumHealth, hpRestorDur, id);

                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }
示例#24
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);
            if (!CheckForShotEnemy(source, skill))
            {
                info.SetSkillUseState(SkillUseState.invalidTarget);
                return(false);
            }
            if (NotCheckDistance(source))
            {
                info.SetSkillUseState(SkillUseState.tooFar);
                return(false);
            }

            float dmgMult             = skill.data.Inputs.GetValue <float>("dmg_mult", 0f);
            float blockWeaponInterval = skill.data.Inputs.GetValue <float>("block_weapon_interval", 0f);

            bool mastery = RollMastery(source);

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

            if (hit.normalOrMissed)
            {
                if (mastery)
                {
                    blockWeaponInterval *= 2;
                }
                Buff blockWeaponBuff = new Buff(skill.data.Id.ToString(), null, BonusType.block_weapon, blockWeaponInterval);
                source.GetComponent <PlayerTarget>().targetObject.GetComponent <PlayerBonuses>().SetBuff(blockWeaponBuff, source);
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shot);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shot);
                return(false);
            }
        }
        public string GetStartAttackMessage(PlayerCharacterObject player, NebulaObject enemy)
        {
            MmoWorld        world          = player.nebulaObject.mmoWorld();
            RaceableObject  playerRaceable = player.GetComponent <RaceableObject>();
            CharacterObject enemyCharacter = enemy.GetComponent <CharacterObject>();
            BotObject       botObject      = enemy.GetComponent <BotObject>();

            string systemName = world.Resource().Zones.GetZoneName(world.Name);
            string playerName = player.characterName;
            //string playerRaceName = world.Resource().Zones.GetRaceName(playerRaceable.getRace());
            string npcName  = GenerateStandardNpcName(systemName, enemy.Id);
            int    npcLevel = enemyCharacter.level;

            string coalitionName = player.guildName;

            if (coalitionName == null)
            {
                coalitionName = string.Empty;
            }


            switch (botObject.getSubType())
            {
            case BotItemSubType.Drill:
                return(string.Format("scm4:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            case BotItemSubType.Outpost:
                return(string.Format("scm5:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            case BotItemSubType.MainOutpost:
                return(string.Format("scm6:zone={0};chname={1};chrace={2};chcoal={3};enname={4};enlvl={5}",
                                     world.Name, playerName,
                                     playerRaceable.race, coalitionName,
                                     npcName, npcLevel));

            default:
                return(string.Empty);
            }
        }
示例#26
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();
            info.SetSkillUseState(SkillUseState.normal);

            if (!source)
            {
                return(false);
            }
            float cooldownPc   = skill.GetFloatInput("cooldown_pc");
            float cooldownTime = skill.GetFloatInput("cooldown_time");
            float radius       = skill.GetFloatInput("radius");

            var sourceChar = source.GetComponent <CharacterObject>();

            //var items = (source.world as MmoWorld).GetItems((it) => {
            //    if(!source) {
            //        return false;
            //    }
            //    if(!it) {
            //        return false;
            //    }

            //    if (it.GetComponent<PlayerBonuses>() && it.GetComponent<CharacterObject>()) {
            //        if (source.transform.DistanceTo(it.transform) <= radius) {
            //            if (sourceChar.RelationTo(it.GetComponent<CharacterObject>()) == FractionRelation.Enemy) {
            //                return true;
            //            }
            //        }
            //    }
            //    return false;
            //});

            var enemies = GetEnemiesAndNeutrals(source, radius);


            bool mastery = RollMastery(source);

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


            foreach (var p in enemies)
            {
                Buff buff = new Buff(skill.idInt.ToString(), null, BonusType.increase_cooldown_on_pc, cooldownTime, cooldownPc);
                //Buff buff = new Buff(skill.data.Id.ToString(), null, BonusType.increase_cooldown_on_cnt, cooldownTime, cooldownCnt);
                p.Value.GetComponent <PlayerBonuses>().SetBuff(buff, source);
            }
            return(true);
        }
示例#27
0
        private float GetColorRemapWeight(NebulaObject playerObject, int groupCount)
        {
            if (playerObject != null)
            {
                var   passiveBonuses = playerObject.GetComponent <PassiveBonusesComponent>();
                float remap          = 0.0f;
                if (passiveBonuses != null)
                {
                    remap += passiveBonuses.coloredLootBonus;
                }

                var character = playerObject.GetComponent <PlayerCharacterObject>();

                remap += BalanceFormulas.RemapParameter(character.level, groupCount);
                return(Mathf.Clamp01(remap));
            }
            return(0f);
        }
示例#28
0
        private void GivePvpPointsToObject(NebulaObject playerObject, int points)
        {
            var playerCharacter = playerObject.GetComponent <PlayerCharacterObject>();

            if (playerCharacter != null)
            {
                playerCharacter.AddPvpPoints(points);
            }
        }
示例#29
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);
            }
        }
示例#30
0
        public override bool TryCast(NebulaObject source, PlayerSkill skill, out Hashtable info)
        {
            info = new Hashtable();


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

            float dmgMult        = skill.data.Inputs.Value <float>("dmg_mult");
            float critChancePc   = skill.data.Inputs.Value <float>("crit_chance_pc");
            float critChanceTime = skill.data.Inputs.Value <float>("crit_chance_time");
            int   skillCount     = skill.data.Inputs.Value <int>("skill_counter");

            var sourceWeapon = source.GetComponent <BaseWeapon>();
            var skills       = source.GetComponent <PlayerSkills>();

            bool mastery = RollMastery(source);

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

            if (hit.normalOrMissed)
            {
                if ((skills.lastSkill != skill.data.Id) || (skills.lastSkill == skill.data.Id && skills.sequenceSkillCounter < skillCount))
                {
                    Buff buff = new Buff(skill.data.Id.ToString() + skills.sequenceSkillCounter, null, BonusType.increase_crit_chance_on_cnt, critChanceTime, critChancePc);
                    source.GetComponent <PlayerBonuses>().SetBuff(buff, source);
                }
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(true);
            }
            else
            {
                source.GetComponent <MmoMessageComponent>().SendShot(EventReceiver.OwnerAndSubscriber, shotInfo);
                return(false);
            }
        }