From 1a241e17f1a87a877040582cffc2cc33a16a425f Mon Sep 17 00:00:00 2001 From: asayre Date: Thu, 29 Jun 2006 04:24:26 +0000 Subject: [PATCH] Addition of Racial Harvest bonuses, Elven nightsight, and rename of OreInfo.cs to ResourceInfo.cs --- Scripts/Engines/AI/Creature/BaseCreature.cs | 5 ++++ Scripts/Engines/Harvest/Core/HarvestBank.cs | 9 +++++-- .../Engines/Harvest/Core/HarvestDefinition.cs | 2 ++ Scripts/Engines/Harvest/Core/HarvestSystem.cs | 26 +++++++++++++++---- Scripts/Engines/Harvest/Lumberjacking.cs | 2 ++ Scripts/Engines/Harvest/Mining.cs | 5 +++- Scripts/Items/Weapons/BaseWeapon.cs | 5 ++-- Scripts/Misc/{OreInfo.cs => ResourceInfo.cs} | 0 Scripts/Mobiles/PlayerMobile.cs | 4 ++- Scripts/Skills/Tracking.cs | 7 ++++- Scripts/Targets/BladedItemTarget.cs | 2 +- 11 files changed, 54 insertions(+), 13 deletions(-) rename Scripts/Misc/{OreInfo.cs => ResourceInfo.cs} (100%) diff --git a/Scripts/Engines/AI/Creature/BaseCreature.cs b/Scripts/Engines/AI/Creature/BaseCreature.cs index e188106d1..d5a350c93 100644 --- a/Scripts/Engines/AI/Creature/BaseCreature.cs +++ b/Scripts/Engines/AI/Creature/BaseCreature.cs @@ -1195,6 +1195,11 @@ namespace Server.Mobiles } else { + if( Core.ML && from.Race == Race.Human ) + { + hides = (int)Math.Ceiling( hides * 1.1 ); //10% Bonus Only applies to Hides, Ore & Logs + } + if ( corpse.Map == Map.Felucca ) { feathers *= 2; diff --git a/Scripts/Engines/Harvest/Core/HarvestBank.cs b/Scripts/Engines/Harvest/Core/HarvestBank.cs index 0b406e002..6600f3644 100644 --- a/Scripts/Engines/Harvest/Core/HarvestBank.cs +++ b/Scripts/Engines/Harvest/Core/HarvestBank.cs @@ -49,7 +49,7 @@ namespace Server.Engines.Harvest m_Vein = m_DefaultVein; } - public void Consume( HarvestDefinition def, int amount ) + public void Consume( HarvestDefinition def, int amount, Mobile from ) { CheckRespawn(); @@ -60,7 +60,12 @@ namespace Server.Engines.Harvest double rnd = Utility.RandomDouble(); m_Current = m_Maximum - amount; - m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( min + (rnd * (max - min)) ); + + double minutes = min + (rnd * (max - min)); + if( def.RaceBonus && from.Race == Race.Elf ) //def.RaceBonus = Core.ML + minutes *= .75; //25% off the time. + + m_NextRespawn = DateTime.Now + TimeSpan.FromMinutes( minutes ); } else { diff --git a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs index 695f37e80..6babb929a 100644 --- a/Scripts/Engines/Harvest/Core/HarvestDefinition.cs +++ b/Scripts/Engines/Harvest/Core/HarvestDefinition.cs @@ -22,6 +22,7 @@ namespace Server.Engines.Harvest private object m_NoResourcesMessage, m_OutOfRangeMessage, m_TimedOutOfRangeMessage, m_DoubleHarvestMessage, m_FailMessage, m_PackFullMessage, m_ToolBrokeMessage; private HarvestResource[] m_Resources; private HarvestVein[] m_Veins; + private bool m_RaceBonus; public int BankWidth{ get{ return m_BankWidth; } set{ m_BankWidth = value; } } public int BankHeight{ get{ return m_BankHeight; } set{ m_BankHeight = value; } } @@ -50,6 +51,7 @@ namespace Server.Engines.Harvest public object ToolBrokeMessage{ get{ return m_ToolBrokeMessage; } set{ m_ToolBrokeMessage = value; } } public HarvestResource[] Resources{ get{ return m_Resources; } set{ m_Resources = value; } } public HarvestVein[] Veins{ get{ return m_Veins; } set{ m_Veins = value; } } + public bool RaceBonus { get { return m_RaceBonus; } set { m_RaceBonus = value; } } private Hashtable m_BanksByMap; diff --git a/Scripts/Engines/Harvest/Core/HarvestSystem.cs b/Scripts/Engines/Harvest/Core/HarvestSystem.cs index f3f39a24c..ea73705ad 100644 --- a/Scripts/Engines/Harvest/Core/HarvestSystem.cs +++ b/Scripts/Engines/Harvest/Core/HarvestSystem.cs @@ -163,15 +163,29 @@ namespace Server.Engines.Harvest } else { + //The whole harvest system is kludgy and I'm sure this is just adding to it. if ( item.Stackable ) { - if ( map == Map.Felucca && bank.Current >= def.ConsumedPerFeluccaHarvest ) - item.Amount = def.ConsumedPerFeluccaHarvest; + int amount = def.ConsumedPerHarvest; + int feluccaAmount = def.ConsumedPerFeluccaHarvest; + + int racialAmount = (int)Math.Ceiling( amount * 1.1 ); + int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 ); + + bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); + bool inFelucca = (map == Map.Felucca); + + if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount ) + item.Amount = feluccaRacialAmount; + else if( inFelucca && bank.Current >= feluccaAmount ) + item.Amount = feluccaAmount; + else if( eligableForRacialBonus && bank.Current >= racialAmount ) + item.Amount = racialAmount; else - item.Amount = def.ConsumedPerHarvest; + item.Amount = amount; } - bank.Consume( def, item.Amount ); + bank.Consume( def, item.Amount, from ); if ( Give( from, item, def.PlaceAtFeetIfFull ) ) { @@ -283,7 +297,9 @@ namespace Server.Engines.Harvest public virtual HarvestResource MutateResource( Mobile from, Item tool, HarvestDefinition def, Map map, Point3D loc, HarvestVein vein, HarvestResource primary, HarvestResource fallback ) { - if ( vein.ChanceToFallback > Utility.RandomDouble() ) + bool racialBonus = (def.RaceBonus && from.Race == Race.Elf ); + + if( vein.ChanceToFallback > (Utility.RandomDouble() + (racialBonus ? .20 : 0)) ) return fallback; double skillValue = from.Skills[def.Skill].Value; diff --git a/Scripts/Engines/Harvest/Lumberjacking.cs b/Scripts/Engines/Harvest/Lumberjacking.cs index ba8e2dacc..8e9b2875a 100644 --- a/Scripts/Engines/Harvest/Lumberjacking.cs +++ b/Scripts/Engines/Harvest/Lumberjacking.cs @@ -85,6 +85,8 @@ namespace Server.Engines.Harvest lumber.Resources = res; lumber.Veins = veins; + lumber.RaceBonus = Core.ML; + m_Definition = lumber; Definitions.Add( lumber ); #endregion diff --git a/Scripts/Engines/Harvest/Mining.cs b/Scripts/Engines/Harvest/Mining.cs index 1eb358a03..7febc21ce 100644 --- a/Scripts/Engines/Harvest/Mining.cs +++ b/Scripts/Engines/Harvest/Mining.cs @@ -110,6 +110,8 @@ namespace Server.Engines.Harvest oreAndStone.Resources = res; oreAndStone.Veins = veins; + oreAndStone.RaceBonus = Core.ML; + Definitions.Add( oreAndStone ); #endregion @@ -177,7 +179,8 @@ namespace Server.Engines.Harvest { if ( def == m_OreAndStone ) { - if ( from is PlayerMobile && ((PlayerMobile)from).StoneMining && ((PlayerMobile)from).ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble() ) + PlayerMobile pm = from as PlayerMobile; + if ( pm != null && pm.StoneMining && pm.ToggleMiningStone && from.Skills[SkillName.Mining].Base >= 100.0 && 0.1 > Utility.RandomDouble() ) return resource.Types[1]; return resource.Types[0]; diff --git a/Scripts/Items/Weapons/BaseWeapon.cs b/Scripts/Items/Weapons/BaseWeapon.cs index 7c5364191..855db60bc 100644 --- a/Scripts/Items/Weapons/BaseWeapon.cs +++ b/Scripts/Items/Weapons/BaseWeapon.cs @@ -1029,12 +1029,13 @@ namespace Server.Items BaseShield shield = defender.FindItemOnLayer( Layer.TwoHanded ) as BaseShield; double parry = defender.Skills[SkillName.Parry].Value; - double parryNonRacial = defender.Skills[SkillName.Parry].NonRacialValue; + double bushidoNonRacial = defender.Skills[SkillName.Bushido].NonRacialValue; double bushido = defender.Skills[SkillName.Bushido].Value; if ( shield != null ) { - double chance = (parryNonRacial - bushido) / 400.0; //As per OSI, no negitive effect from the Racial stuffs, ie, 120 bushido and '0' parry with humans + double chance = (parry - bushidoNonRacial) / 400.0; //As per OSI, no negitive effect from the Racial stuffs, ie, 120 parry and '0' bushido with humans + // Parry over 100 grants a 5% bonus. if ( parry >= 100.0 ) diff --git a/Scripts/Misc/OreInfo.cs b/Scripts/Misc/ResourceInfo.cs similarity index 100% rename from Scripts/Misc/OreInfo.cs rename to Scripts/Misc/ResourceInfo.cs diff --git a/Scripts/Mobiles/PlayerMobile.cs b/Scripts/Mobiles/PlayerMobile.cs index 192b6f5b4..44e9574eb 100644 --- a/Scripts/Mobiles/PlayerMobile.cs +++ b/Scripts/Mobiles/PlayerMobile.cs @@ -439,7 +439,9 @@ namespace Server.Mobiles { global = LightCycle.ComputeLevelFor( this ); - if ( this.LightLevel < 21 && AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 ) + bool racialNightSight = (Core.ML && this.Race == Race.Elf); + + if ( this.LightLevel < 21 && ( AosAttributes.GetValue( this, AosAttribute.NightSight ) > 0 || racialNightSight )) personal = 21; else personal = this.LightLevel; diff --git a/Scripts/Skills/Tracking.cs b/Scripts/Skills/Tracking.cs index 7e4a044f2..e598ac757 100644 --- a/Scripts/Skills/Tracking.cs +++ b/Scripts/Skills/Tracking.cs @@ -201,9 +201,14 @@ namespace Server.SkillHandlers if ( !Core.AOS || !m.Player ) return true; - int tracking = from.Skills[SkillName.Tracking].Fixed; + + + int tracking = from.Skills[SkillName.Tracking].Fixed; int detectHidden = from.Skills[SkillName.DetectHidden].Fixed; + if( Core.ML && m.Race == Race.Elf ) + tracking /= 2; //The 'Guide' says that it requires twice as Much tracking SKILL to track an elf. Not the total difficulty to track. + int hiding = m.Skills[SkillName.Hiding].Fixed; int stealth = m.Skills[SkillName.Stealth].Fixed; int divisor = hiding + stealth; diff --git a/Scripts/Targets/BladedItemTarget.cs b/Scripts/Targets/BladedItemTarget.cs index 0884eb109..e88dcb012 100644 --- a/Scripts/Targets/BladedItemTarget.cs +++ b/Scripts/Targets/BladedItemTarget.cs @@ -101,7 +101,7 @@ namespace Server.Targets } else { - bank.Consume( def, 5 ); + bank.Consume( def, 5, from ); Item item = new Kindling();