Skip to content

Commit

Permalink
Merge pull request #107 from EstelMatiazi/poison_rebalance
Browse files Browse the repository at this point in the history
implements skill-based poisoning charge limits and weapon coating.
  • Loading branch information
sosarian-scribe authored Nov 16, 2024
2 parents 751f829 + 3bd4f3d commit 157b458
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
29 changes: 25 additions & 4 deletions Data/Scripts/System/Skills/Poisoning.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Server;
using System;
using Server.Targeting;
using Server.Items;
Expand Down Expand Up @@ -130,6 +131,7 @@ protected override void OnTick()
{
if ( m_From.CheckTargetSkill( SkillName.Poisoning, m_Target, m_MinSkill, m_MaxSkill ) )
{
bool maxChargesReached = false;
if ( m_Target is Food )
{
((Food)m_Target).Poison = m_Poison;
Expand All @@ -140,11 +142,24 @@ protected override void OnTick()
((BaseBeverage)m_Target).Poison = m_Poison;
((BaseBeverage)m_Target).Poisoner = m_From;
}
else if ( m_Target is BaseWeapon )
else if ( m_Target is BaseWeapon && !MySettings.poisoningCharges)
{
((BaseWeapon)m_Target).Poison = m_Poison;
((BaseWeapon)m_Target).PoisonCharges = 18 - (m_Poison.Level * 2);
}
else if ( m_Target is BaseWeapon && MySettings.poisoningCharges)
{
// at 125 skill, a weapon can hold 41 poison charges.
int maximumPoisonCharges = (int)(m_From.Skills[SkillName.Poisoning].Value)/3;
((BaseWeapon)m_Target).Poison = m_Poison;
// every coating adds from poisoning/10 to poisoning/7 charges. At 125 skill that translates to 12 to 17 charges per potion.
int chargesToAdd = Utility.RandomMinMax((int)(m_From.Skills[SkillName.Poisoning].Value)/10,(int)(m_From.Skills[SkillName.Poisoning].Value/7));
((BaseWeapon)m_Target).PoisonCharges = ((BaseWeapon)m_Target).PoisonCharges + chargesToAdd > maximumPoisonCharges ? maximumPoisonCharges : ((BaseWeapon)m_Target).PoisonCharges + chargesToAdd;
if (((BaseWeapon)m_Target).PoisonCharges == maximumPoisonCharges)
{
maxChargesReached = true;
}
}
else if ( m_Target is FukiyaDarts )
{
((FukiyaDarts)m_Target).Poison = m_Poison;
Expand All @@ -156,9 +171,15 @@ protected override void OnTick()
((Shuriken)m_Target).PoisonCharges = Math.Min( 18 - (m_Poison.Level * 2), ((Shuriken)m_Target).UsesRemaining );
}

m_From.SendLocalizedMessage( 1010517 ); // You apply the poison

Misc.Titles.AwardKarma( m_From, -20, true );
if(maxChargesReached)
{
m_From.SendMessage(38, "This weapon has as much poison as your skills can handle.");
}
else
{
m_From.SendLocalizedMessage( 1010517 ); // You apply the poison
Misc.Titles.AwardKarma( m_From, -20, true );
}
}
else // Failed
{
Expand Down
4 changes: 3 additions & 1 deletion Info/Scripts/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ public static class MySettings
public static int S_MinGold = 100;
public static int S_MaxGold = 150;


// this changes how the poisoning skill works. If set to true, then character skill will be taken into account instead of poison
// level to determine the maximum amount of poison charges a weapon can have, as well as how many charges are applied with each dose.
public static bool poisoningCharges = true;


///////////////////////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 157b458

Please sign in to comment.