Esempio n. 1
0
        private void SendCastSpellOrder(Sprite sprite, Sprite target, Network.Game.GameClient client, bool IsAttack = false)
        {
            var hpbar = new ServerFormat13
            {
                Serial = sprite.Serial,
                Health = 255,
                Sound  = Spell.Template.Sound
            };

            var action = new ServerFormat1A
            {
                Serial = sprite.Serial,
                Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                Speed  = 30
            };

            client.SendStats(StatusFlags.StructB | StatusFlags.StructD);
            client.Aisling.Show(Scope.NearbyAislings, hpbar);
            client.SendAnimation(Spell.Template.Animation, target, sprite);
            client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name));

            if (IsAttack)
            {
                if (target is Aisling)
                {
                    (target as Aisling).Client.SendMessage(0x02, string.Format("{0} Attacks you with {1}.", client.Aisling.Username, Spell.Template.Name));
                }
            }

            client.Aisling.Show(Scope.NearbyAislings, action);
        }
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                client.TrainSpell(Spell);

                if (target is Aisling)
                    (target as Aisling).Client
                        .SendMessage(0x02,
                            string.Format("{0} Attacks you with {1}.", client.Aisling.Username,
                                Spell.Template.Name));


                var dmg = rand.Next(20 * sprite.Level, 50 * sprite.Level);
                var basePower = (Spell.Level + sprite.Int) * dmg * 0.1;


                target.ApplyDamage(sprite, (int) basePower, Spell.Template.ElementalProperty, Spell.Template.Sound);

                client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name));
                client.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = (byte) (client.Aisling.Path == Class.Priest ? 0x80 :
                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                    Speed = 30
                };

                client.Aisling.Show(Scope.NearbyAislings, action);
            }
            else
            {
                var dmg = rand.Next(20 * sprite.Level, 50 * sprite.Level);
                var basePower = target.Level * dmg * 0.1;

                target.ApplyDamage(sprite, (int) basePower, Spell.Template.ElementalProperty, Spell.Template.Sound);

                if (target is Aisling)
                    (target as Aisling).Client
                        .SendMessage(0x02, string.Format("{0} Attacks you with {1}.",
                            (sprite is Monster
                                ? (sprite as Monster).Template.Name
                                : (sprite as Mundane).Template.Name) ?? "Monster",
                            Spell.Template.Name));

                target.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 1,
                    Speed = 30
                };

                sprite.Show(Scope.NearbyAislings, action);
            }
        }
        public override void OnSuccess(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                var action = new ServerFormat1A
                {
                    Serial = client.Aisling.Serial,
                    Number = 0x82,
                    Speed  = 30
                };

                var enemy = client.Aisling.GetInfront();

                if (enemy != null)
                {
                    foreach (var i in enemy)
                    {
                        if (i == null)
                        {
                            continue;
                        }

                        if (client.Aisling.Serial == i.Serial)
                        {
                            continue;
                        }

                        if (i is Money)
                        {
                            continue;
                        }

                        var dmg = Convert.ToInt32(client.Aisling.CurrentHp / 3);
                        i.ApplyDamage(sprite, dmg, true, Skill.Template.Sound);

                        sprite.CurrentHp -= dmg * 2;
                        ((Aisling)sprite).Client.SendStats(StatusFlags.StructB);

                        if (i is Aisling)
                        {
                            (i as Aisling).Client.Aisling.Show(Scope.NearbyAislings,
                                                               new ServerFormat29((uint)client.Aisling.Serial, (uint)i.Serial, byte.MinValue,
                                                                                  Skill.Template.TargetAnimation, 100));
                            (i as Aisling).Client.Send(new ServerFormat08(i as Aisling, StatusFlags.All));
                        }

                        if (i is Monster || i is Mundane || i is Aisling)
                        {
                            client.Aisling.Show(Scope.NearbyAislings,
                                                new ServerFormat29((uint)client.Aisling.Serial, (uint)i.Serial,
                                                                   Skill.Template.TargetAnimation, 0, 100));
                        }
                    }

                    client.Aisling.Show(Scope.NearbyAislings, action);
                }
            }
        }
Esempio n. 4
0
        public override void OnSuccess(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                var action = new ServerFormat1A
                {
                    Serial = client.Aisling.Serial,
                    Number = 0x82,
                    Speed  = 20
                };

                var enemy = client.Aisling.GetInfront();

                if (enemy == null)
                {
                    return;
                }
                foreach (var i in enemy)
                {
                    if (i == null)
                    {
                        continue;
                    }
                    if (client.Aisling.Serial == i.Serial)
                    {
                        continue;
                    }
                    if (i is Money)
                    {
                        continue;
                    }

                    Target = i;

                    var dmg = sprite.MaximumHp * 300 / 100;
                    i.ApplyDamage(sprite, dmg, 44);

                    if (i is Aisling)
                    {
                        (i as Aisling).Client.Aisling.Show(Scope.NearbyAislings,
                                                           new ServerFormat29((uint)client.Aisling.Serial, (uint)i.Serial, byte.MinValue,
                                                                              Skill.Template.TargetAnimation, 100));
                        (i as Aisling).Client.Send(new ServerFormat08(i as Aisling, StatusFlags.All));
                    }

                    if (i is Monster || i is Mundane || i is Aisling)
                    {
                        client.Aisling.Show(Scope.NearbyAislings,
                                            new ServerFormat29((uint)client.Aisling.Serial, (uint)i.Serial,
                                                               Skill.Template.TargetAnimation, 0, 100));
                    }
                }

                client.Aisling.CurrentHp = 1;
                client.SendStats(StatusFlags.All);
                client.Aisling.Show(Scope.NearbyAislings, action);
            }
        }
Esempio n. 5
0
        public override void OnUse(Sprite sprite)
        {
            if (!Skill.Ready)
            {
                return;
            }

            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                if (Skill.Ready)
                {
                    client.TrainSkill(Skill);
                    if (client.Aisling.Invisible)
                    {
                        client.Aisling.Flags = AislingFlags.Normal;
                        client.Refresh();
                    }

                    var success = Skill.RollDice(rand);
                    if (success)
                    {
                        OnSuccess(sprite);
                    }
                    else
                    {
                        OnFailed(sprite);
                    }
                }
            }
            else
            {
                var target = sprite.Target;
                if (target == null)
                {
                    return;
                }


                target.Show(Scope.NearbyAislings,
                            new ServerFormat29((uint)target.Serial, (uint)target.Serial,
                                               Skill.Template.TargetAnimation, 0, 100));

                var dmg = Convert.ToInt32(target.CurrentHp / 3);
                target.ApplyDamage(sprite, dmg, true, Skill.Template.Sound);

                sprite.CurrentHp -= dmg * 2;

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 0x82,
                    Speed  = 20
                };


                target.Show(Scope.NearbyAislings, action);
            }
        }
        public override void OnUse(Sprite sprite)
        {
            if (!Skill.Ready)
            {
                return;
            }

            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                if (Skill.Ready)
                {
                    if (client.Aisling.Invisible && Skill.Template.PostQualifers.HasFlag(PostQualifer.BreakInvisible))
                    {
                        client.Aisling.Flags = AislingFlags.Normal;
                        client.Refresh();
                    }

                    client.TrainSkill(Skill);

                    var success = true;

                    if (success)
                    {
                        OnSuccess(sprite);
                    }
                    else
                    {
                        OnFailed(sprite);
                    }
                }
            }
            else
            {
                var target = sprite.Target;
                if (target == null)
                {
                    return;
                }


                target.Show(Scope.NearbyAislings,
                            new ServerFormat29((uint)target.Serial, (uint)target.Serial,
                                               Skill.Template.TargetAnimation, 0, 100));

                var dmg = 50 * sprite.Str / 100;
                target.ApplyDamage(sprite, dmg, true, Skill.Template.Sound);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 0x82,
                    Speed  = 20
                };


                target.Show(Scope.NearbyAislings, action);
            }
        }
Esempio n. 7
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = Clone <Buff>(Spell.Template.Buff);

                client.TrainSpell(Spell);

                if (sprite.Buffs.FirstOrDefault(i => i.Name == buff.Name) == null)
                {
                    buff.OnApplied(sprite, buff);

                    var action = new ServerFormat1A
                    {
                        Serial = client.Aisling.Serial,
                        Number = 0x80,
                        Speed  = 30
                    };

                    client.SendAnimation(244, client.Aisling, client.Aisling);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.SendMessage(0x02, "you cast " + Spell.Template.Name + ".");
                    client.SendStats(StatusFlags.All);
                }
                else
                {
                    client.SendMessage(0x02, "Your skin is already like stone.");
                }
            }
        }
Esempio n. 8
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = new buff_mordion();

                client.TrainSpell(Spell);

                if (!sprite.HasBuff("dion") && !sprite.HasBuff("mor dion"))
                {
                    buff.OnApplied(sprite, buff);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed = 30
                    };

                    client.SendAnimation(244, client.Aisling, client.Aisling);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.SendMessage(0x02, "you cast " + Spell.Template.Name + ".");
                    client.SendStats(StatusFlags.All);
                }
                else
                {
                    client.SendMessage(0x02, "Your skin is already like stone.");
                }
            }
        }
Esempio n. 9
0
        public void SpriteSpellCastOrder(Sprite sprite, Sprite target)
        {
            var action = new ServerFormat1A
            {
                Serial = sprite.Serial,
                Number = 1,
                Speed  = 30
            };

            var hpbar = new ServerFormat13
            {
                Serial = target.Serial,
                Health = 255,
                Sound  = Spell.Template.Sound
            };

            target.Show(Scope.NearbyAislings, hpbar);
            target.SendAnimation(Spell.Template.Animation, target, sprite);

            if (target is Aisling)
            {
                (target as Aisling).Client
                .SendMessage(0x02,
                             string.Format("{0} Attacks you with {1}.",
                                           (sprite is Monster
                                ? (sprite as Monster).Template.Name
                                : (sprite as Mundane).Template.Name) ?? "Monster",
                                           Spell.Template.Name));
            }

            sprite.Show(Scope.NearbyAislings, action);
        }
Esempio n. 10
0
        public void ReviveInFront()
        {
            var infront = GetInfront().OfType <Aisling>();

            var action = new ServerFormat1A
            {
                Serial = Serial,
                Number = 0x01,
                Speed  = 30
            };

            foreach (var obj in infront)
            {
                if (obj.Serial == Serial)
                {
                    continue;
                }

                if (!obj.LoggedIn)
                {
                    continue;
                }

                obj.RemoveDebuff("skulled", true);
                obj.Client.Revive();
                obj.Animate(5);
            }

            ApplyDamage(this, 0, true, 8);
            Show(Scope.NearbyAislings, action);
        }
Esempio n. 11
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = new buff_aite();

                client.TrainSpell(Spell);

                if (!target.HasBuff(buff.Name))
                {
                    buff.OnApplied(target, buff);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed = 30
                    };

                    client.SendAnimation(Spell.Template.Animation, target, client.Aisling);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.SendMessage(0x02, "you cast " + Spell.Template.Name + ".");
                    client.SendStats(StatusFlags.All);
                }
                else
                {
                    client.SendMessage(0x02, "That target is already empowered.");
                }
            }
        }
Esempio n. 12
0
        public override void OnSuccess(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = new buff_clawfist();

                client.TrainSkill(Skill);

                if (!sprite.HasBuff("Claw Fist"))
                {
                    buff.OnApplied(sprite, buff);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed = 30
                    };

                    client.SendAnimation(54, client.Aisling, client.Aisling);
                    client.SendStats(StatusFlags.All);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                }
                else
                {
                    client.SendMessage(0x02, "Your hands are already empowered.");
                }
            }
        }
Esempio n. 13
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = new buff_hide();

                client.TrainSpell(Spell);

                if (!target.HasBuff(buff.Name))
                {
                    buff.OnApplied(target, buff);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = 0x29,
                        Speed  = 30
                    };

                    client.SendAnimation(Spell.Template.Animation, target, client.Aisling);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.SendMessage(0x02, "you cast " + Spell.Template.Name + ".");
                    client.SendStats(StatusFlags.All);
                }
                else
                {
                    client.SendMessage(0x02, "You are already hidden.");
                }
            }
        }
        public void DestroyAll(GameClient client)
        {
            new TaskFactory().StartNew(() =>
            {
                var objects = GetObjects(i => i.WithinRangeOf(client.Aisling), Get.Monsters);

                var action = new ServerFormat1A
                {
                    Serial = client.Aisling.Serial,
                    Number = 0x02,
                    Speed  = 40
                };

                client.Aisling.Show(Scope.NearbyAislings, action);

                foreach (var obj in objects)
                {
                    (obj as Monster).Target = client.Aisling;
                    (obj as Monster).GenerateRewards(client.Aisling);
                    client.SendAnimation(301, obj, client.Aisling);

                    obj.ApplyDamage(client.Aisling, 999999, false, 40);
                }
            });
        }
Esempio n. 15
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            var targets = target.MonstersNearby().Where(i => i.WithinRangeOf(target, 4) && i.Serial != target.Serial);

            foreach (var obj in targets)
            {
                var affect = Clone <debuff_blind>(debuff);
                affect.OnApplied(obj, affect);
            }

            if (sprite is Aisling aisling)
            {
                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = (byte)(aisling.Path
                                    == Class.Priest ? 0x80 :
                                    aisling.Path
                                    == Class.Wizard ? 0x88 : 0x06),
                    Speed = 30
                };
                sprite.Show(Scope.NearbyAislings, action);
                aisling.Client.SendMessage(0x02, "you cast " + Spell.Template.Name + ".");
            }
        }
Esempio n. 16
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                client.TrainSpell(Spell);

                if (target is Aisling)
                {
                    (target as Aisling).Client
                    .SendMessage(0x02,
                                 $"{client.Aisling.Username} Attacks you with {Spell.Template.Name}.");
                }

                var imp = Spell.Level * 2 / 100;
                var dmg = (int)(client.Aisling.Int / 2 * Spell.Template.DamageExponent);

                dmg *= imp;

                target.ApplyDamage(sprite, dmg, Spell.Template.ElementalProperty, Spell.Template.Sound);

                client.SendMessage(0x02, $"you cast {Spell.Template.Name}");
                client.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                    client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                    Speed = 30
                };

                client.Aisling.Show(Scope.NearbyAislings, action);
            }
            else
            {
                var dmg = sprite.GetBaseDamage(sprite.Target, MonsterDamageType.Elemental);

                target.ApplyDamage(sprite, dmg, Spell.Template.ElementalProperty, Spell.Template.Sound);

                if (target is Aisling)
                {
                    (target as Aisling).Client
                    .SendMessage(0x02,
                                 $"{(sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster"} Attacks you with {Spell.Template.Name}.");
                }

                target.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 1,
                    Speed  = 30
                };

                sprite.Show(Scope.NearbyAislings, action);
            }
        }
Esempio n. 17
0
        public override void OnUse(Sprite sprite)
        {
            if (!Skill.Ready)
            {
                return;
            }

            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                if (Skill.Ready)
                {
                    client.TrainSkill(Skill);
                    if (client.Aisling.Invisible && Skill.Template.PostQualifers == PostQualifer.BreakInvisible)
                    {
                        client.Aisling.Flags = AislingFlags.Normal;
                        client.Refresh();
                    }

                    var success = Skill.RollDice(rand);

                    if (success)
                    {
                        OnSuccess(sprite);
                    }
                    else
                    {
                        OnFailed(sprite);
                    }
                }
            }
            else
            {
                var target = sprite.Target;
                if (target == null)
                {
                    return;
                }

                sprite.Show(Scope.NearbyAislings,
                            new ServerFormat29((uint)target.Serial, (uint)sprite.Serial,
                                               Skill.Template.TargetAnimation, 0, 100));

                var dmg = sprite.MaximumHp * 300 / 100;
                target.ApplyDamage(sprite, dmg, false, 44);


                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 0x82,
                    Speed  = 20
                };


                sprite.CurrentHp = 1;
                sprite.Show(Scope.NearbyAislings, action);
            }
        }
Esempio n. 18
0
        public override void OnSuccess(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = (byte)(client.Aisling.Path == Class.Warrior
                        ? client.Aisling.UsingTwoHanded ? 0x81 : 0x01
                        : 0x01),
                    Speed = 20
                };

                var enemy = GetInCone(sprite, 3);

                if (enemy != null)
                {
                    foreach (var i in enemy.OfType <Monster>())
                    {
                        if (i == null)
                        {
                            continue;
                        }


                        if (client.Aisling.Serial == i.Serial)
                        {
                            continue;
                        }

                        var imp = 300 + Skill.Level;
                        var dmg = client.Aisling.Str * 4 + client.Aisling.Dex * 2;

                        dmg += dmg * imp / 100;

                        if (sprite.EmpoweredAssail)
                        {
                            if (sprite is Aisling)
                            {
                                if ((sprite as Aisling).Weapon == 0)
                                {
                                    dmg *= 3;
                                }
                            }
                        }

                        i.ApplyDamage(sprite, dmg, false, Skill.Template.Sound);
                        i.Target = client.Aisling;

                        client.Aisling.Show(Scope.NearbyAislings,
                                            new ServerFormat29(Skill.Template.TargetAnimation, (ushort)i.XPos, (ushort)i.YPos));
                    }

                    client.Aisling.Show(Scope.NearbyAislings, action);
                }
            }
        }
Esempio n. 19
0
        public override void OnUse(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                if (Skill.Ready)
                {
                    if (client.Aisling.Invisible && Skill.Template.PostQualifers.HasFlag(PostQualifer.BreakInvisible))
                    {
                        client.Aisling.Invisible = false;
                        client.Refresh();
                    }

                    client.TrainSkill(Skill);

                    var success = Skill.RollDice(rand);

                    if (success)
                    {
                        OnSuccess(sprite);
                    }
                    else
                    {
                        OnFailed(sprite);
                    }
                }
            }
            else
            {
                if (Skill.Ready)
                {
                    var target = sprite.Target;
                    if (target == null)
                    {
                        return;
                    }

                    target.Show(Scope.NearbyAislings,
                                new ServerFormat29((uint)target.Serial, (uint)target.Serial,
                                                   Skill.Template.TargetAnimation, 0, 100));

                    var dmg = sprite.GetBaseDamage(target, MonsterDamageType.Physical);
                    target.ApplyDamage(sprite, dmg, Skill.Template.Sound);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = 0x82,
                        Speed  = 20
                    };

                    target.Show(Scope.NearbyAislings, action);
                }
            }
        }
Esempio n. 20
0
        private void SendAction(Sprite sprite)
        {
            var action = new ServerFormat1A
            {
                Serial = sprite.Serial,
                Number = 0x80,
                Speed  = 30
            };

            sprite.Show(Scope.NearbyAislings, action);
        }
Esempio n. 21
0
        private void Apply(GameClient client, Debuff debuff, Sprite target)
        {
            var action = new ServerFormat1A
            {
                Serial = client.Aisling.Serial,
                Number = 0x02,
                Speed = 40
            };
            client.Aisling.Show(Scope.NearbyAislings, action);

            target.ApplyDamage(client.Aisling, 0, false, Skill.Template.Sound);
            debuff.OnApplied(target, debuff);
        }
Esempio n. 22
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                client.TrainSpell(Spell);

                var buff = new buff_armachd();

                if (!target.HasBuff(buff.Name))
                {
                    buff.OnApplied(target, buff);

                    if (target is Aisling)
                    {
                        (target as Aisling).Client
                        .SendMessage(0x02,
                                     string.Format("{0} casts {1} on you.", client.Aisling.Username,
                                                   Spell.Template.Name));
                    }

                    client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name));
                    client.SendAnimation(Spell.Template.Animation, target, sprite);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed = 30
                    };

                    var hpbar = new ServerFormat13
                    {
                        Serial = sprite.Serial,
                        Health = 255,
                        Sound  = 1
                    };

                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.Aisling.Show(Scope.NearbyAislings, hpbar);
                }
                else
                {
                    client.SendMessage(0x02, "You already cast this.");
                }
            }
        }
Esempio n. 23
0
        public override void OnSuccess(Sprite sprite)
        {
            var a = sprite.GetInfront().OfType <Monster>().ToList();
            var b = sprite.GetInfront().OfType <Aisling>().ToList();

            var i = a.Concat <Sprite>(b);

            if (i == null || !i.Any())
            {
                if (sprite is Aisling)
                {
                    var client = (sprite as Aisling).Client;
                    client.SendMessage(0x02, "The enemy has made it through.");
                    return;
                }
            }

            var debuff = new debuff_beagsuain();

            if (debuff == null)
            {
                return;
            }

            foreach (var target in i)
            {
                if (!target.HasDebuff(debuff.Name))
                {
                    if (sprite is Aisling)
                    {
                        var client = (sprite as Aisling).Client;
                        var action = new ServerFormat1A
                        {
                            Serial = client.Aisling.Serial,
                            Number = 0x81,
                            Speed  = 20
                        };

                        client.Aisling.Show(Scope.NearbyAislings, action);
                        {
                            target.ApplyDamage(client.Aisling, 0, false, Skill.Template.Sound);
                            debuff.OnApplied(target, debuff);
                        }
                        return;
                    }
                }
            }
        }
Esempio n. 24
0
        public override void OnSuccess(Sprite sprite)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                var action = new ServerFormat1A
                {
                    Serial = client.Aisling.Serial,
                    Number = 0x85,
                    Speed  = 25
                };

                var enemy = sprite.GetInfront(1, true);
            }
        }
Esempio n. 25
0
        public Aisling Cast(Spell spell, Sprite target, byte actionSpeed = 30)
        {
            var action = new ServerFormat1A
            {
                Serial = Serial,
                Number = (byte)(Path == Class.Priest ? 0x80 : Path == Class.Wizard ? 0x88 : 0x06),
                Speed  = actionSpeed
            };

            if (target != null)
            {
                if (Aisling(target)?.SendAnimation(spell.Template.Animation, target, this) == null)
                {
                    SendAnimation(spell.Template.Animation, target, this);
                }

                if (target.CurrentHp > 0)
                {
                    var hpbar = new ServerFormat13
                    {
                        Serial = target.Serial,
                        Health = (ushort)(100 * target.CurrentHp / target.MaximumHp),
                        Sound  = spell.Template.Sound
                    };

                    target.Show(Scope.NearbyAislings, hpbar);
                }

                Show(Scope.NearbyAislings, action);
                CurrentMp -= spell.Template.ManaCost;

                if (CurrentMp < 0)
                {
                    CurrentMp = 0;
                }

                Client.SendMessage(0x02, "you cast " + spell.Template.Name + ".");
            }

            return(this);
        }
Esempio n. 26
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var debuff = new debuff_fasspoirad();

                client.TrainSpell(Spell);

                if (!sprite.HasDebuff(debuff.Name))
                {
                    debuff.OnApplied(sprite, debuff);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                        client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed = 30
                    };

                    client.Aisling.CurrentHp -= client.Aisling.MaximumMp / 3;
                    client.Aisling.CurrentMp  = client.Aisling.MaximumMp;

                    if (client.Aisling.CurrentHp <= 0)
                    {
                        client.Aisling.CurrentHp = 1;
                    }

                    client.SendAnimation(1, client.Aisling, client.Aisling);
                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.SendMessage(0x02, "you invoke your will.");
                    client.SendStats(StatusFlags.All);
                }
                else
                {
                    client.SendMessage(0x02, "you failed to concretrate.");
                }
            }
        }
Esempio n. 27
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var d   = 15 + (sprite.Int * Spell.Level / 10);
                var dmg = (int)((sprite.Int * d) * Spell.Template.DamageExponent);

                target.ApplyDamage(sprite, dmg, Spell.Template.ElementalProperty, Spell.Template.Sound);
            }
            else
            {
                if (!(target is Aisling))
                {
                    return;
                }

                var client = (target as Aisling).Client;

                var dmg = sprite.GetBaseDamage(target);
                target.ApplyDamage(sprite, dmg, Spell.Template.ElementalProperty, Spell.Template.Sound);

                (target as Aisling).Client
                .SendMessage(0x02, string.Format("{0} Attacks you with {1}.",
                                                 (sprite is Monster
                            ? (sprite as Monster).Template.Name
                            : (sprite as Mundane).Template.Name) ?? "Monster",
                                                 Spell.Template.Name));

                client.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 0x80,
                    Speed  = 30
                };

                client.Aisling.Show(Scope.NearbyAislings, action);
            }
        }
Esempio n. 28
0
        public void DestroyAll(GameClient client)
        {
            var objects = GetObjects(i => i.CurrentMapId == client.Aisling.CurrentMapId, Get.Monsters);

            var action = new ServerFormat1A
            {
                Serial = client.Aisling.Serial,
                Number = 0x02,
                Speed  = 40
            };

            client.Aisling.Show(Scope.NearbyAislings, action);

            foreach (var obj in objects)
            {
                (obj as Monster).Target = client.Aisling;
                (obj as Monster).GiveExperienceTo(client.Aisling);
                client.SendAnimation(301, obj, client.Aisling);

                obj.ApplyDamage(client.Aisling, 999999, false, 40);
            }
        }
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                if (target.HasDebuff("mor fas nadur") || target.HasDebuff("fas nadur"))
                {
                    client.SendMessage(0x02, "You have already casted that spell.");
                    return;
                }

                client.TrainSpell(Spell);

                var debuff = new debuff_fasnadur();

                if (!target.HasDebuff(debuff.Name))
                {
                    debuff.OnApplied(target, debuff);

                    if (target is Aisling)
                    {
                        (target as Aisling).Client
                        .SendMessage(0x02,
                                     string.Format("{0} Casts {1} on you. Elements augmented.", client.Aisling.Username,
                                                   Spell.Template.Name));
                    }

                    client.SendMessage(0x02, string.Format("you cast {0}", Spell.Template.Name));
                    client.SendAnimation(246, target, sprite);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 : client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                        Speed  = 30
                    };

                    var hpbar = new ServerFormat13
                    {
                        Serial = client.Aisling.Serial,
                        Health = byte.MaxValue,
                        Sound  = 20
                    };

                    client.Aisling.Show(Scope.NearbyAislings, action);
                    client.Aisling.Show(Scope.NearbyAislings, hpbar);
                }
                else
                {
                    client.SendMessage(0x02, "You have already casted that spell.");
                }
            }
            else
            {
                var debuff = new debuff_fasnadur();

                if (target.HasDebuff("mor fas nadur") || target.HasDebuff("fas nadur"))
                {
                    return;
                }

                if (!target.HasDebuff(debuff.Name))
                {
                    debuff.OnApplied(target, debuff);

                    if (target is Aisling)
                    {
                        (target as Aisling).Client
                        .SendMessage(0x02,
                                     string.Format("{0} Casts {1} on you. Elements augmented.",
                                                   (sprite is Monster
                                        ? (sprite as Monster).Template.Name
                                        : (sprite as Mundane).Template.Name) ?? "Monster",
                                                   Spell.Template.Name));
                    }

                    target.SendAnimation(246, target, sprite);

                    var action = new ServerFormat1A
                    {
                        Serial = sprite.Serial,
                        Number = 1,
                        Speed  = 30
                    };

                    var hpbar = new ServerFormat13
                    {
                        Serial = target.Serial,
                        Health = byte.MaxValue,
                        Sound  = 20
                    };

                    sprite.Show(Scope.NearbyAislings, action);
                    target.Show(Scope.NearbyAislings, hpbar);
                }
            }
        }
Esempio n. 30
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;

                client.TrainSpell(Spell);

                var debuff = Clone <debuff_beagcradh>(Debuff);
                var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList();

                client.SendMessage(0x02, $"you cast {Spell.Template.Name}");
                client.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = (byte)(client.Aisling.Path == Class.Priest ? 0x80 :
                                    client.Aisling.Path == Class.Wizard ? 0x88 : 0x06),
                    Speed = 30
                };

                var hpbar = new ServerFormat13
                {
                    Serial = client.Aisling.Serial,
                    Health = 255,
                    Sound  = Spell.Template.Sound
                };

                client.Aisling.Show(Scope.NearbyAislings, action);
                client.Aisling.Show(Scope.NearbyAislings, hpbar);

                if (curses.Count > 0)
                {
                    if (target.HasDebuff(debuff.Name))
                    {
                        if (target.RemoveDebuff(debuff.Name, true))
                        {
                            if (target is Aisling)
                            {
                                (target as Aisling).Client
                                .SendMessage(0x02,
                                             $"{client.Aisling.Username} Removes {Spell.Template.Name} from you.");
                            }
                        }
                    }
                    else
                    {
                        var c = curses.FirstOrDefault();
                        if (c != null)
                        {
                            client.SendMessage(0x02, $"A greater cure is required [{c.Name}]");
                        }
                    }
                }
            }
            else
            {
                var debuff = Clone <debuff_beagcradh>(Debuff);
                var curses = target.Debuffs.Values.OfType <debuff_cursed>().ToList();

                if (curses.Count > 0)
                {
                    if (target.HasDebuff(debuff.Name))
                    {
                        if (target.RemoveDebuff(debuff.Name, true))
                        {
                            if (target is Aisling)
                            {
                                (target as Aisling).Client
                                .SendMessage(0x02,
                                             $"{(sprite is Monster ? (sprite as Monster).Template.Name : (sprite as Mundane).Template.Name) ?? "Monster"} Removes {Spell.Template.Name} from you.");
                            }
                        }
                    }
                }

                target.SendAnimation(Spell.Template.Animation, target, sprite);

                var action = new ServerFormat1A
                {
                    Serial = sprite.Serial,
                    Number = 1,
                    Speed  = 30
                };

                var hpbar = new ServerFormat13
                {
                    Serial = target.Serial,
                    Health = 255,
                    Sound  = Spell.Template.Sound
                };

                sprite.Show(Scope.NearbyAislings, action);
                target.Show(Scope.NearbyAislings, hpbar);
            }
        }