Exemplo n.º 1
0
		/// <summary>
		/// Uses percent of damage to heal the caster
		/// </summary>
		public virtual void StealLife(AttackData ad)
		{
			if(ad == null) return;
			if(!m_caster.IsAlive) return;

			if (ad.Target is Keeps.GameKeepDoor || ad.Target is Keeps.GameKeepComponent)
			{
				return;
			}

			int heal = (ad.Damage + ad.CriticalDamage) * m_spell.LifeDrainReturn/100;
			if (m_caster.IsDiseased)
			{
				MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
				heal >>= 1;
			}
			if(heal <= 0) return;
			heal = m_caster.ChangeHealth(m_caster, GameLiving.eHealthChangeType.Spell, heal);

			if(heal > 0) 
			{
				MessageToCaster("You steal " + heal + " hit point" + (heal==1?".":"s."), eChatType.CT_Spell);
			}
			else 
			{
				MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
			}
		}
Exemplo n.º 2
0
  	protected override void OnAttackedByEnemy(AttackData ad)
	{
	  if (AggressionState != eAggressionState.Passive)
	  {
		AddToAggroList(ad.Attacker, (ad.Attacker.Level + 1) << 1);
	  }
	}
Exemplo n.º 3
0
 public virtual void DamageTarget(AttackData ad)
 {
     ad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
     ad.Target.OnAttackedByEnemy(ad);
     ad.Attacker.DealDamage(ad);
     foreach(GamePlayer player in ad.Attacker.GetPlayersInRadius(WorldMgr.VISIBILITY_DISTANCE)) {
         player.Out.SendCombatAnimation(null, ad.Target, 0, 0, 0, 0, 0x0A, ad.Target.HealthPercent);
     }
 }
Exemplo n.º 4
0
        protected override void OnAttackedByEnemy(DOL.GS.AttackData ad)
        {
            base.OnAttackedByEnemy(ad);

            if (ad.Attacker == Body.TargetObject)
            {
                m_targetLastAD = ad;

                m_style = StyleChooser.GetBestStyle(Body, m_lastAD, m_targetLastAD);
                Body.NextCombatStyle = m_style;
            }
        }
Exemplo n.º 5
0
        public override void OnAttackedByEnemy(AttackData ad)
        {
            if (StartCheck)
            {
                StartTime = DateTime.Now;
                StartCheck = false;
            }

            Damage += ad.Damage;
            TimePassed = (DateTime.Now - StartTime);
            Name = "Total: " + Damage.ToString() +" DPS: " + (Damage / (TimePassed.TotalSeconds + 1)).ToString("0");
        }
Exemplo n.º 6
0
 protected override void OnDamageAbsorbed(AttackData ad, int DamageAmount)
 {
     AttackData newad = new AttackData();
     newad.Attacker = ad.Target;
     newad.Target = ad.Attacker;
     newad.Damage = DamageAmount;
     newad.DamageType = Spell.DamageType;
     newad.AttackType = AttackData.eAttackType.Spell;
     newad.AttackResult = GameLiving.eAttackResult.HitUnstyled;
     newad.SpellHandler = this;
     newad.Target.OnAttackedByEnemy(newad);
     newad.Attacker.DealDamage(newad);
 }
Exemplo n.º 7
0
		/// <summary>
		/// Training Dummies never attack
		/// </summary>
		/// <param name="ad"></param>
		public override void OnAttackedByEnemy(AttackData ad)
		{
			if (ad.IsHit && ad.CausesCombat)
			{
				if (ad.Attacker.Realm == 0 || this.Realm == 0)
				{
					LastAttackedByEnemyTickPvE = CurrentRegion.Time;
					ad.Attacker.LastAttackTickPvE = CurrentRegion.Time;
				}
				else
				{
					LastAttackedByEnemyTickPvP = CurrentRegion.Time;
					ad.Attacker.LastAttackTickPvP = CurrentRegion.Time;
				}
			}
		}
Exemplo n.º 8
0
        /// <summary>
        /// Uses percent of damage to heal the caster
        /// </summary>
        public override void StealLife(AttackData ad)
        {
            if (ad == null) return;
            if (!Caster.IsAlive) return;

            int heal = (ad.Damage + ad.CriticalDamage) * 35 / 100;
            int mana = (ad.Damage + ad.CriticalDamage) * 21 / 100;
            int endu = (ad.Damage + ad.CriticalDamage) * 14 / 100;

            if (Caster.IsDiseased)
            {
                MessageToCaster("You are diseased!", eChatType.CT_SpellResisted);
                heal >>= 1;
            }
            if (heal <= 0) return;
            heal = Caster.ChangeHealth(Caster, GameLiving.eHealthChangeType.Spell, heal);
            if (heal > 0)
            {
                MessageToCaster("You drain " + heal + " hit point" + (heal == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more life.", eChatType.CT_SpellResisted);
            }

            if (mana <=0) return;
            mana = Caster.ChangeMana(Caster,GameLiving.eManaChangeType.Spell,mana);
            if (mana > 0)
            {
                MessageToCaster("You drain " + mana + " power point" + (mana == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more power.", eChatType.CT_SpellResisted);
            }

            if (endu <=0) return;
            endu = Caster.ChangeEndurance(Caster,GameLiving.eEnduranceChangeType.Spell,endu);
            if (heal > 0)
            {
                MessageToCaster("You drain " + endu + " endurance point" + (endu == 1 ? "." : "s."), eChatType.CT_Spell);
            }
            else
            {
                MessageToCaster("You cannot absorb any more endurance.", eChatType.CT_SpellResisted);
            }
        }
Exemplo n.º 9
0
		public CastingEventArgs(ISpellHandler handler, GameLiving target, AttackData ad)
		{
			this.m_handler = handler;
			this.m_target = target;
			m_lastAttackData = ad;
		}
Exemplo n.º 10
0
        /// <summary>
        /// Sends damage text messages but makes no damage
        /// </summary>
        /// <param name="ad"></param>
        public override void SendDamageMessages(AttackData ad)
        {
            // Graveen: only GamePlayer should receive messages :p
            GamePlayer PlayerReceivingMessages = null;
            if (m_caster is GamePlayer)
                PlayerReceivingMessages = m_caster as GamePlayer;
            if ( m_caster is GamePet)
                if ((m_caster as GamePet).Brain is IControlledBrain)
                    PlayerReceivingMessages = ((m_caster as GamePet).Brain as IControlledBrain).GetPlayerOwner();
            if (PlayerReceivingMessages == null)
                return;

            if (Spell.Name.StartsWith("Proc"))
            {
                MessageToCaster(String.Format(LanguageMgr.GetTranslation(PlayerReceivingMessages.Client, "DoTSpellHandler.SendDamageMessages.YouHitFor",
                    ad.Target.GetName(0, false), ad.Damage)), eChatType.CT_YouHit);
            }
            else
            {
                MessageToCaster(String.Format(LanguageMgr.GetTranslation(PlayerReceivingMessages.Client, "DoTSpellHandler.SendDamageMessages.YourHitsFor",
                    Spell.Name, ad.Target.GetName(0, false), ad.Damage)), eChatType.CT_YouHit);
            }
            if (ad.CriticalDamage > 0)
                MessageToCaster(String.Format(LanguageMgr.GetTranslation(PlayerReceivingMessages.Client, "DoTSpellHandler.SendDamageMessages.YourCriticallyHits",
                    Spell.Name, ad.Target.GetName(0, false), ad.CriticalDamage)), eChatType.CT_YouHit);

                //			if (ad.Damage > 0)
                //			{
                //				string modmessage = "";
                //				if (ad.Modifier > 0) modmessage = " (+"+ad.Modifier+")";
                //				if (ad.Modifier < 0) modmessage = " ("+ad.Modifier+")";
                //				MessageToCaster("You hit "+ad.Target.GetName(0, false)+" for " + ad.Damage + " damage!", eChatType.CT_Spell);
                //			}
                //			else
                //			{
                //				MessageToCaster("You hit "+ad.Target.GetName(0, false)+" for " + ad.Damage + " damage!", eChatType.CT_Spell);
                //				MessageToCaster(ad.Target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);
                //				MessageToLiving(ad.Target, "You resist the effect!", eChatType.CT_SpellResisted);
                //			}
        }
Exemplo n.º 11
0
		/// <summary>
		/// This living takes damage
		/// </summary>
		/// <param name="ad">AttackData containing damage details</param>
		public virtual void TakeDamage(AttackData ad)
		{
			TakeDamage(ad.Attacker, ad.DamageType, ad.Damage, ad.CriticalDamage);
		}
Exemplo n.º 12
0
 public override void OnAttackedByEnemy(AttackData ad) { }
Exemplo n.º 13
0
        /// <summary>
        /// The NPC has been taunted (spell).
        /// </summary>
        /// <param name="attackData"></param>
        protected virtual void OnTaunted(AttackData attackData)
        {
            GameLiving attacker = attackData.Attacker;

            if (attackData.Target == Body)
            {
                Aggression.Raise(attackData.Attacker, attackData.IsSpellResisted
                    ? 0 : TauntAggressionAmount);
            }
            else
            {
                OnLivingAttacked(attackData.Target, attacker);
            }
        }
Exemplo n.º 14
0
		/// <summary>
		/// Constructs a new AttackFinished
		/// </summary>
		/// <param name="attackData">The attack data</param>
		public AttackFinishedEventArgs(AttackData attackData)
		{
			this.m_attackData=attackData;
		}
Exemplo n.º 15
0
		/// <summary>
		/// [Ganrod] Nidel: Don't interrupt turret cast.
		/// </summary>
		/// <param name="duration"></param>
		/// <param name="attackType"></param>
		/// <param name="attacker"></param>
		public override void StartInterruptTimer(AttackData attack, int duration)
		{
			return;
		}
Exemplo n.º 16
0
		protected override void OnAttackedByEnemy(AttackData ad)
		{
			AddToAggroList(ad.Attacker, (ad.Attacker.Level + 1) << 1);
		}
Exemplo n.º 17
0
 protected virtual void OnDamageAbsorbed(AttackData ad, int DamageAmount)
 {
 }
Exemplo n.º 18
0
 public override void OnAttackedByEnemy(AttackData ad)
 {
 }
Exemplo n.º 19
0
		/// <summary>
		/// Constructs a new AttackedByEnemy
		/// </summary>
		public AttackedByEnemyEventArgs(AttackData attackData)
		{
			this.m_attackData=attackData;
		}
Exemplo n.º 20
0
		protected override void BringFriends(AttackData ad)
		{
			// don't
		}
Exemplo n.º 21
0
        /// <summary>
        /// Body or another living has been attacked.
        /// </summary>
        /// <param name="living"></param>
        /// <param name="attackData"></param>
        protected virtual void OnAttacked(AttackData attackData)
        {
            if (attackData == null)
                return;

            if (attackData.Target == Body)
            {
                if (Body.IsReturningToSpawnPoint)
                    Body.CancelWalkToSpawn();

                if (!attackData.IsMeleeAttack)
                {
                    ISpellHandler spellhandler = attackData.SpellHandler;

                    if (spellhandler != null && spellhandler is TauntSpellHandler)
                    {
                        OnTaunted(attackData);
                        return;
                    }
                }

                Aggression.Raise(attackData.Attacker, attackData.Damage);

                // TODO: Process attack data and change the amount of aggro
                //       accordingly.
            }
            else
            {
                OnLivingAttacked(attackData.Target, attackData.Attacker);
            }
        }
Exemplo n.º 22
0
		/// <summary>
		/// Attacked by enemy event
		/// </summary>
		/// <param name="ad"></param>
		protected virtual void OnAttackedByEnemy(AttackData ad)
		{
			if (!Body.AttackState
			    && Body.IsAlive
			    && Body.ObjectState == GameObject.eObjectState.Active)
			{
				if (ad.AttackResult == GameLiving.eAttackResult.Missed)
				{
					AddToAggroList(ad.Attacker, 1);
				}

				Body.StartAttack(ad.Attacker);
				BringFriends(ad);
			}
		}
Exemplo n.º 23
0
		/// <summary>
		/// If npcs cant move, they cant be interupted from range attack
		/// </summary>
		/// <param name="attacker"></param>
		/// <param name="attackType"></param>
		/// <returns></returns>
		protected override bool OnInterruptTick(GameLiving attacker, AttackData.eAttackType attackType)
		{
			if (this.MaxSpeedBase == 0)
			{
				if (attackType == AttackData.eAttackType.Ranged || attackType == AttackData.eAttackType.Spell)
				{
					if( this.IsWithinRadius( attacker, 150 ) == false )
						return false;
				}
			}

			// Experimental - this prevents interrupts from causing ranged attacks to always switch to melee
			if (AttackState)
			{
				if (ActiveWeaponSlot == eActiveWeaponSlot.Distance && HealthPercent < MINHEALTHPERCENTFORRANGEDATTACK)
				{
					SwitchToMelee(attacker);
				}
				else if (ActiveWeaponSlot != eActiveWeaponSlot.Distance &&
				         Inventory != null &&
				         Inventory.GetItem(eInventorySlot.DistanceWeapon) != null &&
				         GetDistanceTo(attacker) > 500)
				{
					SwitchToRanged(attacker);
				}
			}

			return base.OnInterruptTick(attacker, attackType);
		}
Exemplo n.º 24
0
		public override void ModifyAttack(AttackData attackData)
		{
			base.ModifyAttack(attackData);

			if ((Owner as GamePlayer).Client.Account.PrivLevel > (int)ePrivLevel.Player)
			{
				attackData.Damage = 0;
				attackData.CriticalDamage = 0;
			}
		}
Exemplo n.º 25
0
        protected virtual void OnSpellResist(GameLiving target)
        {
            m_lastdamage -= m_lastdamage / 4;
            SendEffectAnimation(target, 0, false, 0);
            if (target is GameNPC)
            {
                IControlledBrain brain = ((GameNPC)target).Brain as IControlledBrain;
                if (brain != null)
                {
                    GamePlayer owner = brain.GetPlayerOwner();
                    //Worthless checks
                    if (owner != null/* && owner.ControlledNpc != null && target == owner.ControlledNpc.Body*/)
                    {
                        MessageToLiving(owner, "Your " + target.Name + " resists the effect!", eChatType.CT_SpellResisted);
                    }
                }
            }
            else
            {
                MessageToLiving(target, "You resist the effect!", eChatType.CT_SpellResisted);
            }
            MessageToCaster(target.GetName(0, true) + " resists the effect!", eChatType.CT_SpellResisted);

            if (Spell.Damage != 0)
            {
                // notify target about missed attack for spells with damage
                AttackData ad = new AttackData();
                ad.Attacker = Caster;
                ad.Target = target;
                ad.AttackType = AttackData.eAttackType.Spell;
                ad.AttackResult = GameLiving.eAttackResult.Missed;
                ad.SpellHandler = this;
                target.OnAttackedByEnemy(ad);
                target.StartInterruptTimer(target.SpellInterruptDuration, ad.AttackType, Caster);
            }
            else if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC)
            {
                IOldAggressiveBrain aggroBrain = ((GameNPC)target).Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
            if (target.Realm == 0 || Caster.Realm == 0)
            {
                target.LastAttackedByEnemyTickPvE = target.CurrentRegion.Time;
                Caster.LastAttackTickPvE = Caster.CurrentRegion.Time;
            }
            else
            {
                target.LastAttackedByEnemyTickPvP = target.CurrentRegion.Time;
                Caster.LastAttackTickPvP = Caster.CurrentRegion.Time;
            }
        }
Exemplo n.º 26
0
 /// <summary>
 /// [Ganrod] Nidel: Don't interrupt turret cast.
 /// </summary>
 /// <param name="duration"></param>
 /// <param name="attackType"></param>
 /// <param name="attacker"></param>
 public override void StartInterruptTimer(AttackData attack, int duration)
 {
     return;
 }
Exemplo n.º 27
0
		/// <summary>
		/// Bring friends when this living is attacked. There are 2
		/// different mechanisms for BAF:
		/// 1) Any mobs of the same faction within a certain (short) range
		///    around the pulled mob will add on the puller, anywhere.
		/// 2) In dungeons, group size is taken into account as well, the
		///    bigger the group, the more adds will come, even if they are
		///    not close to the pulled mob.
		/// </summary>
		/// <param name="attackData">The data associated with the puller's attack.</param>
		protected virtual void BringFriends(AttackData attackData)
		{
			// Only add on players.

			GameLiving attacker = attackData.Attacker;
			if (attacker is GamePlayer)
			{
				BringCloseFriends(attackData);
				if (attacker.CurrentRegion.IsDungeon)
					BringReinforcements(attackData);
			}
		}
Exemplo n.º 28
0
 public override void OnAttackedByEnemy(AttackData ad) /* do nothing */ }
Exemplo n.º 29
0
        public override void OnAttackedByEnemy(AttackData ad)
        {
            if (EvadeChance == 100)
                return;

            base.OnAttackedByEnemy(ad);
        }
Exemplo n.º 30
0
		/// <summary>
		/// Get mobs close to the pulled mob to add on the puller and his
		/// group as well.
		/// </summary>
		/// <param name="attackData">The data associated with the puller's attack.</param>
		protected virtual void BringCloseFriends(AttackData attackData)
		{
			// Have every friend within close range add on the attacker's
			// group.

			GamePlayer attacker = (GamePlayer)attackData.Attacker;

			foreach (GameNPC npc in Body.GetNPCsInRadius(BAFCloseRange))
			{
				if (npc.IsFriend(Body) && npc.IsAvailable && npc.IsAggressive)
				{
					StandardMobBrain brain = (StandardMobBrain)npc.Brain;
					brain.AddToAggroList(PickTarget(attacker), 1);
					brain.AttackMostWanted();
				}
			}
		}
Exemplo n.º 31
0
		public override void OnAttackedByEnemy(AttackData ad) { /* do nothing */ }
Exemplo n.º 32
0
		/// <summary>
		/// Get mobs to add on the puller's group, their numbers depend on the
		/// group's size.
		/// </summary>
		/// <param name="attackData">The data associated with the puller's attack.</param>
		protected virtual void BringReinforcements(AttackData attackData)
		{
			// Determine how many friends to bring, as a rule of thumb, allow for
			// max 2 players dealing with 1 mob. Only players from the group the
			// original attacker is in will be taken into consideration.
			// Example: A group of 3 or 4 players will get 1 add, a group of 7 or 8
			// players will get 3 adds.

			GamePlayer attacker = (GamePlayer)attackData.Attacker;
			Group attackerGroup = attacker.Group;
			int numAttackers = (attackerGroup == null) ? 1 : attackerGroup.MemberCount;
			int maxAdds = (numAttackers + 1) / 2 - 1;
			if (maxAdds > 0)
			{
				// Bring friends, try mobs in the neighbourhood first. If there
				// aren't any, try getting some from farther away.

				int numAdds = 0;
				ushort range = 250;

				while (numAdds < maxAdds && range <= BAFReinforcementsRange)
				{
					foreach (GameNPC npc in Body.GetNPCsInRadius(range))
					{
						if (numAdds >= maxAdds) break;

						// If it's a friend, have it attack a random target in the
						// attacker's group.

						if (npc.IsFriend(Body) && npc.IsAggressive && npc.IsAvailable)
						{
							StandardMobBrain brain = (StandardMobBrain)npc.Brain;
							brain.AddToAggroList(PickTarget(attacker), 1);
							brain.AttackMostWanted();
							++numAdds;
						}
					}

					// Increase the range for finding friends to join the fight.

					range *= 2;
				}
			}
		}