示例#1
0
        public override IEnumerable <TickTimer> Main()
        {
            //UsePrimaryResource(15f);

            // dashing strike never specifies the target's id so we just search for the closest target
            Target = GetEnemiesInRadius(TargetPosition, 8f).GetClosestTo(TargetPosition);

            if (Target != null)
            {
                // put dash destination just beyond target
                TargetPosition = PowerMath.TranslateDirection2D(User.Position, Target.Position, Target.Position, 7f);
            }
            else
            {
                // if no target, always dash fixed amount
                TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 13f);
            }

            var dashBuff = new DashMoverBuff(TargetPosition);

            AddBuff(User, dashBuff);
            yield return(dashBuff.Timeout);

            if (Target != null && Target.World != null) // target could've died or left world
            {
                User.TranslateFacing(Target.Position, true);
                yield return(WaitSeconds(0.1f));

                User.PlayEffectGroup(113720);
                WeaponDamage(Target, 1.60f, DamageType.Physical);
            }
        }
示例#2
0
        public override IEnumerable <TickTimer> Run()
        {
            // HACK: made up garggy spell :)

            Vector3D inFrontOfTarget = PowerMath.TranslateDirection2D(TargetPosition, User.Position, TargetPosition, 11f);

            inFrontOfTarget.Z = User.Position.Z;
            var garggy = SpawnEffect(122305, inFrontOfTarget, TargetPosition, WaitInfinite());

            garggy.PlayActionAnimation(155988);

            yield return(WaitSeconds(2f));

            for (int n = 0; n < 3; ++n)
            {
                garggy.PlayActionAnimation(211382);

                yield return(WaitSeconds(0.5f));

                SpawnEffect(192210, TargetPosition);
                WeaponDamage(GetEnemiesInRadius(TargetPosition, 12f), 1.00f, DamageType.Poison);

                yield return(WaitSeconds(0.4f));
            }

            garggy.PlayActionAnimation(155536); //mwhaha
            yield return(WaitSeconds(1.5f));

            garggy.PlayActionAnimation(171024);
            yield return(WaitSeconds(2f));

            garggy.Destroy();

            yield break;
        }
示例#3
0
        IEnumerable <TickTimer> _RuneE()
        {
            float    attackRadius   = 8f; // value is not in formulas, just a guess
            Vector3D castedPosition = new Vector3D(User.Position);
            float    castAngle      = MovementHelpers.GetFacingAngle(castedPosition, TargetPosition);
            float    waveOffset     = 0f;

            int flyerCount = (int)ScriptFormula(15);

            for (int n = 0; n < flyerCount; ++n)
            {
                waveOffset += 3.0f;
                var wavePosition  = PowerMath.TranslateDirection2D(castedPosition, TargetPosition, castedPosition, waveOffset);
                var flyerPosition = RandomDirection(wavePosition, 0f, attackRadius);
                var flyer         = SpawnEffect(200561, flyerPosition, castAngle, WaitSeconds(ScriptFormula(20)));
                flyer.OnTimeout = () =>
                {
                    flyer.PlayEffectGroup(200819);
                    AttackPayload attack = new AttackPayload(this);
                    attack.Targets = GetEnemiesInRadius(flyerPosition, attackRadius);
                    attack.AddWeaponDamage(ScriptFormula(11), DamageType.Physical);
                    attack.OnHit = (hitPayload) => { Knockback(hitPayload.Target, 90f); };
                    attack.Apply();
                };

                yield return(WaitSeconds(ScriptFormula(4)));
            }
        }
示例#4
0
 private void _calcTargetPosition()
 {
     // project beam end to always be a certain length
     TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition,
                                                     new Vector3D(User.Position.X, User.Position.Y, TargetPosition.Z),
                                                     BeamLength);
 }
示例#5
0
        private void _setupReturnProjectile(Vector3D spawnPosition)
        {
            Vector3D inFrontOfUser = PowerMath.TranslateDirection2D(User.Position, spawnPosition, User.Position, 5f);

            var return_proj = new Projectile(this, 79400, new Vector3D(spawnPosition.X, spawnPosition.Y, User.Position.Z));

            return_proj.DestroyOnArrival = true;
            return_proj.LaunchArc(inFrontOfUser, 1f, -0.03f);
            User.AddRopeEffect(79402, return_proj);
        }
示例#6
0
        public override IEnumerable <TickTimer> Run()
        {
            UsePrimaryResource(15f);

            User.PlayEffectGroup(188941);

            // calculate hit area of effect, just in front of the user
            TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 9f);

            for (int n = 0; n < 3; ++n)
            {
                WeaponDamage(GetEnemiesInRadius(TargetPosition, 9f), 0.30f, DamageType.Physical);
                yield return(WaitSeconds(0.2f));
            }
        }
示例#7
0
        public override bool Apply()
        {
            if (!base.Apply())
            {
                return(false);
            }

            Vector3D destination = PowerMath.TranslateDirection2D(User.Position, Target.Position,
                                                                  _magnitude < 0f ? User.Position : Target.Position,
                                                                  (float)Math.Sqrt(Math.Abs(_magnitude)));

            _mover = new ActorMover(Target);
            _mover.MoveArc(destination, _height, _gravity, new ACDTranslateArcMessage
            {
                Field3 = 0x2006, // wtf?
                FlyingAnimationTagID  = AnimationSetKeys.KnockBack.ID,
                LandingAnimationTagID = AnimationSetKeys.KnockBackLand.ID,
                Field7 = PowerSNO
            });

            return(true);
        }
示例#8
0
        public override IEnumerable <TickTimer> Main()
        {
            switch (TargetMessage.Field5)
            {
            case 0:
            case 1:
                MeleeStageHit();
                break;

            case 2:
                //AddBuff(User, new ComboStage3Buff());

                // put target position a little bit in front of the monk. represents the lightning ball
                TargetPosition = PowerMath.TranslateDirection2D(User.Position, TargetPosition,
                                                                User.Position, 8f);

                bool          hitAnything = false;
                AttackPayload attack      = new AttackPayload(this);
                attack.Targets = GetEnemiesInRadius(TargetPosition, 7f);
                attack.AddWeaponDamage(1.20f, DamageType.Lightning);
                attack.OnHit = hitPayload => {
                    hitAnything = true;
                    Knockback(hitPayload.Target, 12f);
                };
                attack.Apply();

                if (hitAnything)
                {
                    GeneratePrimaryResource(6f);
                }

                break;
            }

            yield break;
        }
示例#9
0
        public override void Update(int tickCounter)
        {
            // if power executed, wait for attack/cooldown to finish.
            if (_powerRan)
            {
                if (_powerFinishTimer.TimedOut)
                {
                    this.Done = true;
                }

                return;
            }

            // try to get nearest target if no target yet acquired
            if (_target == null)
            {
                if (this.Owner is Minion) // assume minions are player controlled and are targeting monsters
                {
                    _target = this.Owner.GetMonstersInRange(MaxTargetRange).OrderBy(
                        (monster) => PowerMath.Distance2D(monster.Position, this.Owner.Position))
                              .FirstOrDefault();
                }
                else  // monsters targeting players
                {
                    _target = this.Owner.GetPlayersInRange(MaxTargetRange).OrderBy(
                        (player) => PowerMath.Distance2D(player.Position, this.Owner.Position))
                              .FirstOrDefault();
                }
            }

            if (_target != null)
            {
                float targetDistance = PowerMath.Distance2D(_target.Position, this.Owner.Position);

                // if target has moved out of range, deselect it as the target
                if (targetDistance > MaxTargetRange)
                {
                    _target = null;
                }
                else if (targetDistance < _baseAttackRadius + _target.ActorData.Cylinder.Ax2)  // run power if within range
                {
                    // stop any movement
                    _ownerMover.Move(this.Owner.Position, this.Owner.WalkSpeed);

                    this.Owner.World.PowerManager.RunPower(this.Owner, _power, _target, _target.Position);
                    _powerFinishTimer = new SecondsTickTimer(this.Owner.World.Game,
                                                             _power.EvalTag(PowerKeys.AttackSpeed) + _power.EvalTag(PowerKeys.CooldownTime));
                    _powerRan = true;
                }
                else
                {
                    // update or create path movement
                    if (_pathUpdateTimer == null || _pathUpdateTimer.TimedOut)
                    {
                        _pathUpdateTimer = new SecondsTickTimer(this.Owner.World.Game, PathUpdateDelay);

                        // move the space between each path update, or up to target.
                        float moveAmount = this.Owner.WalkSpeed *
                                           (_pathUpdateTimer.TimeoutTick - this.Owner.World.Game.TickCounter);
                        if (targetDistance < moveAmount)
                        {
                            moveAmount = targetDistance; // -(_baseAttackRadius + _target.ActorData.Cylinder.Ax2) - 0.1f;
                        }
                        Vector3D movePos = PowerMath.TranslateDirection2D(this.Owner.Position, _target.Position,
                                                                          this.Owner.Position, moveAmount);

                        this.Owner.TranslateFacing(_target.Position, false);

                        // find suitable movement animation
                        int aniTag;
                        if (this.Owner.AnimationSet == null)
                        {
                            aniTag = -1;
                        }
                        else if (this.Owner.AnimationSet.TagExists(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk))
                        {
                            aniTag = this.Owner.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk);
                        }
                        else if (this.Owner.AnimationSet.TagExists(Mooege.Common.MPQ.FileFormats.AnimationTags.Run))
                        {
                            aniTag = this.Owner.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Run);
                        }
                        else
                        {
                            aniTag = -1;
                        }

                        _ownerMover.Move(movePos, this.Owner.WalkSpeed, new ACDTranslateNormalMessage
                        {
                            TurnImmediately = false,
                            AnimationTag    = aniTag
                        });
                    }
                    else
                    {
                        _ownerMover.Update();
                    }
                }
            }
        }
示例#10
0
        public override IEnumerable <TickTimer> Run()
        {
            // NOTE: not normal plague of toads right now but Obsidian runed "Toad of Hugeness"

            Vector3D userCastPosition = new Vector3D(User.Position);
            Vector3D inFrontOfUser    = PowerMath.TranslateDirection2D(User.Position, TargetPosition, User.Position, 7f);
            var      bigtoad          = SpawnEffect(109906, inFrontOfUser, TargetPosition, WaitInfinite());

            // HACK: holy hell there is alot of hardcoded animation timings here

            bigtoad.PlayActionAnimation(110766); // spawn ani
            yield return(WaitSeconds(1f));

            bigtoad.PlayActionAnimation(110520); // attack ani
            TickTimer waitAttackEnd = WaitSeconds(1.5f);

            yield return(WaitSeconds(0.3f)); // wait for attack ani to play a bit

            var tongueEnd = SpawnProxy(TargetPosition, WaitInfinite());

            bigtoad.AddRopeEffect(107892, tongueEnd);

            yield return(WaitSeconds(0.3f)); // have tongue hang there for a bit

            var tongueMover = new Implementations.KnockbackBuff(-0.01f, 3f, -0.1f);

            this.World.BuffManager.AddBuff(bigtoad, tongueEnd, tongueMover);
            if (ValidTarget())
            {
                this.World.BuffManager.AddBuff(bigtoad, Target, new Implementations.KnockbackBuff(-0.01f, 3f, -0.1f));
            }

            yield return(tongueMover.ArrivalTime);

            tongueEnd.Destroy();

            if (ValidTarget())
            {
                _SetHiddenAttribute(Target, true);

                if (!waitAttackEnd.TimedOut)
                {
                    yield return(waitAttackEnd);
                }

                bigtoad.PlayActionAnimation(110636); // disgest ani, 5 seconds
                for (int n = 0; n < 5 && ValidTarget(); ++n)
                {
                    WeaponDamage(Target, 0.039f, DamageType.Poison);
                    yield return(WaitSeconds(1f));
                }

                if (ValidTarget())
                {
                    _SetHiddenAttribute(Target, false);

                    bigtoad.PlayActionAnimation(110637); // regurgitate ani
                    this.World.BuffManager.AddBuff(bigtoad, Target, new Implementations.KnockbackBuff(36f));
                    Target.PlayEffectGroup(18281);       // actual regurgitate efg isn't working so use generic acid effect
                    yield return(WaitSeconds(0.9f));
                }
            }

            bigtoad.PlayActionAnimation(110764); // despawn ani
            yield return(WaitSeconds(0.7f));

            bigtoad.Destroy();
        }
示例#11
0
        public override void Update(int tickCounter)
        {
            // if power executed, wait for attack/cooldown to finish.
            if (_powerRan)
            {
                if (_powerFinishTimer.TimedOut)
                {
                    this.Done = true;
                }

                return;
            }

            // try to get nearest target if no target yet acquired
            if (_target == null)
            {
                _target = this.Owner.GetPlayersInRange(MaxTargetRange).OrderBy(
                    (player) => PowerMath.Distance2D(player.Position, this.Owner.Position))
                          .FirstOrDefault();
            }

            if (_target != null)
            {
                float targetDistance = PowerMath.Distance2D(_target.Position, this.Owner.Position);

                // if target has moved out of range, deselect it as the target
                if (targetDistance > MaxTargetRange)
                {
                    _target = null;
                }
                else if (targetDistance < _baseAttackRadius + _target.ActorData.Cylinder.Ax2)  // run power if within range
                {
                    // stop any movement
                    this.Owner.Move(this.Owner.Position, MovementHelpers.GetFacingAngle(this.Owner, _target));
                    //this.Owner.TranslateFacing(_target.Position, true);

                    this.Owner.World.PowerManager.RunPower(this.Owner, _power, _target, _target.Position);
                    _powerFinishTimer = new SecondsTickTimer(this.Owner.World.Game,
                                                             _power.EvalTag(PowerKeys.AttackSpeed) + _power.EvalTag(PowerKeys.CooldownTime));
                    _powerRan = true;
                }
                else
                {
                    // update or create path movement
                    if (_pathUpdateTimer == null || _pathUpdateTimer.TimedOut)
                    {
                        _pathUpdateTimer = new SecondsTickTimer(this.Owner.World.Game, PathUpdateDelay);

                        // move the space between each path update
                        Vector3D movePos = PowerMath.TranslateDirection2D(this.Owner.Position, _target.Position, this.Owner.Position,
                                                                          this.Owner.WalkSpeed * (_pathUpdateTimer.TimeoutTick - this.Owner.World.Game.TickCounter));

                        this.Owner.TranslateFacing(_target.Position, false);

                        _ownerMover.Move(movePos, this.Owner.WalkSpeed, new Net.GS.Message.Definitions.Actor.NotifyActorMovementMessage
                        {
                            TurnImmediately = false,
                            AnimationTag    = this.Owner.AnimationSet == null ? 0 : this.Owner.AnimationSet.GetAnimationTag(Mooege.Common.MPQ.FileFormats.AnimationTags.Walk)
                        });
                    }
                    else
                    {
                        _ownerMover.Update();
                    }
                }
            }
        }
示例#12
0
        public override IEnumerable <TickTimer> Main()
        {
            GeneratePrimaryResource(ScriptFormula(25));

            float targetDistance = PowerMath.Distance2D(User.Position, TargetPosition);

            // create grenade projectiles with shared detonation timer
            TickTimer timeout = WaitSeconds(ScriptFormula(2));

            Projectile[] grenades = new Projectile[Rune_C > 0 ? 1 : 3];
            for (int i = 0; i < grenades.Length; ++i)
            {
                var projectile = new Projectile(this, Rune_C > 0 ? 212547 : 88244, User.Position);
                projectile.Timeout = timeout;
                grenades[i]        = projectile;
            }

            // generate spread positions with distance-scaled spread amount.
            float scaledSpreadOffset = Math.Max(targetDistance - ScriptFormula(14), 0f);

            Vector3D[] projDestinations = PowerMath.GenerateSpreadPositions(User.Position, TargetPosition,
                                                                            ScriptFormula(11) - scaledSpreadOffset, grenades.Length);

            // launch and bounce grenades
            yield return(WaitTicks(1));  // helps make bounce timings more consistent

            float bounceOffset  = 1f;
            float minHeight     = ScriptFormula(21);
            float height        = minHeight + ScriptFormula(22);
            float bouncePercent = 0.7f; // ScriptFormula(23);

            while (!timeout.TimedOut)
            {
                for (int i = 0; i < grenades.Length; ++i)
                {
                    grenades[i].LaunchArc(PowerMath.TranslateDirection2D(projDestinations[i], User.Position, projDestinations[i],
                                                                         targetDistance * 0.3f * bounceOffset),
                                          height, ScriptFormula(20));
                }

                height       *= bouncePercent;
                bounceOffset *= 0.3f;

                yield return(grenades[0].ArrivalTime);

                // play "dink dink" grenade bounce sound
                grenades[0].PlayEffect(Effect.Unknown69);
            }

            // damage effects
            foreach (var grenade in grenades)
            {
                var grenadeN = grenade;

                SpawnEffect(RuneSelect(154027, 154045, 154028, 154044, 154046, 154043), grenade.Position);

                // poison pool effect
                if (Rune_A > 0)
                {
                    var pool = SpawnEffect(154076, grenade.Position, 0, WaitSeconds(ScriptFormula(7)));
                    pool.UpdateDelay = 1f;
                    pool.OnUpdate    = () =>
                    {
                        WeaponDamage(GetEnemiesInRadius(grenadeN.Position, ScriptFormula(5)), ScriptFormula(6), DamageType.Poison);
                    };
                }

                AttackPayload attack = new AttackPayload(this);
                attack.Targets = GetEnemiesInRadius(grenade.Position, ScriptFormula(4));
                attack.AddWeaponDamage(ScriptFormula(0), Rune_A > 0 ? DamageType.Poison : DamageType.Fire);
                attack.OnHit = (hitPayload) =>
                {
                    if (Rune_E > 0)
                    {
                        if (Rand.NextDouble() < ScriptFormula(9))
                        {
                            AddBuff(hitPayload.Target, new DebuffStunned(WaitSeconds(ScriptFormula(10))));
                        }
                    }
                    if (Rune_C > 0)
                    {
                        Knockback(grenadeN.Position, hitPayload.Target, ScriptFormula(8));
                    }
                };
                attack.Apply();
            }

            // clusterbomb hits
            if (Rune_B > 0)
            {
                int damagePulses = (int)ScriptFormula(28);
                for (int pulse = 0; pulse < damagePulses; ++pulse)
                {
                    yield return(WaitSeconds(ScriptFormula(12) / damagePulses));

                    foreach (var grenade in grenades)
                    {
                        WeaponDamage(GetEnemiesInRadius(grenade.Position, ScriptFormula(4)), ScriptFormula(0), DamageType.Fire);
                    }
                }
            }
        }