Example #1
0
        public override void OnSuccess(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                var buff   = new buff_dion();

                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.");
                }
            }
        }
Example #2
0
        public override void OnUse(Sprite sprite, Sprite target)
        {
            if (sprite is Aisling)
            {
                var client = (sprite as Aisling).Client;
                if (client.Aisling.CurrentMp >= Spell.Template.ManaCost)
                {
                    client.Aisling.CurrentMp -= Spell.Template.ManaCost;
                    if (client.Aisling.CurrentMp < 0)
                    {
                        client.Aisling.CurrentMp = 0;
                    }

                    if (rand.Next(1, 101) >= 25)
                    {
                        OnSuccess(sprite, target);
                    }
                    else
                    {
                        OnFailed(sprite, target);
                    }
                }
                else
                {
                    if (sprite is Aisling)
                    {
                        (sprite as Aisling).Client.SendMessage(0x02, ServerContext.Config.NoManaMessage);
                    }
                    return;
                }


                client.SendStats(StatusFlags.StructB);
            }
            else
            {
                var buff = new buff_dion();

                if (!sprite.HasBuff(buff.Name))
                {
                    buff.OnApplied(sprite, buff);
                    sprite.SendAnimation(244, sprite, sprite);
                }
            }
        }