This commit is contained in:
mark 2009-06-28 03:36:42 +00:00
parent c63a5f13fa
commit 2204d5fb86
86 changed files with 1077 additions and 257 deletions

View file

@ -55,9 +55,10 @@ namespace Server.Mobiles
[Flags]
public enum FoodType
{
None = 0x0000,
Meat = 0x0001,
FruitsAndVegies = 0x0002,
GrainsAndHay = 0x0004,
FruitsAndVegies = 0x0002,
GrainsAndHay = 0x0004,
Fish = 0x0008,
Eggs = 0x0010,
Gold = 0x0020
@ -170,39 +171,39 @@ namespace Server.Mobiles
#region Var declarations
private BaseAI m_AI; // THE AI
private AIType m_CurrentAI; // The current AI
private AIType m_DefaultAI; // The default AI
private AIType m_CurrentAI; // The current AI
private AIType m_DefaultAI; // The default AI
private Mobile m_FocusMob; // Use focus mob instead of combatant, maybe we don't whan to fight
private FightMode m_FightMode; // The style the mob uses
private FightMode m_FightMode; // The style the mob uses
private int m_iRangePerception; // The view area
private int m_iRangeFight; // The fight distance
private bool m_bDebugAI; // Show debug AI messages
private int m_iTeam; // Monster Team
private bool m_bDebugAI; // Show debug AI messages
private double m_dActiveSpeed; // Timer speed when active
private double m_dPassiveSpeed; // Timer speed when not active
private double m_dCurrentSpeed; // The current speed, lets say it could be changed by something;
private int m_iTeam; // Monster Team
private Point3D m_pHome; // The home position of the creature, used by some AI
private double m_dActiveSpeed; // Timer speed when active
private double m_dPassiveSpeed; // Timer speed when not active
private double m_dCurrentSpeed; // The current speed, lets say it could be changed by something;
private Point3D m_pHome; // The home position of the creature, used by some AI
private int m_iRangeHome = 10; // The home range of the creature
List<Type> m_arSpellAttack; // List of attack spell/power
List<Type> m_arSpellDefense; // List of defensive spell/power
private bool m_bControlled; // Is controlled
private Mobile m_ControlMaster; // My master
private Mobile m_ControlTarget; // My target mobile
private Point3D m_ControlDest; // My target destination (patrol)
private OrderType m_ControlOrder; // My order
private bool m_bControlled; // Is controlled
private Mobile m_ControlMaster; // My master
private Mobile m_ControlTarget; // My target mobile
private Point3D m_ControlDest; // My target destination (patrol)
private OrderType m_ControlOrder; // My order
private int m_Loyalty;
private int m_Loyalty;
private double m_dMinTameSkill;
private bool m_bTamable;
private double m_dMinTameSkill;
private bool m_bTamable;
private bool m_bSummoned = false;
private DateTime m_SummonEnd;
@ -218,20 +219,20 @@ namespace Server.Mobiles
private Mobile m_SummonMaster;
private int m_HitsMax = -1;
private int m_StamMax = -1;
private int m_ManaMax = -1;
private int m_DamageMin = -1;
private int m_DamageMax = -1;
private int m_HitsMax = -1;
private int m_StamMax = -1;
private int m_ManaMax = -1;
private int m_DamageMin = -1;
private int m_DamageMax = -1;
private int m_PhysicalResistance, m_PhysicalDamage = 100;
private int m_FireResistance, m_FireDamage;
private int m_ColdResistance, m_ColdDamage;
private int m_PoisonResistance, m_PoisonDamage;
private int m_EnergyResistance, m_EnergyDamage;
private int m_PhysicalResistance, m_PhysicalDamage = 100;
private int m_FireResistance, m_FireDamage;
private int m_ColdResistance, m_ColdDamage;
private int m_PoisonResistance, m_PoisonDamage;
private int m_EnergyResistance, m_EnergyDamage;
private List<Mobile> m_Owners;
private List<Mobile> m_Friends;
private List<Mobile> m_Owners;
private List<Mobile> m_Friends;
private bool m_IsStabled;
@ -239,6 +240,10 @@ namespace Server.Mobiles
private bool m_Paragon;
private bool m_IsPrisoner;
private Timer m_GhostDeletionTimer;
#endregion
public virtual InhumanSpeech SpeechType{ get{ return null; } }
@ -246,9 +251,20 @@ namespace Server.Mobiles
public bool IsStabled
{
get{ return m_IsStabled; }
set{ m_IsStabled = value; }
set
{
m_IsStabled = value;
SetGhostDeletionTimer( !m_IsStabled );
}
}
[CommandProperty( AccessLevel.GameMaster )]
public bool IsPrisoner
{
get{ return m_IsPrisoner; }
set{ m_IsPrisoner = value; }
}
protected DateTime SummonEnd
{
get { return m_SummonEnd; }
@ -402,6 +418,7 @@ namespace Server.Mobiles
public virtual bool BardImmune{ get{ return false; } }
public virtual bool Unprovokable{ get{ return BardImmune || m_IsDeadPet; } }
public virtual bool Uncalmable{ get{ return BardImmune || m_IsDeadPet; } }
public virtual bool AreaPeaceImmune { get { return BardImmune || m_IsDeadPet; } }
public virtual bool BleedImmune{ get{ return false; } }
public virtual double BonusPetDamageScalar{ get{ return 1.0; } }
@ -824,16 +841,38 @@ namespace Server.Mobiles
int taming = (int)((useBaseSkill ? m.Skills[SkillName.AnimalTaming].Base : m.Skills[SkillName.AnimalTaming].Value ) * 10);
int lore = (int)((useBaseSkill ? m.Skills[SkillName.AnimalLore].Base : m.Skills[SkillName.AnimalLore].Value )* 10);
int bonus = 0, chance = 700;
int difficulty = (int)(dMinTameSkill * 10);
int weighted = ((taming * 4) + lore) / 5;
int bonus = weighted - difficulty;
int chance;
if( Core.ML )
{
int SkillBonus = taming - (int)(dMinTameSkill * 10);
int LoreBonus = lore - (int)(dMinTameSkill * 10);
if ( bonus <= 0 )
chance = 700 + (bonus * 14);
int SkillMod = 6, LoreMod = 6;
if( SkillBonus < 0 )
SkillMod = 28;
if( LoreBonus < 0 )
LoreMod = 14;
SkillBonus *= SkillMod;
LoreBonus *= LoreMod;
bonus = (SkillBonus + LoreBonus ) / 2;
}
else
chance = 700 + (bonus * 6);
{
int difficulty = (int)(dMinTameSkill * 10);
int weighted = ((taming * 4) + lore) / 5;
bonus = weighted - difficulty;
if ( bonus <= 0 )
bonus *= 14;
else
bonus *= 6;
}
chance += bonus;
if ( chance >= 0 && chance < 200 )
chance = 200;
@ -1693,6 +1732,8 @@ namespace Server.Mobiles
if ( IsAnimatedDead )
Spells.Necromancy.AnimateDeadSpell.Register( m_SummonMaster, this );
SetGhostDeletionTimer( true );
}
public virtual bool IsHumanInTown()
@ -2215,9 +2256,23 @@ namespace Server.Mobiles
public void RemoveFollowers()
{
if ( m_ControlMaster != null )
{
m_ControlMaster.Followers -= ControlSlots;
if( m_ControlMaster is PlayerMobile )
{
((PlayerMobile)m_ControlMaster).AllFollowers.Remove( this );
if( ((PlayerMobile)m_ControlMaster).AutoStabled.Contains( this ) )
((PlayerMobile)m_ControlMaster).AutoStabled.Remove( this );
}
}
else if ( m_SummonMaster != null )
{
m_SummonMaster.Followers -= ControlSlots;
if( m_SummonMaster is PlayerMobile )
{
((PlayerMobile)m_SummonMaster).AllFollowers.Remove( this );
}
}
if ( m_ControlMaster != null && m_ControlMaster.Followers < 0 )
m_ControlMaster.Followers = 0;
@ -2229,9 +2284,21 @@ namespace Server.Mobiles
public void AddFollowers()
{
if ( m_ControlMaster != null )
{
m_ControlMaster.Followers += ControlSlots;
if( m_ControlMaster is PlayerMobile )
{
((PlayerMobile)m_ControlMaster).AllFollowers.Add( this );
}
}
else if ( m_SummonMaster != null )
{
m_SummonMaster.Followers += ControlSlots;
if( m_SummonMaster is PlayerMobile )
{
((PlayerMobile)m_SummonMaster).AllFollowers.Add( this );
}
}
}
[CommandProperty( AccessLevel.GameMaster )]
@ -2833,8 +2900,22 @@ namespace Server.Mobiles
{
base.AggressiveAction( aggressor, criminal );
OrderType ct = m_ControlOrder;
if ( m_AI != null )
m_AI.OnAggressiveAction( aggressor );
{
if( !Core.ML || ( ct != OrderType.Follow && ct != OrderType.Stop ) )
{
m_AI.OnAggressiveAction( aggressor );
}
else
{
DebugSay( "I'm being attacked but my master told me not to fight." );
Warmode = false;
Combatant = null;
return;
}
}
StopFlee();
@ -2848,9 +2929,7 @@ namespace Server.Mobiles
pl.FinishShield();
}
OrderType ct = m_ControlOrder;
if ( aggressor.ChangingCombatant && (m_bControlled || m_bSummoned) && (ct == OrderType.Come || ct == OrderType.Stay || ct == OrderType.Stop || ct == OrderType.None || ct == OrderType.Follow) )
if ( aggressor.ChangingCombatant && (m_bControlled || m_bSummoned) && (ct == OrderType.Come || ( !Core.ML && ct == OrderType.Stay ) || ct == OrderType.Stop || ct == OrderType.None || ct == OrderType.Follow) )
{
ControlTarget = aggressor;
ControlOrder = OrderType.Attack;
@ -2874,7 +2953,7 @@ namespace Server.Mobiles
{
}
public virtual bool CanDrop { get { return !Summoned; } }
public virtual bool CanDrop { get { return IsBonded; } }
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
@ -4182,6 +4261,8 @@ namespace Server.Mobiles
GiftOfLifeSpell.HandleDeath( this );
CheckStatTimers();
SetGhostDeletionTimer( true );
}
else
{
@ -4801,8 +4882,26 @@ namespace Server.Mobiles
}
CheckStatTimers();
SetGhostDeletionTimer( false );
}
private void SetGhostDeletionTimer( bool running )
{
if( running && ( !IsDeadBondedPet || !Core.ML ) )
return;
if( m_GhostDeletionTimer != null )
m_GhostDeletionTimer.Stop();
if( !running )
return;
m_GhostDeletionTimer = new GhostDeletionTimer( this, TimeSpan.FromMinutes( 120 + Utility.Random( 120 ) ) );
m_GhostDeletionTimer.Start();
}
public override bool CanBeDamaged()
{
if ( IsDeadPet )
@ -4839,6 +4938,26 @@ namespace Server.Mobiles
[CommandProperty( AccessLevel.GameMaster )]
public int RemoveStep { get { return m_RemoveStep; } set { m_RemoveStep = value; } }
private class GhostDeletionTimer : Timer
{
private BaseCreature m_Creature;
public GhostDeletionTimer( BaseCreature Creature, TimeSpan delay ) : base( delay )
{
Priority = TimerPriority.FiveSeconds;
m_Creature = Creature;
}
protected override void OnTick()
{
if( Core.ML && m_Creature.IsDeadBondedPet );
{
m_Creature.Delete();
}
Stop();
}
}
}
public class LoyaltyTimer : Timer