當前位置: 首頁>>代碼示例>>C#>>正文


C# BaseCreature.CanBeDamaged方法代碼示例

本文整理匯總了C#中Server.Mobiles.BaseCreature.CanBeDamaged方法的典型用法代碼示例。如果您正苦於以下問題:C# BaseCreature.CanBeDamaged方法的具體用法?C# BaseCreature.CanBeDamaged怎麽用?C# BaseCreature.CanBeDamaged使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Server.Mobiles.BaseCreature的用法示例。


在下文中一共展示了BaseCreature.CanBeDamaged方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Target

        public void Target( BaseCreature bc )
        {
            if ( !Caster.CanSee( bc ) )
            {
                Caster.SendLocalizedMessage( 500237 ); // Target can not be seen.
            }
            if ( !Caster.InRange( bc, 6 ) )
            {
                Caster.SendLocalizedMessage( 500643 ); // Target is too far away.
            }
            else if ( !Caster.CanBeHarmful( bc ) || !bc.CanBeDamaged() )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( bc.Controlled || bc.Name == null )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( bc is BaseChampion || bc.IsParagon || bc is Medusa || bc is Lurg || !SlayerGroup.GetEntryByName( SlayerName.Repond ).Slays( bc ) )
            {
                Caster.SendLocalizedMessage( 1074379 ); // You cannot charm that!
            }
            else if ( CheckSequence() )
            {
                double chance = Caster.Skills[SkillName.Spellweaving].Fixed / 1000;

                chance += ( SpellweavingSpell.GetFocusLevel( Caster ) * 2 ) / 100;

                if ( chance > Utility.RandomDouble() )
                {
                    SpellHelper.Turn( Caster, bc );

                    bc.ControlSlots = 3;

                    bc.ActiveSpeed = 2;
                    bc.PassiveSpeed = 2;

                    bc.Owners.Add( Caster );

                    bc.SetControlMaster( Caster );

                    bc.IsBonded = false;

                    Caster.SendLocalizedMessage( 1072527 ); // You allure the humanoid to follow and protect you.

                    Caster.PlaySound( 0x5C4 );
                }
                else
                {
                    bc.Combatant = Caster;

                    Caster.SendLocalizedMessage( 1072528 ); // The humanoid becomes enraged by your charming attempt and attacks you.

                    Caster.PlaySound( 0x5C5 );
                }
            }

            FinishSequence();
        }
開發者ID:Ravenwolfe,項目名稱:xrunuo,代碼行數:59,代碼來源:DryadAllure.cs


注:本文中的Server.Mobiles.BaseCreature.CanBeDamaged方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。