ModernUO/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/JukaLord.cs
Kamron Batman ca6064b775
perf(messages): restructure format-string call sites (#2437)
## Summary

Phase 3 PR B of the message-interpolation cleanup. Handles the multi-line restructure sites flagged in `dev-docs/string-handling-message-interp-audit.md` (Phase 2). Phase 3.1 (PR #2436) handled trivial sweeps; this PR handles sites that needed an `if/else` hoist or switch restructure to eliminate `string.Format` while preserving exact message text.

Each site previously allocated an intermediate `string.Format(...)` result before passing to the message handler, despite Phase 1 making the handler accept interpolated string handlers natively.

## Sites fixed

- **`Projects/Server/Mobiles/Mobile.cs:7911`** - Title/guild header was using `string.Format` with a conditional template (`"[{1}]{2}"` vs `"[{0}, {1}]{2}"`). Split into `if (title.Length <= 0)` / `else` with direct `$"..."` interpolation.
- **`Projects/UOContent/Engines/ConPVP/DuelContext.cs:1337`** - View-ladder rank text used `string.Format(text, from == pm ? "You" : "They")`. Split into `if (from == pm)` / `else` with direct `$"..."` interpolation in each branch.
- **`Projects/UOContent/Engines/ConPVP/DuelContext.cs:1463`** - Showladder text reused a single format string for both `LocalOverheadMessage` ("You ... are ...") and `NonlocalOverheadMessage` ("`{pm.Name}` ... is ..."). Each call now uses an inline `$"..."` directly; no shared template.
- **`Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs:518`** - The signup confirmation message used a `switch` expression assigning a literal format string to `fmt`, then `string.Format(fmt, from.Female ? "Lady" : "Lord", timeUntil)`. Converted to a `switch` statement where each case calls `_registrar.PrivateOverheadMessage(...)` directly with an inline `$"..."`. Lady/Lord branching is hoisted to a `title` local.

## Exempted

- **`Projects/UOContent/Engines/ConPVP/Participant.cs:138`** - The `nonLocalOverhead` format string is a parameter passed in by callers of `Participant.Broadcast`. Investigation found 5 call sites in `DuelContext.cs` (lines 782, 802, 1187, 1196, and three at 1535/1564/1608) that pass distinct literal format strings. Refactoring would require changing all 5 callers and the method signature - out of scope for this PR. Marked with a `// Phase 3 audit:` comment per the audit's exemption convention.
2026-05-03 18:29:11 -07:00

113 lines
3.6 KiB
C#

using ModernUO.Serialization;
using Server.Items;
namespace Server.Mobiles
{
[SerializationGenerator(0, false)]
public partial class JukaLord : BaseCreature
{
[Constructible]
public JukaLord() : base(AIType.AI_Archer, FightMode.Closest, 10, 3)
{
Body = 766;
SetStr(401, 500);
SetDex(81, 100);
SetInt(151, 200);
SetHits(241, 300);
SetDamage(10, 12);
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 40, 50);
SetResistance(ResistanceType.Fire, 45, 50);
SetResistance(ResistanceType.Cold, 40, 50);
SetResistance(ResistanceType.Poison, 20, 25);
SetResistance(ResistanceType.Energy, 40, 50);
SetSkill(SkillName.Anatomy, 90.1, 100.0);
SetSkill(SkillName.Archery, 95.1, 100.0);
SetSkill(SkillName.Healing, 80.1, 100.0);
SetSkill(SkillName.MagicResist, 120.1, 130.0);
SetSkill(SkillName.Swords, 90.1, 100.0);
SetSkill(SkillName.Tactics, 95.1, 100.0);
SetSkill(SkillName.Wrestling, 90.1, 100.0);
Fame = 15000;
Karma = -15000;
VirtualArmor = 28;
var pack = new Backpack();
pack.DropItem(new Arrow(Utility.RandomMinMax(25, 35)));
pack.DropItem(new Arrow(Utility.RandomMinMax(25, 35)));
pack.DropItem(new Bandage(Utility.RandomMinMax(5, 15)));
pack.DropItem(new Bandage(Utility.RandomMinMax(5, 15)));
pack.DropItem(Loot.RandomGem());
pack.DropItem(new ArcaneGem());
PackItem(pack);
AddItem(new JukaBow());
// TODO: Bandage self
}
public override string CorpseName => "a jukan corpse";
public override string DefaultName => "a juka lord";
public override bool AlwaysMurderer => true;
public override bool BardImmune => !Core.AOS;
public override bool CanRummageCorpses => true;
public override int Meat => 1;
public override void GenerateLoot()
{
AddLoot(LootPack.Rich);
AddLoot(LootPack.Average);
}
public override void OnDamage(int amount, Mobile from, bool willKill)
{
if (!willKill && amount > 5 && from?.Player == true && Utility.Random(100) < 5)
{
switch (Utility.Random(4))
{
case 0:
{
Say(true, $"{from.Name}!! You will have to do better than that!");
break;
}
case 1:
{
Say(true, $"{from.Name}!! Prepare to meet your doom!");
break;
}
case 2:
{
Say(true, $"{from.Name}!! My armies will crush you!");
break;
}
default:
{
Say(true, $"{from.Name}!! You will pay for that!");
break;
}
}
}
base.OnDamage(amount, from, willKill);
}
public override int GetIdleSound() => 0x262;
public override int GetAngerSound() => 0x263;
public override int GetHurtSound() => 0x1D0;
public override int GetDeathSound() => 0x28D;
}
}