servuo/Scripts/Mobiles/Normal/Protector.cs
pyro17 bebc100d6c
Ranger Equipment fix, Additem delete (#5012)
* Ranger Equipment fix, Additem delete
- add parameter with default value to AddItem
- On Conflict, still log conflict, but delete the conflicting Item by default

- Delete the base boots of Rangers befor adding the new boots

* Updated Mobile Scripts

- went through all scripts to update them to SetWearable
- reverted change to AddItem

* Update to SetWearable

- last item being set will be worn (if no override to OnEquip returns false
- delete the item on the layer that is the same as the new item (if existend)
- used ifs to cap item.Movable, therefor no need to call to Random if <= 0 or >= 1

* Update base InitOutFit

- replaced the Additem for Backpack with SetWearable, Movable is getting set this way too
- altered the other SetWearable calls, to allow the items to be moved / dropped (as they should normally)

* Null reference sanity check.

Co-authored-by: Voxpire <admin@vita-nex.com>
2022-06-16 04:44:54 +01:00

98 lines
No EOL
2.6 KiB
C#

using Server.Items;
namespace Server.Mobiles
{
[CorpseName("a human corpse")]
public class Protector : BaseCreature
{
[Constructable]
public Protector()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Body = 401;
Female = true;
Hue = Race.Human.RandomSkinHue();
HairItemID = Race.Human.RandomHair(this);
HairHue = Race.Human.RandomHairHue();
Name = "A Protector";
Title = "The Mystic Llamaherder";
SetStr(700, 800);
SetDex(100, 150);
SetInt(50, 75);
SetHits(350, 450);
SetDamage(6, 12);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 30, 40);
SetResistance(ResistanceType.Fire, 20, 30);
SetResistance(ResistanceType.Cold, 35, 40);
SetResistance(ResistanceType.Poison, 30, 40);
SetResistance(ResistanceType.Energy, 30, 40);
SetSkill(SkillName.Wrestling, 70.0, 100.0);
SetSkill(SkillName.Tactics, 80.0, 100.0);
SetSkill(SkillName.MagicResist, 50.0, 70.0);
SetSkill(SkillName.Anatomy, 70.0, 100.0);
Fame = 10000;
Karma = -10000;
Item shroud = new Item(0x204E)
{
Layer = Layer.OuterTorso
};
SetWearable(new ThighBoots(), Utility.Random(2));
SetWearable(shroud, Utility.Random(2));
}
public Protector(Serial serial)
: base(serial)
{
}
public override bool AlwaysMurderer => true;
public override bool PropertyTitle => false;
public override bool ShowFameTitle => false;
public override void GenerateLoot(bool spawning)
{
if (spawning)
return; // No loot/backpack on spawn
base.GenerateLoot(true);
base.GenerateLoot(false);
}
public override void GenerateLoot()
{
AddLoot(LootPack.FilthyRich);
}
public override void OnDeath(Container c)
{
base.OnDeath(c);
if (Utility.RandomDouble() < 0.4)
c.DropItem(new ProtectorsEssence());
}
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();
}
}
}