From 36c6ecee6c1dd2e5975caef6492f3e017b359ae1 Mon Sep 17 00:00:00 2001 From: xavier Date: Fri, 10 Dec 2010 16:58:01 +0000 Subject: [PATCH] potions: create separate new pot when d-click stack, as on OSI, fixes second explosion when exp pot is not thrown, misc accuracy fixes to exp pots, mobiles that cant take damage from an explosion pot also shouldn't absorb their share of the damage. --- .../Skill Items/Magical/Potions/BasePotion.cs | 32 +++++++++++++++++-- .../Explosion Potions/BaseExplosionPotion.cs | 29 ++++++++--------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs b/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs index 92853f018..49a8c021f 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/BasePotion.cs @@ -97,10 +97,36 @@ namespace Server.Items if ( from.InRange( this.GetWorldLocation(), 1 ) ) { - if ( !RequireFreeHand || HasFreeHand( from ) ) - Drink( from ); + if (!RequireFreeHand || HasFreeHand(from)) + { + if (Amount > 1) + { + BasePotion pot = (BasePotion)Activator.CreateInstance(this.GetType()); + + if (pot != null) + { + Amount--; + + if (from.Backpack != null && !from.Backpack.Deleted) + { + from.Backpack.DropItem(pot); + } + else + { + pot.MoveToWorld(from.Location, from.Map); + } + pot.Drink( from ); + } + } + else if( Amount == 1 ) + { + this.Drink( from ); + } + } else - from.SendLocalizedMessage( 502172 ); // You must have a free hand to drink a potion. + { + from.SendLocalizedMessage(502172); // You must have a free hand to drink a potion. + } } else { diff --git a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs index 66191ca50..018d69c3e 100644 --- a/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs +++ b/Scripts/Items/Skill Items/Magical/Potions/Explosion Potions/BaseExplosionPotion.cs @@ -241,9 +241,9 @@ namespace Server.Items if ( map == null ) return; - Effects.PlaySound( loc, map, 0x207 ); - Effects.SendLocationEffect( loc, map, 0x36BD, 20 ); + Effects.PlaySound(loc, map, 0x307); + Effects.SendLocationEffect(loc, map, 0x36B0, 9, 10, 0, 0); int alchemyBonus = 0; if ( direct ) @@ -256,7 +256,7 @@ namespace Server.Items foreach ( object o in eable ) { - if ( o is Mobile ) + if ( o is Mobile && (from == null || (SpellHelper.ValidIndirectTarget( from, (Mobile)o ) && from.CanBeHarmful( (Mobile)o, false )))) { toExplode.Add( o ); ++toDamage; @@ -280,22 +280,19 @@ namespace Server.Items { Mobile m = (Mobile)o; - if ( from == null || (SpellHelper.ValidIndirectTarget( from, m ) && from.CanBeHarmful( m, false )) ) - { - if ( from != null ) - from.DoHarmful( m ); + if ( from != null ) + from.DoHarmful( m ); - int damage = Utility.RandomMinMax( min, max ); + int damage = Utility.RandomMinMax( min, max ); + + damage += alchemyBonus; - damage += alchemyBonus; + if ( !Core.AOS && damage > 40 ) + damage = 40; + else if ( Core.AOS && toDamage > 2 ) + damage /= toDamage - 1; - if ( !Core.AOS && damage > 40 ) - damage = 40; - else if ( Core.AOS && toDamage > 2 ) - damage /= toDamage - 1; - - AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 ); - } + AOS.Damage( m, from, damage, 0, 100, 0, 0, 0 ); } else if ( o is BaseExplosionPotion ) {