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


C# AttackPayload.SetSingleTarget方法代码示例

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


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

示例1: Main

        public override IEnumerable<TickTimer> Main()
        {
            StartCooldown(EvalTag(PowerKeys.CooldownTime));
            bool hitAnything = false;

            if (Rune_B > 0)
            {
                Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, ScriptFormula(9) / 5f, (int)ScriptFormula(11));

                for (int i = 0; i < projDestinations.Length; i++)
                {
                    var proj = new Projectile(this, 161891, User.Position);
                    proj.Scale = 3f;
                    proj.Timeout = WaitSeconds(0.5f);
                    proj.OnCollision = (hit) =>
                    {
                        hitAnything = true;
                        _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_E > 0)
            {
                Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, ScriptFormula(9) / 5f, (int)ScriptFormula(11));

                for (int i = 0; i < projDestinations.Length; i++)
                {
                    var proj = new Projectile(this, 161894, User.Position);
                    proj.Scale = 3f;
                    proj.Timeout = WaitSeconds(0.5f);
                    proj.OnCollision = (hit) =>
                    {
                        hitAnything = true;

                        _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)
            {
                var projectile = new Projectile(this, 161890, User.Position);
                projectile.Scale = 3f;
                projectile.Timeout = WaitSeconds(0.5f);
                projectile.OnCollision = (hit) =>
                {
                    hitAnything = true;

                    _setupReturnProjectile(hit.Position);

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

//.........这里部分代码省略.........
开发者ID:tovipoussin,项目名称:mooege,代码行数:101,代码来源:Barbarian.cs

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

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

示例4: Main

        public override IEnumerable<TickTimer> Main()
        {
            StartCooldown(EvalTag(PowerKeys.CooldownTime));
            UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));

            if (Rune_A > 0)
            {
                Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, -20f);
                Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, 10f, 3);

                var BearProj1 = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                BearProj1.Position.Z -= 3f;
                BearProj1.OnCollision = (hit) =>
                {
                    WeaponDamage(hit, ScriptFormula(4), DamageType.Poison);
                };
                BearProj1.Launch(projDestinations[1], ScriptFormula(19));

                yield return WaitSeconds(0.5f);
                var BearProj2 = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                BearProj2.Position.Z -= 3f;
                BearProj2.OnCollision = (hit) =>
                {
                    WeaponDamage(hit, ScriptFormula(4), DamageType.Poison);
                };
                BearProj2.Launch(projDestinations[0], ScriptFormula(19));

                yield return WaitSeconds(0.5f);
                var BearProj3 = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                BearProj3.Position.Z -= 3f;
                BearProj3.OnCollision = (hit) =>
                {
                    WeaponDamage(hit, ScriptFormula(4), DamageType.Poison);
                };
                BearProj3.Launch(projDestinations[2], ScriptFormula(19));
            }
            else if (Rune_B > 0)
            {
                Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 3f);
                Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition, ScriptFormula(10), (int)ScriptFormula(3));

                for (int i = 1; i < projDestinations.Length; i++)
                {
                    var multiproj = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                    multiproj.Position.Z -= 3f;
                    multiproj.OnCollision = (hit) =>
                    {
                        WeaponDamage(hit, ScriptFormula(4), DamageType.Poison);
                    };
                    multiproj.Launch(projDestinations[i], ScriptFormula(1));
                }
            }
            else if (Rune_D > 0)
            {
                Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 3f);
                var proj = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                proj.Position.Z -= 3f;
                proj.Launch(TargetPosition, ScriptFormula(1));
                proj.OnCollision = (hit) =>
                {
                    AttackPayload attack = new AttackPayload(this);
                    attack.SetSingleTarget(hit);
                    attack.AddWeaponDamage(ScriptFormula(4), DamageType.Poison);
                    attack.Apply();
                    attack.OnDeath = DeathPayload =>
                    {
                        Vector3D inFrontOfUser2 = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 22f);
                        var proj2 = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser2);
                        proj.Launch(TargetPosition, ScriptFormula(1));
                        //TODO:need this stuff.
                        //zombie new distance (SF(13))
                        //zombie speed (SF(14))
                        //New zombie search range (SF(15))
                        //new zombie chance (SF18)
                        //max new zombie per projectile (SF24)
                        //damage scalar -> SF31
                        //damage reduction per zombie -> SF30
                    };
                };
            }
            else if (Rune_E > 0)
            {
                Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 3f);
                var proj = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                proj.Position.Z -= 3f;
                proj.OnCollision = (hit) =>
                {
                    WeaponDamage(GetEnemiesInRadius(hit.Position, ScriptFormula(11)), ScriptFormula(4), DamageType.Fire);
                };
                proj.Launch(TargetPosition, ScriptFormula(7));
            }
            else
            {
                Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 3f);
                var proj = new Projectile(this, RuneSelect(74056, 105501, 105543, 105463, 105969, 105812), inFrontOfUser);
                proj.Position.Z -= 3f;
                proj.Launch(TargetPosition, ScriptFormula(1));
                if (Rune_C > 0)
                {
                    var Puddle = SpawnEffect(105502, proj.Position, 0, WaitSeconds(ScriptFormula(17)));
//.........这里部分代码省略.........
开发者ID:vrobel,项目名称:mooege,代码行数:101,代码来源:WitchDoctor.cs

示例5: Update

 public override bool Update()
 {
     if (base.Update())
         return true;
     if (_damageTimer == null || _damageTimer.TimedOut)
     {
         _damageTimer = WaitSeconds(_damageRate);
         UsePrimaryResource(ScriptFormula(0)); //testing in this area for resource. 
         if (Rune_E > 0)
         {
             WeaponDamage(GetEnemiesInRadius(User.Position, ScriptFormula(21)), ScriptFormula(19), DamageType.Fire);
         }
         else if (Rune_A > 0)
         {
             AttackPayload attack = new AttackPayload(this);
             attack.SetSingleTarget(Target);
             attack.AddWeaponDamage(ScriptFormula(15), DamageType.Fire);
             attack.Apply();
         }
         else if (Rune_B > 0)
         {
             AttackPayload attack = new AttackPayload(this);
             attack.SetSingleTarget(Target);
             attack.AddWeaponDamage(ScriptFormula(18), DamageType.Fire);
             attack.Apply();
         }
         else if (Rune_C > 0)
         {
             AttackPayload attack = new AttackPayload(this);
             attack.SetSingleTarget(Target);
             attack.AddWeaponDamage(ScriptFormula(12), DamageType.Poison);
             attack.OnHit = HitPayload =>
             {
             };
             attack.Apply();
         }
         else
         {
             AttackPayload attack = new AttackPayload(this);
             attack.SetSingleTarget(Target);
             attack.AddWeaponDamage(ScriptFormula(1), DamageType.Fire);
             attack.OnHit = HitPayload =>
             {
                 //Rune_D -> Healing
             };
             attack.Apply();
         }
     }
     return false;
 }
开发者ID:vrobel,项目名称:mooege,代码行数:50,代码来源:WitchDoctor.cs

示例6: OnPayload

 public override void OnPayload(Payload payload)
 {
     //TODO:Rune_E -> Whenever you cast a spell that critically hits, you also shock a nearby enemy for 319% weapon damage as Lightning. 
     if (payload.Target == Target && payload is HitPayload)
     {
         //projectile? ScriptFormula(3) is speed.
         AttackPayload attack = new AttackPayload(this);
         attack.SetSingleTarget(payload.Context.User);
         attack.AddWeaponDamage(ScriptFormula(1), DamageType.Lightning);
         attack.Apply();
         if (Rune_B > 0)
         {
             AddBuff(User, new IndigoBuff());
             AddBuff(User, new MovementBuff(ScriptFormula(14), WaitSeconds(ScriptFormula(20))));
         }
         if (Rune_C > 0)
         {
             AddBuff(User, new TeslaBuff());
         }
     }
 }
开发者ID:n4v,项目名称:mooege,代码行数:21,代码来源:Wizard.cs

示例7: Update

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

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

                    AttackPayload attack = new AttackPayload(this);
                    attack.SetSingleTarget(Target);
                    attack.AddWeaponDamage(ScriptFormula(4), DamageType.Poison);
                    attack.Apply();
                }
                return false;
            }
开发者ID:n4v,项目名称:mooege,代码行数:20,代码来源:Wizard.cs

示例8: Main

        public override IEnumerable<TickTimer> Main()
        {
            // Rune_D resource mod calculated in SF_19
            UsePrimaryResource(ScriptFormula(19));

            AttackPayload attack = new AttackPayload(this);
            if (Rune_B > 0)
            {
                attack.Targets = GetEnemiesInRadius(User.Position, ScriptFormula(7));
                attack.AddWeaponDamage(ScriptFormula(6), DamageType.Cold);
                // TODO: chill debuff?
            }
            else
            {
                // Select first actor beam hits, or make max beam length
                Vector3D attackPos;
                var beamTargets = GetEnemiesInBeamDirection(User.Position, TargetPosition, MaxBeamLength, ScriptFormula(10));
                if (beamTargets.Actors.Count > 0)
                {
                    Actor target = beamTargets.GetClosestTo(User.Position);
                    attackPos = target.Position + new Vector3D(0, 0, 5f);  // fix height for beam end
                    attack.SetSingleTarget(target);
                }
                else
                {
                    attackPos = _calcBeamEnd(MaxBeamLength);
                }

                // update _beamEnd actor
                _beamEnd.MoveSnapped(attackPos, 0f);

                // all runes other than B seem to share the same weapon damage.
                attack.AddWeaponDamage(ScriptFormula(0), DamageType.Cold);

                if (Rune_A > 0)
                {
                    // TODO: damage time amp
                    attack.OnHit = hit =>
                    {
                        AddBuff(hit.Target, new DebuffChilled(0.3f, WaitSeconds(0.5f))); //slow 40%, atk spd 30%
                        //this does attack and movement, but doesnt do the difference which is needed.
                    };
                }
                else if (Rune_C > 0)
                {
                    attack.OnHit = hit =>
                    {
                        AddBuff(hit.Target, new DebuffChilled(ScriptFormula(14), WaitSeconds(ScriptFormula(4)))); //slow 40%, atk spd 30%
                        //Atk Speed Reduction % {SF(24)} to monster //AddBuff(actor, new AtkSpeedDebuff
                        //Dmg Reduction {SF(25)}
                        //targets attack speed by 30% for 5 seconds
                    };
                }
                else
                {
                    attack.OnHit = hit =>
                    {
                        AddBuff(hit.Target, new DebuffChilled(0.3f, WaitSeconds(0.5f))); //slow 40%, atk spd 30%
                        //this does attack and movement, but doesnt do the difference which is needed.
                    };
                }

                if (Rune_E > 0)
                {
                    attack.OnDeath = death =>
                    {
                        var icepool = SpawnEffect(148634, death.Target.Position, 0, WaitSeconds(ScriptFormula(8)));
                        icepool.PlayEffectGroup(149879);
                        icepool.UpdateDelay = 1f;
                        icepool.OnUpdate = () =>
                        {
                            WeaponDamage(GetEnemiesInRadius(icepool.Position, 3f), ScriptFormula(3), DamageType.Cold);
                            // TODO: chilled buff?
                        };
                    };
                }
            }

            attack.Apply();
            yield break;
        }
开发者ID:n4v,项目名称:mooege,代码行数:81,代码来源:Wizard.cs

示例9: Main

        public override IEnumerable<TickTimer> Main()
        {
            StartCooldown(EvalTag(PowerKeys.CooldownTime));
            UsePrimaryResource(EvalTag(PowerKeys.ResourceCost));

            var proj = new Projectile(this, RuneSelect(220527, 222102, 222115, 222128, 220527, 222141), User.Position);
            proj.Position.Z += 5f;  // fix height
            proj.OnCollision = (hit) =>
            {
                hit.PlayEffectGroup(RuneSelect(221164, 222107, 222120, 222133, 221164, 222146));

                AttackPayload attack = new AttackPayload(this);
                attack.SetSingleTarget(hit);
                attack.AddWeaponDamage(ScriptFormula(0), DamageType.Physical);
                attack.OnHit = (HitPayload) =>
                    {
                        //if (HitPayload.IsCriticalHit)
                        //{
                        //    if (Rune_E > 0)
                        //    {
                        //        WeaponDamage(HitPayload.Target, ScriptFormula(13), DamageType.Physical);
                        //    }
                        //}
                        if (Rune_A > 0)
                        {
                            //Nothing goes here.
                        }
                        else
                        {
                            if (Rune_B > 0)
                            {
                                Knockback(User.Position, hit, ScriptFormula(4));
                                AddBuff(hit, new DebuffStunned(WaitSeconds(ScriptFormula(6))));
                            }
                            if (Rune_C > 0)
                            {
                                AddBuff(hit, new addsDOTDamage());
                            }
                            proj.Destroy();
                        }
                    };
                attack.Apply();
            };
            proj.Launch(TargetPosition, ScriptFormula(2));

            if (Rune_D > 0)
            {
                SpawnEffect(222156, User.Position);
                //User.PlayEffectGroup(222155);
                WeaponDamage(GetEnemiesInRadius(User.Position, ScriptFormula(11)), ScriptFormula(12), DamageType.Physical);
            }

            yield return WaitSeconds(1f);
        }
开发者ID:loonbg,项目名称:mooege,代码行数:54,代码来源:DemonHunter.cs

示例10: Update

            public override bool Update()
            {
                if (base.Update())
                    return true;
                if (_damageTimer == null || _damageTimer.TimedOut)
                {
                    _damageTimer = WaitSeconds(_damageRate);

                    if (Rune_D > 0)
                    {
                        //GeneratePrimaryResource(ScriptFormula(3));
                    }

                    AttackPayload attack = new AttackPayload(this);
                    attack.SetSingleTarget(Target);
                    attack.AddWeaponDamage((ScriptFormula(0) / ScriptFormula(1)), DamageType.Holy);
                    attack.OnHit = hit =>
                        {
                            if (Rune_A > 0)
                            {
                                //45% of damage healed back to user
                            } 
                            if (Rune_C > 0)
                            {
                                //DebuffSlowed Target 
                            }
                        };
                    attack.Apply();
                }
                return false;
            }
开发者ID:Vallenhael,项目名称:mooege,代码行数:31,代码来源:WitchDoctor.cs

示例11: Main

        public override IEnumerable<TickTimer> Main()
        {
            //StartCooldown(WaitSeconds(10f));

            var projectile = new Projectile(this, 74636, User.Position);
            projectile.Timeout = WaitSeconds(0.5f);
            projectile.OnCollision = (hit) =>
            {
                GeneratePrimaryResource(15f);
                
                _setupReturnProjectile(hit.Position);

                AttackPayload attack = new AttackPayload(this);
                attack.SetSingleTarget(hit);
                attack.AddWeaponDamage(1.00f, DamageType.Physical);
                attack.OnHit = (hitPayload) =>
                {
                    // GET OVER HERE
                    Knockback(hitPayload.Target, -25f, 1f, -0.03f);
                };
                attack.Apply();

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

            projectile.Launch(TargetPosition, 1.9f);
            User.AddRopeEffect(79402, projectile);

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


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