Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,104 +1,100 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Multis;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.SkillHandlers
|
||||
{
|
||||
public class Hiding
|
||||
{
|
||||
public static bool CombatOverride { get; set; }
|
||||
public class Hiding
|
||||
{
|
||||
public static bool CombatOverride{ get; set; }
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
SkillInfo.Table[21].Callback = OnUse;
|
||||
}
|
||||
public static void Initialize()
|
||||
{
|
||||
SkillInfo.Table[21].Callback = OnUse;
|
||||
}
|
||||
|
||||
public static TimeSpan OnUse( Mobile m )
|
||||
{
|
||||
if ( m.Spell != null )
|
||||
{
|
||||
m.SendLocalizedMessage( 501238 ); // You are busy doing something else and cannot hide.
|
||||
return TimeSpan.FromSeconds( 1.0 );
|
||||
}
|
||||
public static TimeSpan OnUse(Mobile m)
|
||||
{
|
||||
if (m.Spell != null)
|
||||
{
|
||||
m.SendLocalizedMessage(501238); // You are busy doing something else and cannot hide.
|
||||
return TimeSpan.FromSeconds(1.0);
|
||||
}
|
||||
|
||||
if ( Core.ML && m.Target != null )
|
||||
{
|
||||
Targeting.Target.Cancel( m );
|
||||
}
|
||||
if (Core.ML && m.Target != null) Target.Cancel(m);
|
||||
|
||||
double bonus = 0.0;
|
||||
double bonus = 0.0;
|
||||
|
||||
BaseHouse house = BaseHouse.FindHouseAt( m );
|
||||
BaseHouse house = BaseHouse.FindHouseAt(m);
|
||||
|
||||
if ( house != null && house.IsFriend( m ) )
|
||||
{
|
||||
bonus = 100.0;
|
||||
}
|
||||
else if ( !Core.AOS )
|
||||
{
|
||||
if ( house == null )
|
||||
house = BaseHouse.FindHouseAt( new Point3D( m.X - 1, m.Y, 127 ), m.Map, 16 );
|
||||
if (house != null && house.IsFriend(m))
|
||||
{
|
||||
bonus = 100.0;
|
||||
}
|
||||
else if (!Core.AOS)
|
||||
{
|
||||
if (house == null)
|
||||
house = BaseHouse.FindHouseAt(new Point3D(m.X - 1, m.Y, 127), m.Map, 16);
|
||||
|
||||
if ( house == null )
|
||||
house = BaseHouse.FindHouseAt( new Point3D( m.X + 1, m.Y, 127 ), m.Map, 16 );
|
||||
if (house == null)
|
||||
house = BaseHouse.FindHouseAt(new Point3D(m.X + 1, m.Y, 127), m.Map, 16);
|
||||
|
||||
if ( house == null )
|
||||
house = BaseHouse.FindHouseAt( new Point3D( m.X, m.Y - 1, 127 ), m.Map, 16 );
|
||||
if (house == null)
|
||||
house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y - 1, 127), m.Map, 16);
|
||||
|
||||
if ( house == null )
|
||||
house = BaseHouse.FindHouseAt( new Point3D( m.X, m.Y + 1, 127 ), m.Map, 16 );
|
||||
if (house == null)
|
||||
house = BaseHouse.FindHouseAt(new Point3D(m.X, m.Y + 1, 127), m.Map, 16);
|
||||
|
||||
if ( house != null )
|
||||
bonus = 50.0;
|
||||
}
|
||||
if (house != null)
|
||||
bonus = 50.0;
|
||||
}
|
||||
|
||||
//int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
|
||||
int range = Math.Min( (int)((100 - m.Skills[SkillName.Hiding].Value)/2) + 8, 18 ); //Cap of 18 not OSI-exact, intentional difference
|
||||
//int range = 18 - (int)(m.Skills[SkillName.Hiding].Value / 10);
|
||||
int range = Math.Min((int)((100 - m.Skills[SkillName.Hiding].Value) / 2) + 8,
|
||||
18); //Cap of 18 not OSI-exact, intentional difference
|
||||
|
||||
bool badCombat = ( !CombatOverride && m.Combatant != null && m.InRange( m.Combatant.Location, range ) && m.Combatant.InLOS( m ) );
|
||||
bool ok = ( !badCombat /*&& m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus )*/ );
|
||||
bool badCombat = !CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) &&
|
||||
m.Combatant.InLOS(m);
|
||||
bool ok = !badCombat;
|
||||
|
||||
if ( ok )
|
||||
{
|
||||
if ( !CombatOverride )
|
||||
{
|
||||
foreach ( Mobile check in m.GetMobilesInRange( range ) )
|
||||
{
|
||||
if ( check.InLOS( m ) && check.Combatant == m )
|
||||
{
|
||||
badCombat = true;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
if (!CombatOverride)
|
||||
foreach (Mobile check in m.GetMobilesInRange(range))
|
||||
if (check.InLOS(m) && check.Combatant == m)
|
||||
{
|
||||
badCombat = true;
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
|
||||
ok = ( !badCombat && m.CheckSkill( SkillName.Hiding, 0.0 - bonus, 100.0 - bonus ) );
|
||||
}
|
||||
ok = !badCombat && m.CheckSkill(SkillName.Hiding, 0.0 - bonus, 100.0 - bonus);
|
||||
}
|
||||
|
||||
if ( badCombat )
|
||||
{
|
||||
m.RevealingAction();
|
||||
if (badCombat)
|
||||
{
|
||||
m.RevealingAction();
|
||||
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x22, 501237 ); // You can't seem to hide right now.
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x22, 501237); // You can't seem to hide right now.
|
||||
|
||||
return TimeSpan.FromSeconds( 1.0 );
|
||||
}
|
||||
return TimeSpan.FromSeconds(1.0);
|
||||
}
|
||||
|
||||
if ( ok )
|
||||
{
|
||||
m.Hidden = true;
|
||||
m.Warmode = false;
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x1F4, 501240 ); // You have hidden yourself well.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.RevealingAction();
|
||||
if (ok)
|
||||
{
|
||||
m.Hidden = true;
|
||||
m.Warmode = false;
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x1F4, 501240); // You have hidden yourself well.
|
||||
}
|
||||
else
|
||||
{
|
||||
m.RevealingAction();
|
||||
|
||||
m.LocalOverheadMessage( MessageType.Regular, 0x22, 501241 ); // You can't seem to hide here.
|
||||
}
|
||||
m.LocalOverheadMessage(MessageType.Regular, 0x22, 501241); // You can't seem to hide here.
|
||||
}
|
||||
|
||||
return TimeSpan.FromSeconds( 10.0 );
|
||||
}
|
||||
}
|
||||
return TimeSpan.FromSeconds(10.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue