예제 #1
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     if (target.HasAbility(Abilities.VampiirDexterity)
        || target.HasAbility(Abilities.VampiirQuickness))
     {
         MessageToCaster("Your target already has an effect of that type!", eChatType.CT_Spell);
         return;
     }
     base.ApplyEffectOnTarget(target, effectiveness);
 }
예제 #2
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     if (target.HasAbility(Abilities.VampiirDexterity) ||
         target.HasAbility(Abilities.VampiirQuickness))
     {
         MessageToCaster("Your target already has an effect of that type!", eChatType.CT_Spell);
         return;
     }
     base.ApplyEffectOnTarget(target, effectiveness);
 }
예제 #3
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.CCImmunity) || target.HasAbility(Abilities.StunImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.CCImmunity)||target.HasAbility(Abilities.RootImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }
            if (target.EffectList.GetOfType<ChargeEffect>() != null)
            {
                MessageToCaster(target.Name + " is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #5
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.CCImmunity) || target.HasAbility(Abilities.RootImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }
            if (target.EffectList.GetOfType <ChargeEffect>() != null)
            {
                MessageToCaster(target.Name + " is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #6
0
 public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
 {
     if (target.HasAbility(Abilities.StunImmunity))
     {
         MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
         base.OnSpellResisted(target);
         return;
     }
     //Ceremonial bracer dont intercept physical stun
     if (Spell.SpellType.ToLower() != "stylestun")
     {
         GameSpellEffect stunblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerStun");
         if (stunblock != null)
         {
             stunblock.Cancel(false);
             if (target is GamePlayer)
             {
                 (target as GamePlayer).Out.SendMessage("Your item effect intercepts the stun spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
             }
             base.OnSpellResisted(target);
             return;
         }
     }
     base.ApplyEffectOnTarget(target, effectiveness);
 }
		public override int CalcValue(GameLiving living, eProperty property) 
		{
			int percent = 100
				-living.BaseBuffBonusCategory[(int)property] // buff reduce the duration
				+living.DebuffCategory[(int)property]
				-living.ItemBonus[(int)property]
				-living.AbilityBonus[(int)property];

			if (living.HasAbility(Abilities.Stoicism))
				percent -= 25;

			return Math.Max(1, percent);
		}
예제 #8
0
        public override int CalcValue(GameLiving living, eProperty property)
        {
            int percent = 100
                          - living.BaseBuffBonusCategory[(int)property]      // buff reduce the duration
                          + living.DebuffCategory[(int)property]
                          - living.ItemBonus[(int)property]
                          - living.AbilityBonus[(int)property];

            if (living.HasAbility(Abilities.Stoicism))
            {
                percent -= 25;
            }

            return(Math.Max(1, percent));
        }
예제 #9
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");

            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                {
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #10
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            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;
            }

            if (target.HasAbility(Abilities.CCImmunity))
            {
                MessageToCaster($"{target.Name} is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }

            if (target.TempProperties.getProperty("Charging", false))
            {
                MessageToCaster($"{target.Name} is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }

            if (target is GameNPC npc)
            {
                if (npc.Brain is IOldAggressiveBrain aggroBrain)
                {
                    aggroBrain.AddToAggroList(Caster, 1);
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Apply effect on target or do spell action if non duration spell
        /// </summary>
        /// <param name="target">target that gets the effect</param>
        /// <param name="effectiveness">factor from 0..1 (0%-100%)</param>
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            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;
            }
            if (target.HasAbility(Abilities.CCImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }
            if (target.TempProperties.getProperty("Charging", false))
            {
                MessageToCaster(target.Name + " is moving to fast for this spell to have any effect!", eChatType.CT_SpellResisted);
                return;
            }
            base.ApplyEffectOnTarget(target, effectiveness);

            if (Spell.CastTime > 0)
            {
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
            }
            if(target is GameNPC)
            {
                GameNPC npc = (GameNPC)target;
                IOldAggressiveBrain aggroBrain = npc.Brain as IOldAggressiveBrain;
                if (aggroBrain != null)
                    aggroBrain.AddToAggroList(Caster, 1);
            }
        }
예제 #12
0
        /// <summary>
        /// All checks before any casting begins
        /// </summary>
        /// <param name="selectedTarget"></param>
        /// <returns></returns>
        public virtual bool CheckBeginCast(GameLiving selectedTarget, bool quiet)
        {
            if (m_caster.ObjectState != GameLiving.eObjectState.Active)
            {
                return false;
            }

            if (!m_caster.IsAlive)
            {
                if(!quiet) MessageToCaster("You are dead and can't cast!", eChatType.CT_System);
                return false;
            }

            if (m_caster is GamePlayer)
            {
                long nextSpellAvailTime = m_caster.TempProperties.getProperty<long>(GamePlayer.NEXT_SPELL_AVAIL_TIME_BECAUSE_USE_POTION);

                if (nextSpellAvailTime > m_caster.CurrentRegion.Time)
                {
                    ((GamePlayer)m_caster).Out.SendMessage(LanguageMgr.GetTranslation(((GamePlayer)m_caster).Client, "GamePlayer.CastSpell.MustWaitBeforeCast", (nextSpellAvailTime - m_caster.CurrentRegion.Time) / 1000), eChatType.CT_System, eChatLoc.CL_SystemWindow);
                    return false;
                }
                if (((GamePlayer)m_caster).Steed != null && ((GamePlayer)m_caster).Steed is GameSiegeRam)
                {
                    if (!quiet) MessageToCaster("You can't cast in a siegeram!.", eChatType.CT_System);
                    return false;
                }
                GameSpellEffect naturesWomb = FindEffectOnTarget(Caster, typeof(NaturesWombEffect));
                if (naturesWomb != null)
                {
                    //[StephenxPimentel]
                    //Get Correct Message for 1.108 update.
                    MessageToCaster("You are silenced and cannot cast a spell right now.", eChatType.CT_SpellResisted);
                    return false;
                }
            }

            GameSpellEffect Phaseshift = FindEffectOnTarget(Caster, "Phaseshift");
            if (Phaseshift != null && (Spell.InstrumentRequirement == 0 || Spell.SpellType == "Mesmerize"))
            {
                if (!quiet) MessageToCaster("You're phaseshifted and can't cast a spell", eChatType.CT_System);
                return false;
            }

            // Apply Mentalist RA5L
            if (Spell.Range>0)
            {
                SelectiveBlindnessEffect SelectiveBlindness = Caster.EffectList.GetOfType<SelectiveBlindnessEffect>();
                if (SelectiveBlindness != null)
                {
                    GameLiving EffectOwner = SelectiveBlindness.EffectSource;
                    if(EffectOwner==selectedTarget)
                    {
                        if (m_caster is GamePlayer && !quiet)
                            ((GamePlayer)m_caster).Out.SendMessage(string.Format("{0} is invisible to you!", selectedTarget.GetName(0, true)), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);

                        return false;
                    }
                }
            }

            if (selectedTarget!=null && selectedTarget.HasAbility("DamageImmunity") && Spell.SpellType == "DirectDamage" && Spell.Radius == 0)
            {
                if (!quiet) MessageToCaster(selectedTarget.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return false;
            }

            if (m_spell.InstrumentRequirement != 0)
            {
                if (!CheckInstrument())
                {
                    if (!quiet) MessageToCaster("You are not wielding the right type of instrument!",
                                                eChatType.CT_SpellResisted);
                    return false;
                }
            }
            else if (m_caster.IsSitting) // songs can be played if sitting
            {
                //Purge can be cast while sitting but only if player has negative effect that
                //don't allow standing up (like stun or mez)
                if (!quiet) MessageToCaster("You can't cast while sitting!", eChatType.CT_SpellResisted);
                return false;
            }

            if (m_caster.AttackState && m_spell.CastTime != 0)
            {
                if (m_caster.CanCastInCombat(Spell) == false)
                {
                    m_caster.StopAttack();
                    return false;
                }
            }

            if (!m_spell.Uninterruptible && m_spell.CastTime > 0 && m_caster is GamePlayer &&
                m_caster.EffectList.GetOfType<QuickCastEffect>() == null && m_caster.EffectList.GetOfType<MasteryofConcentrationEffect>() == null)
            {
                if (Caster.InterruptAction > 0 && Caster.InterruptAction + Caster.SpellInterruptRecastTime > Caster.CurrentRegion.Time)
                {
                    if (!quiet) MessageToCaster("You must wait " + (((Caster.InterruptAction + Caster.SpellInterruptRecastTime) - Caster.CurrentRegion.Time) / 1000 + 1).ToString() + " seconds to cast a spell!", eChatType.CT_SpellResisted);
                    return false;
                }
            }

            if (m_spell.RecastDelay > 0)
            {
                int left = m_caster.GetSkillDisabledDuration(m_spell);
                if (left > 0)
                {
                    if (m_caster is NecromancerPet && ((m_caster as NecromancerPet).Owner as GamePlayer).Client.Account.PrivLevel > (int)ePrivLevel.Player)
                    {
                        // Ignore Recast Timer
                    }
                    else
                    {
                        if (!quiet) MessageToCaster("You must wait " + (left / 1000 + 1).ToString() + " seconds to use this spell!", eChatType.CT_System);
                        return false;
                    }
                }
            }

            String targetType = m_spell.Target.ToLower();

            //[Ganrod] Nidel: Can cast pet spell on all Pet/Turret/Minion (our pet)
            if (targetType.Equals("pet"))
            {
                if (selectedTarget == null || !Caster.IsControlledNPC(selectedTarget as GameNPC))
                {
                    if (Caster.ControlledBrain != null && Caster.ControlledBrain.Body != null)
                    {
                        selectedTarget = Caster.ControlledBrain.Body;
                    }
                    else
                    {
                        if (!quiet) MessageToCaster("You must cast this spell on a creature you are controlling.",
                                                    eChatType.CT_System);
                        return false;
                    }
                }
            }
            if (targetType == "area")
            {
                if (!m_caster.IsWithinRadius(m_caster.GroundTarget, CalculateSpellRange()))
                {
                    if (!quiet) MessageToCaster("Your area target is out of range.  Select a closer target.", eChatType.CT_SpellResisted);
                    return false;
                }
                if (!Caster.GroundTargetInView)
                {
                    MessageToCaster("Your ground target is not in view!", eChatType.CT_SpellResisted);
                    return false;
                }
            }
            else if (targetType != "self" && targetType != "group" && targetType != "pet"
                     && targetType != "controlled" && targetType != "cone" && m_spell.Range > 0)
            {
                // All spells that need a target.

                if (selectedTarget == null || selectedTarget.ObjectState != GameLiving.eObjectState.Active)
                {
                    if (!quiet) MessageToCaster("You must select a target for this spell!",
                                                eChatType.CT_SpellResisted);
                    return false;
                }

                if (!m_caster.IsWithinRadius(selectedTarget, CalculateSpellRange()))
                {
                    if(Caster is GamePlayer && !quiet) MessageToCaster("That target is too far away!",
                                                                       eChatType.CT_SpellResisted);
                    Caster.Notify(GameLivingEvent.CastFailed,
                                  new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetTooFarAway));
                    return false;
                }

                switch (m_spell.Target.ToLower())
                {
                    case "enemy":
                        if (selectedTarget == m_caster)
                        {
                            if (!quiet) MessageToCaster("You can't attack yourself! ", eChatType.CT_System);
                            return false;
                        }

                        if (FindStaticEffectOnTarget(selectedTarget, typeof(NecromancerShadeEffect)) != null)
                        {
                            if (!quiet) MessageToCaster("Invalid target.", eChatType.CT_System);
                            return false;
                        }

                        if (m_spell.SpellType == "Charm" && m_spell.CastTime == 0 && m_spell.Pulse != 0)
                            break;

                        if (m_caster.IsObjectInFront(selectedTarget, 180) == false)
                        {
                            if (!quiet) MessageToCaster("Your target is not in view!", eChatType.CT_SpellResisted);
                            Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
                            return false;
                        }

                        if (m_caster.TargetInView == false)
                        {
                            if (!quiet) MessageToCaster("Your target is not visible!", eChatType.CT_SpellResisted);
                            Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
                            return false;
                        }

                        if (!GameServer.ServerRules.IsAllowedToAttack(Caster, selectedTarget, quiet))
                        {
                            return false;
                        }
                        break;

                    case "corpse":
                        if (selectedTarget.IsAlive || !GameServer.ServerRules.IsSameRealm(Caster, selectedTarget, true))
                        {
                            if (!quiet) MessageToCaster("This spell only works on dead members of your realm!", eChatType.CT_SpellResisted);
                            return false;
                        }
                        break;

                    case "realm":
                        if (GameServer.ServerRules.IsAllowedToAttack(Caster, selectedTarget, true))
                        {
                            return false;
                        }
                        break;
                }

                //heals/buffs/rez need LOS only to start casting
                if (!m_caster.TargetInView && m_spell.Target.ToLower() != "pet")
                {
                    if (!quiet) MessageToCaster("Your target is not in visible!", eChatType.CT_SpellResisted);
                    Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
                    return false;
                }

                if (m_spell.Target.ToLower() != "corpse" && !selectedTarget.IsAlive)
                {
                    if (!quiet) MessageToCaster(selectedTarget.GetName(0, true) + " is dead!", eChatType.CT_SpellResisted);
                    return false;
                }
            }

            //Ryan: don't want mobs to have reductions in mana
            if (Spell.Power != 0 && m_caster is GamePlayer && (m_caster as GamePlayer).CharacterClass.ID != (int)eCharacterClass.Savage && m_caster.Mana < PowerCost(selectedTarget) && Spell.SpellType != "Archery")
            {
                if (!quiet) MessageToCaster("You don't have enough power to cast that!", eChatType.CT_SpellResisted);
                return false;
            }

            if (m_caster is GamePlayer && m_spell.Concentration > 0)
            {
                if (m_caster.Concentration < m_spell.Concentration)
                {
                    if (!quiet) MessageToCaster("This spell requires " + m_spell.Concentration + " concentration points to cast!", eChatType.CT_SpellResisted);
                    return false;
                }

                if (m_caster.ConcentrationEffects.ConcSpellsCount >= 50)
                {
                    if (!quiet) MessageToCaster("You can only cast up to 50 simultaneous concentration spells!", eChatType.CT_SpellResisted);
                    return false;
                }
            }

            // Cancel engage if user starts attack
            if (m_caster.IsEngaging)
            {
                EngageEffect engage = m_caster.EffectList.GetOfType<EngageEffect>();
                if (engage != null)
                {
                    engage.Cancel(false);
                }
            }

            if (!(Caster is GamePlayer))
            {
                Caster.Notify(GameLivingEvent.CastSucceeded, this, new PetSpellEventArgs(Spell, SpellLine, selectedTarget));
            }

            return true;
        }
		public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
		{
			if (target.HasAbility(Abilities.StunImmunity))
			{
				MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
				base.OnSpellResisted(target);
				return;
			}
			//Ceremonial bracer dont intercept physical stun
			if(Spell.SpellType.ToLower() != "stylestun" )
			{
				GameSpellEffect stunblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerStun");
				if (stunblock != null)
				{
					stunblock.Cancel(false);
					if (target is GamePlayer)
						(target as GamePlayer).Out.SendMessage("Your item effect intercepts the stun spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
					base.OnSpellResisted(target);
					return;
				}
			}
			base.ApplyEffectOnTarget(target, effectiveness);
		}
		public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
		{
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (Caster.IsWithinRadius(target, this.Spell.Range * 5) == false)
                {
                    CancelPulsingSpell(Caster, this.Spell.SpellType);
                    MessageToCaster("You are far away from the target. You stop playing your song.", eChatType.CT_Spell);
                    return;
                }

                if (target != null && (!target.IsAlive)) 
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (target != Caster.TargetObject)
                    return;

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                        return;
                }

            }

//

			if (target.HasAbility(Abilities.MezzImmunity))
			{
				MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}
			if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
			{
				MessageToCaster("Your target is immune!", eChatType.CT_System);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}
			//Do nothing when already mez, but inform caster
			GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
			if(mezz != null)
			{
				MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
//				SendEffectAnimation(target, 0, false, 0);
				return;
			}
			GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");
			if (mezblock != null)
			{
				mezblock.Cancel(false);
				if (target is GamePlayer)
					(target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
				//inform caster
				MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
				SendEffectAnimation(target, 0, false, 0);
				target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
				return;
			}

			base.ApplyEffectOnTarget(target, effectiveness);
		}
예제 #15
0
		public override bool CheckBeginCast(GameLiving selectedTarget)
		{
			if (m_caster.ObjectState != GameLiving.eObjectState.Active)	return false;
			if (!m_caster.IsAlive)
			{
				MessageToCaster("You are dead and can't cast!", eChatType.CT_System);
				return false;
			}
			
			// Is PS ?
			GameSpellEffect Phaseshift = SpellHandler.FindEffectOnTarget(Caster, "Phaseshift");
			if (Phaseshift != null && (Spell.InstrumentRequirement == 0 || Spell.SpellType == "Mesmerize"))
			{
				MessageToCaster("You're phaseshifted and can't cast a spell", eChatType.CT_System);
				return false;
			}

			// Is Shield Disarm ?
			ShieldTripDisarmEffect shieldDisarm = Caster.EffectList.GetOfType<ShieldTripDisarmEffect>();
			if (shieldDisarm != null)
			{
				MessageToCaster("You're disarmed and can't cast a spell", eChatType.CT_System);
				return false;
			}

			// Is Mentalist RA5L ?
			SelectiveBlindnessEffect SelectiveBlindness = Caster.EffectList.GetOfType<SelectiveBlindnessEffect>();
			if (SelectiveBlindness != null)
			{
				GameLiving EffectOwner = SelectiveBlindness.EffectSource;
				if(EffectOwner==selectedTarget)
				{
					if (m_caster is GamePlayer)
						((GamePlayer)m_caster).Out.SendMessage(string.Format("{0} is invisible to you!", selectedTarget.GetName(0, true)), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);
					
					return false;
				}
			}
			
			// Is immune ?
			if (selectedTarget!=null&&selectedTarget.HasAbility("DamageImmunity"))
			{
				MessageToCaster(selectedTarget.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
				return false;
			}
			
			if (m_caster.IsSitting)
			{
				MessageToCaster("You can't cast while sitting!", eChatType.CT_SpellResisted);
				return false;
			}
			if (m_spell.RecastDelay > 0)
			{
				int left = m_caster.GetSkillDisabledDuration(m_spell);
				if (left > 0)
				{
					MessageToCaster("You must wait " + (left / 1000 + 1).ToString() + " seconds to use this spell!", eChatType.CT_System);
					return false;
				}
			}
			String targetType = m_spell.Target.ToLower();
			if (targetType == "area")
			{
				if (!m_caster.IsWithinRadius(m_caster.GroundTarget, CalculateSpellRange()))
				{
					MessageToCaster("Your area target is out of range.  Select a closer target.", eChatType.CT_SpellResisted);
					return false;
				}
			}

			if (targetType == "enemy")
			{
				if (m_caster.IsObjectInFront(selectedTarget, 180) == false)
				{
					MessageToCaster("Your target is not in view!", eChatType.CT_SpellResisted);
					Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
					return false;
				}

				if (m_caster.TargetInView == false)
				{
					MessageToCaster("Your target is not visible!", eChatType.CT_SpellResisted);
					Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
					return false;
				}
			}
			
			if (Caster != null && Caster is GamePlayer && Caster.AttackWeapon != null && GlobalConstants.IsBowWeapon((eObjectType)Caster.AttackWeapon.Object_Type))
			{
				if (Spell.LifeDrainReturn == (int)eShotType.Critical && (!(Caster.IsStealthed)))
				{
					MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
					return false;
				}

				return true;
			}
			else
			{
				if (Spell.LifeDrainReturn == (int)eShotType.Critical)
				{
					MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
					return false;
				}

				MessageToCaster("You must be wielding a bow to use this ability!", eChatType.CT_SpellResisted);
				return false;
			}
		}
예제 #16
0
파일: Banelord.cs 프로젝트: mynew4/DOLSharp
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.CCImmunity)||target.HasAbility(Abilities.StunImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #17
0
        public virtual bool CheckAbilityToUseItem(GameLiving living, ItemTemplate item)
        {
            if (living == null || item == null)
                return false;

            GamePlayer player = living as GamePlayer;

            // GMs can equip everything
            if (player != null  && player.Client.Account.PrivLevel > (uint) ePrivLevel.Player)
                return true;

            // allow usage of all house items
            if ((item.Object_Type == 0 || item.Object_Type >= (int)eObjectType._FirstHouse) && item.Object_Type <= (int)eObjectType._LastHouse)
                return true;

            // on some servers we may wish for dropped items to be used by all realms regardless of what is set in the db
            if (!ServerProperties.Properties.ALLOW_CROSS_REALM_ITEMS)
            {
                if (item.Realm != 0 && item.Realm != (int)living.Realm)
                    return false;
            }

            // classes restriction. 0 means every class
            if (player != null && !Util.IsEmpty(item.AllowedClasses, true))
            {
                if (!item.AllowedClasses.SplitCSV(true).Contains(player.CharacterClass.ID.ToString()))
                    return false;
            }

            //armor
            if (item.Object_Type >= (int)eObjectType._FirstArmor && item.Object_Type <= (int)eObjectType._LastArmor)
            {
                int armorAbility = -1;
                switch ((eRealm)item.Realm)
                {
                        case eRealm.Albion: armorAbility = living.GetAbilityLevel(Abilities.AlbArmor); break;
                        case eRealm.Hibernia: armorAbility = living.GetAbilityLevel(Abilities.HibArmor); break;
                        case eRealm.Midgard: armorAbility = living.GetAbilityLevel(Abilities.MidArmor); break;
                    default: // use old system
                        armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.AlbArmor));
                        armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.HibArmor));
                        armorAbility = Math.Max(armorAbility, living.GetAbilityLevel(Abilities.MidArmor));
                        break;
                }
                switch ((eObjectType)item.Object_Type)
                {
                        case eObjectType.GenericArmor: return armorAbility >= ArmorLevel.GenericArmor;
                        case eObjectType.Cloth: return armorAbility >= ArmorLevel.Cloth;
                        case eObjectType.Leather: return armorAbility >= ArmorLevel.Leather;
                    case eObjectType.Reinforced:
                        case eObjectType.Studded: return armorAbility >= ArmorLevel.Studded;
                    case eObjectType.Scale:
                        case eObjectType.Chain: return armorAbility >= ArmorLevel.Chain;
                        case eObjectType.Plate: return armorAbility >= ArmorLevel.Plate;
                        default: return false;
                }
            }

            // non-armors
            string abilityCheck = null;
            string[] otherCheck = new string[0];

            //http://dol.kitchenhost.de/files/dol/Info/itemtable.txt
            switch ((eObjectType)item.Object_Type)
            {
                    case eObjectType.GenericItem: return true;
                    case eObjectType.GenericArmor: return true;
                    case eObjectType.GenericWeapon: return true;
                    case eObjectType.Staff: abilityCheck = Abilities.Weapon_Staves; break;
                    case eObjectType.Fired: abilityCheck = Abilities.Weapon_Shortbows; break;
                    case eObjectType.FistWraps: abilityCheck = Abilities.Weapon_FistWraps; break;
                    case eObjectType.MaulerStaff: abilityCheck = Abilities.Weapon_MaulerStaff; break;

                    //alb
                    case eObjectType.CrushingWeapon: abilityCheck = Abilities.Weapon_Crushing; break;
                    case eObjectType.SlashingWeapon: abilityCheck = Abilities.Weapon_Slashing; break;
                    case eObjectType.ThrustWeapon: abilityCheck = Abilities.Weapon_Thrusting; break;
                    case eObjectType.TwoHandedWeapon: abilityCheck = Abilities.Weapon_TwoHanded; break;
                    case eObjectType.PolearmWeapon: abilityCheck = Abilities.Weapon_Polearms; break;
                case eObjectType.Longbow:
                    otherCheck = new string[] { Abilities.Weapon_Longbows, Abilities.Weapon_Archery };
                    break;
                    case eObjectType.Crossbow: abilityCheck = Abilities.Weapon_Crossbow; break;
                    case eObjectType.Flexible: abilityCheck = Abilities.Weapon_Flexible; break;
                    //TODO: case 5: abilityCheck = Abilities.Weapon_Thrown; break;

                    //mid
                    case eObjectType.Sword: abilityCheck = Abilities.Weapon_Swords; break;
                    case eObjectType.Hammer: abilityCheck = Abilities.Weapon_Hammers; break;
                case eObjectType.LeftAxe:
                    case eObjectType.Axe: abilityCheck = Abilities.Weapon_Axes; break;
                    case eObjectType.Spear: abilityCheck = Abilities.Weapon_Spears; break;
                case eObjectType.CompositeBow:
                    otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Archery };
                    break;
                    case eObjectType.Thrown: abilityCheck = Abilities.Weapon_Thrown; break;
                    case eObjectType.HandToHand: abilityCheck = Abilities.Weapon_HandToHand; break;

                    //hib
                case eObjectType.RecurvedBow:
                    otherCheck = new string[] { Abilities.Weapon_RecurvedBows, Abilities.Weapon_Archery };
                    break;
                    case eObjectType.Blades: abilityCheck = Abilities.Weapon_Blades; break;
                    case eObjectType.Blunt: abilityCheck = Abilities.Weapon_Blunt; break;
                    case eObjectType.Piercing: abilityCheck = Abilities.Weapon_Piercing; break;
                    case eObjectType.LargeWeapons: abilityCheck = Abilities.Weapon_LargeWeapons; break;
                    case eObjectType.CelticSpear: abilityCheck = Abilities.Weapon_CelticSpear; break;
                    case eObjectType.Scythe: abilityCheck = Abilities.Weapon_Scythe; break;

                    //misc
                    case eObjectType.Magical: return true;
                    case eObjectType.Shield: return living.GetAbilityLevel(Abilities.Shield) >= item.Type_Damage;
                    case eObjectType.Bolt: abilityCheck = Abilities.Weapon_Crossbow; break;
                    case eObjectType.Arrow: otherCheck = new string[] { Abilities.Weapon_CompositeBows, Abilities.Weapon_Longbows, Abilities.Weapon_RecurvedBows, Abilities.Weapon_Shortbows }; break;
                    case eObjectType.Poison: return living.GetModifiedSpecLevel(Specs.Envenom) > 0;
                    case eObjectType.Instrument: return living.HasAbility(Abilities.Weapon_Instruments);
                    //TODO: different shield sizes
            }

            if(abilityCheck != null && living.HasAbility(abilityCheck))
                return true;

            foreach (string str in otherCheck)
                if (living.HasAbility(str))
                    return true;

            return false;
        }
예제 #18
0
파일: Archery.cs 프로젝트: mynew4/DOLSharp
        public override bool CheckBeginCast(GameLiving selectedTarget)
        {
            if (m_caster.ObjectState != GameLiving.eObjectState.Active)	return false;
            if (!m_caster.IsAlive)
            {
                MessageToCaster("You are dead and can't cast!", eChatType.CT_System);
                return false;
            }

            // Is PS ?
            GameSpellEffect Phaseshift = SpellHandler.FindEffectOnTarget(Caster, "Phaseshift");
            if (Phaseshift != null && (Spell.InstrumentRequirement == 0 || Spell.SpellType == "Mesmerize"))
            {
                MessageToCaster("You're phaseshifted and can't cast a spell", eChatType.CT_System);
                return false;
            }

            // Is Shield Disarm ?
            ShieldTripDisarmEffect shieldDisarm = Caster.EffectList.GetOfType<ShieldTripDisarmEffect>();
            if (shieldDisarm != null)
            {
                MessageToCaster("You're disarmed and can't cast a spell", eChatType.CT_System);
                return false;
            }

            // Is Mentalist RA5L ?
            SelectiveBlindnessEffect SelectiveBlindness = Caster.EffectList.GetOfType<SelectiveBlindnessEffect>();
            if (SelectiveBlindness != null)
            {
                GameLiving EffectOwner = SelectiveBlindness.EffectSource;
                if(EffectOwner==selectedTarget)
                {
                    if (m_caster is GamePlayer)
                        ((GamePlayer)m_caster).Out.SendMessage(string.Format("{0} is invisible to you!", selectedTarget.GetName(0, true)), eChatType.CT_Missed, eChatLoc.CL_SystemWindow);

                    return false;
                }
            }

            // Is immune ?
            if (selectedTarget!=null&&selectedTarget.HasAbility("DamageImmunity"))
            {
                MessageToCaster(selectedTarget.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                return false;
            }

            if (m_caster.IsSitting)
            {
                MessageToCaster("You can't cast while sitting!", eChatType.CT_SpellResisted);
                return false;
            }
            if (m_spell.RecastDelay > 0)
            {
                int left = m_caster.GetSkillDisabledDuration(m_spell);
                if (left > 0)
                {
                    MessageToCaster("You must wait " + (left / 1000 + 1).ToString() + " seconds to use this spell!", eChatType.CT_System);
                    return false;
                }
            }
            String targetType = m_spell.Target.ToLower();
            if (targetType == "area")
            {
                if (!m_caster.IsWithinRadius(m_caster.GroundTarget, CalculateSpellRange()))
                {
                    MessageToCaster("Your area target is out of range.  Select a closer target.", eChatType.CT_SpellResisted);
                    return false;
                }
            }

            if (targetType == "enemy")
            {
                if (m_caster.IsObjectInFront(selectedTarget, 180) == false)
                {
                    MessageToCaster("Your target is not in view!", eChatType.CT_SpellResisted);
                    Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
                    return false;
                }

                if (m_caster.TargetInView == false)
                {
                    MessageToCaster("Your target is not visible!", eChatType.CT_SpellResisted);
                    Caster.Notify(GameLivingEvent.CastFailed, new CastFailedEventArgs(this, CastFailedEventArgs.Reasons.TargetNotInView));
                    return false;
                }
            }

            if (Caster != null && Caster is GamePlayer && Caster.AttackWeapon != null && GlobalConstants.IsBowWeapon((eObjectType)Caster.AttackWeapon.Object_Type))
            {
                if (Spell.LifeDrainReturn == (int)eShotType.Critical && (!(Caster.IsStealthed)))
                {
                    MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
                    return false;
                }

                return true;
            }
            else
            {
                if (Spell.LifeDrainReturn == (int)eShotType.Critical)
                {
                    MessageToCaster("You must be stealthed and wielding a bow to use this ability!", eChatType.CT_SpellResisted);
                    return false;
                }

                MessageToCaster("You must be wielding a bow to use this ability!", eChatType.CT_SpellResisted);
                return false;
            }
        }
예제 #19
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");
            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");
            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }
예제 #20
0
        public override void ApplyEffectOnTarget(GameLiving target, double effectiveness)
        {
// WHRIA
// Flute Mez (pulse>0)
            if (this.Spell.Pulse > 0)
            {
                if (Caster.IsWithinRadius(target, this.Spell.Range * 5) == false)
                {
                    CancelPulsingSpell(Caster, this.Spell.SpellType);
                    MessageToCaster("You are far away from the target. You stop playing your song.", eChatType.CT_Spell);
                    return;
                }

                if (target != null && (!target.IsAlive))
                {
                    GameSpellEffect effect = SpellHandler.FindEffectOnTarget(target, this);
                    if (effect != null)
                    {
                        effect.Cancel(false);//call OnEffectExpires
                        CancelPulsingSpell(Caster, this.Spell.SpellType);
                        MessageToCaster("You stop playing your song.", eChatType.CT_Spell);
                    }
                    return;
                }

                if (target != Caster.TargetObject)
                {
                    return;
                }

                if (this.Spell.Range != 0)
                {
                    if (!Caster.IsWithinRadius(target, this.Spell.Range))
                    {
                        return;
                    }
                }
            }

//

            if (target.HasAbility(Abilities.MezzImmunity))
            {
                MessageToCaster(target.Name + " is immune to this effect!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            if (FindStaticEffectOnTarget(target, typeof(MezzRootImmunityEffect)) != null)
            {
                MessageToCaster("Your target is immune!", eChatType.CT_System);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }
            //Do nothing when already mez, but inform caster
            GameSpellEffect mezz = SpellHandler.FindEffectOnTarget(target, "Mesmerize");

            if (mezz != null)
            {
                MessageToCaster("Your target is already mezzed!", eChatType.CT_SpellResisted);
//				SendEffectAnimation(target, 0, false, 0);
                return;
            }
            GameSpellEffect mezblock = SpellHandler.FindEffectOnTarget(target, "CeremonialBracerMezz");

            if (mezblock != null)
            {
                mezblock.Cancel(false);
                if (target is GamePlayer)
                {
                    (target as GamePlayer).Out.SendMessage("Your item effect intercepts the mesmerization spell and fades!", eChatType.CT_SpellResisted, eChatLoc.CL_SystemWindow);
                }
                //inform caster
                MessageToCaster("Ceremonial Bracer intercept your mez!", eChatType.CT_SpellResisted);
                SendEffectAnimation(target, 0, false, 0);
                target.StartInterruptTimer(target.SpellInterruptDuration, AttackData.eAttackType.Spell, Caster);
                return;
            }

            base.ApplyEffectOnTarget(target, effectiveness);
        }