• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AttackPayload类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AttackPayload的典型用法代码示例。如果您正苦于以下问题:C# AttackPayload类的具体用法?C# AttackPayload怎么用?C# AttackPayload使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AttackPayload类属于命名空间,在下文中一共展示了AttackPayload类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: OnAttackPayload

        // I attacked someone
        private void OnAttackPayload(AttackPayload payload)
        {
            foreach (Combatant target in payload.Targets)
            {
                var hitPayload = new HitPayload(payload, this, payload.Power);

                target.SendMessage(hitPayload);
            }
        }
开发者ID:GrindFest,项目名称:GrindFest,代码行数:10,代码来源:Combatant.cs


示例4: HitPayload

        public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
            : base(attackPayload.Context, target)
        {
            this.IsCriticalHit = criticalHit;
            
            // TODO: select these values based on element type?
            float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
            float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];

            // calculate and add up damage amount for each element type
            this.ElementDamages = new Dictionary<DamageType, float>();

            foreach (var entry in attackPayload.DamageEntries)
            {
                if (!this.ElementDamages.ContainsKey(entry.DamageType))
                    this.ElementDamages[entry.DamageType] = 0f;

                if (entry.IsWeaponBasedDamage)
                    this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier *
                        (weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta);
                else
                    this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;

                this.ElementDamages[entry.DamageType] *= 1.0f + this.Target.Attributes[GameAttribute.Amplify_Damage_Percent];
            }

            // apply critical damage boost
            if (criticalHit)
            {
                // TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set
                var damTypes = this.ElementDamages.Keys.ToArray();
                foreach (var type in damTypes)
                    this.ElementDamages[type] *= 1.5f + this.Target.Attributes[GameAttribute.Crit_Percent_Bonus_Capped];
            }



            // TODO: reduce element damage amounts according to target's resistances

            // TODO: reduce total damage by target's armor
            // ~weltmeyer Using WOW Calculation till we find the correct formula :)


            this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value) ;
            var targetArmor = target.Attributes[GameAttribute.Armor_Total];
            var attackerLevel = attackPayload.Context.User.Attributes[GameAttribute.Level];
            var reduction = TotalDamage * (0.1f * targetArmor) /
                               ((8.5f * attackerLevel) + 40);

            reduction /= 1+reduction;
            reduction = Math.Min(0.75f, reduction);
            this.TotalDamage = TotalDamage*(1 - reduction);

            this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
            if (this.DominantDamageType == null)
                this.DominantDamageType = DamageType.Physical; // default to physical if no other damage type calced
        }
开发者ID:loonbg,项目名称:mooege,代码行数:57,代码来源:HitPayload.cs


示例5: 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


示例6: HitPayload

        public HitPayload(AttackPayload attackPayload, bool criticalHit, Actor target)
        {
            this.Context = attackPayload.Context;
            this.Target = target;
            this.IsCriticalHit = criticalHit;
            
            // TODO: select these values based on element type?
            float weaponMinDamage = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Min_Total, 0];
            float weaponDamageDelta = this.Context.User.Attributes[GameAttribute.Damage_Weapon_Delta_Total, 0];

            // calculate and add up damage amount for each element type
            this.ElementDamages = new Dictionary<DamageType, float>();

            foreach (var entry in attackPayload.DamageEntries)
            {
                if (!this.ElementDamages.ContainsKey(entry.DamageType))
                    this.ElementDamages[entry.DamageType] = 0f;

                if (entry.IsWeaponBasedDamage)
                    this.ElementDamages[entry.DamageType] += entry.WeaponDamageMultiplier *
                        (weaponMinDamage + (float)PowerContext.Rand.NextDouble() * weaponDamageDelta);
                else
                    this.ElementDamages[entry.DamageType] += entry.MinDamage + (float)PowerContext.Rand.NextDouble() * entry.DamageDelta;
            }

            // apply critical damage boost
            if (criticalHit)
            {
                // TODO: probably will calculate this off of GameAttribute.Crit_Damage_Percent, but right now that attribute is never set
                var damTypes = this.ElementDamages.Keys.ToArray();
                foreach (var type in damTypes)
                    this.ElementDamages[type] *= 1.0f + 0.25f;
            }

            // TODO: reduce element damage amounts according to target's resistances

            // TODO: reduce total damage by target's armor

            this.TotalDamage = this.ElementDamages.Sum(kv => kv.Value);
            this.DominantDamageType = this.ElementDamages.OrderByDescending(kv => kv.Value).FirstOrDefault().Key;
        }
开发者ID:n3rus,项目名称:mooege,代码行数:41,代码来源:HitPayload.cs


示例7: 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


示例8: Main

        public override IEnumerable<TickTimer> Main()
        {
            switch (TargetMessage.Field5)
            {
                case 0:
                    if (Rune_A > 0)
                    {
                        //Dash
                    }
                    else
                    {
                        MeleeStageHit();
                    }
                    break;
                case 1:
                    //stage 2 get hit chance bonus
                    MultiHit();
                    break;
                case 2:
                    if (Rune_D > 0)
                    {
                        if(Rand.NextDouble() < ScriptFormula(25))
                        {
                            GeneratePrimaryResource(ScriptFormula(24));
                        }
                    }

                    bool hitAnything = false;
                    AttackPayload attack = new AttackPayload(this);
                    attack.Targets = GetEnemiesInArcDirection(User.Position, TargetPosition, ScriptFormula(30), ScriptFormula(31));
                    attack.AddWeaponDamage(ScriptFormula(2), DamageType.Holy);
                    attack.OnHit = hitPayload =>
                    {
                        hitAnything = true;
                        Knockback(hitPayload.Target, ScriptFormula(5), ScriptFormula(6)); 
                        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());
                        }
                    }
                    //TODO: Range should be only 40f ahead.
                    if (Rune_E > 0)
                    {
                        var proj = new Projectile(this, 136022, User.Position);
                        proj.Launch(TargetPosition, ScriptFormula(23));
                        proj.OnCollision = (hit) =>
                        {
                            //proj.Destroy();
                            WeaponDamage(hit, ScriptFormula(11), DamageType.Physical);
                        };
                    }

                    break;
            }

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


示例9: Update

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

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

                    AttackPayload attack = new AttackPayload(this);
                    attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(13));
                    attack.AddWeaponDamage(_damagetotal, DamageType.Physical); 
                    //we divide by four because this is by second, and tick-intervals = 0.25
                    attack.AutomaticHitEffects = false;
                    attack.Apply();
                }
                return false;
            }
开发者ID:jujuman,项目名称:mooege,代码行数:18,代码来源:Monk.cs


示例10: 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


示例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: 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


示例13: Main

        public override IEnumerable<TickTimer> Main()
        {

            AttackPayload attack = new AttackPayload(this);
            attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(4));
            attack.OnHit = hitPayload =>
            {
                AddBuff(hitPayload.Target, new RendDebuff());
            };
            //this work? if it dies with rend debuff, infect others.
            attack.OnDeath = DeathPayload =>
                {
                    if (AddBuff(Target, new RendDebuff()))
                    {
                        AttackPayload BleedAgain = new AttackPayload(this);
                        BleedAgain.Targets = GetEnemiesInRadius(Target.Position, ScriptFormula(19));
                        BleedAgain.OnHit = hitPayload2 =>
                        {
                            AddBuff(hitPayload2.Target, new RendDebuff());
                        };
                        BleedAgain.Apply();
                    }
                };
            attack.Apply();
            yield break;
        }
开发者ID:Vallenhael,项目名称:mooege,代码行数:26,代码来源:Barbarian.cs


示例14: 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类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AttackResult类代码示例发布时间:2022-05-24
下一篇:
C# AttackData类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap