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


C# AttackPayload.Apply方法代码示例

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


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

示例1: Main

        public override IEnumerable<TickTimer> Main()
        {
            float reachLength;
            float reachThickness;

            switch(ComboIndex)
            {
                case 0:
                    reachLength = 13;
                    reachThickness = 3f;
                    break;
                case 1:
                    reachLength = 14;
                    reachThickness = 4.5f;
                    break;
                case 2:
                    reachLength = 18;
                    reachThickness = 4.5f;
                    break;
                default:
                    yield break;
            }

            bool hitAnything = false;
            AttackPayload attack = new AttackPayload(this);
            attack.Targets = GetEnemiesInBeamDirection(User.Position, TargetPosition, reachLength, reachThickness);
            attack.AddWeaponDamage(1.20f, DamageType.Physical);
            attack.OnHit = hitPayload => { hitAnything = true; };
            attack.Apply();

            if (hitAnything)
                GeneratePrimaryResource(6f);

            yield break;
        }
开发者ID:Ethos,项目名称:mooege,代码行数:35,代码来源:Monk.cs

示例2: Main

        public override IEnumerable<TickTimer> Main()
        {
            bool hitAnything = false;
            var ShockWavePos = PowerMath.TranslateDirection2D(User.Position, TargetPosition,
                                                             User.Position,
                                                            ScriptFormula(23));
            var maxHits = ScriptFormula(1);
            for (int i = 0; i < maxHits; ++i)
            {
                AttackPayload attack = new AttackPayload(this);
                attack.Targets = GetBestMeleeEnemy();

                if (i == 0)
                { attack.AddWeaponDamage(ScriptFormula(3), DamageType.Physical); }
                else
                { attack.AddWeaponDamage(ScriptFormula(12), DamageType.Physical); }

                attack.OnHit = hitPayload =>
                {
                    hitAnything = true;
                    if (Rune_D > 0)
                    {
                        GeneratePrimaryResource(ScriptFormula(10));
                    }
                    if (Rune_B > 0)
                    {
                        AddBuff(User, new AddDamageBuff());
                    }

                    if (Rune_A > 0)
                    {
                    }
                    else if (Rune_C > 0)
                    {
                        if (Rand.NextDouble() < ScriptFormula(14))
                            AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(ScriptFormula(15))));
                    }
                    else
                    {
                        if (Rand.NextDouble() < ScriptFormula(0))
                            Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6), ScriptFormula(7));
                    }
                };
                attack.Apply();
                yield return WaitSeconds(ScriptFormula(13));

                if(hitAnything)
                    GeneratePrimaryResource(EvalTag(PowerKeys.ResourceGainedOnFirstHit));
            }
            //Shockwave -> capsule distance, at the moment using beamdirection
            if (Rune_E > 0)
            {
                User.PlayEffectGroup(93867);
                yield return WaitSeconds(0.5f);
                WeaponDamage(GetEnemiesInBeamDirection(ShockWavePos, TargetPosition, 30f, 8f), ScriptFormula(18), DamageType.Physical);
            }
            yield break;
        }
开发者ID:tovipoussin,项目名称:mooege,代码行数:58,代码来源:Barbarian.cs

示例3: Main

        public override IEnumerable<TickTimer> Main()
        {
            AttackPayload attack = new AttackPayload(this);
            attack.Targets = GetBestMeleeEnemy();
            attack.AddWeaponDamage(1.45f, DamageType.Physical);
            attack.OnHit = hitPayload =>
            {
                GeneratePrimaryResource(6f);

                if (Rand.NextDouble() < 0.20)
                    Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6), ScriptFormula(7));
            };

            attack.Apply();

            yield break;
        }
开发者ID:MKesenheimer,项目名称:mooege,代码行数:17,代码来源:Barbarian.cs

示例4: Run

        public override IEnumerable<TickTimer> Run()
        {
            yield return WaitSeconds(0.25f); // wait for swing animation

            User.PlayEffectGroup(18662);

            if (CanHitMeleeTarget(Target))
            {
                var payload = new AttackPayload(this);
                payload.AddTarget(Target);
                payload.AddWeaponDamage(1.45f, DamageType.Physical);
                payload.OnHit = (hit) =>
                {
                    GeneratePrimaryResource(6f);

                    if (Rand.NextDouble() < 0.20)
                        Knockback(Target, 4f);
                };

                payload.Apply();
            }

            yield break;
        }
开发者ID:n3rus,项目名称:mooege,代码行数:24,代码来源:Barbarian.cs

示例5: Update

            public override bool Update()
            {
                _mover.Update();

                if (base.Update())
                    return true;
                if (_damageTimer == null || _damageTimer.TimedOut)
                {
                    _damageTimer = WaitSeconds(_damageRate);
                    AttackPayload attack = new AttackPayload(this);
                    attack.AddWeaponDamage(ScriptFormula(16), DamageType.Physical);
                    attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(6));
                    attack.OnHit = hit =>
                    {
                        hitAnything = true;
                        Knockback(hit.Target, ScriptFormula(2));
                        if (Rune_B > 0)
                        {
                            User.Attributes[GameAttribute.Hitpoints_Granted] += ScriptFormula(21);
                            User.Attributes.BroadcastChangedIfRevealed();
                        }
                        if (Rune_D > 0)
                        {
                            GeneratePrimaryResource(ScriptFormula(11));
                        }
                        if (Rune_C > 0)
                        {
                            if (hit.IsCriticalHit)
                            {
                                AddBuff(hit.Target, new DebuffStunned(WaitSeconds(ScriptFormula(8))));
                            }
                        }
                        if (Rune_E > 0)
                        {
                            int resourceHit = 0;
                            while (resourceHit < ScriptFormula(10))
                            {
                                //maybe this cannot go here?
                            }
                        }
                    };
                    attack.Apply();
                }
                return false;
            }
开发者ID:tovipoussin,项目名称:mooege,代码行数:45,代码来源:Barbarian.cs

示例6: MeleeStageHit

 private void MeleeStageHit()
 {
     AttackPayload attack = new AttackPayload(this);
     attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(1));
     attack.AddWeaponDamage(ScriptFormula(4), DamageType.Physical);
     attack.Apply();
 }
开发者ID:jujuman,项目名称:mooege,代码行数:7,代码来源:Monk.cs

示例7: OnPayload

            public override void OnPayload(Payload payload)
            {
                if (payload.Target == Target && payload is DeathPayload)
                {
                    AttackPayload attack = new AttackPayload(this);
                    attack.Targets = GetEnemiesInRadius(Target.Position, ScriptFormula(11));
                    attack.AddDamage(ScriptFormula(9) * Target.Attributes[GameAttribute.Hitpoints_Max_Total],
                                     ScriptFormula(10), DamageType.Physical);
                    if (Rune_D > 0)
                    {
                        attack.OnHit = (hitPayload) =>
                        {
                            GeneratePrimaryResource(ScriptFormula(14));
                        };
                    }
                    attack.Apply();

                    SpawnProxy(Target.Position).PlayEffectGroup(18991);
                }
            }
开发者ID:jujuman,项目名称:mooege,代码行数:20,代码来源:Monk.cs

示例8: Update

            public override bool Update()
            {
                if (base.Update())
                    return true;

                if (_damageTimer == null || _damageTimer.TimedOut)
                {
                    _damageTimer = WaitSeconds(_damageRate);

                    AttackPayload attack = new AttackPayload(this);
                    attack.SetSingleTarget(Target);
                    attack.AddWeaponDamage(ScriptFormula(6) * _damageRate, DamageType.Physical);
                    attack.AutomaticHitEffects = false;
                    attack.Apply();
                }
                return false;
            }
开发者ID:jujuman,项目名称:mooege,代码行数:17,代码来源:Monk.cs

示例9: Main

        public override IEnumerable<TickTimer> Main()
        {
            AttackPayload attack = new AttackPayload(this);
            switch (ComboIndex)
            {
                case 0:
                case 1:
                    attack.Targets = GetBestMeleeEnemy();
                    attack.AddWeaponDamage(ScriptFormula(0), DamageType.Physical);
                    if (Rune_C > 0)
                        attack.AddBuffOnHit<RuneCDebuff>();
                    break;

                case 2:
                    if (Rune_B > 0)
                    {
                        attack.Targets = GetEnemiesInArcDirection(User.Position, TargetPosition, ScriptFormula(19), ScriptFormula(20));
                        int maxTargets = (int)ScriptFormula(18);
                        if (maxTargets < attack.Targets.Actors.Count)
                            attack.Targets.Actors.RemoveRange(maxTargets, attack.Targets.Actors.Count - maxTargets);
                    }
                    else
                    {
                        attack.Targets = GetBestMeleeEnemy();
                    }

                    attack.AutomaticHitEffects = false;
                    attack.AddBuffOnHit<MainDebuff>();
                    break;

                default:
                    yield break;
            }
            bool hitAnything = false;
            attack.OnHit = hitPayload => { hitAnything = true; };
            attack.Apply();

            if (hitAnything)
                GeneratePrimaryResource(EvalTag(PowerKeys.SpiritGained));
            yield break;
        }
开发者ID:jujuman,项目名称:mooege,代码行数:41,代码来源:Monk.cs

示例10: Main

        public override IEnumerable<TickTimer> Main()
        {
            //StartCooldown(WaitSeconds(10f));
            if (Rune_B > 0)
            {
                Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, ScriptFormula(9), (int)ScriptFormula(11));

                for (int i = 0; i < projDestinations.Length; i++)
                {
                    var proj = new Projectile(this, 74636, User.Position);
                    proj.Timeout = WaitSeconds(0.5f);
                    proj.OnCollision = (hit) =>
                    {
                        GeneratePrimaryResource(15f);

                        _setupReturnProjectile(hit.Position);

                        AttackPayload attack = new AttackPayload(this);
                        attack.SetSingleTarget(hit);
                        attack.AddWeaponDamage(ScriptFormula(0), DamageType.Physical);
                        attack.OnHit = (hitPayload) =>
                        {
                            hitPayload.Target.PlayEffectGroup(79420);
                            Knockback(hitPayload.Target, -25f, ScriptFormula(3), ScriptFormula(4));
                        };
                        attack.Apply();

                        proj.Destroy();
                    };
                    proj.OnTimeout = () =>
                    {
                        _setupReturnProjectile(proj.Position);
                    };

                    proj.Launch(projDestinations[i], ScriptFormula(8));
                    User.AddRopeEffect(79402, proj);
                }
            }
            else if (Rune_A > 0)
            {
                //Straight line but brings all the zombies in that line back to you.
            }
            else
            {
                var projectile = new Projectile(this, 74636, User.Position);
                projectile.Timeout = WaitSeconds(0.5f);
                projectile.OnCollision = (hit) =>
                {
                    GeneratePrimaryResource(ScriptFormula(12) + ScriptFormula(13));

                    _setupReturnProjectile(hit.Position);

                    AttackPayload attack = new AttackPayload(this);
                    attack.SetSingleTarget(hit);
                    attack.AddWeaponDamage(ScriptFormula(0), DamageType.Physical);
                    attack.OnHit = (hitPayload) =>
                    {
                        // GET OVER HERE
                        //unknown on magnitude/knockback offset?
                        hitPayload.Target.PlayEffectGroup(79420);
                        Knockback(hitPayload.Target, -25f, ScriptFormula(3), ScriptFormula(4));
                    };
                    attack.Apply();

                    projectile.Destroy();
                };
                projectile.OnTimeout = () =>
                {
                    _setupReturnProjectile(projectile.Position);
                };

                projectile.Launch(TargetPosition, ScriptFormula(8));
                User.AddRopeEffect(79402, projectile);
            }
            yield break;
        }
开发者ID:Vallenhael,项目名称:mooege,代码行数:76,代码来源:Barbarian.cs

示例11: MultiHit

        private void MultiHit()
        {
            if (Rune_D > 0)
            {
                if (Rand.NextDouble() < ScriptFormula(25))
                {
                    GeneratePrimaryResource(ScriptFormula(24));
                }
            }
            //TODO: this needs to be redone when I figure out how to do multiple hits to certain MAX targets..
                bool hitAnything = false;
                AttackPayload attack = new AttackPayload(this);
                attack.Targets = GetEnemiesInArcDirection(User.Position,TargetPosition, ScriptFormula(28), ScriptFormula(29));
                attack.AddWeaponDamage(ScriptFormula(1), DamageType.Physical);
                attack.OnHit = hitPayload =>
                {
                    hitAnything = true;
                    if (Rune_A > 0)
                    {
                        AddBuff(hitPayload.Target, new RuneA_DOT_100Fists());
                    }
                };
                attack.Apply();

                if (hitAnything)
                {
                    GeneratePrimaryResource(EvalTag(PowerKeys.SpiritGained));
                    if (Rune_C > 0)
                    {
                        AddBuff(User, new RuneCbuff());
                    }
                }
        }
开发者ID:jujuman,项目名称:mooege,代码行数:33,代码来源:Monk.cs

示例12: Apply

 public override bool Apply()
 {
     if (!base.Apply())
         return false;
     User.Attributes[GameAttribute.Damage_Percent_Reduction_From_Melee] += ScriptFormula(10);
     User.Attributes[GameAttribute.Damage_Percent_Reduction_From_Ranged] += ScriptFormula(10);
     Target.Attributes.BroadcastChangedIfRevealed();
     if (Rune_D > 0)
     {
         AttackPayload attack = new AttackPayload(this);
         attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(8));
         attack.AddWeaponDamage(ScriptFormula(11), DamageType.Physical);
         attack.OnHit = hitPayload =>
         {
             Knockback(hitPayload.Target, ScriptFormula(6), ScriptFormula(7));
         };
         attack.Apply();
     }
     return true;
 }
开发者ID:tovipoussin,项目名称:mooege,代码行数:20,代码来源:Barbarian.cs


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