示例#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);
			}
		}
示例#2
0
  	protected override void OnAttackedByEnemy(AttackData ad)
	{
	  if (AggressionState != eAggressionState.Passive)
	  {
		AddToAggroList(ad.Attacker, (ad.Attacker.Level + 1) << 1);
	  }
	}
示例#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);
     }
 }
示例#4
0
文件: DPSDummy.cs 项目: mynew4/DAoC
        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");
        }
示例#5
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);
 }
示例#6
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;
				}
			}
		}
示例#7
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);
            }
        }
 public override void OnAttackedByEnemy(AttackData ad) { }
        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;
            }
        }
示例#10
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);
            }
        }
示例#11
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);
		}
示例#12
0
		/// <summary>
		/// Constructs a new AttackFinished
		/// </summary>
		/// <param name="attackData">The attack data</param>
		public AttackFinishedEventArgs(AttackData attackData)
		{
			this.m_attackData=attackData;
		}
示例#13
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);
            }
        }
示例#14
0
文件: TurretPet.cs 项目: mynew4/DAoC
		/// <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;
		}
示例#15
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);
                //			}
        }
示例#16
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;
				}
			}
		}
示例#17
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;
			}
		}
示例#18
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();
				}
			}
		}
示例#19
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);
			}
		}
示例#20
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);
			}
		}
示例#21
0
文件: GameObject.cs 项目: mynew4/DAoC
		/// <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);
		}
示例#22
0
 protected virtual void OnDamageAbsorbed(AttackData ad, int DamageAmount)
 {
 }
示例#23
0
		/// <summary>
		/// Constructs a new AttackedByEnemy
		/// </summary>
		public AttackedByEnemyEventArgs(AttackData attackData)
		{
			this.m_attackData=attackData;
		}
示例#24
0
		protected override void BringFriends(AttackData ad)
		{
			// don't
		}
示例#25
0
        public override void OnAttackedByEnemy(AttackData ad)
        {
            if (EvadeChance == 100)
                return;

            base.OnAttackedByEnemy(ad);
        }
示例#26
0
		protected override void OnAttackedByEnemy(AttackData ad)
		{
			AddToAggroList(ad.Attacker, (ad.Attacker.Level + 1) << 1);
		}
示例#27
0
		public override void OnAttackedByEnemy(AttackData ad) { /* do nothing */ }
示例#28
0
		public CastingEventArgs(ISpellHandler handler, GameLiving target, AttackData ad)
		{
			this.m_handler = handler;
			this.m_target = target;
			m_lastAttackData = ad;
		}