Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
88
Projects/Scripts/Spells/First/CreateFood.cs
Normal file
88
Projects/Scripts/Spells/First/CreateFood.cs
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.Spells.First
|
||||
{
|
||||
public class CreateFoodSpell : MagerySpell
|
||||
{
|
||||
private static SpellInfo m_Info = new SpellInfo(
|
||||
"Create Food", "In Mani Ylem",
|
||||
224,
|
||||
9011,
|
||||
Reagent.Garlic,
|
||||
Reagent.Ginseng,
|
||||
Reagent.MandrakeRoot
|
||||
);
|
||||
|
||||
private static FoodInfo[] m_Food =
|
||||
{
|
||||
new FoodInfo(typeof(Grapes), "a grape bunch"),
|
||||
new FoodInfo(typeof(Ham), "a ham"),
|
||||
new FoodInfo(typeof(CheeseWedge), "a wedge of cheese"),
|
||||
new FoodInfo(typeof(Muffins), "muffins"),
|
||||
new FoodInfo(typeof(FishSteak), "a fish steak"),
|
||||
new FoodInfo(typeof(Ribs), "cut of ribs"),
|
||||
new FoodInfo(typeof(CookedBird), "a cooked bird"),
|
||||
new FoodInfo(typeof(Sausage), "sausage"),
|
||||
new FoodInfo(typeof(Apple), "an apple"),
|
||||
new FoodInfo(typeof(Peach), "a peach")
|
||||
};
|
||||
|
||||
public CreateFoodSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
|
||||
{
|
||||
}
|
||||
|
||||
public override SpellCircle Circle => SpellCircle.First;
|
||||
|
||||
public override void OnCast()
|
||||
{
|
||||
if (CheckSequence())
|
||||
{
|
||||
FoodInfo foodInfo = m_Food[Utility.Random(m_Food.Length)];
|
||||
Item food = foodInfo.Create();
|
||||
|
||||
if (food != null)
|
||||
{
|
||||
Caster.AddToBackpack(food);
|
||||
|
||||
// You magically create food in your backpack:
|
||||
Caster.SendLocalizedMessage(1042695, true, " " + foodInfo.Name);
|
||||
|
||||
Caster.FixedParticles(0, 10, 5, 2003, EffectLayer.RightHand);
|
||||
Caster.PlaySound(0x1E2);
|
||||
}
|
||||
}
|
||||
|
||||
FinishSequence();
|
||||
}
|
||||
}
|
||||
|
||||
public class FoodInfo
|
||||
{
|
||||
public FoodInfo(Type type, string name)
|
||||
{
|
||||
Type = type;
|
||||
Name = name;
|
||||
}
|
||||
|
||||
public Type Type{ get; set; }
|
||||
|
||||
public string Name{ get; set; }
|
||||
|
||||
public Item Create()
|
||||
{
|
||||
Item item;
|
||||
|
||||
try
|
||||
{
|
||||
item = (Item)Activator.CreateInstance(Type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
item = null;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue