fix: Cleans up some comments and spell code (#1120)

This commit is contained in:
Kamron Batman 2022-07-16 19:45:41 -07:00 committed by GitHub
parent 56c97ca84a
commit fa3515f930
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
44 changed files with 338 additions and 469 deletions

View file

@ -3058,16 +3058,21 @@ namespace Server
public virtual void UpdateResistances()
{
Resistances ??= new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
var delta = false;
for (var i = 0; i < Resistances.Length; ++i)
if (Resistances == null)
{
if (Resistances[i] != int.MinValue)
Resistances = new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
}
else
{
for (var i = 0; i < Resistances.Length; ++i)
{
Resistances[i] = int.MinValue;
delta = true;
if (Resistances[i] != int.MinValue)
{
Resistances[i] = int.MinValue;
delta = true;
}
}
}
@ -3079,11 +3084,9 @@ namespace Server
public virtual int GetResistance(ResistanceType type)
{
Resistances ??= new[] { int.MinValue, int.MinValue, int.MinValue, int.MinValue, int.MinValue };
var v = (int)type;
if (v < 0 || v >= Resistances.Length)
if (Resistances == null || Resistances.Length == 0 || v < 0 || v >= Resistances.Length)
{
return 0;
}

View file

@ -134,16 +134,12 @@ namespace Server.Engines.ConPVP
return false;
}
string title = null;
if (move is NinjaMove)
string title = move switch
{
title = "Bushido";
}
else if (move is SamuraiMove)
{
title = "Ninjitsu";
}
NinjaMove => "Bushido",
SamuraiMove => "Ninjitsu",
_ => null
};
if (title == null || name == null || Ruleset.GetOption(title, name))
{

View file

@ -124,11 +124,8 @@ namespace Server.Factions
if (remaining.TotalDays >= 1)
{
from.SendLocalizedMessage(
1042743,
remaining.TotalDays
.ToString("N0")
); // Your term of service will come to an end in ~1_DAYS~ days.
// Your term of service will come to an end in ~1_DAYS~ days.
from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0"));
}
else if (remaining.TotalHours >= 1)
{

View file

@ -1708,7 +1708,7 @@ namespace Server.Engines.MLQuests.Definitions
"acid elementals",
new QuestArea(1074806, "The Palace of Paroxysmus")
)
); // The Palace of Paroxysmus
);
Rewards.Add(ItemReward.LargeBagOfTreasure);
}
@ -1734,7 +1734,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague spawns",
new QuestArea(1074806, "The Palace of Paroxysmus")
)
); // The Palace of Paroxysmus
);
Objectives.Add(
new KillObjective(
3,
@ -1742,7 +1742,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague beasts",
new QuestArea(1074806, "The Palace of Paroxysmus")
)
); // The Palace of Paroxysmus
);
Objectives.Add(
new KillObjective(
1,
@ -1750,7 +1750,7 @@ namespace Server.Engines.MLQuests.Definitions
"plague beast lord",
new QuestArea(1074806, "The Palace of Paroxysmus")
)
); // The Palace of Paroxysmus
);
Rewards.Add(ItemReward.LargeBagOfTreasure);
}
@ -3072,14 +3072,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
Utility.RandomList(
1074209, // Hey, could you help me out with something?
1074184
)
); // Come here, I have work for you.
// Hey, could you help me out with something?
// Come here, I have work for you.
MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074184);
}
public override void Serialize(IGenericWriter writer)
@ -3332,14 +3327,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
Utility.RandomList(
1074186, // Come here, I have a task.
1074209
)
); // Hey, could you help me out with something?
// Come here, I have a task.
// Hey, could you help me out with something?
MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074186);
}
public override void Serialize(IGenericWriter writer)
@ -3588,14 +3578,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
Utility.RandomList(
1074187, // Want a job?
1074209
)
); // Hey, could you help me out with something?
// Hey, could you help me out with something?
// Want a job?
MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074209 : 1074187);
}
public override void Serialize(IGenericWriter writer)
@ -3653,14 +3638,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
Utility.RandomList(
1074187, // Want a job?
1074185
)
); // Hey you! Want to help me out?
// Hey you! Want to help me out?
// Want a job?
MLQuestSystem.Tell(this, pm, Utility.RandomBool() ? 1074185 : 1074187);
}
public override void Serialize(IGenericWriter writer)

View file

@ -27,11 +27,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074940,
"",
0x2A
); // You have gained the boon of Maul! Your understanding of the seasons grows. You are one step closer to claiming your elven heritage.
// You have gained the boon of Maul! Your understanding of the seasons grows.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074940, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -58,11 +56,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074941,
"",
0x2A
); // You have gained the boon of Strongroot! You have been approved by one whose roots touch the bones of Sosaria. You are one step closer to claiming your elven heritage.
// You have gained the boon of Strongroot! You have been approved by one whose roots touch the bones of Sosaria.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074941, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -89,11 +85,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074945,
"",
0x2A
); // You have gained the boon of Enigma! You are wise enough to know how little you know. You are one step closer to claiming your elven heritage.
// You have gained the boon of Enigma! You are wise enough to know how little you know.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074945, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
@ -125,7 +119,7 @@ namespace Server.Engines.MLQuests.Definitions
Objectives.Add(
new EscortObjective(new QuestArea(1074779, "Bravehorn's drinking pool"))
); // Bravehorn's drinking pool
);
Rewards.Add(new DummyReward(1072806)); // The boon of Bravehorn.
}
@ -134,11 +128,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074942,
"",
0x2A
); // You have gained the boon of Bravehorn! You have glimpsed the nobility of those that sacrifice themselves for their people. You are one step closer to claiming your elven heritage.
// You have gained the boon of Bravehorn!
// You have glimpsed the nobility of those that sacrifice themselves for their people.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074942, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -161,7 +154,7 @@ namespace Server.Engines.MLQuests.Definitions
"timber wolves",
new QuestArea(1074833, "Huntsman's Forest")
)
); // Huntsman's Forest
);
Rewards.Add(new DummyReward(1072807)); // The boon of the Huntsman.
}
@ -170,11 +163,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074943,
"",
0x2A
); // You have gained the boon of the Huntsman! You have been given a taste of the bittersweet duty of those who guard the balance. You are one step closer to claiming your elven heritage.
// You have gained the boon of the Huntsman!
// You have been given a taste of the bittersweet duty of those who guard the balance.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074943, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -200,11 +192,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074944,
"",
0x2A
); // You have gained the boon of Arielle! You have been taught the importance of laughter and light spirits. You are one step closer to claiming your elven heritage.
// You have gained the boon of Arielle!
// You have been taught the importance of laughter and light spirits.
// You are one step closer to claiming your elven heritage.
instance.Player.SendLocalizedMessage(1074944, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -494,11 +485,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074946,
"",
0x2A
); // You have demonstrated your ingenuity! Humans are jacks of all trades and know a little about a lot of things. You are one step closer to achieving humanity.
// You have demonstrated your ingenuity!
// Humans are jacks of all trades and know a little about a lot of things.
// You are one step closer to achieving humanity.
instance.Player.SendLocalizedMessage(1074946, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -534,11 +524,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074948,
"",
0x2A
); // You have demonstrated your physical strength! Humans can carry vast loads without complaint. You are one step closer to achieving humanity.
// You have demonstrated your physical strength!
// Humans can carry vast loads without complaint. You are one step closer to achieving humanity.
instance.Player.SendLocalizedMessage(1074948, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}
@ -559,11 +547,8 @@ namespace Server.Engines.MLQuests.Definitions
public static void AwardTo(PlayerMobile pm)
{
MLQuestSystem.GetOrCreateContext(pm).SetDoneQuest(MLQuestSystem.FindQuest(typeof(HumanInNeed)));
pm.SendLocalizedMessage(
1074949,
"",
0x2A
); // You have demonstrated your compassion! Your kind actions have been noted.
// You have demonstrated your compassion! Your kind actions have been noted.
pm.SendLocalizedMessage(1074949, "", 0x2A);
}
}
@ -586,7 +571,7 @@ namespace Server.Engines.MLQuests.Definitions
"efreets",
new QuestArea(1074808, "Fire")
)
); // Fire
);
Objectives.Add(
new KillObjective(
5,
@ -594,7 +579,7 @@ namespace Server.Engines.MLQuests.Definitions
"ice fiends",
new QuestArea(1074809, "Ice")
)
); // Ice
);
Rewards.Add(new DummyReward(1074875)); // Another step closer to becoming human.
}
@ -603,11 +588,10 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.Player.SendLocalizedMessage(
1074947,
"",
0x2A
); // You have demonstrated your toughness! Humans are able to endure unimaginable hardships in pursuit of their goals. You are one step closer to achieving humanity.
// You have demonstrated your toughness!
// Humans are able to endure unimaginable hardships in pursuit of their goals.
// You are one step closer to achieving humanity.
instance.Player.SendLocalizedMessage(1074947, "", 0x2A);
instance.ClaimRewards(); // skip gump
}
}

View file

@ -25,7 +25,7 @@ namespace Server.Engines.MLQuests.Definitions
// OSI sends this instead, but it doesn't make sense for an escortable
// public override void OnComplete( MLQuestInstance instance )
// {
// instance.Player.SendLocalizedMessage( 1073775, "", 0x23 ); // Your quest is complete. Return for your reward.
// instance.Player.SendLocalizedMessage( 1073775, "", 0x23 ); // Your quest is complete. Return for your reward.
// }
}

View file

@ -988,11 +988,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
1078187
); // The art of fencing requires a dexterous hand, a quick wit and fleet feet.
// The art of fencing requires a dexterous hand, a quick wit and fleet feet.
MLQuestSystem.Tell(this, pm, 1078187);
}
public override void Serialize(IGenericWriter writer)
@ -1053,11 +1050,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void Shout(PlayerMobile pm)
{
MLQuestSystem.Tell(
this,
pm,
1078136
); // There is an art to slaying your enemies swiftly. It's called tactics, and I can teach it to you.
// There is an art to slaying your enemies swiftly. It's called tactics, and I can teach it to you.
MLQuestSystem.Tell(this, pm, 1078136);
}
public override void Serialize(IGenericWriter writer)

View file

@ -360,7 +360,7 @@ namespace Server.Engines.MLQuests.Definitions
"orcs",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Objectives.Add(
new KillObjective(
5,
@ -368,7 +368,7 @@ namespace Server.Engines.MLQuests.Definitions
"orc bombers",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Objectives.Add(
new KillObjective(
3,
@ -376,7 +376,7 @@ namespace Server.Engines.MLQuests.Definitions
"orc brutes",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.BagOfTreasure);
}
@ -437,7 +437,7 @@ namespace Server.Engines.MLQuests.Definitions
"Moug-Guur",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.BagOfTreasure);
}
@ -466,7 +466,7 @@ namespace Server.Engines.MLQuests.Definitions
"Chiikkaha",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.BagOfTreasure);
}
@ -496,7 +496,7 @@ namespace Server.Engines.MLQuests.Definitions
"Szavetra",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.Strongbox);
}
@ -603,7 +603,7 @@ namespace Server.Engines.MLQuests.Definitions
"ogres",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.BagOfTreasure);
}
@ -630,7 +630,7 @@ namespace Server.Engines.MLQuests.Definitions
"ogre lords",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.LargeBagOfTreasure);
}
@ -657,7 +657,7 @@ namespace Server.Engines.MLQuests.Definitions
"cyclops",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.LargeBagOfTreasure);
}
@ -686,7 +686,7 @@ namespace Server.Engines.MLQuests.Definitions
"titans",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.LargeBagOfTreasure);
}
@ -713,7 +713,7 @@ namespace Server.Engines.MLQuests.Definitions
"gargoyles",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(ItemReward.BagOfTrinkets);
}

View file

@ -230,7 +230,7 @@ namespace Server.Engines.MLQuests.Definitions
"rats",
new QuestArea(1074807, "Sanctuary")
)
); // Sanctuary
);
Rewards.Add(new DummyReward(1074872)); // The opportunity to learn the ways of the Arcanist.
}
@ -398,11 +398,8 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.PlayerContext.SummonFey = true;
instance.Player.SendLocalizedMessage(
1074320,
"",
0x2A
); // *giggle* Mean reapers got fixed! Pixie friend now! *giggle* When mean thingies bother you, a brave pixie will help.
// *giggle* Mean reapers got fixed! Pixie friend now! *giggle* When mean thingies bother you, a brave pixie will help.
instance.Player.SendLocalizedMessage(1074320, "", 0x2A);
base.GetRewards(instance);
}
@ -423,11 +420,9 @@ namespace Server.Engines.MLQuests.Definitions
Objectives.Add(new KillObjective(50, new[] { typeof(Imp) }, "imps"));
Rewards.Add(
new DummyReward(
1074873
)
); // The opportunity to prove yourself worthy of learning to Summon Fiends. (Sufficient spellweaving skill is required to cast the spell)
// The opportunity to prove yourself worthy of learning to Summon Fiends.
// (Sufficient spellweaving skill is required to cast the spell)
Rewards.Add(new DummyReward(107487));
}
public override Type NextQuest => typeof(CrackingTheWhipI);
@ -479,11 +474,9 @@ namespace Server.Engines.MLQuests.Definitions
public override void GetRewards(MLQuestInstance instance)
{
instance.PlayerContext.SummonFiend = true;
instance.Player.SendLocalizedMessage(
1074322,
"",
0x2A
); // You've demonstrated your strength, got a means of control, and taught the imps to fear you. You're ready now to summon them.
// You've demonstrated your strength, got a means of control, and taught the imps to fear you.
// You're ready now to summon them.
instance.Player.SendLocalizedMessage(1074322, "", 0x2A);
base.GetRewards(instance);
}

View file

@ -145,15 +145,17 @@ namespace Server.Engines.MLQuests.Gumps
140,
312,
16,
quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202,
quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202, // Description [(quest chain)]
0x2710
); // Description [(quest chain)]
);
TextDefinition.AddHtmlText(this, 98, 156, 312, 240, quest.Description, false, true, 0x15F90, 0xBDE784);
}
public void AddObjectives(MLQuest quest)
{
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized(
98,
156,
@ -161,7 +163,7 @@ namespace Server.Engines.MLQuests.Gumps
16,
quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209,
0x2710
); // All of the following / Only one of the following
);
var y = 172;
@ -186,6 +188,7 @@ namespace Server.Engines.MLQuests.Gumps
var quest = instance.Quest;
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
// All of the following / Only one of the following
AddHtmlLocalized(
98,
156,
@ -193,7 +196,7 @@ namespace Server.Engines.MLQuests.Gumps
16,
quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209,
0x2710
); // All of the following / Only one of the following
);
var y = 172;

View file

@ -153,11 +153,9 @@ namespace Server.Engines.MLQuests
{
if (message)
{
MLQuestSystem.Tell(
quester,
pm,
1075575
); // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes?
// I'm sorry, but I don't have anything else for you right now.
// Could you check back with me in a few minutes?
MLQuestSystem.Tell(quester, pm, 1075575);
}
return false;

View file

@ -386,9 +386,8 @@ namespace Server.Engines.MLQuests
rewardItem.Delete();
}
Player.SendLocalizedMessage(
1078524
); // Your backpack is full. You cannot complete the quest and receive your reward.
// Your backpack is full. You cannot complete the quest and receive your reward.
Player.SendLocalizedMessage(1078524);
return;
}
@ -398,10 +397,8 @@ namespace Server.Engines.MLQuests
if (rewardItem.Stackable)
{
Player.SendLocalizedMessage(
1115917,
$"{rewardItem.Amount}\t{rewardName}"
); // You receive a reward: ~1_QUANTITY~ ~2_ITEM~
// You receive a reward: ~1_QUANTITY~ ~2_ITEM~
Player.SendLocalizedMessage(1115917, $"{rewardItem.Amount}\t{rewardName}");
}
else
{

View file

@ -47,16 +47,12 @@ namespace Server.Engines.MLQuests.Objectives
if (minutes == 1)
{
MLQuestSystem.Tell(quester, pm, "You must rest 1 minute before we set out on this journey.");
MLQuestSystem.Tell(quester, pm, 1042722);
}
else
{
MLQuestSystem.Tell(
quester,
pm,
1071195,
minutes.ToString()
); // You must rest ~1_minsleft~ minutes before we set out on this journey.
// You must rest ~1_minsleft~ minutes before we set out on this journey.
MLQuestSystem.Tell(quester, pm, 1071195, minutes.ToString());
}
}
@ -141,10 +137,8 @@ namespace Server.Engines.MLQuests.Objectives
}
else if (m_Objective.Destination.Contains(m_Escort))
{
m_Escort.Say(
1042809,
pm.Name
); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.
// We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.
m_Escort.Say(1042809, pm.Name);
if (pm.Young || m_Escort.Region.IsPartOf("Haven Island"))
{
@ -251,7 +245,7 @@ namespace Server.Engines.MLQuests.Objectives
}
// Note: this sound is sent twice on OSI (once here and once in Cancel())
// m_Player.SendSound( 0x5B3 ); // private sound
// m_Player.SendSound(0x5B3); // private sound
pm.SendLocalizedMessage(1071194); // You have failed your escort quest...
if (!instance.Removed)

View file

@ -108,10 +108,8 @@ namespace Server.Engines.MLQuests.Objectives
}
else
{
pm.SendLocalizedMessage(
1075051,
(desired - Slain).ToString()
); // You have killed a quest creature. ~1_val~ more left.
// You have killed a quest creature. ~1_val~ more left.
pm.SendLocalizedMessage(1075051, (desired - Slain).ToString());
}
return true;

View file

@ -106,9 +106,8 @@ namespace Server.Engines.PartySystem
}
else
{
from.SendLocalizedMessage(
1005448
); // You have chosen to prevent your party from looting your corpse.
// You have chosen to prevent your party from looting your corpse.
from.SendLocalizedMessage(1005448);
}
}
}

View file

@ -21,9 +21,8 @@ namespace Server.Engines.PartySystem
if (from == m)
{
from.SendLocalizedMessage(
1005446
); // You may only remove yourself from a party if you are not the leader.
// You may only remove yourself from a party if you are not the leader.
from.SendLocalizedMessage(1005446);
}
else
{

View file

@ -336,10 +336,9 @@ namespace Server.Engines.Plants
if (bev == null)
{
from.Target = new PlantPourTarget(m_Plant);
from.SendLocalizedMessage(
1060808,
$"#{m_Plant.GetLocalizedPlantStatus()}"
); // Target the container you wish to use to water the ~1_val~.
// Target the container you wish to use to water the ~1_val~.
from.SendLocalizedMessage(1060808, $"#{m_Plant.GetLocalizedPlantStatus()}");
}
else
{
@ -406,10 +405,9 @@ namespace Server.Engines.Plants
from.SendLocalizedMessage(1061884); // You don't have any strong potions of that type in your pack.
from.Target = new PlantPourTarget(m_Plant);
from.SendLocalizedMessage(
1060808,
$"#{m_Plant.GetLocalizedPlantStatus()}"
); // Target the container you wish to use to water the ~1_val~.
// Target the container you wish to use to water the ~1_val~.
from.SendLocalizedMessage(1060808, $"#{m_Plant.GetLocalizedPlantStatus()}");
return;
}

View file

@ -33,11 +33,8 @@ namespace Server.Items
if (!from.CanBeginAction<GreenThorns>())
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061908
); // * You must wait a while before planting another thorn. *
// * You must wait a while before planting another thorn. *
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061908);
return;
}
@ -80,11 +77,8 @@ namespace Server.Items
if (!from.CanBeginAction<GreenThorns>())
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061908
); // * You must wait a while before planting another thorn. *
// * You must wait a while before planting another thorn. *
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061908);
return;
}
@ -101,11 +95,8 @@ namespace Server.Items
if (targeted is not LandTarget land)
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061912
); // * You cannot plant a green thorn there! *
// * You cannot plant a green thorn there! *
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061912);
}
else
{
@ -113,27 +104,18 @@ namespace Server.Items
if (effect == null)
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061913
); // * You sense it would be useless to plant a green thorn there. *
// * You sense it would be useless to plant a green thorn there. *
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061913);
}
else
{
m_Thorn.Consume();
from.LocalOverheadMessage(
MessageType.Emote,
0x961,
1061914
); // * You push the strange green thorn into the ground *
from.NonlocalOverheadMessage(
MessageType.Emote,
0x961,
1061915,
from.Name
); // * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. *
// * You push the strange green thorn into the ground *
from.LocalOverheadMessage(MessageType.Emote, 0x961, 1061914);
// * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. *
from.NonlocalOverheadMessage(MessageType.Emote, 0x961, 1061915, from.Name);
from.BeginAction<GreenThorns>();
new EndActionTimer(from).Start();

View file

@ -142,11 +142,8 @@ namespace Server.Engines.Plants
}
else if (dirt.Amount < _dirtNeeded)
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061896
); // You need more dirt to fill a plant bowl!
// You need more dirt to fill a plant bowl!
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061896);
}
else
{
@ -157,21 +154,15 @@ namespace Server.Engines.Plants
dirt.Consume(_dirtNeeded);
m_PlantBowl.Delete();
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061895
); // You fill the bowl with fresh dirt.
// You fill the bowl with fresh dirt.
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061895);
}
else
{
fullBowl.Delete();
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061894
); // There is no room in your backpack for a bowl full of dirt!
// There is no room in your backpack for a bowl full of dirt!
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894);
}
}
}
@ -189,20 +180,14 @@ namespace Server.Engines.Plants
{
fullBowl.Delete();
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061894
); // There is no room in your backpack for a bowl full of dirt!
// There is no room in your backpack for a bowl full of dirt!
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061894);
}
}
else
{
from.LocalOverheadMessage(
MessageType.Regular,
0x3B2,
1061893
); // You'll want to gather fresh dirt in order to raise a healthy plant!
// You'll want to gather fresh dirt in order to raise a healthy plant!
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1061893);
}
}

View file

@ -475,10 +475,8 @@ namespace Server.Engines.Plants
}
else if (m_PlantStatus != PlantStatus.BowlOfDirt)
{
from.SendLocalizedMessage(
1080389,
$"#{GetLocalizedPlantStatus()}"
); // This bowl of dirt already has a ~1_val~ in it!
// This bowl of dirt already has a ~1_val~ in it!
from.SendLocalizedMessage(1080389, $"#{GetLocalizedPlantStatus()}");
}
else if (PlantSystem.Water < 2)
{

View file

@ -15,10 +15,8 @@ namespace Server.Engines.Plants
{
if (!m_Plant.IsUsableBy(from))
{
m_Plant.LabelTo(
from,
1061856
); // You must have the item in your backpack or locked down in order to use it.
// You must have the item in your backpack or locked down in order to use it.
m_Plant.LabelTo(from, 1061856);
}
else if (!m_Plant.IsCrossable)
{
@ -40,10 +38,8 @@ namespace Server.Engines.Plants
}
else if (!targ.IsUsableBy(from))
{
targ.LabelTo(
from,
1061856
); // You must have the item in your backpack or locked down in order to use it.
// You must have the item in your backpack or locked down in order to use it.
targ.LabelTo(from, 1061856);
}
else if (!targ.IsCrossable)
{

View file

@ -195,10 +195,8 @@ namespace Server.Engines.Plants
}
else if (!m_Plant.PlantSystem.PollenProducing)
{
m_Plant.LabelTo(
from,
1053051
); // You cannot gather pollen from a plant in this stage of development!
// You cannot gather pollen from a plant in this stage of development!
m_Plant.LabelTo(from, 1053051);
}
else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy)
{
@ -248,10 +246,8 @@ namespace Server.Engines.Plants
else
{
resource.Delete();
m_Plant.LabelTo(
from,
1053058
); // You attempt to gather as many resources as you can hold, but your backpack is full.
// You attempt to gather as many resources as you can hold, but your backpack is full.
m_Plant.LabelTo(from, 1053058);
}
}
@ -283,10 +279,8 @@ namespace Server.Engines.Plants
else
{
seed.Delete();
m_Plant.LabelTo(
from,
1053062
); // You attempt to gather as many seeds as you can hold, but your backpack is full.
// You attempt to gather as many seeds as you can hold, but your backpack is full.
m_Plant.LabelTo(from, 1053062);
}
}

View file

@ -76,10 +76,9 @@ namespace Server.Engines.Plants
case 3: // Ok
{
m_Plant.PlantStatus = PlantStatus.DecorativePlant;
m_Plant.LabelTo(
from,
1053077
); // You prune the plant. This plant will no longer produce resources or seeds, but will require no upkeep.
// You prune the plant.
// This plant will no longer produce resources or seeds, but will require no upkeep.
m_Plant.LabelTo(from, 1053077);
break;
}

View file

@ -151,7 +151,7 @@ namespace Server.Misc
pm.ToTTotalMonsterFame += (int)(bc.Fame * (1 + Math.Sqrt(pm.Luck) / 100));
// This is the Exponential regression with only 2 data points.
// This is the Exponential regression with only 2 datapoints.
// A log. func would also work, but it didn't make as much sense.
// This function isn't OSI exact being that I don't know OSI's func they used ;p
var x = pm.ToTTotalMonsterFame;
@ -263,9 +263,7 @@ namespace Server.Mobiles
{
if (m.Alive && m is PlayerMobile pm)
{
var range = 3;
if (pm.Alive && (Z - pm.Z).Abs() < 16 && InRange(m, range) && !InRange(oldLocation, range))
if (pm.Alive && (Z - pm.Z).Abs() < 16 && InRange(m, 3) && !InRange(oldLocation, 3))
{
if (pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward)
{
@ -327,9 +325,8 @@ namespace Server.Gumps
public ItemTileButtonInfo(Item i) : base(
i.ItemID,
i.Hue,
i.Name == null || i.Name.Length <= 0 ? i.LabelNumber : i.Name
) =>
Item = i;
i.Name is not { Length: > 0 } ? i.LabelNumber : i.Name
) => Item = i;
public Item Item { get; set; }
}
@ -619,7 +616,7 @@ namespace Server.Gumps
// Bring me 10 of the lost treasures of Tokuno and I will reward you with a valuable item.
m_Collector.SayTo(pm, 1071013);
}
// This and above case should ALWAYS be FALSE with this gump, jsut a sanity check
// This and above case should ALWAYS be FALSE with this gump, just a sanity check
else if (pm.ToTItemsTurnedIn < TreasuresOfTokuno.ItemsPerReward)
{
m_Collector.SayTo(

View file

@ -46,11 +46,8 @@ namespace Server.Items
{
if (from.Poisoned || MortalStrike.IsWounded(from))
{
from.LocalOverheadMessage(
MessageType.Regular,
0x22,
1005000
); // You can not heal yourself in your current state.
// You can not heal yourself in your current state.
from.LocalOverheadMessage(MessageType.Regular, 0x22, 1005000);
}
else
{
@ -69,19 +66,15 @@ namespace Server.Items
}
else
{
from.LocalOverheadMessage(
MessageType.Regular,
0x22,
500235
); // You must wait 10 seconds before using another healing potion.
// You must wait 10 seconds before using another healing potion.
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500235);
}
}
}
else
{
from.SendLocalizedMessage(
1049547
); // You decide against drinking this potion, as you are already at full health.
// You decide against drinking this potion, as you are already at full health.
from.SendLocalizedMessage(1049547);
}
}
}

View file

@ -292,7 +292,7 @@ namespace Server.Items
if (weapon.Poison != null && weapon.PoisonCharges > 0)
{
if (EvilOmenSpell.TryEndEffect(target))
if (EvilOmenSpell.EndEffect(target))
{
target.ApplyPoison(from, Poison.GetPoison(weapon.Poison.Level + 1));
}

View file

@ -1258,7 +1258,7 @@ namespace Server.Items
target.Paralyzed = false;
EvilOmenSpell.TryEndEffect(target);
EvilOmenSpell.EndEffect(target);
StrangleSpell.RemoveCurse(target);
CorpseSkinSpell.RemoveCurse(target);
CurseSpell.RemoveEffect(target);

View file

@ -1900,7 +1900,6 @@ namespace Server.Items
var lifeLeech = 0;
var stamLeech = 0;
var manaLeech = 0;
int wraithLeech;
if ((int)(AosWeaponAttributes.GetValue(attacker, AosWeaponAttribute.HitLeechHits) * propertyBonus) >
Utility.Random(100))
@ -1935,7 +1934,7 @@ namespace Server.Items
if (context?.Type == typeof(WraithFormSpell))
{
// Wraith form gives an additional 5-20% mana leech
wraithLeech = 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / 100);
var wraithLeech = 5 + (int)(15 * attacker.Skills.SpiritSpeak.Value / 100);
// Mana leeched by the Wraith Form spell is actually stolen, not just leeched.
defender.Mana -= AOS.Scale(damageGiven, wraithLeech);

View file

@ -164,23 +164,20 @@ namespace Server
}
}
if (from?.Player != true && m.Player && m.Mount is SwampDragon pet)
if (from?.Player != true && m.Player && m.Mount is SwampDragon { HasBarding: true } pet)
{
if (pet.HasBarding)
var percent = pet.BardingExceptional ? 20 : 10;
var absorbed = Scale(totalDamage, percent);
totalDamage -= absorbed;
pet.BardingHP -= absorbed;
if (pet.BardingHP < 0)
{
var percent = pet.BardingExceptional ? 20 : 10;
var absorbed = Scale(totalDamage, percent);
pet.HasBarding = false;
pet.BardingHP = 0;
totalDamage -= absorbed;
pet.BardingHP -= absorbed;
if (pet.BardingHP < 0)
{
pet.HasBarding = false;
pet.BardingHP = 0;
m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
}
m.SendLocalizedMessage(1053031); // Your dragon's barding has been destroyed!
}
}

View file

@ -26,7 +26,7 @@ namespace Server
{
}
// Only the timed one needs to Mobile to know when to automagically remove it.
// Only the timed one needs the Mobile to know when to automagically remove it.
public BuffInfo(BuffIcon iconID, int titleCliloc, int secondaryCliloc, TimeSpan length, Mobile m)
: this(iconID, titleCliloc, secondaryCliloc)
{

View file

@ -1325,7 +1325,7 @@ namespace Server.Mobiles
amount = (int)(amount * BonusPetDamageScalar);
}
if (EvilOmenSpell.TryEndEffect(this))
if (EvilOmenSpell.EndEffect(this))
{
amount = (int)(amount * 1.25);
}
@ -1385,7 +1385,7 @@ namespace Server.Mobiles
return ApplyPoisonResult.Immune;
}
if (EvilOmenSpell.TryEndEffect(this))
if (EvilOmenSpell.EndEffect(this))
{
poison = PoisonImpl.IncreaseLevel(poison);
}

View file

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using Server.Accounting;
using Server.Collections;
using Server.ContextMenus;
using Server.Engines.BulkOrders;
using Server.Engines.ConPVP;
@ -2716,19 +2717,19 @@ namespace Server.Mobiles
if (m_BuffTable != null)
{
var list = new List<BuffInfo>();
using var queue = PooledRefQueue<BuffInfo>.Create();
foreach (var buff in m_BuffTable.Values)
{
if (!buff.RetainThroughDeath)
{
list.Add(buff);
queue.Enqueue(buff);
}
}
for (var i = 0; i < list.Count; i++)
while (queue.Count > 0)
{
RemoveBuff(list[i]);
RemoveBuff(queue.Dequeue());
}
}
}
@ -2838,7 +2839,7 @@ namespace Server.Mobiles
public override void Damage(int amount, Mobile from = null, bool informMount = true)
{
if (EvilOmenSpell.TryEndEffect(this))
if (EvilOmenSpell.EndEffect(this))
{
amount = (int)(amount * 1.25);
}
@ -4132,7 +4133,7 @@ namespace Server.Mobiles
return ApplyPoisonResult.Immune;
}
if (EvilOmenSpell.TryEndEffect(this))
if (EvilOmenSpell.EndEffect(this))
{
poison = PoisonImpl.IncreaseLevel(poison);
}

View file

@ -78,9 +78,8 @@ namespace Server.SkillHandlers
if (faction == null)
{
from.SendLocalizedMessage(
1010538
); // You may not disarm faction traps unless you are in an opposing faction
// You may not disarm faction traps unless you are in an opposing faction
from.SendLocalizedMessage(1010538);
}
else if (trap.Faction != null && faction == trap.Faction && !isOwner)
{
@ -88,9 +87,8 @@ namespace Server.SkillHandlers
}
else if (!isOwner && kit == null)
{
from.SendLocalizedMessage(
1042530
); // You must have a trap removal kit at the base level of your pack to disarm a faction trap.
// You must have a trap removal kit at the base level of your pack to disarm a faction trap.
from.SendLocalizedMessage(1042530);
}
else
{
@ -110,13 +108,8 @@ namespace Server.SkillHandlers
if (silver > 0)
{
from.SendLocalizedMessage(
1008113,
true,
silver.ToString(
"N0"
)
); // You have been granted faction silver for removing the enemy trap :
// You have been granted faction silver for removing the enemy trap :
from.SendLocalizedMessage(1008113, true, silver.ToString("N0"));
}
}

View file

@ -138,7 +138,7 @@ namespace Server.Spells.Chivalry
sendEffect = true;
}
sendEffect = EvilOmenSpell.TryEndEffect(m) || sendEffect;
sendEffect = EvilOmenSpell.EndEffect(m) || sendEffect;
sendEffect = StrangleSpell.RemoveCurse(m) || sendEffect;
sendEffect = CorpseSkinSpell.RemoveCurse(m) || sendEffect;
sendEffect = CurseSpell.RemoveEffect(m) || sendEffect;

View file

@ -98,7 +98,7 @@ namespace Server.Spells.Chivalry
m.Paralyzed = false;
EvilOmenSpell.TryEndEffect(m);
EvilOmenSpell.EndEffect(m);
StrangleSpell.RemoveCurse(m);
CorpseSkinSpell.RemoveCurse(m);
CurseSpell.RemoveEffect(m);

View file

@ -66,7 +66,7 @@ namespace Server.Spells.Necromancy
var duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0);
Timer.StartTimer(duration, () => TryEndEffect(m));
Timer.StartTimer(duration, () => EndEffect(m));
HarmfulSpell(m);
@ -81,7 +81,7 @@ namespace Server.Spells.Necromancy
Caster.Target = new SpellTargetMobile(this, TargetFlags.Harmful, Core.ML ? 10 : 12);
}
public static bool TryEndEffect(Mobile m)
public static bool EndEffect(Mobile m)
{
if (!_table.Remove(m, out var mod))
{

View file

@ -25,7 +25,7 @@ namespace Server.Spells.Ninjitsu
9002
);
private static readonly Dictionary<Mobile, int> m_LastAnimalForms = new();
private static readonly Dictionary<Mobile, int> _lastAnimalForms = new();
private static readonly Dictionary<Mobile, AnimalFormContext> _table = new();
private bool m_WasMoving;
@ -135,10 +135,8 @@ namespace Server.Spells.Ninjitsu
var mana = ScaleMana(RequiredMana);
if (mana > Caster.Mana)
{
Caster.SendLocalizedMessage(
1060174,
mana.ToString()
); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
// You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability.
Caster.SendLocalizedMessage(1060174, mana.ToString());
}
else if (context != null)
{
@ -167,24 +165,21 @@ namespace Server.Spells.Ninjitsu
}
}
}
else if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail)
{
DoFizzle();
}
else
{
if (Morph(Caster, GetLastAnimalForm(Caster)) == MorphResult.Fail)
{
DoFizzle();
}
else
{
Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
Caster.Mana -= mana;
}
Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist);
Caster.Mana -= mana;
}
}
FinishSequence();
}
public int GetLastAnimalForm(Mobile m) => m_LastAnimalForms.TryGetValue(m, out var value) ? value : -1;
public int GetLastAnimalForm(Mobile m) => _lastAnimalForms.TryGetValue(m, out var value) ? value : -1;
public static MorphResult Morph(Mobile m, int entryID)
{
@ -195,15 +190,12 @@ namespace Server.Spells.Ninjitsu
var entry = Entries[entryID];
m_LastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one
_lastAnimalForms[m] = entryID; // On OSI, it's the last /attempted/ one not the last succeeded one
if (m.Skills.Ninjitsu.Value < entry.ReqSkill)
{
var args = $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t ";
m.SendLocalizedMessage(
1063013,
args
); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
// You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability.
m.SendLocalizedMessage(1063013, $"{entry.ReqSkill:F1}\t{SkillName.Ninjitsu}\t ");
return MorphResult.NoSkill;
}
@ -539,81 +531,81 @@ namespace Server.Spells.Ninjitsu
public class AnimalFormTimer : Timer
{
private readonly int m_Body;
private readonly int m_Hue;
private readonly Mobile m_Mobile;
private int m_Counter;
private Mobile m_LastTarget;
private int _body;
private int _hue;
private Mobile _mobile;
private int _counter;
private Mobile _lastTarget;
public AnimalFormTimer(Mobile from, int body, int hue)
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
{
m_Mobile = from;
m_Body = body;
m_Hue = hue;
m_Counter = 0;
_mobile = from;
_body = body;
_hue = hue;
_counter = 0;
}
protected override void OnTick()
{
if (m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Body != m_Body || m_Mobile.Hue != m_Hue)
if (_mobile.Deleted || !_mobile.Alive || _mobile.Body != _body || _mobile.Hue != _hue)
{
AnimalForm.RemoveContext(m_Mobile, true);
AnimalForm.RemoveContext(_mobile, true);
Stop();
return;
}
if (m_Body == 0x115) // Cu Sidhe
if (_body == 0x115) // Cu Sidhe
{
if (m_Counter++ >= 8)
if (_counter++ >= 8)
{
if (m_Mobile.Hits < m_Mobile.HitsMax && m_Mobile.Backpack != null)
if (_mobile.Hits < _mobile.HitsMax && _mobile.Backpack != null)
{
var b = m_Mobile.Backpack.FindItemByType<Bandage>();
var b = _mobile.Backpack.FindItemByType<Bandage>();
if (b != null)
{
m_Mobile.Hits += Utility.RandomMinMax(20, 50);
_mobile.Hits += Utility.RandomMinMax(20, 50);
b.Consume();
}
}
m_Counter = 0;
_counter = 0;
}
}
else if (m_Body == 0x114) // Reptalon
else if (_body == 0x114) // Reptalon
{
if (m_Mobile.Combatant != null && m_Mobile.Combatant != m_LastTarget)
if (_mobile.Combatant != null && _mobile.Combatant != _lastTarget)
{
m_Counter = 1;
m_LastTarget = m_Mobile.Combatant;
_counter = 1;
_lastTarget = _mobile.Combatant;
}
if (m_Mobile.Warmode && m_LastTarget is { Alive: true, Deleted: false } && m_Counter-- <= 0)
if (_mobile.Warmode && _lastTarget is { Alive: true, Deleted: false } && _counter-- <= 0)
{
if (m_Mobile.CanBeHarmful(m_LastTarget) && m_LastTarget.Map == m_Mobile.Map &&
m_LastTarget.InRange(m_Mobile.Location, BaseCreature.DefaultRangePerception) &&
m_Mobile.InLOS(m_LastTarget))
if (_mobile.CanBeHarmful(_lastTarget) && _lastTarget.Map == _mobile.Map &&
_lastTarget.InRange(_mobile.Location, BaseCreature.DefaultRangePerception) &&
_mobile.InLOS(_lastTarget))
{
m_Mobile.Direction = m_Mobile.GetDirectionTo(m_LastTarget);
m_Mobile.Freeze(TimeSpan.FromSeconds(1));
m_Mobile.PlaySound(0x16A);
_mobile.Direction = _mobile.GetDirectionTo(_lastTarget);
_mobile.Freeze(TimeSpan.FromSeconds(1));
_mobile.PlaySound(0x16A);
StartTimer(TimeSpan.FromSeconds(1.3), () => BreathEffect_Callback(m_LastTarget));
StartTimer(TimeSpan.FromSeconds(1.3), () => BreathEffect_Callback(_lastTarget));
}
m_Counter = Math.Min((int)m_Mobile.GetDistanceToSqrt(m_LastTarget), 10);
_counter = Math.Min((int)_mobile.GetDistanceToSqrt(_lastTarget), 10);
}
}
}
public void BreathEffect_Callback(Mobile target)
{
if (m_Mobile.CanBeHarmful(target))
if (_mobile.CanBeHarmful(target))
{
m_Mobile.RevealingAction();
m_Mobile.PlaySound(0x227);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0);
_mobile.RevealingAction();
_mobile.PlaySound(0x227);
Effects.SendMovingEffect(_mobile, target, 0x36D4, 5, 0);
StartTimer(TimeSpan.FromSeconds(1), () => BreathDamage_Callback(target));
}
@ -621,11 +613,11 @@ namespace Server.Spells.Ninjitsu
public void BreathDamage_Callback(Mobile target)
{
if (m_Mobile.CanBeHarmful(target))
if (_mobile.CanBeHarmful(target))
{
m_Mobile.RevealingAction();
m_Mobile.DoHarmful(target);
AOS.Damage(target, m_Mobile, 20, !target.Player, 0, 100, 0, 0, 0);
_mobile.RevealingAction();
_mobile.DoHarmful(target);
AOS.Damage(target, _mobile, 20, !target.Player, 0, 100, 0, 0, 0);
}
}
}

View file

@ -29,19 +29,15 @@ namespace Server.Spells.Ninjitsu
var ninjitsu = attacker.Skills.Ninjitsu.Value;
double chance;
// TODO: should be defined onHit method, what if the player hit and remove the weapon before process? ;)
var isRanged = attacker.Weapon is BaseRanged;
if (ninjitsu < 100) // This formula is an approximation from OSI data. TODO: find correct formula
var chance = ninjitsu switch
{
chance = 30 + (ninjitsu - 85) * 2.2;
}
else
{
chance = 63 + (ninjitsu - 100) * 1.1;
}
// This formula is an approximation from OSI data. TODO: find correct formula
< 100 => 30 + (ninjitsu - 85) * 2.2,
_ => 63 + (ninjitsu - 100) * 1.1
};
if (chance / 100 < Utility.RandomDouble())
{
@ -91,19 +87,19 @@ namespace Server.Spells.Ninjitsu
private class DeathStrikeTimer : Timer
{
public readonly Mobile m_Attacker;
public readonly int m_DamageBonus;
public readonly bool m_isRanged;
public readonly Mobile m_Target;
private Mobile _attacker;
private int _damageBonus;
private bool _isRanged;
private Mobile _target;
public int Steps { get; set; }
internal DeathStrikeTimer(Mobile target, Mobile attacker, int damageBonus, bool isRanged)
: base(TimeSpan.FromSeconds(5.0))
{
m_Target = target;
m_Attacker = attacker;
m_DamageBonus = damageBonus;
m_isRanged = isRanged;
_target = target;
_attacker = attacker;
_damageBonus = damageBonus;
_isRanged = isRanged;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@ -116,13 +112,12 @@ namespace Server.Spells.Ninjitsu
{
int damage;
var ninjitsu = m_Attacker.Skills.Ninjitsu.Value;
var stalkingBonus = Tracking.GetStalkingBonus(m_Attacker, m_Target);
var ninjitsu = _attacker.Skills.Ninjitsu.Value;
var stalkingBonus = Tracking.GetStalkingBonus(_attacker, _target);
if (Core.ML)
{
var scalar = Math.Min(1, (m_Attacker.Skills.Hiding.Value +
m_Attacker.Skills.Stealth.Value) / 220);
var scalar = Math.Min(1, (_attacker.Skills.Hiding.Value + _attacker.Skills.Stealth.Value) / 220);
// New formula doesn't apply DamageBonus anymore, caps must be, directly, 60/30.
if (Steps >= 5)
@ -134,7 +129,7 @@ namespace Server.Spells.Ninjitsu
damage = (int)Math.Floor(Math.Min(30, ninjitsu / 9 * (0.3 + 0.7 * scalar) + stalkingBonus));
}
if (m_isRanged)
if (_isRanged)
{
damage /= 2;
}
@ -145,18 +140,19 @@ namespace Server.Spells.Ninjitsu
var baseDamage = ninjitsu / divisor * 10;
var maxDamage = Steps >= 5 ? 62 : 22;
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + m_DamageBonus;
damage = Math.Clamp((int)(baseDamage + stalkingBonus), 0, maxDamage) + _damageBonus;
}
if (Core.ML)
{
m_Target.Damage(damage, m_Attacker); // Damage is direct.
_target.Damage(damage, _attacker); // Damage is direct.
}
else
{
// Damage is physical.
AOS.Damage(
m_Target,
m_Attacker,
_target,
_attacker,
damage,
true,
100,
@ -169,7 +165,7 @@ namespace Server.Spells.Ninjitsu
false,
false,
true
); // Damage is physical.
);
}
Stop();

View file

@ -99,29 +99,29 @@ namespace Server.Spells.Ninjitsu
return 0;
}
var xDelta = t.m_Location.X - from.X;
var yDelta = t.m_Location.Y - from.Y;
var xDelta = t._location.X - from.X;
var yDelta = t._location.Y - from.Y;
return Math.Min(Math.Sqrt(xDelta * xDelta + yDelta * yDelta), 20.0);
}
private class KiAttackTimer : Timer
{
public readonly Mobile m_Mobile;
public Point3D m_Location;
public Mobile _mobile;
public Point3D _location;
public KiAttackTimer(Mobile m) : base(TimeSpan.FromSeconds(2.0))
{
m_Mobile = m;
m_Location = m.Location;
_mobile = m;
_location = m.Location;
}
protected override void OnTick()
{
ClearCurrentMove(m_Mobile);
m_Mobile.SendLocalizedMessage(1063102); // You failed to complete your Ki Attack in time.
ClearCurrentMove(_mobile);
_mobile.SendLocalizedMessage(1063102); // You failed to complete your Ki Attack in time.
_table.Remove(m_Mobile);
_table.Remove(_mobile);
}
}
}

View file

@ -10,7 +10,7 @@ namespace Server.Spells.Ninjitsu
{
public class MirrorImage : NinjaSpell
{
private static readonly Dictionary<Mobile, int> m_CloneCount = new();
private static readonly Dictionary<Mobile, int> _cloneCount = new();
private static readonly SpellInfo _info = new(
"Mirror Image",
@ -30,7 +30,7 @@ namespace Server.Spells.Ninjitsu
public override bool BlockedByAnimalForm => false;
public static bool HasClone(Mobile m) => m_CloneCount.ContainsKey(m);
public static bool HasClone(Mobile m) => _cloneCount.ContainsKey(m);
public static void AddClone(Mobile m)
{
@ -39,23 +39,23 @@ namespace Server.Spells.Ninjitsu
return;
}
m_CloneCount[m] = 1 + (m_CloneCount.TryGetValue(m, out var count) ? count : 0);
_cloneCount[m] = 1 + (_cloneCount.TryGetValue(m, out var count) ? count : 0);
}
public static void RemoveClone(Mobile m)
{
if (m == null || !m_CloneCount.TryGetValue(m, out var count))
if (m == null || !_cloneCount.TryGetValue(m, out var count))
{
return;
}
if (count <= 1)
{
m_CloneCount.Remove(m);
_cloneCount.Remove(m);
}
else
{
m_CloneCount[m]--;
_cloneCount[m]--;
}
}

View file

@ -6,8 +6,7 @@ namespace Server.Spells.Ninjitsu
{
public class SurpriseAttack : NinjaMove
{
private static readonly Dictionary<Mobile, SurpriseAttackInfo>
_table = new();
private static readonly Dictionary<Mobile, SurpriseAttackTimer> _table = new();
public override int BaseMana => 20;
public override double RequiredSkill => Core.ML ? 60.0 : 30.0;
@ -59,10 +58,10 @@ namespace Server.Spells.Ninjitsu
var malus = ninjitsu / 60 + (int)Tracking.GetStalkingBonus(attacker, defender);
var info = new SurpriseAttackInfo(defender, malus);
Timer.StartTimer(TimeSpan.FromSeconds(8.0), () => EndSurprise(info), out info._timerToken);
var timer = new SurpriseAttackTimer(defender, malus);
timer.Start();
_table[defender] = info;
_table[defender] = timer;
CheckGain(attacker);
}
@ -83,34 +82,39 @@ namespace Server.Spells.Ninjitsu
return false;
}
malus = info.m_Malus;
malus = info.Malus;
return true;
}
private static void StopTimer(Mobile m)
{
if (_table.Remove(m, out var info))
if (_table.Remove(m, out var timer))
{
info._timerToken.Cancel();
timer.Stop();
}
}
private static void EndSurprise(SurpriseAttackInfo info)
private static void EndSurprise(SurpriseAttackTimer info)
{
StopTimer(info.m_Target);
info.m_Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
StopTimer(info.Target);
info.Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
}
private class SurpriseAttackInfo
private class SurpriseAttackTimer : Timer
{
public readonly int m_Malus;
public readonly Mobile m_Target;
public TimerExecutionToken _timerToken;
public int Malus;
public Mobile Target;
public SurpriseAttackInfo(Mobile target, int effect)
public SurpriseAttackTimer(Mobile target, int effect) : base(TimeSpan.FromSeconds(8.0))
{
m_Target = target;
m_Malus = effect;
Target = target;
Malus = effect;
}
protected override void OnTick()
{
StopTimer(Target);
Target.SendLocalizedMessage(1063131); // Your defenses have returned to normal.
}
}
}

View file

@ -57,9 +57,9 @@ namespace Server.Spells
MessageType.Regular,
0x3B2,
3,
502357,
502357, // I can not recall from that object.
from.Name
); // I can not recall from that object.
);
}
}
else if (o is HouseRaffleDeed deed && deed.ValidLocation())
@ -74,9 +74,9 @@ namespace Server.Spells
MessageType.Regular,
0x3B2,
3,
502357,
502357, // I can not recall from that object.
from.Name
); // I can not recall from that object.
);
}
}

View file

@ -19,6 +19,11 @@ namespace Server.Spells
protected override bool CanTarget(Mobile from, StaticTarget staticTarget, ref Point3D loc, ref Map map) => false;
protected override bool CanTarget(Mobile from, Mobile mobile, ref Point3D loc, ref Map map) => false;
protected override void OnCantSeeTarget(Mobile from, object o)
{
from.SendLocalizedMessage(500237); // Target can not be seen.
}
protected override void OnTarget(Mobile from, object o)
{
_spell.Target(o as Item);

View file

@ -27,6 +27,11 @@ namespace Server.Spells
_spell.Target(o as IPoint3D);
}
protected override void OnCantSeeTarget(Mobile from, object o)
{
from.SendLocalizedMessage(500237); // Target can not be seen.
}
protected override void OnTargetOutOfLOS(Mobile from, object o)
{
if (!_retryOnLos)