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


C# ISpell.GetType方法代码示例

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


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

示例1: SpellAllowed

        public bool SpellAllowed(ISpell s)
        {
            Type stype = s.GetType();

            foreach (Type type in m_BeneficialTypes)
                if (type == stype)
                {
                    m_Spell = s.GetType();
                    return true;
                }

            if (s.GetType() == m_Spell)
                m_CastCount++;

            else
            {
                m_Spell = s.GetType();
                m_CastCount = 1;
            }

            if (m_CastCount > 3)
            {
                m_Part.SendMessage("You have already tried to cast that spell three times in a row!");
                return false;
            }

            return true;
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:28,代码来源:SpellWatcher.cs

示例2: ValidateAttack

        protected void ValidateAttack(ISpell spellToCast)
        {
            if (this.Unit.EnergyPoints < spellToCast.EnergyCost)
                throw new NotEnoughEnergyException(string.Format("{0} does not have enough energy to cast {1}", unit.Name, spellToCast.GetType().Name));

            unit.EnergyPoints -= spellToCast.EnergyCost;
        }
开发者ID:LyuboslavLyubenov,项目名称:OOP,代码行数:7,代码来源:CombatHandlerBase.cs

示例3: ValidateEnergyPoints

 public void ValidateEnergyPoints(IUnit unit, ISpell spell)
 {
     if (unit.EnergyPoints < spell.EnergyCost)
     {
         throw new NotEnoughEnergyException(
             string.Format("{0} does not have enough energy to cast {1}", unit.Name, spell.GetType().Name));
     }
 }
开发者ID:EBojilova,项目名称:CSharp-OOP-June-2015,代码行数:8,代码来源:CombatHandler.cs

示例4: ValidateEnergy

 public void ValidateEnergy(ISpell attack)
 {
     if (this.Unit.EnergyPoints - attack.EnergyCost < 0)
        {
        throw new NotEnoughEnergyException(String.Format(GlobalMessages.NotEnoughEnergy, this.Unit.Name,
            attack.GetType().Name));
        }
 }
开发者ID:ikolev94,项目名称:Exercises,代码行数:8,代码来源:CombatHandler.cs

示例5: HasEnoughEnergy

        public static bool HasEnoughEnergy(IUnit unit, ISpell spell)
        {
            if (unit.EnergyPoints - spell.EnergyCost < 0)
            {
                var message = string.Format(GlobalMessages.NotEnoughEnergy, unit.Name, spell.GetType().Name);
                throw new NotEnoughEnergyException(message);
            }

            return true;
        }
开发者ID:peterkirilov,项目名称:SoftUni-1,代码行数:10,代码来源:Validator.cs

示例6: IsThereEnoughEnergy

 protected void IsThereEnoughEnergy(ISpell attack)
 {
     if (this.Unit.EnergyPoints < attack.EnergyCost)
     {
         throw new NotEnoughEnergyException(string.Format(
             GlobalMessages.NotEnoughEnergy,
             this.Unit.Name,
             attack.GetType().Name));
     }
 }
开发者ID:IskraNikolova,项目名称:Object-oriented-programming,代码行数:10,代码来源:CombatHandler.cs

示例7: CastSpell

 public void CastSpell(Player player, ISpell spell)
 {
     player.CastSpell(spell);
     if (spell.GetType() == typeof (Shield))
     {
         player.IsShielded = true;
     }
     if (!spell.Target.IsShielded)
     {
         spell.Target.Health -= spell.Damage;
     }
     
 }
开发者ID:the-eejay,项目名称:SpellcasterCSharp,代码行数:13,代码来源:Game.cs

示例8: GetRegistryNumber

		public static int GetRegistryNumber( ISpell s )
		{
			return GetRegistryNumber( s.GetType() );
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:4,代码来源:SpellRegistry.cs

示例9: GetRegistryNumber

		public static int GetRegistryNumber( ISpell s ) {
			Type[] t = SpellRegistry.Types;

			for( int i = 0; i < t.Length; i++ ) {
				if( s.GetType() == t[i] )
					return i;
			}

			return -1;
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:10,代码来源:RegionControl.cs

示例10: CheckSpellCast

		public virtual bool CheckSpellCast(Mobile caster, ISpell spell)
		{
			if (caster == null || caster.Deleted || spell == null)
			{
				return false;
			}

			if (!DebugMode && caster.AccessLevel >= AccessLevel.Counselor)
			{
				return true;
			}

			if (!(spell is Spell))
			{
				return true;
			}

			if (!Options.Rules.CanFly)
			{
				var t = spell.GetType();

				if (t.Name.ContainsAny("FlySpell", "FlightSpell"))
				{
					return false;
				}
			}

			return !Options.Restrictions.Spells.IsRestricted((Spell)spell);
		}
开发者ID:Ravenwolfe,项目名称:Core,代码行数:29,代码来源:Battle_Actions.cs

示例11: OnSpellCastDeny

		protected override void OnSpellCastDeny(Mobile caster, ISpell spell)
		{
			if (Crystal != null && !Crystal.Deleted && Crystal.Carrier == caster && spell != null)
			{
				Type st = spell.GetType();

				if (_NoCarrySpellCasts.Contains(st))
				{
					string name = spell is Spell ? ((Spell)spell).Name : st.Name.Replace("Spell", String.Empty).SpaceWords();

					caster.SendMessage(33, "You cannot cast {0} while holding the Crystal of Power!", name);
					return;
				}
			}

			base.OnSpellCastDeny(caster, spell);
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:17,代码来源:BoW.cs

示例12: CheckSpellCast

		public override bool CheckSpellCast(Mobile caster, ISpell spell)
		{
			if (!base.CheckSpellCast(caster, spell))
			{
				return false;
			}

			if (Crystal != null && !Crystal.Deleted && Crystal.Carrier == caster && spell != null && _NoCarrySpellCasts.Contains(spell.GetType()))
			{
				return false;
			}

			return true;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:14,代码来源:BoW.cs

示例13: GetSpellInfo

		public static SpellInfo GetSpellInfo(ISpell s)
		{
			return s != null ? GetSpellInfo(s.GetType()) : null;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:4,代码来源:SpellRegistry.cs

示例14: GetRegistryNumber

		public static int GetRegistryNumber(ISpell s)
		{
			return s != null ? GetRegistryNumber(s.GetType()) : -1;
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:4,代码来源:SpellRegistry.cs


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