Beispiel #1
0
        protected override void Attack()
        {
            if (!Target.IsAttackTarget(this))
            {
                Target = null;
                return;
            }

            ShockTime  = 0;
            ActionTime = Envir.Time + 300;

            Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);

            if (_ThunderTime < Envir.Time)
            {
                AttackTime = Envir.Time + AttackSpeed;

                _ThunderTime = Envir.Time + 10000 + Envir.Random.Next(0, 10000);

                Broadcast(new S.ObjectRangeAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0
                });

                int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
                if (damage == 0)
                {
                    return;
                }

                DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility, 2);
                ActionList.Add(action);
                return;
            }

            if (_MassThunderTime < Envir.Time)
            {
                AttackTime = Envir.Time + AttackSpeed;

                _MassThunderTime = Envir.Time + 20000 + Envir.Random.Next(0, 30000);

                Broadcast(new S.ObjectRangeAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1
                });

                int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
                if (damage == 0)
                {
                    return;
                }

                DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MACAgility, 5);
                ActionList.Add(action);
                return;
            }

            if (_OrbTime < Envir.Time)
            {
                AttackTime = Envir.Time + AttackSpeed;

                _OrbTime = Envir.Time + 30000 + Envir.Random.Next(0, 10000);

                Broadcast(new S.ObjectRangeAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2
                });

                var attempts = 4;
                var distance = 4;

                for (int i = 0; i < attempts; i++)
                {
                    var location = new Point(CurrentLocation.X + Envir.Random.Next(-distance, distance + 1),
                                             CurrentLocation.Y + Envir.Random.Next(-distance, distance + 1));

                    if (PowerBead.SpawnRandom(this, location))
                    {
                        break;
                    }
                }

                return;
            }

            if (Envir.Random.Next(5) == 0)
            {
                Broadcast(new S.ObjectAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2
                });

                TeleportBehindWeakerTarget();
                return;
            }

            if (Envir.Random.Next(5) > 0)
            {
                AttackTime = Envir.Time + AttackSpeed;

                //Sword Attack
                Broadcast(new S.ObjectAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0
                });

                int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
                if (damage == 0)
                {
                    return;
                }

                LineAttack(damage, 2, 300, DefenceType.ACAgility, Envir.Random.Next(5) == 0);
            }
            else
            {
                AttackTime = Envir.Time + AttackSpeed;

                Broadcast(new S.ObjectAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1
                });

                //PushAttack
                int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
                if (damage == 0)
                {
                    return;
                }

                FullmoonAttack(damage, 500, DefenceType.ACAgility, Envir.Random.Next(1, 3));
            }
        }
Beispiel #2
0
        protected override void Attack()
        {
            if (!Target.IsAttackTarget(this))
            {
                Target = null;
                return;
            }

            Direction = Functions.DirectionFromPoint(CurrentLocation, Target.CurrentLocation);
            bool ranged = CurrentLocation == Target.CurrentLocation || !Functions.InRange(CurrentLocation, Target.CurrentLocation, 3);

            if (Envir.Time > _OrbTime)
            {
                _OrbTime = Envir.Time + 20000;

                Broadcast(new S.ObjectAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 2
                });

                ActionTime = Envir.Time + AttackSpeed + 300;

                var attempts = 4;
                var distance = 8;
                var count    = 2;

                for (int j = 0; j < count; j++)
                {
                    for (int i = 0; i < attempts; i++)
                    {
                        var location = new Point(CurrentLocation.X + Envir.Random.Next(-distance, distance + 1),
                                                 CurrentLocation.Y + Envir.Random.Next(-distance, distance + 1));

                        if (location == CurrentLocation || location == Target.CurrentLocation)
                        {
                            continue;
                        }

                        if (PowerBead.SpawnRandom(this, location))
                        {
                            break;
                        }
                    }
                }
            }

            if (Envir.Time > _MassThunderTime)
            {
                _MassThunderTime = Envir.Time + 10000 + Envir.Random.Next(0, 5000);

                Broadcast(new S.ObjectAttack {
                    ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 3
                });

                ActionTime = Envir.Time + AttackSpeed + 300;

                int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
                if (damage == 0)
                {
                    return;
                }

                DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility, true);
                ActionList.Add(action);

                return;
            }

            if (!ranged)
            {
                if (Envir.Random.Next(4) > 0)
                {
                    Broadcast(new S.ObjectAttack {
                        ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 0
                    });

                    ActionTime = Envir.Time + AttackSpeed + 300;

                    int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
                    if (damage == 0)
                    {
                        return;
                    }

                    DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.ACAgility);
                    ActionList.Add(action);
                }
                else
                {
                    Broadcast(new S.ObjectAttack {
                        ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, Type = 1
                    });

                    ActionTime = Envir.Time + AttackSpeed + 3400;

                    int damage = GetAttackPower(Stats[Stat.MinDC], Stats[Stat.MaxDC]);
                    if (damage == 0)
                    {
                        return;
                    }

                    FullmoonAttack(damage, 500, DefenceType.ACAgility, 1, 2);
                    FullmoonAttack(damage, 1700, DefenceType.ACAgility, 1, 2);
                    FullmoonAttack(damage, 2500, DefenceType.ACAgility, 1, 2);

                    var start = 3000;

                    SpellObject ob = new SpellObject
                    {
                        Spell           = Spell.DarkOmaKingNuke,
                        Value           = Stats[Stat.MaxDC],
                        ExpireTime      = Envir.Time + 900 + start,
                        TickSpeed       = 1000,
                        Direction       = Direction,
                        CurrentLocation = Functions.PointMove(CurrentLocation, Direction, 3),
                        CastLocation    = CurrentLocation,
                        Show            = true,
                        CurrentMap      = CurrentMap,
                        Caster          = this
                    };

                    DelayedAction action2 = new DelayedAction(DelayedType.Spawn, Envir.Time + start, ob);
                    CurrentMap.ActionList.Add(action2);
                }
            }
            else
            {
                if (Envir.Random.Next(3) == 0)
                {
                    Broadcast(new S.ObjectRangeAttack {
                        ObjectID = ObjectID, Direction = Direction, Location = CurrentLocation, TargetID = Target.ObjectID, Type = 0
                    });

                    ActionTime = Envir.Time + AttackSpeed + 300;

                    int damage = GetAttackPower(Stats[Stat.MinMC], Stats[Stat.MaxMC]);
                    if (damage == 0)
                    {
                        return;
                    }

                    DelayedAction action = new DelayedAction(DelayedType.Damage, Envir.Time + 300, Target, damage, DefenceType.MAC);
                    ActionList.Add(action);
                }
            }

            ShockTime  = 0;
            AttackTime = Envir.Time + AttackSpeed;
        }