fix bandage range, change some ondeath/onbeforedeath region calls, fix spell delayed damage
This commit is contained in:
parent
85fbf8ab81
commit
603f1bf8fe
6 changed files with 75 additions and 38 deletions
|
|
@ -1,17 +1,18 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
using Server.Gumps;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class Bandage : Item, IDyable
|
||||
{
|
||||
public static int Range = ( Core.AOS ? 2 : 1 );
|
||||
|
||||
public override double DefaultWeight
|
||||
{
|
||||
get { return 0.1; }
|
||||
|
|
@ -59,7 +60,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from.InRange( GetWorldLocation(), Core.AOS ? 2 : 1 ) )
|
||||
if ( from.InRange( GetWorldLocation(), Range ) )
|
||||
{
|
||||
from.RevealingAction();
|
||||
|
||||
|
|
@ -72,11 +73,12 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 500295 ); // You are too far away to do that.
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private Bandage m_Bandage;
|
||||
|
||||
public InternalTarget( Bandage bandage ) : base( 1, false, TargetFlags.Beneficial )
|
||||
public InternalTarget( Bandage bandage ) : base( Bandage.Range, false, TargetFlags.Beneficial )
|
||||
{
|
||||
m_Bandage = bandage;
|
||||
}
|
||||
|
|
@ -88,9 +90,9 @@ namespace Server.Items
|
|||
|
||||
if ( targeted is Mobile )
|
||||
{
|
||||
if ( from.InRange( m_Bandage.GetWorldLocation(), Core.AOS ? 2 : 1 ) )
|
||||
if ( from.InRange( m_Bandage.GetWorldLocation(), Bandage.Range ) )
|
||||
{
|
||||
if ( BandageContext.BeginHeal( from, (Mobile) targeted ) != null )
|
||||
if ( BandageContext.BeginHeal( from, (Mobile)targeted ) != null )
|
||||
{
|
||||
m_Bandage.Consume();
|
||||
}
|
||||
|
|
@ -145,11 +147,13 @@ namespace Server.Items
|
|||
m_Timer = null;
|
||||
}
|
||||
|
||||
private static Hashtable m_Table = new Hashtable();
|
||||
private static Dictionary<Mobile, BandageContext> m_Table = new Dictionary<Mobile, BandageContext>();
|
||||
|
||||
public static BandageContext GetContext( Mobile healer )
|
||||
{
|
||||
return (BandageContext)m_Table[healer];
|
||||
BandageContext bc = null;
|
||||
m_Table.TryGetValue( healer, out bc );
|
||||
return bc;
|
||||
}
|
||||
|
||||
public static SkillName GetPrimarySkill( Mobile m )
|
||||
|
|
@ -187,7 +191,7 @@ namespace Server.Items
|
|||
patientNumber = -1;
|
||||
playSound = false;
|
||||
}
|
||||
else if ( !m_Healer.InRange( m_Patient, Core.AOS ? 2 : 1 ) )
|
||||
else if ( !m_Healer.InRange( m_Patient, Bandage.Range ) )
|
||||
{
|
||||
healerNumber = 500963; // You did not stay close enough to heal your target.
|
||||
patientNumber = -1;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace Server.Mobiles
|
|||
if ( box == null )
|
||||
return false;
|
||||
|
||||
ArrayList items = new ArrayList();
|
||||
List<Item> items = new List<Item>();
|
||||
|
||||
while ( amount > 0 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,38 +46,64 @@ namespace Server.Spells
|
|||
//the possibility of stacking 'em. Note that a MA & an Explosion will stack, but
|
||||
//of course, two MA's won't.
|
||||
|
||||
private static Dictionary<Type, Dictionary<Mobile, Timer>> m_ContextTable = new Dictionary<Type, Dictionary<Mobile, Timer>>();
|
||||
private static Dictionary<Mobile, List<DelayedDamageContext>> m_ContextTable = new Dictionary<Mobile, List<DelayedDamageContext>>();
|
||||
|
||||
public void StartDelayedDamageContext( Mobile m, Timer t )
|
||||
private class DelayedDamageContext {
|
||||
public Mobile Target;
|
||||
public Type Type;
|
||||
public Timer Timer;
|
||||
|
||||
public DelayedDamageContext( Mobile target, Type type, Timer timer ) {
|
||||
Target = target;
|
||||
Type = type;
|
||||
Timer = timer;
|
||||
}
|
||||
}
|
||||
|
||||
public void StartDelayedDamageContext( Mobile target, Timer timer )
|
||||
{
|
||||
if( DelayedDamageStacking )
|
||||
return; //Sanity
|
||||
|
||||
Dictionary<Mobile, Timer> contexts;
|
||||
List<DelayedDamageContext> contexts;
|
||||
Type type = this.GetType();
|
||||
|
||||
if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
|
||||
{
|
||||
contexts = new Dictionary<Mobile, Timer>();
|
||||
m_ContextTable.Add( GetType(), contexts );
|
||||
if( !m_ContextTable.TryGetValue( m_Caster, out contexts ) )
|
||||
contexts = new List<DelayedDamageContext>();
|
||||
else {
|
||||
for ( int i = 0; i < contexts.Count; i++ ) {
|
||||
DelayedDamageContext ddc = contexts[i];
|
||||
|
||||
if ( ddc.Target == target && ddc.Type == type ) {
|
||||
ddc.Timer.Stop();
|
||||
contexts.RemoveAt( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( contexts.ContainsKey( m ) )
|
||||
{
|
||||
contexts[m].Stop();
|
||||
contexts.Remove( m );
|
||||
}
|
||||
contexts.Add( new DelayedDamageContext( target, type, timer );
|
||||
}
|
||||
|
||||
contexts.Add( m, t );
|
||||
}
|
||||
|
||||
public void RemoveDelayedDamageContext( Mobile m )
|
||||
public void RemoveDelayedDamageContext( Mobile target )
|
||||
{
|
||||
Dictionary<Mobile, Timer> contexts;
|
||||
List<DelayedDamageContext> contexts;
|
||||
Type type = this.GetType();
|
||||
|
||||
if( !m_ContextTable.TryGetValue( GetType(), out contexts ) )
|
||||
if( !m_ContextTable.TryGetValue( m_Caster, out contexts ) )
|
||||
return;
|
||||
|
||||
contexts.Remove( m );
|
||||
for ( int i = 0; i < contexts.Count; i++ ) {
|
||||
DelayedDamageContext ddc = contexts[i];
|
||||
|
||||
if ( ddc.Target == target && ddc.Type == type ) {
|
||||
contexts.RemoveAt( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( contexts.Count == 0 )
|
||||
m_ContextTable.Remove( m_Caster );
|
||||
}
|
||||
|
||||
public Spell( Mobile caster, Item scroll, SpellInfo info )
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ namespace Server.Spells
|
|||
m_Spell = s;
|
||||
|
||||
if ( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking )
|
||||
m_Spell.StartDelayedDamageContext( from, this );
|
||||
m_Spell.StartDelayedDamageContext( target, this );
|
||||
|
||||
Priority = TimerPriority.TwentyFiveMS;
|
||||
}
|
||||
|
|
@ -891,7 +891,7 @@ namespace Server.Spells
|
|||
|
||||
m_Target.Damage( m_Damage );
|
||||
if ( m_Spell != null )
|
||||
m_Spell.RemoveDelayedDamageContext( m_From );
|
||||
m_Spell.RemoveDelayedDamageContext( m_Target );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -917,7 +917,7 @@ namespace Server.Spells
|
|||
m_DFA = dfa;
|
||||
m_Spell = s;
|
||||
if ( m_Spell != null && m_Spell.DelayedDamage && !m_Spell.DelayedDamageStacking )
|
||||
m_Spell.StartDelayedDamageContext( from, this );
|
||||
m_Spell.StartDelayedDamageContext( target, this );
|
||||
|
||||
Priority = TimerPriority.TwentyFiveMS;
|
||||
}
|
||||
|
|
@ -938,7 +938,7 @@ namespace Server.Spells
|
|||
( (BaseCreature) m_Target ).OnDamagedBySpell( m_From );
|
||||
|
||||
if ( m_Spell != null )
|
||||
m_Spell.RemoveDelayedDamageContext( m_From );
|
||||
m_Spell.RemoveDelayedDamageContext( m_Target );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue