ModernUO/Projects/UOContent/Mobiles/Animals/Mounts/LesserHiryu.cs
mark1145 053dbcbad0
fix: Fixes ignoring mobs, champions, party crash, slayer rarity, boat speedhack, etc (#1222)
* Movie ignore mobiles to Mobile class
* Allow necromancer familiars to ignore mobiles
* ChampionSpawn should not quietly fail when creating new spawn
* Fix client party crash bug: 2 people partied, the leader logs out, other client is hung
* Fix spellbooks creating with magery/meditation only and creating magery multiple times
* Fix BaseRunicTool.GetRandomSlayer() creating more undead slayers than intended
* Do not allow players to dismount each other whilst mounted
* Fix AOS onwards damage increase tooltip and wrong formula in AOS
* Fix monsters killing other monster revenants + animate dead should not attack player pets + other animates
* Fix fire steed having loot pack added twice
* Fix oaks spawn not able to create Unicorns + Kirins via Activator.CreateInstace() due to constructor having name as parametr
* Fix ignoreMobiles flag not propagated to client for non-players.
* Fix harrower tents not leeching from players
* Fix boats speedhacking around the map
* Fix bless, agility etc. not renewing duration
* Fix reveal always worked
* Fix empty constructor for steeds so they don't throw now.
2022-10-31 22:16:50 -07:00

178 lines
4.8 KiB
C#

using System;
using Server.Engines.Plants;
using Server.Items;
namespace Server.Mobiles;
public class LesserHiryu : BaseMount
{
public override string DefaultName => "a lesser hiryu";
[Constructible]
public LesserHiryu() : base(243, 0x3E94, AIType.AI_Melee)
{
Hue = GetHue();
SetStr(301, 410);
SetDex(171, 270);
SetInt(301, 325);
SetHits(401, 600);
SetMana(60);
SetDamage(18, 23);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 45, 70);
SetResistance(ResistanceType.Fire, 60, 80);
SetResistance(ResistanceType.Cold, 5, 15);
SetResistance(ResistanceType.Poison, 30, 40);
SetResistance(ResistanceType.Energy, 30, 40);
SetSkill(SkillName.Anatomy, 75.1, 80.0);
SetSkill(SkillName.MagicResist, 85.1, 100.0);
SetSkill(SkillName.Tactics, 100.1, 110.0);
SetSkill(SkillName.Wrestling, 100.1, 120.0);
Fame = 10000;
Karma = -10000;
Tamable = true;
ControlSlots = 3;
MinTameSkill = 98.7;
if (Utility.RandomDouble() < .33)
{
PackItem(Seed.RandomBonsaiSeed());
}
}
public LesserHiryu(Serial serial) : base(serial)
{
}
public override string CorpseName => "a hiryu corpse";
public override double WeaponAbilityChance => 0.07; /* 1 in 15 chance of using; 1 in 5 chance of success */
public override bool StatLossAfterTame => true;
public override int TreasureMapLevel => 3;
public override int Meat => 16;
public override int Hides => 60;
public override FoodType FavoriteFood => FoodType.Meat;
public override bool CanAngerOnTame => true;
public override WeaponAbility GetWeaponAbility() => WeaponAbility.Dismount;
private static MonsterAbility[] _abilities = { MonsterAbility.GraspingClaw };
public override MonsterAbility[] GetMonsterAbilities() => _abilities;
private static int GetHue()
{
return Utility.Random(525) switch
{
524 => 0x258, // Midnight Blue 0.19%
523 => CraftResources.GetHue(CraftResource.Valorite), // Valorite 0.19%
>= 520 => 0x7D4, // Dark Green 0.57%
>= 510 => 0x163, // Green 1.90%
>= 500 => 0x295, // Green 1.90%
_ => 0 // No Hue 95.24%
} | 0x8000;
}
public override bool OverrideBondingReqs() => ControlMaster.Skills.Bushido.Base >= 90.0;
public override int GetAngerSound() => 0x4FE;
public override int GetIdleSound() => 0x4FD;
public override int GetAttackSound() => 0x4FC;
public override int GetHurtSound() => 0x4FF;
public override int GetDeathSound() => 0x4FB;
public override void GenerateLoot()
{
AddLoot(LootPack.FilthyRich, 2);
AddLoot(LootPack.Gems, 4);
}
public override double GetControlChance(Mobile m, bool useBaseSkill = false)
{
var tamingChance = base.GetControlChance(m, useBaseSkill);
if (tamingChance >= 0.95)
{
return tamingChance;
}
var skill = useBaseSkill ? m.Skills.Bushido.Base : m.Skills.Bushido.Value;
if (skill < 90.0)
{
return tamingChance;
}
var bushidoChance = (skill - 30.0) / 100;
if (m.Skills.Bushido.Base >= 120)
{
bushidoChance += 0.05;
}
return bushidoChance > tamingChance ? bushidoChance : tamingChance;
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
writer.Write(2);
}
public override void Deserialize(IGenericReader reader)
{
base.Deserialize(reader);
var version = reader.ReadInt();
if (version <= 1)
{
Timer.StartTimer(() => Fix(version));
}
if (version < 2)
{
for (var i = 0; i < Skills.Length; ++i)
{
Skills[i].Cap = Math.Max(100.0, Skills[i].Cap * 0.9);
if (Skills[i].Base > Skills[i].Cap)
{
Skills[i].Base = Skills[i].Cap;
}
}
}
}
private void Fix(int version)
{
switch (version)
{
case 1:
{
if (InternalItem != null)
{
InternalItem.Hue = Hue;
}
goto case 0;
}
case 0:
{
Hue = GetHue();
break;
}
}
}
}