fix: Codegens potions and fixes a few minor bugs (#1347)

This commit is contained in:
Kamron Batman 2023-02-24 18:06:59 -08:00 • committed by GitHub
parent 42bcf3c95a
commit 8c4aaeeda6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 1644 additions and 2095 deletions

View file

@ -1,60 +1,43 @@
using System;
using ModernUO.Serialization;
using Server.Engines.ConPVP;
using Server.Spells;
namespace Server.Items
namespace Server.Items;
[SerializationGenerator(0, false)]
public abstract partial class BaseStrengthPotion : BasePotion
{
public abstract class BaseStrengthPotion : BasePotion
public BaseStrengthPotion(PotionEffect effect) : base(0xF09, effect)
{
public BaseStrengthPotion(PotionEffect effect) : base(0xF09, effect)
}
public abstract int StrOffset { get; }
public abstract TimeSpan Duration { get; }
public bool DoStrength(Mobile from)
{
// TODO: Verify scaled; is it offset, duration, or both?
if (SpellHelper.AddStatOffset(from, StatType.Str, Scale(from, StrOffset), Duration))
{
from.FixedEffect(0x375A, 10, 15);
from.PlaySound(0x1E7);
return true;
}
public BaseStrengthPotion(Serial serial) : base(serial)
from.SendLocalizedMessage(502173); // You are already under a similar effect.
return false;
}
public override void Drink(Mobile from)
{
if (DoStrength(from))
{
}
PlayDrinkEffect(from);
public abstract int StrOffset { get; }
public abstract TimeSpan Duration { get; }
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
}
public bool DoStrength(Mobile from)
{
// TODO: Verify scaled; is it offset, duration, or both?
if (SpellHelper.AddStatOffset(from, StatType.Str, Scale(from, StrOffset), Duration))
if (!DuelContext.IsFreeConsume(from))
{
from.FixedEffect(0x375A, 10, 15);
from.PlaySound(0x1E7);
return true;
}
from.SendLocalizedMessage(502173); // You are already under a similar effect.
return false;
}
public override void Drink(Mobile from)
{
if (DoStrength(from))
{
PlayDrinkEffect(from);
if (!DuelContext.IsFreeConsume(from))
{
Consume();
}
Consume();
}
}
}