ModernUO/Scripts/Skills/Meditation.cs
eos 287bacac0e - Spawners now show all (instead of only 2) spawned objects, grouped by type, sorted alphabetically in their mouseover menu. (Displayed amounts fixed too.)
- Talisman slayers fixed to account for inheritance.
- Added repond slayer vulnerability to Troglodyte.
- Added overload for AOS.Damage with chaos damage support.
- Corrected order of ML artifact award messages.
- MageAI corrected to not meditate when already meditating.
- Changed MageAI necro/mage bias to something more sensible.
- Changed speed of most named ML mobs.
- Skeletal steeds are now bleed immune.
- Damage cap of 200 (before resists) added to fire breath attacks.
- Damaging aura effect added to BaseCreature.
- Necromancy skill added to several undead mobs.
- The succubus special drain effect message no longer shows.
- Corrected Sir Patrick's drain effect to account for LOS.
- Added healing skill to Troglodytes.
- Added named ML mobs for the Labyrinth, Painted Caves, Palace of Paroxysmus, Sanctuary and Twisted Weald.
- Added changelings.
- Disabled auto unequiping of weapons when meditating for nonplayers.
- Added cast animations for players in wraith form, lich form and horrific beast.
- Fixed Holy Light to account for LOS.
- Fixed Animate Dead to account for inheritance.
- Fixed Wither friendly fire issue when cast by monsters.
2012-03-04 05:01:41 +00:00

101 lines
No EOL
2.7 KiB
C#

using System;
using Server.Items;
namespace Server.SkillHandlers
{
class Meditation
{
public static void Initialize()
{
SkillInfo.Table[46].Callback = new SkillUseCallback( OnUse );
}
public static bool CheckOkayHolding( Item item )
{
if ( item == null )
return true;
if ( item is Spellbook || item is Runebook )
return true;
if ( Core.AOS && item is BaseWeapon && ((BaseWeapon)item).Attributes.SpellChanneling != 0 )
return true;
if ( Core.AOS && item is BaseArmor && ((BaseArmor)item).Attributes.SpellChanneling != 0 )
return true;
return false;
}
public static TimeSpan OnUse( Mobile m )
{
m.RevealingAction();
if ( m.Target != null )
{
m.SendLocalizedMessage( 501845 ); // You are busy doing something else and cannot focus.
return TimeSpan.FromSeconds( 5.0 );
}
else if ( !Core.AOS && m.Hits < (m.HitsMax / 10) ) // Less than 10% health
{
m.SendLocalizedMessage( 501849 ); // The mind is strong but the body is weak.
return TimeSpan.FromSeconds( 5.0 );
}
else if ( m.Mana >= m.ManaMax )
{
m.SendLocalizedMessage( 501846 ); // You are at peace.
return TimeSpan.FromSeconds( Core.AOS ? 10.0 : 5.0 );
}
else if ( Core.AOS && Server.Misc.RegenRates.GetArmorOffset( m ) > 0 )
{
m.SendLocalizedMessage( 500135 ); // Regenative forces cannot penetrate your armor!
return TimeSpan.FromSeconds( 10.0 );
}
else
{
Item oneHanded = m.FindItemOnLayer( Layer.OneHanded );
Item twoHanded = m.FindItemOnLayer( Layer.TwoHanded );
if ( Core.AOS && m.Player )
{
if ( !CheckOkayHolding( oneHanded ) )
m.AddToBackpack( oneHanded );
if ( !CheckOkayHolding( twoHanded ) )
m.AddToBackpack( twoHanded );
}
else if ( !CheckOkayHolding( oneHanded ) || !CheckOkayHolding( twoHanded ) )
{
m.SendLocalizedMessage( 502626 ); // Your hands must be free to cast spells or meditate.
return TimeSpan.FromSeconds( 2.5 );
}
double skillVal = m.Skills[SkillName.Meditation].Value;
double chance = (50.0 + (( skillVal - ( m.ManaMax - m.Mana ) ) * 2)) / 100;
if ( chance > Utility.RandomDouble() )
{
m.CheckSkill( SkillName.Meditation, 0.0, 100.0 );
m.SendLocalizedMessage( 501851 ); // You enter a meditative trance.
m.Meditating = true;
BuffInfo.AddBuff( m, new BuffInfo( BuffIcon.ActiveMeditation, 1075657 ) );
if ( m.Player || m.Body.IsHuman )
m.PlaySound( 0xF9 );
}
else
{
m.SendLocalizedMessage( 501850 ); // You cannot focus your concentration.
}
return TimeSpan.FromSeconds( 10.0 );
}
}
}
}