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


C# Spell.GetType方法代码示例

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


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

示例1: SaveSpellResult

	private void SaveSpellResult (Spell spell) {
		var spellType = spell.GetType ().ToString ();

		if (spell.State == SpellState.Win) {
			if (!HasUserCompletedSpell (spellType)) {
				PlayerPrefs.SetString (spellType, spellType); // value does not matter right now
			}
		}
	}
开发者ID:dggriffin,项目名称:Rain-Rain-Ritual,代码行数:9,代码来源:UserDataManager.cs

示例2: OnCast

        public static bool OnCast( Mobile caster, Spell spell )
        {
            ITransformationSpell transformSpell = spell as ITransformationSpell;

            if( transformSpell == null )
                return false;

            if( Factions.Sigil.ExistsOn( caster ) )
            {
                caster.SendLocalizedMessage( 1061632 ); // You can't do that while carrying the sigil.
            }
            else if( !caster.CanBeginAction( typeof( PolymorphSpell ) ) )
            {
                caster.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
            }
            else if ( DisguiseTimers.IsDisguised( caster ) )
            {
                caster.SendLocalizedMessage( 1061631 ); // You can't do that while disguised.
                return false;
            }
            else if( AnimalForm.UnderTransformation( caster ) )
            {
                caster.SendLocalizedMessage( 1061091 ); // You cannot cast that spell in this form.
            }
            else if( !caster.CanBeginAction( typeof( IncognitoSpell ) ) || (caster.IsBodyMod && GetContext( caster ) == null) )
            {
                spell.DoFizzle();
            }
            else if( spell.CheckSequence() )
            {
                TransformContext context = GetContext( caster );
                Type ourType = spell.GetType();

                bool wasTransformed = (context != null);
                bool ourTransform = (wasTransformed && context.Type == ourType);

                if( wasTransformed )
                {
                    RemoveContext( caster, context, ourTransform );

                    if( ourTransform )
                    {
                        caster.PlaySound( 0xFA );
                        caster.FixedParticles( 0x3728, 1, 13, 5042, EffectLayer.Waist );
                    }
                }

                if( !ourTransform )
                {
                    List<ResistanceMod> mods = new List<ResistanceMod>();

                    if( transformSpell.PhysResistOffset != 0 )
                        mods.Add( new ResistanceMod( ResistanceType.Physical, transformSpell.PhysResistOffset ) );

                    if( transformSpell.FireResistOffset != 0 )
                        mods.Add( new ResistanceMod( ResistanceType.Fire, transformSpell.FireResistOffset ) );

                    if( transformSpell.ColdResistOffset != 0 )
                        mods.Add( new ResistanceMod( ResistanceType.Cold, transformSpell.ColdResistOffset ) );

                    if( transformSpell.PoisResistOffset != 0 )
                        mods.Add( new ResistanceMod( ResistanceType.Poison, transformSpell.PoisResistOffset ) );

                    if( transformSpell.NrgyResistOffset != 0 )
                        mods.Add( new ResistanceMod( ResistanceType.Energy, transformSpell.NrgyResistOffset ) );

                    if( !((Body)transformSpell.Body).IsHuman )
                    {
                        Mobiles.IMount mt = caster.Mount;

                        if( mt != null )
                            mt.Rider = null;
                    }

                    caster.BodyMod = transformSpell.Body;
                    caster.HueMod = transformSpell.Hue;

                    for( int i = 0; i < mods.Count; ++i )
                        caster.AddResistanceMod( mods[i] );

                    transformSpell.DoEffect( caster );

                    Timer timer = new TransformTimer( caster, transformSpell );
                    timer.Start();

                    AddContext( caster, new TransformContext( timer, mods, ourType, transformSpell ) );
                    return true;
                }
            }

            return false;
        }
开发者ID:Leorgrium,项目名称:runuo,代码行数:92,代码来源:SpellHelper.cs

示例3: Spellinfo

        private string Spellinfo(Spell spell)
        {
            string details = "No Details";
            string type = spell.GetType().BaseType.Name.ToString();
            switch (type)
            {
                case "DoTSpell":
                    DoTSpell dot = spell as DoTSpell;
                    details =
                        "Damage over time spell" +
                        "\nNumber of ticks: " + dot.TickNumber.ToString() +
                        "\nTick Damage:" + dot.TickDamage.ToString() + "|" + dot.TickCritDamage.ToString() +
                        "\nCast Time:" + dot.CastTime.ToString() + "Secs" +
                        "\nDebuff Duration:" + dot.DebuffDuration.ToString() +
                        "\nMana Cost:" + dot.ManaCost.ToString() +
                        "\nTime Between Ticks:" + dot.TickPeriod.ToString() + "Secs";
                    break;
                case "DD":
                    DD dd = spell as DD;
                    details =
                        "Direct Damage Spell" +
                        "\nMin Damage: " + dd.MinDamage.ToString() + "|" + dd.MinCritDamage.ToString() +
                        "\nMax Damage:" + dd.MaxDamage.ToString() + "|" + dd.MaxCritDamage.ToString() +
                        "\nCast Time:" + dd.CastTime.ToString() + "Secs" +
                        "\nCool Down:" + dd.Cooldown.ToString() + "Secs" +
                        "\nMana Cost:" + dd.ManaCost.ToString();


                    break;
            }
            return details;
        }
开发者ID:LucasPeacecraft,项目名称:rawr,代码行数:32,代码来源:CharacterCalculationsShadowPriest.cs


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