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

@ -1096,6 +1096,7 @@ namespace Server.Mobiles
case OrderType.Stop:
m_Mobile.ControlMaster.RevealingAction();
m_Mobile.Home = m_Mobile.Location;
m_Mobile.CurrentSpeed = m_Mobile.PassiveSpeed;
m_Mobile.PlaySound( m_Mobile.GetIdleSound() );
m_Mobile.Warmode = false;
@ -1476,13 +1477,9 @@ namespace Server.Mobiles
Mobile newCombatant = null;
double newScore = 0.0;
List<AggressorInfo> list = m_Mobile.Aggressors;
for( int i = 0; i < list.Count; ++i )
foreach( Mobile aggr in m_Mobile.GetMobilesInRange( m_Mobile.RangePerception ) )
{
Mobile aggr = list[i].Attacker;
if( aggr.Map != m_Mobile.Map || !aggr.InRange( m_Mobile.Location, m_Mobile.RangePerception ) || !m_Mobile.CanSee( aggr ) )
if( !m_Mobile.CanSee( aggr ) || aggr.Combatant != m_Mobile )
continue;
if( aggr.IsDeadBondedPet || !aggr.Alive )
@ -1571,7 +1568,15 @@ namespace Server.Mobiles
m_Mobile.Home = m_Mobile.Location;
m_Mobile.ControlTarget = null;
m_Mobile.ControlOrder = OrderType.None;
if( Core.ML )
{
WalkRandomInHome( 3, 2, 1 );
}
else
{
m_Mobile.ControlOrder = OrderType.None;
}
return true;
}

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

View file

@ -118,7 +118,7 @@ namespace Server
typeof( SnowElemental ), typeof( WhiteWyrm ), typeof( Wisp ),
typeof( DemonKnight ), typeof( GiantBlackWidow ), typeof( SummonedAirElemental ),
typeof( LesserHiryu ), typeof( Hiryu ), typeof( LadyOfTheSnow ),
typeof( RaiJu ), typeof( Ronin )
typeof( RaiJu ), typeof( Ronin ), typeof( RuneBeetle )
} ),
/* Very Fast */
new SpeedInfo( 0.175, 0.350, new Type[]
@ -206,7 +206,7 @@ namespace Server
typeof( Kappa ), typeof( KazeKemono ), typeof( DeathwatchBeetle ),
typeof( TsukiWolf ), typeof( YomotsuElder ), typeof( YomotsuPriest ),
typeof( YomotsuWarrior ), typeof( RevenantLion ), typeof( Oni ),
typeof( RuneBeetle ), typeof( Gaman ), typeof( Crane )
typeof( Gaman ), typeof( Crane )
} )
};
}

View file

@ -7,6 +7,7 @@ using Server.Multis;
using Server.Prompts;
using Server.Mobiles;
using Server.ContextMenus;
using Server.Items;
namespace Server.Engines.BulkOrders
{
@ -63,6 +64,34 @@ namespace Server.Engines.BulkOrders
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
}
public override void OnDoubleClickSecureTrade( Mobile from )
{
if ( !from.InRange( GetWorldLocation(), 2 ) )
{
from.SendLocalizedMessage( 500446 ); // That is too far away.
}
else if ( m_Entries.Count == 0 )
{
from.SendLocalizedMessage( 1062381 ); // The book is empty.
}
else
{
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
SecureTradeContainer cont = GetSecureTradeCont();
if ( cont != null )
{
SecureTrade trade = cont.Trade;
if ( trade != null && trade.From.Mobile == from )
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.To.Mobile), this ) );
else if ( trade != null && trade.To.Mobile == from )
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)(trade.From.Mobile), this ) );
}
}
}
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( dropped is LargeBOD )

View file

@ -56,12 +56,10 @@ namespace Server.Engines.Harvest
if ( m_Definition.RandomizeVeins )
{
m_Vein = m_Definition.GetVeinFrom( Utility.RandomDouble() );
}
else
{
m_Vein = m_DefaultVein;
m_DefaultVein = m_Definition.GetVeinFrom( Utility.RandomDouble() );
}
m_Vein = m_DefaultVein;
}
public void Consume( int amount, Mobile from )

View file

@ -91,6 +91,15 @@ namespace Server.Engines.Harvest
fish.Resources = res;
fish.Veins = veins;
if ( Core.ML )
{
fish.BonusResources = new BonusHarvestResource[]
{
new BonusHarvestResource( 0, 99.4, null, null ), //set to same chance as mining ml gems
new BonusHarvestResource( 80.0, .6, 1072597, typeof( WhitePearl ) )
};
}
m_Definition = fish;
Definitions.Add( fish );
#endregion

View file

@ -114,13 +114,13 @@ namespace Server.Engines.Harvest
{
oreAndStone.BonusResources = new BonusHarvestResource[]
{
new BonusHarvestResource( 0, 99.8998, null, null ), //Nothing //Note: Rounded the below to .0167 instead of 1/6th of a %. Close enough
new BonusHarvestResource( 100, .0167, 1072562, typeof( BlueDiamond ) ),
new BonusHarvestResource( 100, .0167, 1072567, typeof( DarkSapphire ) ),
new BonusHarvestResource( 100, .0167, 1072570, typeof( EcruCitrine ) ),
new BonusHarvestResource( 100, .0167, 1072564, typeof( FireRuby ) ),
new BonusHarvestResource( 100, .0167, 1072566, typeof( PerfectEmerald ) ),
new BonusHarvestResource( 100, .0167, 1072568, typeof( Turquoise ) )
new BonusHarvestResource( 0, 99.4, null, null ), //Nothing
new BonusHarvestResource( 100, .1, 1072562, typeof( BlueDiamond ) ),
new BonusHarvestResource( 100, .1, 1072567, typeof( DarkSapphire ) ),
new BonusHarvestResource( 100, .1, 1072570, typeof( EcruCitrine ) ),
new BonusHarvestResource( 100, .1, 1072564, typeof( FireRuby ) ),
new BonusHarvestResource( 100, .1, 1072566, typeof( PerfectEmerald ) ),
new BonusHarvestResource( 100, .1, 1072568, typeof( Turquoise ) )
};
}

View file

@ -166,13 +166,13 @@ namespace Server.PathAlgorithms.FastAStar
int newCost = m_Nodes[bestNode].cost + 1;
int newTotal = newCost + Heuristic( newNode % AreaSize, (newNode / AreaSize) % AreaSize, m_Nodes[newNode].z );
if ( m_Nodes[newNode].total > newTotal )
if ( !wasTouched || m_Nodes[newNode].total > newTotal )
{
m_Nodes[newNode].parent = bestNode;
m_Nodes[newNode].cost = newCost;
m_Nodes[newNode].total = newTotal;
if ( !m_OnOpen[newNode] )
if ( !wasTouched || !m_OnOpen[newNode] )
{
AddToChain( newNode );

View file

@ -149,8 +149,8 @@ namespace Server
{
alg = FastAStarAlgorithm.Instance;
if ( !alg.CheckCondition( m, map, start, goal ) )
alg = SlowAStarAlgorithm.Instance;
//if ( !alg.CheckCondition( m, map, start, goal ) ) // SlowAstar is still broken
// alg = SlowAStarAlgorithm.Instance; // TODO: Fix SlowAstar
}
if ( alg != null && alg.CheckCondition( m, map, start, goal ) )