当前位置: 首页>>代码示例>>C#>>正文


C# MabiCreature.GetAimPercent方法代码示例

本文整理汇总了C#中Aura.World.World.MabiCreature.GetAimPercent方法的典型用法代码示例。如果您正苦于以下问题:C# MabiCreature.GetAimPercent方法的具体用法?C# MabiCreature.GetAimPercent怎么用?C# MabiCreature.GetAimPercent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Aura.World.World.MabiCreature的用法示例。


在下文中一共展示了MabiCreature.GetAimPercent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UseCombat

        public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
        {
            var target = WorldManager.Instance.GetCreatureById(targetId);
            if (target == null)
                return SkillResults.InvalidTarget;

            if (attacker.Inventory.Magazine == null || attacker.Inventory.Magazine.Count < 1)
                return SkillResults.Failure;

            var rnd = RandomProvider.Get();

            attacker.StopMove();

            var factory = new CombatFactory();
            factory.SetAttackerAction(attacker, CombatActionType.RangeHit, skill.Id, targetId);
            factory.SetAttackerOptions(AttackerOptions.Result);
            factory.SetAttackerStun(AfterUseStun);

            bool hit = false;

            if (attacker.GetAimPercent(attacker.Skills.Get(SkillConst.RangedCombatMastery).RankInfo.Var3, attacker.ActiveSkillStacks == 5 ? skill.RankInfo.Var3 : 0) > rnd.NextDouble())
            {
                target.StopMove();

                factory.AddTargetAction(target, CombatActionType.TakeHit);
                factory.SetTargetOptions(TargetOptions.Result);
                factory.SetTargetStun(StunTime);

                hit = true;
            }
            else
            {
                factory.AddTargetAction(target, CombatActionType.None);
            }

            Send.SkillUse(attacker.Client, attacker, skill.Id, AfterUseStun, 1);

            SkillHelper.DecStack(attacker, skill);

            attacker.Client.Send(new MabiPacket(Op.CombatTargetSet, attacker.Id).PutLong(0));

            factory.ExecuteDamage(new System.Func<MabiCreature, MabiCreature, float>((a, t) =>
                {
                    var dmg = attacker.GetRndRangeDamage();

                    switch (5 - a.ActiveSkillStacks)
                    {
                        case 1:
                            dmg *= (95 + skill.RankInfo.Var1) / 100f;
                            break;
                        case 2:
                            dmg *= (105 + skill.RankInfo.Var1) / 100f;
                            break;
                        case 3:
                            dmg *= (110 + skill.RankInfo.Var1) / 100f;
                            break;
                        case 4:
                            dmg *= (130 + skill.RankInfo.Var1) / 100f;
                            break;
                        default:
                            dmg *= (160 + skill.RankInfo.Var2) / 100f;
                            break;
                    }

                    return dmg;
                }));
            factory.ExecuteStun();
            factory.ExecuteKnockback(40f);

            WorldManager.Instance.HandleCombatActionPack(factory.GetCap());

            if (hit)
                CombatHelper.SetAggro(attacker, target);

            SkillHelper.GiveSkillExp(attacker, skill, 20);

            return SkillResults.Okay;
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:78,代码来源:ArrowRevolverHandler.cs

示例2: UseCombat

        public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
        {
            var target = WorldManager.Instance.GetCreatureById(targetId);
            if (target == null)
                return SkillResults.InvalidTarget;

            if (attacker.Magazine == null || attacker.Magazine.Count < 1)
                return SkillResults.Failure;

            var rnd = RandomProvider.Get();

            attacker.StopMove();

            var factory = new CombatFactory();
            factory.SetAttackerAction(attacker, CombatActionType.RangeHit, skill.Id, targetId);
            factory.SetAttackerOptions(AttackerOptions.Result);
            factory.SetAttackerStun(AfterUseStun);

            bool hit = false;

            if (attacker.GetAimPercent(1) > rnd.NextDouble())
            {
                target.StopMove();

                factory.AddTargetAction(target, CombatActionType.TakeHit);
                factory.SetTargetOptions(TargetOptions.Result);
                factory.SetTargetStun(StunTime);

                hit = true;
            }
            else
            {
                factory.AddTargetAction(target, CombatActionType.None);
            }

            Send.SkillUse(attacker.Client, attacker, skill.Id, AfterUseStun, 1);

            SkillHelper.ClearStack(attacker, skill);

            attacker.Client.Send(new MabiPacket(Op.CombatTargetSet, attacker.Id).PutLong(0));

            factory.ExecuteDamage(new System.Func<MabiCreature, MabiCreature, float>((a, t) =>
                {
                    var damage = attacker.GetRndRangeDamage();
                    damage *= skill.RankInfo.Var1 / 100f;
                    return damage;
                }));
            factory.ExecuteStun();
            factory.ExecuteKnockback(CombatHelper.MaxKnockBack);

            WorldManager.Instance.HandleCombatActionPack(factory.GetCap());

            if (hit)
                CombatHelper.SetAggro(attacker, target);

            SkillHelper.GiveSkillExp(attacker, skill, 20);

            return SkillResults.Okay;
        }
开发者ID:nvrlcky,项目名称:aura,代码行数:59,代码来源:MagnumShotHandler.cs

示例3: UseCombat

        public override SkillResults UseCombat(MabiCreature attacker, ulong targetId, MabiSkill skill)
        {
            var target = WorldManager.Instance.GetCreatureById(targetId);
            if (target == null)
                return SkillResults.InvalidTarget;

            if (attacker.Magazine == null || attacker.Magazine.Count < 1)
                return SkillResults.Failure;

            var rnd = RandomProvider.Get();

            attacker.StopMove();

            var factory = new CombatFactory();
            factory.SetAttackerAction(attacker, CombatActionType.RangeHit, skill.Id, targetId);
            factory.SetAttackerOptions(AttackerOptions.Result);
            factory.SetAttackerStun(AfterUseStun);

            bool hit = false;

            if (attacker.GetAimPercent(attacker.Skills.Get(SkillConst.RangedCombatMastery).RankInfo.Var3) > rnd.NextDouble())
            {
                target.StopMove();

                factory.AddTargetAction(target, CombatActionType.TakeHit);
                factory.SetTargetOptions(TargetOptions.Result);
                factory.SetTargetStun(StunTime);

                hit = true;
            }
            else
            {
                factory.AddTargetAction(target, CombatActionType.None);
            }

            Send.SkillUse(attacker.Client, attacker, skill.Id, AfterUseStun, 1);

            SkillHelper.ClearStack(attacker, skill);

            attacker.Client.Send(new MabiPacket(Op.CombatTargetSet, attacker.Id).PutLong(0));

            factory.ExecuteDamage(new System.Func<MabiCreature, MabiCreature, float>((a, t) =>
                {
                    var damage = attacker.GetRndRangeDamage();
                    return damage * .8f;
                }));
            factory.ExecuteStun();
            factory.ExecuteKnockback(0f);

            WorldManager.Instance.HandleCombatActionPack(factory.GetCap());

            if (!target.IsDead && hit)
            {
                // TODO: debuff

                WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.SupportShot).PutByte(1), SendTargets.Range, target);

                System.Threading.Thread t = new System.Threading.Thread(() =>
                {
                    System.Threading.Thread.Sleep(3000);
                    WorldManager.Instance.Broadcast(new MabiPacket(Op.Effect, target.Id).PutInt(Effect.SupportShot).PutByte(0), SendTargets.Range, target);
                });

                t.Start();

                CombatHelper.SetAggro(attacker, target);
            }

            SkillHelper.GiveSkillExp(attacker, skill, 20);

            return SkillResults.Okay;
        }
开发者ID:Fuhhue,项目名称:aura_legacy,代码行数:72,代码来源:SupportShotHandler.cs


注:本文中的Aura.World.World.MabiCreature.GetAimPercent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。