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


C# CharData.IsSameGroup方法代码示例

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


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

示例1: SongSleep

        /// <summary>
        /// Song of sleep.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongSleep( CharData ch, Spell spell, int level, Target target )
        {
            foreach( CharData victim in ch.InRoom.People )
            {
                if (victim.IsAffected(Affect.AFFECT_SLEEP)
                        || Magic.SpellSavingThrow( level, victim, AttackType.DamageType.charm )
                        || victim.GetRace() == Race.RACE_VAMPIRE
                        || ch.IsSameGroup( victim ) )
                {
                    continue;
                }

                Affect af = new Affect(Affect.AffectType.song, spell.Name, level / 8, Affect.Apply.none, 0, Affect.AFFECT_SLEEP);
                victim.CombineAffect(af);

                if( victim.IsAwake() )
                {
                    victim.SendText( "You feel very sleepy... zzzzz.\r\n" );
                    if (ch.Fighting || victim.CurrentPosition == Position.fighting)
                    {
                        Combat.StopFighting(victim, false);
                    }
                    CommandType.Interpret( victim, "sleep" );
                }

            }

            return true;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:37,代码来源:Songs.cs

示例2: SongHealing

        /// <summary>
        /// Song of healing.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="level"></param>
        /// <param name="target"></param>
        /// <returns></returns>
        public static bool SongHealing( CharData ch, Spell spell, int level, Target target )
        {
            foreach( CharData victim in ch.InRoom.People )
            {
                if( !ch.IsSameGroup( victim ) )
                    continue;

                int heal = MUDMath.Dice( 4, ( level / 3 ) ) + 1;

                if( victim.Hitpoints < victim.GetMaxHit() )
                    victim.Hitpoints = Math.Min( victim.Hitpoints + heal, victim.GetMaxHit() );
                victim.UpdatePosition();

                victim.SendText( "&+WYour wounds begin to heal.&n\r\n" );
            }
            return true;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:25,代码来源:Songs.cs

示例3: Group

        public static void Group(CharData ch, string[] str)
        {
            if( ch == null ) return;

            // Group with no arguments should show group staus.
            if (str.Length == 0)
            {
                ch.ShowGroup();
                return;
            }

            if (!MUDString.IsPrefixOf(str[0], "all"))
            {
                int added = 0;
                foreach (CharData ivictim in ch.InRoom.People)
                {
                    if (ivictim == ch
                            || ivictim.FlightLevel != ch.FlightLevel
                            || ch.IsRacewar(ivictim))
                        continue;
                    if (((ivictim.IsNPC() && ivictim.HasActionBit(MobTemplate.ACT_PET))
                            || (!ivictim.IsNPC() && ivictim.IsConsenting(ch)))
                            && ivictim.Master == ch && !ivictim.GroupLeader)
                    {
                        ch.AddGroupMember(ivictim);
                        ++added;
                    }
                }
                if (added < 1)
                {
                    ch.SendText("No new group members.\r\n");
                }
                return;
            }

            CharData victim = ch.GetCharRoom(str[0]);
            if (!victim)
            {
                ch.SendText("They aren't here.\r\n");
                return;
            }
            if (ch == victim)
            {
                ch.RemoveFromGroup(victim);
                return;
            }
            if (ch.IsRacewar(victim) && !victim.IsNPC())
            {
                ch.SendText("You can't group with such slime!\r\n");
                return;
            }
            if (ch.IsSameGroup(victim))
            {
                if (ch.GroupLeader == ch)
                {
                    ch.RemoveFromGroup(victim);
                }
                else
                {
                    ch.SendText("Only the leader of a group may kick someone out.\r\n");
                }
                return;
            }
            if (ch.GroupLeader == null || ch.GroupLeader == ch)
            {
                string buf;
                if (victim.GroupLeader == null)
                {
                    if ((!victim.IsNPC() && !victim.IsConsenting(ch)) || (victim.IsNPC() && victim.Master != ch))
                    {
                        buf = String.Format("{0} doesn't want to be in your group.\r\n", victim.ShowNameTo(ch, true));
                        ch.SendText(buf);
                    }
                    else
                    {
                        ch.GroupLeader = ch;
                        ch.AddGroupMember(victim);
                    }
                }
                else
                {
                    buf = String.Format("{0} is in another group.\r\n", victim.ShowNameTo(ch, true));
                    ch.SendText(buf);
                }
            }
            else
            {
                ch.SendText("You must be the head of the group to add someone.\r\n");
            }
            return;
        }
开发者ID:ramseur,项目名称:ModernMUD,代码行数:91,代码来源:Command.cs

示例4: HasSpellConsent

        /// <summary>
        /// Function for use with portal spells.  Can be reused for other spells if applicable.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="victim"></param>
        /// <returns></returns>
        public static bool HasSpellConsent( CharData ch, CharData victim )
        {
            if( victim.IsNPC() || ch.IsNPC() )
                return true;

            if( ch.IsSameGuild( victim ) )
                return true;

            if( ch.IsSameGroup( victim ) )
                return true;

            if( ch.IsImmortal() )
                return true;

            if( !victim.IsConsenting(ch) )
            {
                ch.SendText( "You do not have their consent.\r\n" );
                return false;
            }

            return true;
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:28,代码来源:Magic.cs

示例5: AreaSpellDamage

        /// <summary>
        /// Inflict the damage from an area-effect spell.
        /// </summary>
        /// <param name="ch"></param>
        /// <param name="spell"></param>
        /// <param name="numTargets"></param>
        /// <param name="damage"></param>
        /// <param name="damtype"></param>
        public static void AreaSpellDamage( CharData ch, Spell spell, int numTargets, int damage, AttackType.DamageType damtype )
        {
            int count = 0;

            // TODO: Start with either a random or a targeted character instead of picking the first.
            foreach( CharData targetChar in ch.InRoom.People )
            {
                if (++count > numTargets)
                    break;

                if( !ch.IsSameGroup( targetChar ) && ch != targetChar && ch.FlightLevel == targetChar.FlightLevel )
                {
                    int tmpDam = damage;
                    /* handle special damage types (chain lightning, quake, etc) here */
                    /* by modifying tmpDam, or setting stuff on chars */
                    if (tmpDam > 0)
                    {
                        Combat.InflictSpellDamage(ch, targetChar, damage, spell, damtype);
                    }
                } //end if
            }
        }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:30,代码来源:Magic.cs

示例6: IsValidAreaTarget

 /// <summary>
 /// Checks whether someone is a valid target for an area-effect spell.
 /// </summary>
 /// <param name="ch"></param>
 /// <param name="target"></param>
 /// <returns></returns>
 static bool IsValidAreaTarget( CharData ch, CharData target )
 {
     if (target.IsSameGroup(ch) || ch == target)
     {
         return false;
     }
     if (target.FlightLevel != ch.FlightLevel)
     {
         return false;
     }
     return true;
 }
开发者ID:carriercomm,项目名称:ModernMUD,代码行数:18,代码来源:Magic.cs


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