Beispiel #1
0
		public HotAura( SpellTemplate st, Mobile c, Mobile t, int d, int dur, int freq )
		{
			if ( t.Dead )
				return;
			spell = st;
			from = c;
			target = t;
			heal = d;
			duration = dur;
			frequency = freq;
			PeriodicAura( new AuraPeriodicEffect( this.PeriodicDamage ), dur, freq );
		}
Beispiel #2
0
 public DrainHealthAura( SpellTemplate st, Mobile c, Mobile t, int d, int dur, int freq )
 {
     if ( t.Dead )
         return;
     spell = st;
     from = c;
     target = t;
     dmg = (float)d;
     duration = dur;
     frequency = freq;
     PeriodicAura( new AuraPeriodicEffect( this.PeriodicDrainHealth ), dur, freq );
 }
Beispiel #3
0
			public AutoShotEffect(Mobile _target,Mobile _caster,int tick,SpellTemplate _st,Item _ammo):base(WowTimer.Priorities.Milisec100,tick)
			{
				target = _target;
				caster = _caster;
				st = _st;
				ammo = _ammo;
				move = false;
			}
Beispiel #4
0
		public void AttackerStateUpdateForSpell(Mobile src, Mobile target,SpellTemplate st, int degats)
		{
			int offset = 4;
			if ( degats <= 0 )
				Converter.ToBytes( 0x22, tempBuff, ref offset );
			else
				Converter.ToBytes( 0x22, tempBuff, ref offset );
	
			Converter.ToBytes( src.Guid, tempBuff, ref offset );
			Converter.ToBytes( target.Guid, tempBuff, ref offset );
			if ( degats < 0 )
				Converter.ToBytes( 0, tempBuff, ref offset );
			else
				Converter.ToBytes( degats, tempBuff, ref offset );
			Converter.ToBytes( (byte)1, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			if ( degats > 0 )
				Converter.ToBytes( (float)degats/*DamageType*/, tempBuff, ref offset );
			else
				Converter.ToBytes( 0, tempBuff, ref offset );
			if ( degats < 0 )
				Converter.ToBytes( 0, tempBuff, ref offset );
			else
				Converter.ToBytes( degats, tempBuff, ref offset );
			
			Converter.ToBytes( st.Id, tempBuff, ref offset ); // additional spell damage id
			Converter.ToBytes( st.Id, tempBuff, ref offset ); // additional spell damage id
			if ( degats >= 0 )
				Converter.ToBytes( 1, tempBuff, ref offset );
			else
				if ( degats == -1 )
				Converter.ToBytes( 2, tempBuff, ref offset );// dodge
			else
				if ( degats == - 2 )
				Converter.ToBytes( 9, tempBuff, ref offset );// parry
			else
				if ( degats == - 3 )
				Converter.ToBytes( 4, tempBuff, ref offset );// interrupted
			else
				if ( degats == - 4  )
				Converter.ToBytes( 5, tempBuff, ref offset );// block
			else
				if ( degats == - 5 )
				Converter.ToBytes( 6, tempBuff, ref offset );// evade
			else
				if ( degats == - 6 )
				Converter.ToBytes( 7, tempBuff, ref offset );// immune
			else
				if ( degats == - 7 )
				Converter.ToBytes( 8, tempBuff, ref offset );// deflect

			
			if ( degats == 0 )
				Converter.ToBytes( 0xffffffff, tempBuff, ref offset );
			else
				Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			Converter.ToBytes( 0, tempBuff, ref offset );
			ToAllPlayerNear( OpCodes.SMSG_ATTACKERSTATEUPDATE, tempBuff, offset );					

		}
Beispiel #5
0
		public void AISpellAttack( int forceCastSpell )
		{
			if ( this.knownAbilities.Count > 0 )//	spell caster
			{				
				SpellsTypes choosed = SpellsTypes.None;
				int spellChoosed = 0;

				#region Choice
				IDictionaryEnumerator Enumerator = knownAbilities.GetEnumerator();
				while (Enumerator.MoveNext())
				{
					cast.baseability = null;
					cast.castingtime = 0;
					cast.cool = 0;
					cast.id = 0;
					cast.manacost = 0;
					cast.type = 0;
					cast.duration =0;
					cast.radius = 0;

					int spell = (int)Enumerator.Key;
					SpellsTypes type = (SpellsTypes)Enumerator.Value;
					#region cast creation
				{
					BaseAbility ba;
					
					ba = (BaseAbility)Abilities.abilities[spell];
					
					if (ba is SpellTemplate)
					{
						SpellTemplate st;
						
						st = (SpellTemplate)ba;
						
						this.cast.castingtime = st.CastingTime(this);
						this.cast.cool = st.CoolDown(this);
						this.cast.id = st.Id;
						this.cast.manacost = st.GetManaCost(this);
						this.cast.type = (ushort)type;
						this.cast.baseability = st;
						int radius = st.Radius1;
						if(st.Radius2 > radius) radius = st.Radius2;
						if(st.Radius3 > radius) radius = st.Radius3;
						if(ba is AuraEffect)
							this.cast.duration = (ba as AuraEffect).Duration(this);
						else cast.duration = 0;
						this.cast.radius = (short)radius;
						
						
					}
					else
					{
						
						this.cast.castingtime = ba.CastingTime(this);
						this.cast.cool = ba.CoolDown(this);
						this.cast.id = ba.Id;
						this.cast.manacost = 0;
						this.cast.type = (ushort)type;
						this.cast.baseability = ba;
						
						this.cast.duration = 0;
						this.cast.radius = 0;
						
					}
				}
					#endregion

					if ( type == SpellsTypes.Healing && this.HitPoints < this.BaseHitPoints / 2 )
					{
						if ( cast.baseability is SpellTemplate )
						{
							SpellTemplate st = (SpellTemplate)cast.baseability;
							if ( cast.manacost <= Mana )
							{
								if ( forceCastSpell > 0 && spell == forceCastSpell )
								{
									choosed = type;
									spellChoosed = spell;
									forceCastSpell = 0;
									break;
								}
							}
						}
					}
					else
						if ( type == SpellsTypes.Curse )
					{
					}
					else
						if ( type == SpellsTypes.Defensive )
					{
						BaseAbility ba = Abilities.abilities[ spell ];
						if ( ba is AuraEffect )
						{
							AuraEffect ae = (AuraEffect)ba;
							bool alreadyCasted = false;
							foreach( AuraReleaseTimer art in aura )
								if ( art.ae == ae )
								{
									alreadyCasted = true;
									break;
								}
							if ( !alreadyCasted && cast.manacost <= Mana )
							{								
								if ( forceCastSpell > 0 && spell == forceCastSpell )
								{
									choosed = type;
									spellChoosed = spell;
									forceCastSpell = 0;
									break;
								}
							}
						}
					}
					else
						if ( type == SpellsTypes.Offensive && AttackTarget != null && !AttackTarget.Dead )
					{
						BaseAbility ba = Abilities.abilities[ spell ];
						if ( ba is SpellTemplate )
						{
							SpellTemplate st = (SpellTemplate)ba;
							if ( cast.manacost <= Mana )
							{
								if ( spellChoosed == 0 )
								{
									if ( forceCastSpell > 0 && spell == forceCastSpell )
									{
										choosed = type;
										spellChoosed = spell;
										forceCastSpell = 0;
										break;
									}
								}
							}
						}
					}
				}
				#endregion

				#region Apply decision
				if ( spellChoosed != 0 )
				{
					SpellTemplate st = (SpellTemplate)Abilities.abilities[ spellChoosed ];
					switch( choosed )
					{
						case SpellsTypes.Healing:
							beingCasting = st;
							if ( SpellTemplate.SpellEffects[ cast.id ] is SingleTargetSpellEffect )
								SingleTargetCastSpell( this, cast.id, 0x8000 );
							else
								if ( SpellTemplate.SpellEffects[ cast.id ] is OnSelfSpellEffect )
							{									
								CastOnSelf( false, cast.id, 0 );
							}
							break;
						case SpellsTypes.Defensive:
							beingCasting = st;
							if ( SpellTemplate.SpellEffects[ cast.id ] is SingleTargetSpellEffect )
								SingleTargetCastSpell( this, cast.id, 0x8000 );
							else
								if ( SpellTemplate.SpellEffects[ cast.id] is OnSelfSpellEffect )
							{									
								CastOnSelf( false, cast.id, 0 );
							}
							break;
						case SpellsTypes.Offensive:
							if ( AttackTarget == null )
								break;
							MoveTo( (float)( X + ( AttackTarget.X - X ) * 0.02f ), (float)( Y + ( AttackTarget.Y - Y ) * 0.02f ), (float)( AttackTarget.Z ) );
							beingCasting = st;
							if ( SpellTemplate.SpellEffects[ cast.id ] is SingleTargetSpellEffect )
								SingleTargetCastSpell( AttackTarget, cast.id, 2 );//0x8000 );
							else
								if ( SpellTemplate.SpellEffects[ cast.id ] is OnSelfSpellEffect )
							{									
								CastOnSelf( false, cast.id, 0 );
							}
							else
								FakeCast( cast.id, AttackTarget, new WhenDone( this.SpellTakeEffect ) );
							break;
					}
				}
				#endregion
			}
		}
Beispiel #6
0
        public bool ImmuneCheck(Mobile target, SpellTemplate a)
        {
            // test for immunity for non auras spells
            if (target.ImmuneAllSpellsAndAbilites)
                return true;
            if (this.resistance == Resistances.Fire)
                if (target.ImmuneFireSpell) return true;
            if (this.resistance == Resistances.Frost)
                if (target.ImmuneFrostSpell) return true;
            if (this.resistance == Resistances.Armor)
                if (target.ImmunePhysicalDamage) return true;

            switch ( this.dispeltype)
            {
                case DispelType.Magic : if (target.ImmuneMagic)	return true;break;
                case DispelType.Disease: if (target.ImmuneDisease) return true;break;
                case DispelType.Poison: if (target.ImmunePoison) return true;break;
            }

            return false;
        }