Beispiel #1
0
        public void ComboHit( Mobile from, Mobile target, SpellDamage typedamage )
        {
            float bonus = 1f;
            switch( typedamage )
            {
                case SpellDamage.TypeS1:
                    bonus = (float)Bonus1;
                    break;
                case SpellDamage.TypeS2:
                    bonus = (float)Bonus2;
                    break;
            }
            float dmg = from.Hit( target, bonus + from.ComboPoints * comboModifier );
            if ( dmg > 0f )
            {
                from.ResetCombo( target );
                target.LooseHits( from, (int)dmg, true );

            //01 00 00 00
            //43 02 00 00 00 00 00 00
            //FF 01 00 00 00 00 00 00
            //00 00 00 00
            //01 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00
            //00
            //01 00 00 00
            //E8 03 00 00
            //00 00 00 00
            //00 00 00 00
            //00 00 00 00

                    int offset = 4;
                    Converter.ToBytes( target.Guid, from.tempBuff, ref offset );
                    Converter.ToBytes( from.Guid, from.tempBuff, ref offset );
                    Converter.ToBytes( (int)Id, from.tempBuff, ref offset );
                    Converter.ToBytes( (int)dmg, from.tempBuff, ref offset );
                    Converter.ToBytes( 0x2, from.tempBuff, ref offset );
                    Converter.ToBytes( target.Guid, from.tempBuff, ref offset );
                    Converter.ToBytes( 0, from.tempBuff, ref offset );
                    from.ToAllPlayerNear( OpCodes.SMSG_SPELLNONMELEEDAMAGELOG, from.tempBuff, offset );
            /*
                int offset = 4;
                byte []tempBuff = from.tempBuff;
                if ( (int)dmg <= 0 )
                    Converter.ToBytes( 1, tempBuff, ref offset );
                else
                    Converter.ToBytes( 4, tempBuff, ref offset );

                Converter.ToBytes( from.Guid, tempBuff, ref offset );
                Converter.ToBytes( target.Guid, tempBuff, ref offset );
                Converter.ToBytes( (int)dmg, tempBuff, ref offset );
                Converter.ToBytes( 0x1, tempBuff, ref offset );
                Converter.ToBytes( (byte)0, tempBuff, ref offset );
            //	float ang = (float)Math.Atan2( target.Y - from.Y, target.X - from.X );
                Converter.ToBytes( (float)dmg, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );
                Converter.ToBytes( 1, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );
                Converter.ToBytes( 0, tempBuff, ref offset );

                from.ToAllPlayerNear( OpCodes.SMSG_ATTACKERSTATEUPDATE, tempBuff, offset );
                */
            /*		data.Initialize(SMSG_ATTACKERSTATEUPDATE);
                data << (uint32)hit_status;   // Attack flags
                data << GetGUID();
                data << pVictim->GetGUID();
                data << (uint32)damage;
                data << (uint8)1;       // Damage type counter

                // for each...
                data << damageType;      // Damage type, // 0 - white font, 1 - yellow
                data << (uint32)0;      // damage float
                data << (uint32)damage; // Damage amount
                data << (uint32)0;      // damage absorbed

                data << (uint32)1;      // new victim state
                data << (uint32)0;      // victim round duraction
                data << (uint32)0;      // additional spell damage amount
                data << (uint32)0;      // additional spell damage id
                data << (uint32)0;      // Damage amount blocked*/
            }
        }
Beispiel #2
0
		public virtual int AttackSwing( Mobile target,bool pass )
		{
			#region immune test
			if (this.ImmuneAttack)
			{
				this.lastAttack = AttackStatus.Immune;
				return 0;
			}
			#endregion
			
			if(this.AttackTarget != null)
			{
										
				ArrayList NAEbuff = (ArrayList)NextAttackEffects.Clone();
				foreach(NextAttackEffect nae in NAEbuff)
				{
						
					this.OnSpellTemplateResults(nae.spell,this.AttackTarget);
					this.NextAttackSpellGo(nae);
						
				}
					
				NAEbuff.Clear();
			}

			int amountAbsorbed = 0;
			int amountBlocked = 0;
			int degats = Hit( target, 0f, pass, ref amountBlocked, ref amountAbsorbed );
			int offset = 4;
			if ( degats <= 0 )
				Converter.ToBytes( 0x22, tempBuff, ref offset );
			else
				Converter.ToBytes( 0x22, tempBuff, ref offset );
	
			Converter.ToBytes( 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 );

			//		Converter.ToBytes( 0/*DamageType*/, tempBuff, ref offset );
			//		float ang = (float)Math.Atan2( AttackTarget.Y - Y, AttackTarget.X - X );
			if ( degats < 0 )
				Converter.ToBytes( 0, tempBuff, ref offset );
			else
				Converter.ToBytes( degats, tempBuff, ref offset );
			//	Converter.ToBytes( amountAbsorbed, tempBuff, ref offset );// damage absorbed 
			//	Converter.ToBytes( 0, tempBuff, ref offset ); // new victim state
			Converter.ToBytes( 0, tempBuff, ref offset ); // additional spell damage id
			Converter.ToBytes( 0, tempBuff, ref offset ); // additional spell damage id
			#region Degats types
			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 || amountBlocked > 0 )
				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

			#endregion
		
			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 );					

			target.LooseHits( this, degats, true );
			return degats;
		}
Beispiel #3
0
        public int WeaponDMGPlusSchool( Mobile src, Mobile target, float dmg,bool school )
        {
            if ( target.Dead ) return 0;

            int absorb = 0;
            int resist = 0;
            int absorbHit = 0;
            int blockHit = 0;
            LastSpellState state = LastSpellState.None;
            int weapondmg = src.Hit(target,ref blockHit,ref absorbHit);
            if(weapondmg > 0)
            {
                int realDamage = this.SpellDMG(src,target,dmg,ref absorb,ref resist,ref state,true);
                    absorb +=absorbHit;
                realDamage +=weapondmg;
                if(state == LastSpellState.Critical || src.LastAttackStatus == AttackStatus.Critical)
                    state = LastSpellState.Critical;
                if(school)
                    this.SendDamageMessage(src,target,state,realDamage,resist,absorb,-1,false);
                else
                    this.SendDamageMessage(src,target,state,realDamage,resist,absorb,blockHit,false);

                if ( realDamage > target.HitPoints )
                    realDamage = target.HitPoints;

                target.LooseHits( src, (int)realDamage, false );
                if ( target.SummonedBy != src )
                    target.OnGetHit( src, false, (int)realDamage );

                src.LastSpellStatus = AttackStatus.None;

                return realDamage;
            }
            else
            {
                return 0;
            }
        }
Beispiel #4
0
        public int MakeDamage( bool forceDamage, Mobile src, Mobile target, float dmg, bool f,bool showMSG,bool crit )
        {
            if ( target.Dead ) return 0;

            if(forceDamage)
            {
                this.SendDamageMessage(src,target,LastSpellState.Normal,(int)dmg,0,0,0,false);
                target.LooseHits( src, (int)dmg, false );
                return (int)dmg;
            }
            int absorb = 0;
            int resist = 0;
            LastSpellState state = LastSpellState.None;
            int realDamage = this.SpellDMG(src,target,dmg,ref absorb,ref resist,ref state,crit);

            if(showMSG)
            {
                this.SendDamageMessage(src,target,state,realDamage,resist,absorb,-1,false);
            }
            if ( realDamage > target.HitPoints )
                realDamage = target.HitPoints;

            target.LooseHits( src, (int)realDamage, false );

            MakeDMGSpellTriggers(src,target,state,realDamage);
            src.LastSpellStatus = AttackStatus.None;
            return 0;
        }
Beispiel #5
0
 public void LifeTap( Mobile src, Mobile target, float dmg )
 {
     target.LooseHits(src,(int)dmg);
     if ( src.HaveTalent( Talents.ImprovedLifeTap ) )
     {
         AuraEffect ae = (AuraEffect)src.GetTalentEffect( Talents.ImprovedLifeTap );
         float minus = (float)dmg;
         minus += ( minus * (float)ae.S1 ) / 100f;
         target.GainMana( src, (int)minus);
     }
     src.GainMana( src, (int)dmg );
 }
        public void ComboHit(Mobile from, Mobile target, SpellDamage typedamage)
        {
            float bonus = 1f;

            switch (typedamage)
            {
            case SpellDamage.TypeS1:
                bonus = (float)Bonus1;
                break;

            case SpellDamage.TypeS2:
                bonus = (float)Bonus2;
                break;
            }
            float dmg = from.Hit(target, bonus + from.ComboPoints * comboModifier);

            if (dmg > 0f)
            {
                from.ResetCombo(target);
                target.LooseHits(from, (int)dmg, true);

//01 00 00 00
//43 02 00 00 00 00 00 00
//FF 01 00 00 00 00 00 00
//00 00 00 00
//01 00 00 00
//00 00 00 00
//00 00 00 00
//00 00 00 00
//00
//01 00 00 00
//E8 03 00 00
//00 00 00 00
//00 00 00 00
//00 00 00 00

                int offset = 4;
                Converter.ToBytes(target.Guid, from.tempBuff, ref offset);
                Converter.ToBytes(from.Guid, from.tempBuff, ref offset);
                Converter.ToBytes((int)Id, from.tempBuff, ref offset);
                Converter.ToBytes((int)dmg, from.tempBuff, ref offset);
                Converter.ToBytes(0x2, from.tempBuff, ref offset);
                Converter.ToBytes(target.Guid, from.tempBuff, ref offset);
                Converter.ToBytes(0, from.tempBuff, ref offset);
                from.ToAllPlayerNear(OpCodes.SMSG_SPELLNONMELEEDAMAGELOG, from.tempBuff, offset);

/*
 *                              int offset = 4;
 *                              byte []tempBuff = from.tempBuff;
 *                              if ( (int)dmg <= 0 )
 *                                      Converter.ToBytes( 1, tempBuff, ref offset );
 *                              else
 *                                      Converter.ToBytes( 4, tempBuff, ref offset );
 *
 *                              Converter.ToBytes( from.Guid, tempBuff, ref offset );
 *                              Converter.ToBytes( target.Guid, tempBuff, ref offset );
 *                              Converter.ToBytes( (int)dmg, tempBuff, ref offset );
 *                              Converter.ToBytes( 0x1, tempBuff, ref offset );
 *                              Converter.ToBytes( (byte)0, tempBuff, ref offset );
 *                      //	float ang = (float)Math.Atan2( target.Y - from.Y, target.X - from.X );
 *                              Converter.ToBytes( (float)dmg, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *                              Converter.ToBytes( 1, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *                              Converter.ToBytes( 0, tempBuff, ref offset );
 *
 *                              from.ToAllPlayerNear( OpCodes.SMSG_ATTACKERSTATEUPDATE, tempBuff, offset );
 */
                /*		data.Initialize(SMSG_ATTACKERSTATEUPDATE);
                 *              data << (uint32)hit_status;   // Attack flags
                 *              data << GetGUID();
                 *              data << pVictim->GetGUID();
                 *              data << (uint32)damage;
                 *              data << (uint8)1;       // Damage type counter
                 *
                 *              // for each...
                 *              data << damageType;      // Damage type, // 0 - white font, 1 - yellow
                 *              data << (uint32)0;      // damage float
                 *              data << (uint32)damage; // Damage amount
                 *              data << (uint32)0;      // damage absorbed
                 *
                 *              data << (uint32)1;      // new victim state
                 *              data << (uint32)0;      // victim round duraction
                 *              data << (uint32)0;      // additional spell damage amount
                 *              data << (uint32)0;      // additional spell damage id
                 *              data << (uint32)0;      // Damage amount blocked*/
            }
        }