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.

This commit is contained in:
xavier 2010-12-10 16:58:01 +00:00
parent 478439ef52
commit 36c6ecee6c
2 changed files with 42 additions and 19 deletions

View file

@ -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
{

View file

@ -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 )
{