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


C# MirObjects.MonsterObject类代码示例

本文整理汇总了C#中Server.MirObjects.MonsterObject的典型用法代码示例。如果您正苦于以下问题:C# MonsterObject类的具体用法?C# MonsterObject怎么用?C# MonsterObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MonsterObject类属于Server.MirObjects命名空间,在下文中一共展示了MonsterObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Attacked

        public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
        {
            int armour = 0;

            switch (type)
            {
                case DefenceType.ACAgility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.AC:
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.MACAgility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinMAC, MaxMAC);
                    break;
                case DefenceType.MAC:
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.Agility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    break;
            }

            if (MagicShield)
                damage -= damage * (MagicShieldLv + 2) / 10;

            if (armour >= damage) return 0;

            MagicShieldTime -= (damage - armour) * 60;

            LastHitter = attacker.Master ?? attacker;
            LastHitTime = Envir.Time + 10000;
            RegenTime = Envir.Time + RegenDelay;

            DamageDura();

            Enqueue(new S.Struck { AttackerID = attacker.ObjectID });
            Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });
            //
            ChangeHP(armour - damage);
            return damage - armour;
        }
开发者ID:xiaofengzhiyu,项目名称:CSharpMir,代码行数:44,代码来源:PlayerObject.cs

示例2: IsFriendlyTarget

 public override bool IsFriendlyTarget(MonsterObject ally)
 {
     throw new NotSupportedException();
 }
开发者ID:quttap,项目名称:mir2,代码行数:4,代码来源:ItemObject.cs

示例3: IsFriendlyTarget

        public override bool IsFriendlyTarget(MonsterObject ally)
        {
            if (Master != null) return false;
            if (ally.Race != ObjectType.Monster) return false;
            if (ally.Master != null) return false;

            return true;
        }
开发者ID:GenysisGaming,项目名称:mir2,代码行数:8,代码来源:MonsterObject.cs

示例4: IsAttackTarget

 public override bool IsAttackTarget(MonsterObject attacker)
 {
     return false;
 }
开发者ID:mstation,项目名称:mir2,代码行数:4,代码来源:IntelligentCreatureObject.cs

示例5: Attacked

 public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
 {
     throw new NotSupportedException();
 }
开发者ID:quttap,项目名称:mir2,代码行数:4,代码来源:ItemObject.cs

示例6: IsAttackTarget

 public abstract bool IsAttackTarget(MonsterObject attacker);
开发者ID:ufaith,项目名称:cmir2,代码行数:1,代码来源:MapObject.cs

示例7: Remove

 public virtual void Remove(MonsterObject monster)
 {
 }
开发者ID:ufaith,项目名称:cmir2,代码行数:3,代码来源:MapObject.cs

示例8: IsAttackTarget

        public override bool IsAttackTarget(MonsterObject attacker)
        {
            if (attacker == null || attacker.Node == null) return false;
            if (Dead || attacker.Master == this || GMGameMaster) return false;
            if (attacker.Info.AI == 6 || attacker.Info.AI == 58) return PKPoints >= 200;
            if (attacker.Master == null) return true;
            if (InSafeZone || attacker.Master.InSafeZone) return false;

            if (LastHitter != attacker.Master && attacker.Master.LastHitter != this)
            {
                bool target = false;

                for (int i = 0; i < attacker.Master.Pets.Count; i++)
                {
                    if (attacker.Master.Pets[i].Target != this) continue;

                    target = true;
                    break;
                }

                if (!target)
                    return false;
            }

            switch (attacker.Master.AMode)
            {
                case AttackMode.All:
                    return true;
                case AttackMode.Group:
                    return GroupMembers == null || !GroupMembers.Contains(attacker.Master);
                case AttackMode.Guild:
                    return true;
                case AttackMode.EnemyGuild:
                    return false;
                case AttackMode.Peace:
                    return false;
                case AttackMode.RedBrown:
                    return PKPoints >= 200 || Envir.Time < BrownTime;
            }

            return true;

        }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:43,代码来源:PlayerObject.cs

示例9: IsFriendlyTarget

        public override bool IsFriendlyTarget(MonsterObject ally)
        {
            if (ally.Race != ObjectType.Monster) return false;
            if (ally.Master == null) return false;

            switch (ally.Master.Race)
            {
                case ObjectType.Player:
                    if (!ally.Master.IsFriendlyTarget(this)) return false;
                    break;
                case ObjectType.Monster:
                    return false;
            }

            return true;
        }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:16,代码来源:PlayerObject.cs

示例10: Add

        public override void Add(MonsterObject monster)
        {
            Enqueue(monster.GetInfo());

            monster.SendHealth(this);
        }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:6,代码来源:PlayerObject.cs

示例11: ElectricShock

        private void ElectricShock(MonsterObject target, UserMagic magic)
        {
            if (target == null || !target.IsAttackTarget(this)) return;

            if (Envir.Random.Next(4 - magic.Level) > 0)
            {
                if (Envir.Random.Next(2) == 0) LevelMagic(magic);
                return;
            }

            LevelMagic(magic);

            if (target.Master == this)
            {
                target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
                target.Target = null;
                return;
            }

            if (Envir.Random.Next(2) > 0)
            {
                target.ShockTime = Envir.Time + (magic.Level * 5 + 10) * 1000;
                target.Target = null;
                return;
            }

            if (target.Level > Level + 2 || !target.Info.CanTame) return;

            if (Envir.Random.Next(Level + 20 + magic.Level * 5) <= target.Level + 10)
            {
                if (Envir.Random.Next(5) > 0 && target.Master == null)
                {
                    target.RageTime = Envir.Time + (Envir.Random.Next(20) + 10) * 1000;
                    target.Target = null;
                }
                return;
            }

            if (Pets.Count(t => !t.Dead) >= magic.Level + 2) return;
            int rate = (int)(target.MaxHP / 100);
            if (rate <= 2) rate = 2;
            else rate *= 2;

            if (Envir.Random.Next(rate) != 0) return;
            //else if (Envir.Random.Next(20) == 0) target.Die();

            if (target.Master != null)
            {
                target.SetHP(target.MaxHP / 10);
                target.Master.Pets.Remove(target);
            }
            else if (target.Respawn != null)
            {
                target.Respawn.Count--;
                Envir.MonsterCount--;
                CurrentMap.MonsterCount--;
                target.Respawn = null;
            }

            target.Master = this;
            //target.HealthChanged = true;
            target.BroadcastHealthChange();
            Pets.Add(target);
            target.Target = null;
            target.RageTime = 0;
            target.ShockTime = 0;
            target.OperateTime = 0;
            target.MaxPetLevel = (byte)(1 + magic.Level * 2);

            target.Broadcast(new S.ObjectName { ObjectID = target.ObjectID, Name = target.Name });
        }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:71,代码来源:PlayerObject.cs

示例12: Remove

 public override void Remove(MonsterObject monster)
 {
     Enqueue(new S.ObjectRemove { ObjectID = monster.ObjectID });
 }
开发者ID:thedeaths,项目名称:official-mir2c-,代码行数:4,代码来源:PlayerObject.cs

示例13: Attacked

        public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
        {
            if (Target == null && attacker.IsAttackTarget(this))
                Target = attacker;

            int armour = 0;

            switch (type)
            {
                case DefenceType.ACAgility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.AC:
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.MACAgility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinMAC, MaxMAC);
                    break;
                case DefenceType.MAC:
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.Agility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    break;
            }

            armour = (int)(armour * PoisonRate);

            if (armour >= damage) return 0;

            if (Target != this && attacker.IsAttackTarget(this))
                Target = attacker;

            ShockTime = 0;

            if (attacker.Info.AI == 6)
                EXPOwner = null;

            else if (attacker.Master != null)
            {
                if (!Functions.InRange(attacker.CurrentLocation, attacker.Master.CurrentLocation, Globals.DataRange))
                    EXPOwner = null;
                else
                {

                    if (EXPOwner == null || EXPOwner.Dead)
                        EXPOwner = attacker.Master;

                    if (EXPOwner == attacker.Master)
                        EXPOwnerTime = Envir.Time + EXPOwnerDelay;
                }

            }

            Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });

            ChangeHP(armour - damage);
            return damage - armour;
        }
开发者ID:WillMcKill,项目名称:MirRage,代码行数:61,代码来源:MonsterObject.cs

示例14: Attacked

        public override int Attacked(MonsterObject attacker, int damage, DefenceType type = DefenceType.ACAgility)
        {
            int armour = 0;
            switch (type)
            {
                case DefenceType.ACAgility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.AC:
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.MACAgility:
                    if (Envir.Random.Next(Settings.MagicResistWeight) < MagicResist) return 0;
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    armour = GetAttackPower(MinMAC, MaxMAC);
                    break;
                case DefenceType.MAC:
                    if (Envir.Random.Next(Settings.MagicResistWeight) < MagicResist) return 0;
                    armour = GetAttackPower(MinAC, MaxAC);
                    break;
                case DefenceType.Agility:
                    if (Envir.Random.Next(Agility + 1) > attacker.Accuracy) return 0;
                    break;
            }

            if (Envir.Random.Next(100) < Reflect)
            {
                attacker.Attacked(this, damage, type, false);
                CurrentMap.Broadcast(new S.ObjectEffect { ObjectID = ObjectID, Effect = SpellEffect.Reflect },CurrentLocation);
                return 0;
            }

            if (MagicShield)
                damage -= damage * (MagicShieldLv + 2) / 10;

            if (armour >= damage) return 0;

            MagicShieldTime -= (damage - armour) * 60;

            LastHitter = attacker.Master ?? attacker;
            LastHitTime = Envir.Time + 10000;
            RegenTime = Envir.Time + RegenDelay;

            DamageDura();
            ActiveBlizzard = false;

            Enqueue(new S.Struck { AttackerID = attacker.ObjectID });
            Broadcast(new S.ObjectStruck { ObjectID = ObjectID, AttackerID = attacker.ObjectID, Direction = Direction, Location = CurrentLocation });
            //
            ChangeHP(armour - damage);
            return damage - armour;
        }
开发者ID:ufaith,项目名称:cmirosg,代码行数:53,代码来源:PlayerObject.cs

示例15: Add

 public virtual void Add(MonsterObject monster)
 {
 }
开发者ID:ufaith,项目名称:cmir2,代码行数:3,代码来源:MapObject.cs


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