## Summary Overhauls the fame and karma system to be more era-accurate, based on original design documents and publish notes. ### Karma on player kill → karma on murder report - Removes karma gain/loss on player kill (was immediate on death) - Karma is now set to `Kills * -1000` on murder **report** instead - Fame on player kill now uses the same formula as monster kills (`Fame / 100`) This karma loss on murder report behaviour was tested on both the demo and live servers, behaviour was matching in terms of karma loss on report. Official UO servers karma loss AMOUNT match with my memory of T2A/UOR with one caveat - it's doubled on live servers (-2000 * kill count). I'm not sure when this changed and this behaviour has always had very poor and incorrect documentation, even 10-20 years ago. I was obsessed with the dread lord title on OSI and the only way I knew how to get it was reach 10 kills then macro them off. Even in publish 16 (when "The Murderer" title was removed) it still required 10 kills. Maybe it changed to -2000*Kills in AOS - that's where I've put the era gating diff. ### Era gates - **Karma lock** (ankh toggle + auto-lock on negative karma) gated to `Core.UOTD && !Core.AOS` — [didn't exist before Jan 28, 2001](https://web.archive.org/web/20010128092700/http://update.uo.com/design_300.html) - **Felucca fame/karma +30% bonus** gated to `Core.LBR` — [added in Publish 16, July 2002](https://uo.com/wiki/ultima-online-wiki/technical/previous-publishes/2002-2/publish-16-part-2-5-23rd-july/) - **Fame/karma splitting** among damage dealers gated to `Core.UOR` — pre-UOR awards go to last hit only ### Skill karma penalties - **Provocation** on innocent NPC: NPC says cliloc 501591, karma loss (floor -7500) - **Stealing** attempt: karma loss on every attempt (floor -5000). Stealing did not cause karma loss at all before! - **Summon Daemon**: karma loss on successful cast (floor -7000) - **Corpse carving** (human): -70 for innocent corpses (floor -7000), -20 for freely-aggressable (floor -2000) - **Bounty head turn-in**: karma gain capped at 2000 (was awarding flat +2000) ### Beneficial action karma - **Beneficial spells** (heal, cure, etc.): `AwardKarma(caster, target.Karma / 5)` — healing good targets raises karma, healing evil targets lowers it - source is UO98 demo scripts - **Bandages**: same formula but gain only (skipped if target karma ≤ 0) - see stratics link ("only ever gain karma, not lose it") Sources: UO98 Demo scripts and playing, [Fame and Karma wiki](https://uo.com/wiki/ultima-online-wiki/player/fame-and-karma/), [UO design doc (Jan 2001)](https://web.archive.org/web/20010128092700/http://update.uo.com/design_300.html), [Publish 16](https://uo.com/wiki/ultima-online-wiki/technical/previous-publishes/2002-2/publish-16-part-2-5-23rd-july/), [Stratics healing reference](https://web.archive.org/web/20001209014200fw_/http://uo.stratics.com/heal.shtml) ### Refactoring - Extracted `Titles.ComputeKillAwards(killed, map)` shared by player kill and creature kill paths - Extracted `Titles.SetKarma(m, value, message)` for direct karma assignment (used by murder report) - Extracted `SendKarmaMessage` and `CheckKarmaLock` helpers from `AwardKarma`
183 lines
7.6 KiB
C#
183 lines
7.6 KiB
C#
using System;
|
|
using Server.Items;
|
|
using Server.Misc;
|
|
using Server.Mobiles;
|
|
using Server.Targeting;
|
|
|
|
namespace Server.SkillHandlers
|
|
{
|
|
public static class Provocation
|
|
{
|
|
public static void Initialize()
|
|
{
|
|
SkillInfo.Table[(int)SkillName.Provocation].Callback = OnUse;
|
|
}
|
|
|
|
public static TimeSpan OnUse(Mobile m)
|
|
{
|
|
m.RevealingAction();
|
|
|
|
BaseInstrument.PickInstrument(m, OnPickedInstrument);
|
|
|
|
return TimeSpan.FromSeconds(1.0); // Cannot use another skill for 1 second
|
|
}
|
|
|
|
public static void OnPickedInstrument(Mobile from, BaseInstrument instrument)
|
|
{
|
|
from.RevealingAction();
|
|
from.SendLocalizedMessage(501587); // Whom do you wish to incite?
|
|
from.Target = new InternalFirstTarget(from, instrument);
|
|
}
|
|
|
|
private class InternalFirstTarget : Target
|
|
{
|
|
private readonly BaseInstrument m_Instrument;
|
|
|
|
public InternalFirstTarget(Mobile from, BaseInstrument instrument) : base(
|
|
BaseInstrument.GetBardRange(from, SkillName.Provocation),
|
|
false,
|
|
TargetFlags.None
|
|
) =>
|
|
m_Instrument = instrument;
|
|
|
|
protected override void OnTarget(Mobile from, object targeted)
|
|
{
|
|
from.RevealingAction();
|
|
|
|
if (targeted is BaseCreature creature && from.CanBeHarmful(creature, true))
|
|
{
|
|
if (!m_Instrument.IsChildOf(from.Backpack))
|
|
{
|
|
from.SendLocalizedMessage(
|
|
1062488
|
|
); // The instrument you are trying to play is no longer in your backpack!
|
|
}
|
|
else if (Notoriety.Compute(from, creature) == Notoriety.Innocent)
|
|
{
|
|
// Think not that I fail to see what thou art doing!
|
|
creature.Say(501591);
|
|
|
|
Titles.AwardKarma(from, -75, true);
|
|
}
|
|
else if (creature.Controlled)
|
|
{
|
|
from.SendLocalizedMessage(501590); // They are too loyal to their master to be provoked.
|
|
}
|
|
else if (creature.IsParagon && BaseInstrument.GetBaseDifficulty(creature) >= 160.0)
|
|
{
|
|
from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
|
|
}
|
|
else
|
|
{
|
|
from.RevealingAction();
|
|
m_Instrument.PlayInstrumentWell(from);
|
|
|
|
// You play your music and your target becomes angered. Whom do you wish them to attack?
|
|
from.SendLocalizedMessage(1008085);
|
|
from.Target = new InternalSecondTarget(from, m_Instrument, creature);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(501589); // You can't incite that!
|
|
}
|
|
}
|
|
}
|
|
|
|
private class InternalSecondTarget : Target
|
|
{
|
|
private readonly BaseCreature m_Creature;
|
|
private readonly BaseInstrument m_Instrument;
|
|
|
|
public InternalSecondTarget(Mobile from, BaseInstrument instrument, BaseCreature creature) : base(
|
|
BaseInstrument.GetBardRange(from, SkillName.Provocation),
|
|
false,
|
|
TargetFlags.None
|
|
)
|
|
{
|
|
m_Instrument = instrument;
|
|
m_Creature = creature;
|
|
}
|
|
|
|
protected override void OnTarget(Mobile from, object targeted)
|
|
{
|
|
from.RevealingAction();
|
|
|
|
if (targeted is BaseCreature creature)
|
|
{
|
|
if (!m_Instrument.IsChildOf(from.Backpack))
|
|
{
|
|
// The instrument you are trying to play is no longer in your backpack!
|
|
from.SendLocalizedMessage(1062488);
|
|
}
|
|
else if (m_Creature.Unprovokable)
|
|
{
|
|
from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
|
|
}
|
|
else if (creature.Unprovokable && creature is not DemonKnight)
|
|
{
|
|
from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures.
|
|
}
|
|
else if (m_Creature.Map != creature.Map ||
|
|
!m_Creature.InRange(creature, BaseInstrument.GetBardRange(from, SkillName.Provocation)))
|
|
{
|
|
// The creatures you are trying to provoke are too far away from each other for your music to have an effect.
|
|
from.SendLocalizedMessage(1049450);
|
|
}
|
|
else if (m_Creature != creature)
|
|
{
|
|
from.NextSkillTime = Core.TickCount + 10000;
|
|
|
|
var diff =
|
|
(m_Instrument.GetDifficultyFor(m_Creature) + m_Instrument.GetDifficultyFor(creature)) * 0.5 - 5.0;
|
|
var music = from.Skills.Musicianship.Value;
|
|
|
|
if (music > 100.0)
|
|
{
|
|
diff -= (music - 100.0) * 0.5;
|
|
}
|
|
|
|
if (from.CanBeHarmful(m_Creature, true) && from.CanBeHarmful(creature, true))
|
|
{
|
|
if (!BaseInstrument.CheckMusicianship(from))
|
|
{
|
|
from.NextSkillTime = Core.TickCount + 5000;
|
|
from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
|
|
m_Instrument.PlayInstrumentBadly(from);
|
|
m_Instrument.ConsumeUse(from);
|
|
}
|
|
else
|
|
{
|
|
// from.DoHarmful( m_Creature );
|
|
// from.DoHarmful( creature );
|
|
|
|
if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
|
|
{
|
|
from.NextSkillTime = Core.TickCount + 5000;
|
|
from.SendLocalizedMessage(501599); // Your music fails to incite enough anger.
|
|
m_Instrument.PlayInstrumentBadly(from);
|
|
m_Instrument.ConsumeUse(from);
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(501602); // Your music succeeds, as you start a fight.
|
|
m_Instrument.PlayInstrumentWell(from);
|
|
m_Instrument.ConsumeUse(from);
|
|
m_Creature.Provoke(from, creature, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(501593); // You can't tell someone to attack themselves!
|
|
}
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(501589); // You can't incite that!
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|