Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implements skill-based poisoning charge limits and weapon coating. #107

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -234,7 +234,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