当前位置: 首页>>代码示例>>C#>>正文


C# GameLiving.HasAbility方法代码示例

本文整理汇总了C#中GameLiving.HasAbility方法的典型用法代码示例。如果您正苦于以下问题:C# GameLiving.HasAbility方法的具体用法?C# GameLiving.HasAbility怎么用?C# GameLiving.HasAbility使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameLiving的用法示例。


在下文中一共展示了GameLiving.HasAbility方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyEffectOnTarget

 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);
 }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:10,代码来源:DualStatBuff.cs

示例2: ApplyEffectOnTarget

        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);
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:15,代码来源:UnbreakableSpeedDecreaseSpellHandler.cs

示例3: CalcValue

		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);
		}
开发者ID:mynew4,项目名称:DAoC,代码行数:13,代码来源:SpeedDecreaseDurationPercentCalculator.cs

示例4: ApplyEffectOnTarget

        /// <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);
            }
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:41,代码来源:HereticSpeedDecrease.cs

示例5: ApplyEffectOnTarget

		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);
		}
开发者ID:dudemanvox,项目名称:Dawn-of-Light-Server,代码行数:23,代码来源:CCSpellHandler.cs

示例6: CheckAbilityToUseItem


//.........这里部分代码省略.........

            //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;
        }
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:AbstractServerRules.cs

示例7: CheckBeginCast

        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)
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:Archery.cs

示例8: CheckBeginCast

        /// <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)
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DOLSharp,代码行数:101,代码来源:SpellHandler.cs

示例9: ApplyEffectOnTarget

        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);
        }
开发者ID:uvbs,项目名称:Dawn-of-Light-core,代码行数:39,代码来源:CCSpellHandler.cs

示例10: ApplyEffectOnTarget

        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);
        }
开发者ID:mynew4,项目名称:DOLSharp,代码行数:10,代码来源:Banelord.cs


注:本文中的GameLiving.HasAbility方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。