ModernUO/Scripts/Spells/Necromancy/Strangle.cs
xavier 5c7774b99a Missing System Message "Your pet looks happier" (regardless of loyalty)
http://www.runuo.com/community/threads/ready-missing-system-message-your-pet-looks-happier.450209/

Not all powerscrolls do drop - Ninjitsu, Bushido etc.
http://www.runuo.com/community/threads/ready-not-all-powerscrolls-do-drop.459974/

Savage Kin Paint Wrong Skill Requirement + Wrong Success Chance
http://www.runuo.com/community/threads/ready-savage-kin-paint-wrong-skill-requirement-wrong-success-chance.455360/

Hag Quest - Stew, can't eat it
http://www.runuo.com/community/threads/ready-hag-quest-stew.454406/

Giant Blue Beetles shouldn't need beating into submission after being tamed once
http://www.runuo.com/community/threads/ready-giant-blue-beetles.450205/

Greater Dragon Fame/Karma Doesn't Match OSI
http://www.runuo.com/community/threads/ready-greater-dragon-fame-karma-doesnt-match-osi.472206/

Resizing Houses, you can resize a house by using a command under the house sign
http://www.runuo.com/community/threads/ready-resizing-houses.414762/

Crafted Shield Resists are wrong on RunUO
http://www.runuo.com/community/threads/ready-crafted-shield-resists.454186/

Yomotsu Mines, you should not be able to recall out of there.
http://www.runuo.com/community/threads/ready-yomotsu-mines.445486/

Missing Necro Icons in the Buff/Debuff Bar
http://www.runuo.com/community/threads/ready-missing-necro-icons-in-the-buff-debuff-bar.450872/

Chivalry Spells, you are allowed to attempt casting of spells outside of your skill range without a system message
http://www.runuo.com/community/threads/ready-chivalry-spells.450757/

Tinker tools use a different graphic on OSI
http://www.runuo.com/community/threads/ready-tinker-tools.460690/

Tinkering should not be required when crafted a Tetsubo
http://www.runuo.com/community/threads/ready-wrong-skill-requirement-carpentry-wrong-success-chances.455342/

Carpentry-Small+Large Beds -Wrong Success Chance
http://www.runuo.com/community/threads/ready-carpentry-small-large-beds-wrong-success-chance.455794/

Telekinesis, various changes to behaviour with items
http://www.runuo.com/community/threads/ready-telekinesis.455250/

Forensic Evaluation Various issues
http://www.runuo.com/community/threads/ready-forensic-evaluation-various-issues-merged.458700/

Animate Dead Corpses, you cannot carve the corpse after it's used
http://www.runuo.com/community/threads/ready-animate-dead-corpses.453823/

You should be able to use begging skill while riding
http://www.runuo.com/community/threads/ready-begging-while-riding.466174/

Crafting Mod Lower Requirements should only appear on shields
http://www.runuo.com/community/threads/ready-crafting-mod-lower-requirements.452112/

You should be revealed While Taking Poison/Strangle Damage
http://www.runuo.com/community/threads/ready-you-never-reveal-while-taking-poison-strangle-damage.456946/

Insurance messages don't do the math!
http://www.runuo.com/community/threads/ready-insurance-messages-dont-do-the-math.454928/

Slayers should work on area of effect spells
http://www.runuo.com/community/threads/ready-slayers-should-work-on-area-of-effect-spells.448774/

You should not be able to use any travel spell in Heartwood
http://www.runuo.com/community/threads/ready-heartwood.457379/

Welcome Back To The House Friend message does not show post-AoS
http://www.runuo.com/community/threads/ready-welcome-back-to-the-house-friend.415924/

Giant Beetle speed should be very fast when magery spells are cast on it
http://www.runuo.com/community/threads/ready-giant-beetle.417848/
2011-06-25 18:39:14 +00:00

241 lines
No EOL
6.7 KiB
C#

using System;
using System.Collections;
using Server.Network;
using Server.Items;
using Server.Targeting;
namespace Server.Spells.Necromancy
{
public class StrangleSpell : NecromancerSpell
{
private static SpellInfo m_Info = new SpellInfo(
"Strangle", "In Bal Nox",
209,
9031,
Reagent.DaemonBlood,
Reagent.NoxCrystal
);
public override TimeSpan CastDelayBase { get { return TimeSpan.FromSeconds( 2.0 ); } }
public override double RequiredSkill{ get{ return 65.0; } }
public override int RequiredMana{ get{ return 29; } }
public StrangleSpell( Mobile caster, Item scroll ) : base( caster, scroll, m_Info )
{
}
public override void OnCast()
{
Caster.Target = new InternalTarget( this );
}
public void Target( Mobile m )
{
if ( CheckHSequence( m ) )
{
SpellHelper.Turn( Caster, m );
//SpellHelper.CheckReflect( (int)this.Circle, Caster, ref m ); //Irrelevent after AoS
/* Temporarily chokes off the air suply of the target with poisonous fumes.
* The target is inflicted with poison damage over time.
* The amount of damage dealt each "hit" is based off of the caster's Spirit Speak skill and the Target's current Stamina.
* The less Stamina the target has, the more damage is done by Strangle.
* Duration of the effect is Spirit Speak skill level / 10 rounds, with a minimum number of 4 rounds.
* The first round of damage is dealt after 5 seconds, and every next round after that comes 1 second sooner than the one before, until there is only 1 second between rounds.
* The base damage of the effect lies between (Spirit Speak skill level / 10) - 2 and (Spirit Speak skill level / 10) + 1.
* Base damage is multiplied by the following formula: (3 - (target's current Stamina / target's maximum Stamina) * 2).
* Example:
* For a target at full Stamina the damage multiplier is 1,
* for a target at 50% Stamina the damage multiplier is 2 and
* for a target at 20% Stamina the damage multiplier is 2.6
*/
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.PlaySound( 0x22F );
m.FixedParticles( 0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head );
m.FixedParticles( 0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255 );
if ( !m_Table.Contains( m ) )
{
Timer t = new InternalTimer( m, Caster );
t.Start();
m_Table[m] = t;
}
HarmfulSpell( m );
}
//Calculations for the buff bar
double spiritlevel = Caster.Skills[SkillName.SpiritSpeak].Value / 10;
if (spiritlevel < 4)
spiritlevel = 4;
int d_MinDamage = 4;
int d_MaxDamage = ((int)spiritlevel + 1) * 3;
string args = String.Format("{0}\t{1}", d_MinDamage, d_MaxDamage);
int i_Count = (int)spiritlevel;
int i_MaxCount = i_Count;
int i_HitDelay = 5;
int i_Length = i_HitDelay;
while (i_Count > 1)
{
--i_Count;
if (i_HitDelay > 1)
{
if (i_MaxCount < 5)
{
--i_HitDelay;
}
else
{
int delay = (int)(Math.Ceiling((1.0 + (5 * i_Count)) / i_MaxCount));
if (delay <= 5)
i_HitDelay = delay;
else
i_HitDelay = 5;
}
}
i_Length += i_HitDelay;
}
TimeSpan t_Duration = TimeSpan.FromSeconds(i_Length);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args.ToString()));
FinishSequence();
}
private static Hashtable m_Table = new Hashtable();
public static bool RemoveCurse( Mobile m )
{
Timer t = (Timer)m_Table[m];
if ( t == null )
return false;
t.Stop();
m.SendLocalizedMessage( 1061687 ); // You can breath normally again.
m_Table.Remove( m );
return true;
}
private class InternalTimer : Timer
{
private Mobile m_Target, m_From;
private double m_MinBaseDamage, m_MaxBaseDamage;
private DateTime m_NextHit;
private int m_HitDelay;
private int m_Count, m_MaxCount;
public InternalTimer( Mobile target, Mobile from ) : base( TimeSpan.FromSeconds( 0.1 ), TimeSpan.FromSeconds( 0.1 ) )
{
Priority = TimerPriority.FiftyMS;
m_Target = target;
m_From = from;
double spiritLevel = from.Skills[SkillName.SpiritSpeak].Value / 10;
m_MinBaseDamage = spiritLevel - 2;
m_MaxBaseDamage = spiritLevel + 1;
m_HitDelay = 5;
m_NextHit = DateTime.Now + TimeSpan.FromSeconds( m_HitDelay );
m_Count = (int)spiritLevel;
if ( m_Count < 4 )
m_Count = 4;
m_MaxCount = m_Count;
}
protected override void OnTick()
{
if ( !m_Target.Alive )
{
m_Table.Remove( m_Target );
Stop();
}
if ( !m_Target.Alive || DateTime.Now < m_NextHit )
return;
--m_Count;
if ( m_HitDelay > 1 )
{
if ( m_MaxCount < 5 )
{
--m_HitDelay;
}
else
{
int delay = (int)(Math.Ceiling( (1.0 + (5 * m_Count)) / m_MaxCount ) );
if ( delay <= 5 )
m_HitDelay = delay;
else
m_HitDelay = 5;
}
}
if ( m_Count == 0 )
{
m_Target.SendLocalizedMessage( 1061687 ); // You can breath normally again.
m_Table.Remove( m_Target );
Stop();
}
else
{
m_NextHit = DateTime.Now + TimeSpan.FromSeconds( m_HitDelay );
double damage = m_MinBaseDamage + (Utility.RandomDouble() * (m_MaxBaseDamage - m_MinBaseDamage));
damage *= (3 - (((double)m_Target.Stam / m_Target.StamMax) * 2));
if ( damage < 1 )
damage = 1;
if ( !m_Target.Player )
damage *= 1.75;
AOS.Damage( m_Target, m_From, (int)damage, 0, 0, 0, 100, 0 );
if ( 0.60 <= Utility.RandomDouble() ) // OSI: randomly revealed between first and third damage tick, guessing 60% chance
m_Target.RevealingAction();
}
}
}
private class InternalTarget : Target
{
private StrangleSpell m_Owner;
public InternalTarget( StrangleSpell owner ) : base( Core.ML ? 10 : 12, false, TargetFlags.Harmful )
{
m_Owner = owner;
}
protected override void OnTarget( Mobile from, object o )
{
if ( o is Mobile )
m_Owner.Target( (Mobile) o );
}
protected override void OnTargetFinish( Mobile from )
{
m_Owner.FinishSequence();
}
}
}
}