v0.0.1-Alpha (#42)
This commit is contained in:
parent
d30f93c454
commit
a36796c2c1
3552 changed files with 2476 additions and 15223 deletions
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class AgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
[Constructible]
|
||||
public AgilityPotion() : base(PotionEffect.Agility)
|
||||
{
|
||||
}
|
||||
|
||||
public AgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DexOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseAgilityPotion : BasePotion
|
||||
{
|
||||
public BaseAgilityPotion(PotionEffect effect) : base(0xF08, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseAgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int DexOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public bool DoAgility(Mobile from)
|
||||
{
|
||||
// TODO: Verify scaled; is it offset, duration, or both?
|
||||
if (SpellHelper.AddStatOffset(from, StatType.Dex, Scale(from, DexOffset), Duration))
|
||||
{
|
||||
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 (DoAgility(from))
|
||||
{
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterAgilityPotion : BaseAgilityPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterAgilityPotion() : base(PotionEffect.AgilityGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterAgilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int DexOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
263
Projects/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs
Normal file
263
Projects/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs
Normal file
|
|
@ -0,0 +1,263 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Engines.Craft;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum PotionEffect
|
||||
{
|
||||
Nightsight,
|
||||
CureLesser,
|
||||
Cure,
|
||||
CureGreater,
|
||||
Agility,
|
||||
AgilityGreater,
|
||||
Strength,
|
||||
StrengthGreater,
|
||||
PoisonLesser,
|
||||
Poison,
|
||||
PoisonGreater,
|
||||
PoisonDeadly,
|
||||
Refresh,
|
||||
RefreshTotal,
|
||||
HealLesser,
|
||||
Heal,
|
||||
HealGreater,
|
||||
ExplosionLesser,
|
||||
Explosion,
|
||||
ExplosionGreater,
|
||||
Conflagration,
|
||||
ConflagrationGreater,
|
||||
MaskOfDeath, // Mask of Death is not available in OSI but does exist in cliloc files
|
||||
MaskOfDeathGreater, // included in enumeration for compatibility if later enabled by OSI
|
||||
ConfusionBlast,
|
||||
ConfusionBlastGreater,
|
||||
Invisibility,
|
||||
Parasitic,
|
||||
Darkglow
|
||||
}
|
||||
|
||||
public abstract class BasePotion : Item, ICraftable, ICommodity
|
||||
{
|
||||
private PotionEffect m_PotionEffect;
|
||||
|
||||
public BasePotion(int itemID, PotionEffect effect) : base(itemID)
|
||||
{
|
||||
m_PotionEffect = effect;
|
||||
|
||||
Stackable = Core.ML;
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public BasePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public PotionEffect PotionEffect
|
||||
{
|
||||
get => m_PotionEffect;
|
||||
set
|
||||
{
|
||||
m_PotionEffect = value;
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1041314 + (int)m_PotionEffect;
|
||||
|
||||
public virtual bool RequireFreeHand => true;
|
||||
|
||||
int ICommodity.DescriptionNumber => LabelNumber;
|
||||
bool ICommodity.IsDeedable => Core.ML;
|
||||
|
||||
#region ICraftable Members
|
||||
|
||||
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
|
||||
CraftItem craftItem, int resHue)
|
||||
{
|
||||
if (craftSystem is DefAlchemy)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if (pack != null)
|
||||
{
|
||||
if ((int)PotionEffect >= (int)PotionEffect.Invisibility)
|
||||
return 1;
|
||||
|
||||
List<PotionKeg> kegs = pack.FindItemsByType<PotionKeg>();
|
||||
|
||||
for (int i = 0; i < kegs.Count; ++i)
|
||||
{
|
||||
PotionKeg keg = kegs[i];
|
||||
|
||||
// Should never happen
|
||||
// if (keg == null)
|
||||
// continue;
|
||||
|
||||
if (keg.Held <= 0 || keg.Held >= 100)
|
||||
continue;
|
||||
|
||||
if (keg.Type != PotionEffect)
|
||||
continue;
|
||||
|
||||
++keg.Held;
|
||||
|
||||
Consume();
|
||||
from.AddToBackpack(new Bottle());
|
||||
|
||||
return -1; // signal placed in keg
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static bool HasFreeHand(Mobile m)
|
||||
{
|
||||
Item handOne = m.FindItemOnLayer(Layer.OneHanded);
|
||||
Item handTwo = m.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
if (handTwo is BaseWeapon)
|
||||
handOne = handTwo;
|
||||
|
||||
if (handTwo is BaseRanged ranged && ranged.Balanced)
|
||||
return true;
|
||||
|
||||
return handOne == null || handTwo == null;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (!Movable)
|
||||
return;
|
||||
|
||||
if (from.InRange(GetWorldLocation(), 1))
|
||||
{
|
||||
if (!RequireFreeHand || HasFreeHand(from))
|
||||
{
|
||||
if (this is BaseExplosionPotion && Amount > 1)
|
||||
{
|
||||
BasePotion pot = (BasePotion)Activator.CreateInstance(GetType());
|
||||
|
||||
Amount--;
|
||||
|
||||
if (from.Backpack?.Deleted != false)
|
||||
from.Backpack.DropItem(pot);
|
||||
else
|
||||
pot.MoveToWorld(from.Location, from.Map);
|
||||
pot.Drink(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
Drink(from);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(502138); // That is too far away for you to use
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write((int)m_PotionEffect);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_PotionEffect = (PotionEffect)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (version == 0)
|
||||
Stackable = Core.ML;
|
||||
}
|
||||
|
||||
public abstract void Drink(Mobile from);
|
||||
|
||||
public static void PlayDrinkEffect(Mobile m)
|
||||
{
|
||||
m.RevealingAction();
|
||||
|
||||
m.PlaySound(0x2D6);
|
||||
|
||||
#region Dueling
|
||||
|
||||
if (!DuelContext.IsFreeConsume(m))
|
||||
m.AddToBackpack(new Bottle());
|
||||
|
||||
#endregion
|
||||
|
||||
if (m.Body.IsHuman && !m.Mounted)
|
||||
m.Animate(34, 5, 1, true, false, 0);
|
||||
}
|
||||
|
||||
public static int EnhancePotions(Mobile m)
|
||||
{
|
||||
int EP = AosAttributes.GetValue(m, AosAttribute.EnhancePotions);
|
||||
int skillBonus = m.Skills.Alchemy.Fixed / 330 * 10;
|
||||
|
||||
if (Core.ML && EP > 50 && m.AccessLevel <= AccessLevel.Player)
|
||||
EP = 50;
|
||||
|
||||
return EP + skillBonus;
|
||||
}
|
||||
|
||||
public static TimeSpan Scale(Mobile m, TimeSpan v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
double scalar = 1.0 + 0.01 * EnhancePotions(m);
|
||||
|
||||
return TimeSpan.FromSeconds(v.TotalSeconds * scalar);
|
||||
}
|
||||
|
||||
public static double Scale(Mobile m, double v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
double scalar = 1.0 + 0.01 * EnhancePotions(m);
|
||||
|
||||
return v * scalar;
|
||||
}
|
||||
|
||||
public static int Scale(Mobile m, int v)
|
||||
{
|
||||
if (!Core.AOS)
|
||||
return v;
|
||||
|
||||
return AOS.Scale(v, 100 + EnhancePotions(m));
|
||||
}
|
||||
|
||||
public override bool StackWith(Mobile from, Item dropped, bool playSound)
|
||||
{
|
||||
return dropped is BasePotion potion && potion.m_PotionEffect == m_PotionEffect &&
|
||||
base.StackWith(from, potion, playSound);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,307 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseConflagrationPotion : BasePotion
|
||||
{
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
|
||||
public BaseConflagrationPotion(PotionEffect effect) : base(0xF06, effect)
|
||||
{
|
||||
Hue = 0x489;
|
||||
}
|
||||
|
||||
public BaseConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int MinDamage{ get; }
|
||||
public abstract int MaxDamage{ get; }
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
int delay = GetDelay(from);
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1072529,
|
||||
$"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Target is ThrowTarget targ && targ.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
||||
from.Target = new ThrowTarget(this);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual void Explode(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted || map == null)
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
// Check if any other players are using this potion
|
||||
for (int i = 0; i < m_Users.Count; i++)
|
||||
if (m_Users[i].Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(from);
|
||||
|
||||
// Effects
|
||||
Effects.PlaySound(loc, map, 0x20C);
|
||||
|
||||
for (int i = -2; i <= 2; i++)
|
||||
for (int j = -2; j <= 2; j++)
|
||||
{
|
||||
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
|
||||
|
||||
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
|
||||
new InternalItem(from, p, map, MinDamage, MaxDamage);
|
||||
}
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseConflagrationPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
public BaseConflagrationPotion Potion{ get; }
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
if (!(targeted is IPoint3D p) || from.Map == null)
|
||||
return;
|
||||
|
||||
// Add delay
|
||||
AddDelay(from);
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
|
||||
if (p is Mobile mobile)
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity(Serial.Zero, new Point3D(p), from.Map);
|
||||
|
||||
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.5), () => Potion.Explode(from, new Point3D(p), from.Map));
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalItem : Item
|
||||
{
|
||||
private DateTime m_End;
|
||||
private int m_MaxDamage;
|
||||
private int m_MinDamage;
|
||||
private Timer m_Timer;
|
||||
|
||||
public InternalItem(Mobile from, Point3D loc, Map map, int min, int max) : base(0x398C)
|
||||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle300;
|
||||
|
||||
MoveToWorld(loc, map);
|
||||
|
||||
From = from;
|
||||
m_End = DateTime.UtcNow + TimeSpan.FromSeconds(10);
|
||||
|
||||
SetDamage(min, max);
|
||||
|
||||
m_Timer = new InternalTimer(this, m_End);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public InternalItem(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public Mobile From{ get; private set; }
|
||||
|
||||
public override bool BlocksFit => true;
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
m_Timer?.Stop();
|
||||
}
|
||||
|
||||
public int GetDamage()
|
||||
{
|
||||
return Utility.RandomMinMax(m_MinDamage, m_MaxDamage);
|
||||
}
|
||||
|
||||
private void SetDamage(int min, int max)
|
||||
{
|
||||
/* new way to apply alchemy bonus according to Stratics' calculator.
|
||||
this gives a mean to values 25, 50, 75 and 100. Stratics' calculator is outdated.
|
||||
Those goals will give 2 to alchemy bonus. It's not really OSI-like but it's an approximation. */
|
||||
|
||||
m_MinDamage = min;
|
||||
m_MaxDamage = max;
|
||||
|
||||
if (From == null)
|
||||
return;
|
||||
|
||||
int alchemySkill = From.Skills.Alchemy.Fixed;
|
||||
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250;
|
||||
|
||||
m_MinDamage = Scale(From, m_MinDamage + alchemyBonus);
|
||||
m_MaxDamage = Scale(From, m_MaxDamage + alchemyBonus);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write(From);
|
||||
writer.Write(m_End);
|
||||
writer.Write(m_MinDamage);
|
||||
writer.Write(m_MaxDamage);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
From = reader.ReadMobile();
|
||||
m_End = reader.ReadDateTime();
|
||||
m_MinDamage = reader.ReadInt();
|
||||
m_MaxDamage = reader.ReadInt();
|
||||
|
||||
m_Timer = new InternalTimer(this, m_End);
|
||||
m_Timer.Start();
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget(From, m) &&
|
||||
From.CanBeHarmful(m, false))
|
||||
{
|
||||
From.DoHarmful(m);
|
||||
|
||||
AOS.Damage(m, From, GetDamage(), 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private DateTime m_End;
|
||||
private InternalItem m_Item;
|
||||
|
||||
public InternalTimer(InternalItem item, DateTime end) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Item = item;
|
||||
m_End = end;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_Item.Deleted)
|
||||
return;
|
||||
|
||||
if (DateTime.UtcNow > m_End)
|
||||
{
|
||||
m_Item.Delete();
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
|
||||
Mobile from = m_Item.From;
|
||||
|
||||
if (m_Item.Map == null || from == null)
|
||||
return;
|
||||
|
||||
foreach (Mobile m in m_Item.GetMobilesInRange(0))
|
||||
{
|
||||
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != from) &&
|
||||
SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
|
||||
{
|
||||
from.DoHarmful(m);
|
||||
|
||||
AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x208);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Delay
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public static void AddDelay(Mobile m)
|
||||
{
|
||||
m_Delay.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(30), EndDelay, m);
|
||||
}
|
||||
|
||||
public static int GetDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out Timer timer) && timer.Next > DateTime.UtcNow)
|
||||
return (int)(timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ConflagrationPotion() : base(PotionEffect.Conflagration)
|
||||
{
|
||||
}
|
||||
|
||||
public ConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinDamage => 2;
|
||||
public override int MaxDamage => 4;
|
||||
|
||||
public override int LabelNumber => 1072095; // a Conflagration potion
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterConflagrationPotion : BaseConflagrationPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterConflagrationPotion() : base(PotionEffect.ConflagrationGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterConflagrationPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinDamage => 4;
|
||||
public override int MaxDamage => 8;
|
||||
|
||||
public override int LabelNumber => 1072098; // a Greater Conflagration potion
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,179 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseConfusionBlastPotion : BasePotion
|
||||
{
|
||||
private List<Mobile> m_Users = new List<Mobile>();
|
||||
|
||||
public BaseConfusionBlastPotion(PotionEffect effect) : base(0xF06, effect)
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
|
||||
public BaseConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int Radius{ get; }
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
int delay = GetDelay(from);
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
from.SendLocalizedMessage(1072529,
|
||||
$"{delay}\t{(delay > 1 ? "seconds." : "second.")}"); // You cannot use that for another ~1_NUM~ ~2_TIMEUNITS~
|
||||
return;
|
||||
}
|
||||
|
||||
if (from.Target is ThrowTarget targ && targ.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if (!m_Users.Contains(from))
|
||||
m_Users.Add(from);
|
||||
|
||||
from.Target = new ThrowTarget(this);
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual void Explode(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted || map == null)
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
// Check if any other players are using this potion
|
||||
for (int i = 0; i < m_Users.Count; i++)
|
||||
if (m_Users[i].Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(from);
|
||||
|
||||
// Effects
|
||||
Effects.PlaySound(loc, map, 0x207);
|
||||
|
||||
Geometry.Circle2D(loc, map, Radius, BlastEffect, 270, 90);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(0.3), () => CircleEffect2(loc, map));
|
||||
|
||||
foreach (Mobile mobile in map.GetMobilesInRange(loc, Radius))
|
||||
if (mobile is BaseCreature mon)
|
||||
{
|
||||
if (mon.Controlled || mon.Summoned)
|
||||
continue;
|
||||
|
||||
mon.Pacify(from, DateTime.UtcNow + TimeSpan.FromSeconds(5.0)); // TODO check
|
||||
}
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseConfusionBlastPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
public BaseConfusionBlastPotion Potion{ get; }
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
if (!(targeted is IPoint3D p) || from.Map == null)
|
||||
return;
|
||||
|
||||
// Add delay
|
||||
AddDelay(from);
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to;
|
||||
|
||||
if (p is Mobile mobile)
|
||||
to = mobile;
|
||||
else
|
||||
to = new Entity(Serial.Zero, new Point3D(p), from.Map);
|
||||
|
||||
Effects.SendMovingEffect(from, to, 0xF0D, 7, 0, false, false, Potion.Hue);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => Potion.Explode(from, new Point3D(p), from.Map));
|
||||
}
|
||||
}
|
||||
|
||||
#region Effects
|
||||
|
||||
public virtual void BlastEffect(Point3D p, Map map)
|
||||
{
|
||||
if (map.CanFit(p, 12, true, false))
|
||||
Effects.SendLocationEffect(p, map, 0x376A, 4, 9);
|
||||
}
|
||||
|
||||
public void CircleEffect2(Point3D p, Map m)
|
||||
{
|
||||
Geometry.Circle2D(p, m, Radius, BlastEffect, 90, 270);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Delay
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public static void AddDelay(Mobile m)
|
||||
{
|
||||
m_Delay.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
m_Delay[m] = Timer.DelayCall(TimeSpan.FromSeconds(60), EndDelay, m);
|
||||
}
|
||||
|
||||
public static int GetDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out Timer timer) && timer.Next > DateTime.UtcNow)
|
||||
return (int)(timer.Next - DateTime.UtcNow).TotalSeconds;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void EndDelay(Mobile m)
|
||||
{
|
||||
if (m_Delay.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Delay.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ConfusionBlastPotion() : base(PotionEffect.ConfusionBlast)
|
||||
{
|
||||
}
|
||||
|
||||
public ConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int Radius => 5;
|
||||
|
||||
public override int LabelNumber => 1072105; // a Confusion Blast potion
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterConfusionBlastPotion : BaseConfusionBlastPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterConfusionBlastPotion() : base(PotionEffect.ConfusionBlastGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterConfusionBlastPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int Radius => 7;
|
||||
|
||||
public override int LabelNumber => 1072108; // a Greater Confusion Blast potion
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
using Server.Spells.Necromancy;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class CureLevelInfo
|
||||
{
|
||||
public CureLevelInfo(Poison poison, double chance)
|
||||
{
|
||||
Poison = poison;
|
||||
Chance = chance;
|
||||
}
|
||||
|
||||
public Poison Poison{ get; }
|
||||
|
||||
public double Chance{ get; }
|
||||
}
|
||||
|
||||
public abstract class BaseCurePotion : BasePotion
|
||||
{
|
||||
public BaseCurePotion(PotionEffect effect) : base(0xF07, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract CureLevelInfo[] LevelInfo{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoCure(Mobile from)
|
||||
{
|
||||
bool cure = false;
|
||||
|
||||
CureLevelInfo[] info = LevelInfo;
|
||||
|
||||
for (int i = 0; i < info.Length; ++i)
|
||||
{
|
||||
CureLevelInfo li = info[i];
|
||||
|
||||
if (li.Poison == from.Poison && Scale(from, li.Chance) > Utility.RandomDouble())
|
||||
{
|
||||
cure = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cure && from.CurePoison(from))
|
||||
{
|
||||
from.SendLocalizedMessage(500231); // You feel cured of poison!
|
||||
|
||||
from.FixedEffect(0x373A, 10, 15);
|
||||
from.PlaySound(0x1E0);
|
||||
}
|
||||
else if (!cure)
|
||||
{
|
||||
from.SendLocalizedMessage(500232); // That potion was not strong enough to cure your ailment!
|
||||
}
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (TransformationSpellHelper.UnderTransformation(from, typeof(VampiricEmbraceSpell)))
|
||||
{
|
||||
from.SendLocalizedMessage(1061652); // The garlic in the potion would surely kill you.
|
||||
}
|
||||
else if (from.Poisoned)
|
||||
{
|
||||
DoCure(from);
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
from.FixedParticles(0x373A, 10, 15, 5012, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E0);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1042000); // You are not poisoned.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class CurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 0.75), // 75% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 0.50), // 50% chance to cure greater poison
|
||||
new CureLevelInfo(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00),
|
||||
new CureLevelInfo(Poison.Regular, 0.95),
|
||||
new CureLevelInfo(Poison.Greater, 0.75),
|
||||
new CureLevelInfo(Poison.Deadly, 0.50),
|
||||
new CureLevelInfo(Poison.Lethal, 0.25)
|
||||
};
|
||||
|
||||
[Constructible]
|
||||
public CurePotion() : base(PotionEffect.Cure)
|
||||
{
|
||||
}
|
||||
|
||||
public CurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 1.00), // 100% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 1.00), // 100% chance to cure greater poison
|
||||
new CureLevelInfo(Poison.Deadly, 0.75), // 75% chance to cure deadly poison
|
||||
new CureLevelInfo(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 1.00),
|
||||
new CureLevelInfo(Poison.Regular, 1.00),
|
||||
new CureLevelInfo(Poison.Greater, 1.00),
|
||||
new CureLevelInfo(Poison.Deadly, 0.95),
|
||||
new CureLevelInfo(Poison.Lethal, 0.75)
|
||||
};
|
||||
|
||||
[Constructible]
|
||||
public GreaterCurePotion() : base(PotionEffect.CureGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserCurePotion : BaseCurePotion
|
||||
{
|
||||
private static CureLevelInfo[] m_OldLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
|
||||
new CureLevelInfo(Poison.Regular, 0.50), // 50% chance to cure regular poison
|
||||
new CureLevelInfo(Poison.Greater, 0.15) // 15% chance to cure greater poison
|
||||
};
|
||||
|
||||
private static CureLevelInfo[] m_AosLevelInfo =
|
||||
{
|
||||
new CureLevelInfo(Poison.Lesser, 0.75),
|
||||
new CureLevelInfo(Poison.Regular, 0.50),
|
||||
new CureLevelInfo(Poison.Greater, 0.25)
|
||||
};
|
||||
|
||||
[Constructible]
|
||||
public LesserCurePotion() : base(PotionEffect.CureLesser)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserCurePotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override CureLevelInfo[] LevelInfo => Core.AOS ? m_AosLevelInfo : m_OldLevelInfo;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class DarkglowPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public DarkglowPotion() : base(PotionEffect.Darkglow)
|
||||
{
|
||||
Hue = 0x96;
|
||||
}
|
||||
|
||||
public DarkglowPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Poison Poison => Poison.Greater; /* MUST be restored when prerequisites are done */
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override int LabelNumber => 1072849; // Darkglow Poison
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,267 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseExplosionPotion : BasePotion
|
||||
{
|
||||
private const int ExplosionRange = 2; // How long is the blast radius?
|
||||
|
||||
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
|
||||
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
|
||||
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
|
||||
|
||||
private Timer m_Timer;
|
||||
|
||||
public BaseExplosionPotion(PotionEffect effect) : base(0xF0D, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int MinDamage{ get; }
|
||||
public abstract int MaxDamage{ get; }
|
||||
|
||||
public override bool RequireFreeHand => false;
|
||||
|
||||
public List<Mobile> Users{ get; private set; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public virtual IEntity FindParent(Mobile from)
|
||||
{
|
||||
if (HeldBy?.Holding == this)
|
||||
return HeldBy;
|
||||
|
||||
if (RootParent != null)
|
||||
return RootParent;
|
||||
|
||||
if (Map == Map.Internal)
|
||||
return from;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
|
||||
{
|
||||
from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
|
||||
return;
|
||||
}
|
||||
|
||||
ThrowTarget targ = from.Target as ThrowTarget;
|
||||
Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode.
|
||||
|
||||
if (targ?.Potion == this)
|
||||
return;
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
if (Users == null)
|
||||
Users = new List<Mobile>();
|
||||
|
||||
if (!Users.Contains(from))
|
||||
Users.Add(from);
|
||||
|
||||
from.Target = new ThrowTarget(this);
|
||||
|
||||
if (m_Timer == null)
|
||||
{
|
||||
from.SendLocalizedMessage(500236); // You should throw it now!
|
||||
|
||||
int timer = 3;
|
||||
|
||||
if (Core.ML)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5,
|
||||
() => Detonate_OnTick(from, timer--)); // 3.6 seconds explosion delay
|
||||
else
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4,
|
||||
() => Detonate_OnTick(from, timer--)); // 2.6 seconds explosion delay
|
||||
}
|
||||
}
|
||||
|
||||
private void Detonate_OnTick(Mobile from, int timer)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
IEntity parent = FindParent(from);
|
||||
|
||||
if (timer == 0)
|
||||
{
|
||||
Point3D loc;
|
||||
Map map;
|
||||
|
||||
if (parent is Item item)
|
||||
{
|
||||
loc = item.GetWorldLocation();
|
||||
map = item.Map;
|
||||
}
|
||||
else if (parent is Mobile m)
|
||||
{
|
||||
loc = m.Location;
|
||||
map = m.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Explode(from, true, loc, map);
|
||||
m_Timer = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parent is Item item)
|
||||
item.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
else if (parent is Mobile mobile)
|
||||
mobile.PublicOverheadMessage(MessageType.Regular, 0x22, false, timer.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void Reposition_OnTick(Mobile from, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
if (InstantExplosion)
|
||||
Explode(from, true, loc, map);
|
||||
else
|
||||
MoveToWorld(loc, map);
|
||||
}
|
||||
|
||||
public void Explode(Mobile from, bool direct, Point3D loc, Map map)
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
Consume();
|
||||
|
||||
for (int i = 0; Users != null && i < Users.Count; ++i)
|
||||
{
|
||||
Mobile m = Users[i];
|
||||
|
||||
if (m.Target is ThrowTarget targ && targ.Potion == this)
|
||||
Target.Cancel(m);
|
||||
}
|
||||
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
Effects.PlaySound(loc, map, 0x307);
|
||||
|
||||
Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0);
|
||||
int alchemyBonus = 0;
|
||||
|
||||
if (direct)
|
||||
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
|
||||
|
||||
IPooledEnumerable<IEntity> eable = map.GetObjectsInRange(loc, ExplosionRange, LeveledExplosion);
|
||||
int toDamage = 0;
|
||||
|
||||
List<IEntity> toExplode = eable.Where(o =>
|
||||
{
|
||||
if (!(o is Mobile mobile) || from != null &&
|
||||
(!SpellHelper.ValidIndirectTarget(from, mobile) || !from.CanBeHarmful(mobile, false)))
|
||||
return o is BaseExplosionPotion && o != this;
|
||||
|
||||
++toDamage;
|
||||
return true;
|
||||
}).ToList();
|
||||
|
||||
eable.Free();
|
||||
|
||||
int min = Scale(from, MinDamage);
|
||||
int max = Scale(from, MaxDamage);
|
||||
|
||||
for (int i = 0; i < toExplode.Count; ++i)
|
||||
{
|
||||
IEntity o = toExplode[i];
|
||||
|
||||
if (o is Mobile m)
|
||||
{
|
||||
from?.DoHarmful(m);
|
||||
|
||||
int damage = Utility.RandomMinMax(min, max);
|
||||
|
||||
damage += alchemyBonus;
|
||||
|
||||
if (!Core.AOS && damage > 40)
|
||||
damage = 40;
|
||||
else if (Core.AOS && toDamage > 2)
|
||||
damage /= toDamage - 1;
|
||||
|
||||
AOS.Damage(m, from, damage, 0, 100, 0, 0, 0);
|
||||
}
|
||||
else if (o is BaseExplosionPotion pot)
|
||||
{
|
||||
pot.Explode(from, false, pot.GetWorldLocation(), pot.Map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
public ThrowTarget(BaseExplosionPotion potion) : base(12, true, TargetFlags.None)
|
||||
{
|
||||
Potion = potion;
|
||||
}
|
||||
|
||||
public BaseExplosionPotion Potion{ get; }
|
||||
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (Potion.Deleted || Potion.Map == Map.Internal)
|
||||
return;
|
||||
|
||||
if (!(targeted is IPoint3D p))
|
||||
return;
|
||||
|
||||
Map map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
return;
|
||||
|
||||
SpellHelper.GetSurfaceTop(ref p);
|
||||
|
||||
from.RevealingAction();
|
||||
|
||||
IEntity to = new Entity(Serial.Zero, new Point3D(p), map);
|
||||
|
||||
if (p is Mobile m)
|
||||
{
|
||||
if (!RelativeLocation) // explosion location = current mob location.
|
||||
p = m.Location;
|
||||
else
|
||||
to = m;
|
||||
}
|
||||
|
||||
Effects.SendMovingEffect(from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue);
|
||||
|
||||
if (Potion.Amount > 1) Mobile.LiftItemDupe(Potion, 1);
|
||||
|
||||
Potion.Internalize();
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => Potion.Reposition_OnTick(from, new Point3D(p), map));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ExplosionPotion() : base(PotionEffect.Explosion)
|
||||
{
|
||||
}
|
||||
|
||||
public ExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinDamage => 10;
|
||||
public override int MaxDamage => 20;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterExplosionPotion() : base(PotionEffect.ExplosionGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinDamage => Core.AOS ? 20 : 15;
|
||||
public override int MaxDamage => Core.AOS ? 40 : 30;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserExplosionPotion : BaseExplosionPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserExplosionPotion() : base(PotionEffect.ExplosionLesser)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserExplosionPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinDamage => 5;
|
||||
public override int MaxDamage => 10;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseHealPotion : BasePotion
|
||||
{
|
||||
public BaseHealPotion(PotionEffect effect) : base(0xF0C, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int MinHeal{ get; }
|
||||
public abstract int MaxHeal{ get; }
|
||||
public abstract double Delay{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoHeal(Mobile from)
|
||||
{
|
||||
int min = Scale(from, MinHeal);
|
||||
int max = Scale(from, MaxHeal);
|
||||
|
||||
from.Heal(Utility.RandomMinMax(min, max));
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Hits < from.HitsMax)
|
||||
{
|
||||
if (from.Poisoned || MortalStrike.IsWounded(from))
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22,
|
||||
1005000); // You can not heal yourself in your current state.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (from.BeginAction<BaseHealPotion>())
|
||||
{
|
||||
DoHeal(from);
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(Delay), from.EndAction<BaseHealPotion>);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22,
|
||||
500235); // You must wait 10 seconds before using another healing potion.
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1049547); // You decide against drinking this potion, as you are already at full health.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterHealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterHealPotion() : base(PotionEffect.HealGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinHeal => Core.AOS ? 20 : 9;
|
||||
public override int MaxHeal => Core.AOS ? 25 : 30;
|
||||
public override double Delay => 10.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class HealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public HealPotion() : base(PotionEffect.Heal)
|
||||
{
|
||||
}
|
||||
|
||||
public HealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinHeal => Core.AOS ? 13 : 6;
|
||||
public override int MaxHeal => Core.AOS ? 16 : 20;
|
||||
public override double Delay => Core.AOS ? 8.0 : 10.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserHealPotion : BaseHealPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserHealPotion() : base(PotionEffect.HealLesser)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserHealPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int MinHeal => Core.AOS ? 6 : 3;
|
||||
public override int MaxHeal => Core.AOS ? 8 : 10;
|
||||
public override double Delay => Core.AOS ? 3.0 : 10.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class InvisibilityPotion : BasePotion
|
||||
{
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
|
||||
[Constructible]
|
||||
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility)
|
||||
{
|
||||
Hue = 0x48D;
|
||||
}
|
||||
|
||||
public InvisibilityPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int LabelNumber => 1072941; // Potion of Invisibility
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Hidden)
|
||||
{
|
||||
from.SendLocalizedMessage(1073185); // You are already unseen.
|
||||
return;
|
||||
}
|
||||
|
||||
if (HasTimer(from))
|
||||
{
|
||||
from.SendLocalizedMessage(1073186); // An invisibility potion is already taking effect on your person.
|
||||
return;
|
||||
}
|
||||
|
||||
Consume();
|
||||
m_Table[from] = Timer.DelayCall(TimeSpan.FromSeconds(2), Hide, from);
|
||||
PlayDrinkEffect(from);
|
||||
}
|
||||
|
||||
public static void Hide(Mobile m)
|
||||
{
|
||||
Effects.SendLocationParticles(
|
||||
EffectItem.Create(new Point3D(m.X, m.Y, m.Z + 16), m.Map, EffectItem.DefaultDuration), 0x376A, 10, 15, 5045);
|
||||
m.PlaySound(0x3C4);
|
||||
|
||||
m.Hidden = true;
|
||||
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
|
||||
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); //Invisibility/Invisible
|
||||
|
||||
RemoveTimer(m);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(30), EndHide, m);
|
||||
}
|
||||
|
||||
public static void EndHide(Mobile m)
|
||||
{
|
||||
m.RevealingAction();
|
||||
RemoveTimer(m);
|
||||
}
|
||||
|
||||
public static bool HasTimer(Mobile m)
|
||||
{
|
||||
return m_Table.ContainsKey(m);
|
||||
}
|
||||
|
||||
public static void RemoveTimer(Mobile m, bool interrupted = false)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
if (interrupted)
|
||||
m.SendLocalizedMessage(1073187); // The invisibility effect is interrupted.
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class NightSightPotion : BasePotion
|
||||
{
|
||||
[Constructible]
|
||||
public NightSightPotion() : base(0xF06, PotionEffect.Nightsight)
|
||||
{
|
||||
}
|
||||
|
||||
public NightSightPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.BeginAction<LightCycle>())
|
||||
{
|
||||
new LightCycle.NightSightTimer(from).Start();
|
||||
from.LightLevel = LightCycle.DungeonLevel / 2;
|
||||
|
||||
from.FixedParticles(0x376A, 9, 32, 5007, EffectLayer.Waist);
|
||||
from.PlaySound(0x1E3);
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You already have nightsight.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class ParasiticPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public ParasiticPotion() : base(PotionEffect.Parasitic)
|
||||
{
|
||||
Hue = 0x17C;
|
||||
}
|
||||
|
||||
public ParasiticPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
/* public override Poison Poison => Poison.Darkglow; MUST be restored when prerequisites are done */
|
||||
public override Poison Poison => Poison.Greater;
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override int LabelNumber => 1072848; // Parasitic Poison
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BasePoisonPotion : BasePotion
|
||||
{
|
||||
public BasePoisonPotion(PotionEffect effect) : base(0xF0A, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BasePoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract Poison Poison{ get; }
|
||||
|
||||
public abstract double MinPoisoningSkill{ get; }
|
||||
public abstract double MaxPoisoningSkill{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public void DoPoison(Mobile from)
|
||||
{
|
||||
from.ApplyPoison(from, Poison);
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
DoPoison(from);
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class DeadlyPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public DeadlyPoisonPotion() : base(PotionEffect.PoisonDeadly)
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Poison Poison => Poison.Deadly;
|
||||
|
||||
public override double MinPoisoningSkill => 95.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class GreaterPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterPoisonPotion() : base(PotionEffect.PoisonGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Poison Poison => Poison.Greater;
|
||||
|
||||
public override double MinPoisoningSkill => 60.0;
|
||||
public override double MaxPoisoningSkill => 100.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class LesserPoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public LesserPoisonPotion() : base(PotionEffect.PoisonLesser)
|
||||
{
|
||||
}
|
||||
|
||||
public LesserPoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Poison Poison => Poison.Lesser;
|
||||
|
||||
public override double MinPoisoningSkill => 0.0;
|
||||
public override double MaxPoisoningSkill => 60.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class PoisonPotion : BasePoisonPotion
|
||||
{
|
||||
[Constructible]
|
||||
public PoisonPotion() : base(PotionEffect.Poison)
|
||||
{
|
||||
}
|
||||
|
||||
public PoisonPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override Poison Poison => Poison.Regular;
|
||||
|
||||
public override double MinPoisoningSkill => 30.0;
|
||||
public override double MaxPoisoningSkill => 70.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using Server.Engines.ConPVP;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseRefreshPotion : BasePotion
|
||||
{
|
||||
public BaseRefreshPotion(PotionEffect effect) : base(0xF0B, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseRefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract double Refresh{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
|
||||
public override void Drink(Mobile from)
|
||||
{
|
||||
if (from.Stam < from.StamMax)
|
||||
{
|
||||
from.Stam += Scale(from, (int)(Refresh * from.StamMax));
|
||||
|
||||
PlayDrinkEffect(from);
|
||||
|
||||
if (!DuelContext.IsFreeConsume(from))
|
||||
Consume();
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You decide against drinking this potion, as you are already at full stamina.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class RefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
[Constructible]
|
||||
public RefreshPotion() : base(PotionEffect.Refresh)
|
||||
{
|
||||
}
|
||||
|
||||
public RefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override double Refresh => 0.25;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public class TotalRefreshPotion : BaseRefreshPotion
|
||||
{
|
||||
[Constructible]
|
||||
public TotalRefreshPotion() : base(PotionEffect.RefreshTotal)
|
||||
{
|
||||
}
|
||||
|
||||
public TotalRefreshPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override double Refresh => 1.0;
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using Server.Engines.ConPVP;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseStrengthPotion : BasePotion
|
||||
{
|
||||
public BaseStrengthPotion(PotionEffect effect) : base(0xF09, effect)
|
||||
{
|
||||
}
|
||||
|
||||
public BaseStrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public abstract int StrOffset{ get; }
|
||||
public abstract TimeSpan Duration{ get; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int 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))
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GreaterStrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
[Constructible]
|
||||
public GreaterStrengthPotion() : base(PotionEffect.StrengthGreater)
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterStrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StrOffset => 20;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class StrengthPotion : BaseStrengthPotion
|
||||
{
|
||||
[Constructible]
|
||||
public StrengthPotion() : base(PotionEffect.Strength)
|
||||
{
|
||||
}
|
||||
|
||||
public StrengthPotion(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int StrOffset => 10;
|
||||
public override TimeSpan Duration => TimeSpan.FromMinutes(2.0);
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue