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


C# ICharacter.HasActiveItem方法代码示例

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


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

示例1: ChangeAttackBuff

        public static void ChangeAttackBuff(ICharacter character, ICharacter attacker, IMap map, int counter, PacketHitList hitlist)
        {
            if (counter < 0) {
                if (character.VolatileStatus.GetStatus("Mist") != null) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s stats didn't drop due to the mist!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }
                if (attacker != character && character.VolatileStatus.GetStatus("Substitute") != null) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by Substitute!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }

                //twist band
                if (character.HasActiveItem(172)) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Twist Band prevented its Attack stats from dropping!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }

                if (HasActiveBagItem(character, 49, 0, 0)) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s item prevented its stats from dropping!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }

                if (HasAbility(character, "White Smoke") && !HasAbility(attacker, "Mold Breaker")) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s White Smoke prevented its stats from dropping!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }

                if (HasAbility(character, "Clear Body") && !HasAbility(attacker, "Mold Breaker")) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Clear Body prevented its stats from dropping!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }

                if (HasAbility(character, "Hyper Cutter") && !HasAbility(attacker, "Mold Breaker")) {
                    hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Hyper Cutter prevented its Attack from dropping!", Text.WhiteSmoke), character.X, character.Y, 10);
                    return;
                }
            }

            if (HasAbility(character, "Contrary") && !HasAbility(attacker, "Mold Breaker")) {
                counter *= -1;
            }

            if (HasAbility(character, "Simple") && !HasAbility(attacker, "Mold Breaker")) {
                counter *= 2;
            }

            if (character.AttackBuff >= 10 && counter > 0) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack won't go higher!", Text.WhiteSmoke), character.X, character.Y, 10);
                return;
            } else if (character.AttackBuff <= -10 && counter < 0) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack won't go lower!", Text.WhiteSmoke), character.X, character.Y, 10);
                return;
            }

            if (character.AttackBuff + counter > 10) {
                counter = 10 - character.AttackBuff;
            } else if (character.AttackBuff + counter < -10) {
                counter = -10 - character.AttackBuff;
            }

            if (counter == 0) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack didn't change.", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter == 1) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack rose slightly.", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter == -1) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack fell slightly.", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter == 2) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack rose sharply!", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter == -2) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack fell harshly!", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter > 2) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack rose drastically!", Text.WhiteSmoke), character.X, character.Y, 10);
            } else if (counter < -2) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Attack fell drastically!", Text.WhiteSmoke), character.X, character.Y, 10);
            }
            character.AttackBuff += counter;

            if (counter < 0 && HasAbility(character, "Defiant")) {
                //hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " defied the stat change!", Text.WhiteSmoke), character.X, character.Y, 10);
                ChangeAttackBuff(character, map, 2, hitlist);
            }
            if (counter < 0 && HasAbility(character, "Competitive")) {
                //hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " defied the stat change!", Text.WhiteSmoke), character.X, character.Y, 10);
                ChangeSpAtkBuff(character, map, 2, hitlist);
            }
        }
开发者ID:MandL27,项目名称:Server,代码行数:87,代码来源:StatusScript.cs

示例2: GetCharacterWeather

        public static Enums.Weather GetCharacterWeather(ICharacter character)
        {
            try {
            if (character.HasActiveItem(303)) {
                return Enums.Weather.None;
            }
            IMap map = MapManager.RetrieveActiveMap(character.MapID);
            if (map != null) {
                if (map.Weather == Enums.Weather.Ambiguous || map.Weather == Enums.Weather.None) {
                    if (character.HasActiveItem(302)) {
                        return Enums.Weather.Sunny;
                    } else if (character.HasActiveItem(301)) {
                        return Enums.Weather.Raining;
                    } else if (character.HasActiveItem(300)) {
                        return Enums.Weather.Sandstorm;
                    } else if (character.HasActiveItem(299)) {
                        return Enums.Weather.Hail;
                    }

                }

                return map.Weather;
            }
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: GetCharacterWeather", Text.Black);
            }

            return Enums.Weather.Ambiguous;
        }
开发者ID:MandL27,项目名称:Server,代码行数:29,代码来源:BattleScript.cs

示例3: RefreshCharacterSprite

        public static void RefreshCharacterSprite(ICharacter character, IMap map, PacketHitList hitlist)
        {
            PacketHitList.MethodStart(ref hitlist);
            //sprite
            ExtraStatus status;

            int sprite = character.Sprite;

            character.CalculateOriginalSprite();

            if (character.HasActiveItem(259) && character.HeldItem.Num == 259 && map != null && map.Moral == Enums.MapMoral.House) {
                character.Sprite = character.HeldItem.Tag.ToInt();
            }

            status = character.VolatileStatus.GetStatus("Illusion");
            if (status != null) {
                character.Sprite = status.Counter;
            }

            if (character.VolatileStatus.GetStatus("Substitute") != null) {
                character.Sprite = 0;
                character.Form = 3;
            }

            if (character.VolatileStatus.GetStatus("SemiInvul") != null ||
                character.VolatileStatus.GetStatus("SkyDrop:0") != null ||
                character.VolatileStatus.GetStatus("SkyDrop:1") != null) {
                character.Sprite = 0;
                character.Form = 2;
            }
            if (sprite != character.Sprite) {
                if (character.CharacterType == Enums.CharacterType.Recruit) {
                    PacketBuilder.AppendSprite(((Recruit)character).Owner, hitlist);
                } else {

                    PacketBuilder.AppendNpcSprite(map, hitlist, ((MapNpc)character).MapSlot);
                }
            }
            PacketHitList.MethodEnded(ref hitlist);
        }
开发者ID:MandL27,项目名称:Server,代码行数:40,代码来源:StatusScript.cs

示例4: AddExtraStatus


//.........这里部分代码省略.........
                                if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " acquired the ability " + tag + "!", Text.WhiteSmoke), character.X, character.Y, 10);
                            }
                            if (tag == "Insomnia") {
                                if (character.StatusAilment == Enums.StatusAilment.Sleep) {
                                    SetStatusAilment(character, map, Enums.StatusAilment.OK, 0, hitlist);
                                }
                                RemoveExtraStatus(character, map, "Yawn", hitlist);
                            }
                            RefreshCharacterTraits(character, map, hitlist, false, false, false, true, false, false, false, false, false, false, false, false, false);
                        }
                        break;
                    case "Ability3": {
                            if (tag != "None") {
                                if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " acquired the ability " + tag + "!", Text.WhiteSmoke), character.X, character.Y, 10);
                            }
                            if (tag == "Insomnia") {
                                if (character.StatusAilment == Enums.StatusAilment.Sleep) {
                                    SetStatusAilment(character, map, Enums.StatusAilment.OK, 0, hitlist);
                                }
                                RemoveExtraStatus(character, map, "Yawn", hitlist);
                            }
                            RefreshCharacterTraits(character, map, hitlist, false, false, false, true, false, false, false, false, false, false, false, false, false);
                        }
                        break;
                    case "Nightmare": {
                            if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " will get nightmares when it sleeps!", Text.BrightRed), character.X, character.Y, 10);
                            newStatus.Emoticon = 85;
                            RefreshCharacterVolatileStatus(character, map, hitlist);
                        }
                        break;
                    case "Attract": {
                            if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " became infatuated!", Text.WhiteSmoke), character.X, character.Y, 10);
                            RefreshCharacterSpeedLimit(character, map, hitlist);
                            if (character.HasActiveItem(704)) {
                                if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " has a Destiny Knot!", Text.WhiteSmoke), character.X, character.Y, 10);
                                TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 10, map, character, character.X, character.Y, Enums.Direction.Up, true, false, false);
                                for (int i = 0; i < targets.Count; i++) {
                                    AddExtraStatus(targets[i], null, map, "Attract", counter, null, "", hitlist, true);
                                }
                            }
                        }
                        break;
                    case "Follow": {
                            if (target != null) {
                                if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " can only attack " + target.Name + " now!", Text.WhiteSmoke), character.X, character.Y, 10);
                            } else {
                                if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "is focused on a single target now!", Text.WhiteSmoke), character.X, character.Y, 10);
                            }
                            newStatus.Emoticon = 75;
                            RefreshCharacterVolatileStatus(character, map, hitlist);
                        }
                        break;
                    case "Embargo": {
                            if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was prevented from using items!", Text.WhiteSmoke), character.X, character.Y, 10);
                            newStatus.Emoticon = 147;
                            RefreshCharacterVolatileStatus(character, map, hitlist);
                        }
                        break;
                    case "HealBlock": {
                            if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was prevented from recovering HP!", Text.WhiteSmoke), character.X, character.Y, 10);
                            newStatus.Emoticon = 91;
                            RefreshCharacterVolatileStatus(character, map, hitlist);
                        }
                        break;
                    case "Ingrain": {
                            if (msg) hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " planted its roots!", Text.WhiteSmoke), character.X, character.Y, 10);
开发者ID:MandL27,项目名称:Server,代码行数:67,代码来源:StatusScript.cs

示例5: RefreshCharacterMobility

        public static void RefreshCharacterMobility(ICharacter character, IMap map, PacketHitList hitlist)
        {
            PacketHitList.MethodStart(ref hitlist);
            //Mobility

            for (int i = 0; i < character.Mobility.Length; i++) {
                character.Mobility[i] = false;
            }

            if (character.Type1 == Enums.PokemonType.Ground || character.Type2 == Enums.PokemonType.Ground) {
                character.Mobility[8] = true;
            }

            if (character.Type1 == Enums.PokemonType.Water || character.Type2 == Enums.PokemonType.Water) {
                character.Mobility[1] = true;
            }
            if (character.Type1 == Enums.PokemonType.Fire || character.Type2 == Enums.PokemonType.Fire) {
                character.Mobility[3] = true;
            }
            if ((character.Type1 == Enums.PokemonType.Flying || character.Type2 == Enums.PokemonType.Flying)
            && IsGroundImmune(character, map)) {
                character.Mobility[1] = true;
                character.Mobility[2] = true;
                character.Mobility[3] = true;
                character.Mobility[8] = true;
                //character.Mobility[5] = true;
            }
            if (character.Type1 == Enums.PokemonType.Ghost || character.Type2 == Enums.PokemonType.Ghost) {
                character.Mobility[1] = true;
                character.Mobility[2] = true;
                character.Mobility[3] = true;
                character.Mobility[4] = true;
                //character.Mobility[6] = true;
                //character.Mobility[7] = true;
            }

            if (character.Type1 == Enums.PokemonType.Ice || character.Type2 == Enums.PokemonType.Ice) {
                character.Mobility[5] = true;
            }

            if (character.Type1 == Enums.PokemonType.Bug || character.Type2 == Enums.PokemonType.Bug) {
                character.Mobility[6] = true;
            }

            if (character.Type1 == Enums.PokemonType.Grass || character.Type2 == Enums.PokemonType.Grass) {
                character.Mobility[7] = true;
            }

            if (character.VolatileStatus.GetStatus("Slip") != null) {
                character.Mobility[1] = true;
            }
            if (character.HasActiveItem(146)) {
                for (int i = 0; i < character.Mobility.Length; i++) {
                    character.Mobility[i] = true;
                }
            }
            if (character.VolatileStatus.GetStatus("SuperMobile") != null) {
                for (int i = 0; i < character.Mobility.Length; i++) {
                    character.Mobility[i] = true;
                }
            }

            if (HasAbility(character, "Levitate") || character.HasActiveItem(82)) {
                if (IsGroundImmune(character, map)) {
                    character.Mobility[1] = true;
                    character.Mobility[2] = true;
                    character.Mobility[3] = true;
                }
            }

            if (character.HasActiveItem(349)) {
                character.Mobility[1] = true;
            }

            if (character.HasActiveItem(805)) {
                character.Mobility[3] = true;
            }

            if (character.HasActiveItem(814)) {
                for (int i = 0; i < character.Mobility.Length; i++) {
                    character.Mobility[i] = false;
                }
            }

            if (character.CharacterType == Enums.CharacterType.Recruit) {
                PacketBuilder.AppendMobility(((Recruit)character).Owner, hitlist);
            }
            PacketHitList.MethodEnded(ref hitlist);
        }
开发者ID:MandL27,项目名称:Server,代码行数:89,代码来源:StatusScript.cs

示例6: RefreshCharacterSpeedLimit

        public static void RefreshCharacterSpeedLimit(ICharacter character, IMap map, PacketHitList hitlist)
        {
            PacketHitList.MethodStart(ref hitlist);
            //Movement Speed
            ExtraStatus status;

            int speed = 4;

            if (character.Species == 492 && character.Form == 1) {
                speed++;
            }

            if (character.HasActiveItem(118)) {
                speed -= 2;
            }

            if (character.HasActiveItem(111)) {
                speed -=1;
            }

            if ((GetCharacterWeather(character) == Enums.Weather.Snowing || GetCharacterWeather(character) == Enums.Weather.Snowstorm) && (character.Type1 == Enums.PokemonType.Ice || character.Type2 == Enums.PokemonType.Ice)) {
                speed++;
            }

            if (HasActiveBagItem(character, 3, -1, (int)GetCharacterWeather(character)) || HasActiveBagItem(character, 3, (int)GetCharacterWeather(character), -1)) {
                speed++;
            }

            //Type Gems
            if (character.HasActiveItem(598) && GetCharacterWeather(character) == Enums.Weather.Sunny) {
                speed++;
            }
            if (character.HasActiveItem(599) && GetCharacterWeather(character) == Enums.Weather.Cloudy) {
                speed++;
            }
            if (character.HasActiveItem(601) && (GetCharacterWeather(character) == Enums.Weather.None || GetCharacterWeather(character) == Enums.Weather.Ambiguous)) {
                speed++;
            }
            if (character.HasActiveItem(604) && (GetCharacterWeather(character) == Enums.Weather.None || GetCharacterWeather(character) == Enums.Weather.Ambiguous)) {
                speed++;
            }
            if (character.HasActiveItem(607) && GetCharacterWeather(character) == Enums.Weather.Sandstorm) {
                speed++;
            }
            if (character.HasActiveItem(608) && GetCharacterWeather(character) == Enums.Weather.Fog) {
                speed++;
            }

            if (HasAbility(character, "Speed Boost")) {
                speed++;
            }
            status = character.VolatileStatus.GetStatus("MovementSpeed");
            if (status != null) {
                speed += status.Counter;
            }

            if (character.StatusAilment == Enums.StatusAilment.Paralyze) {
                if (HasAbility(character, "Quick Feet")) {
                    speed++;
                } else if (speed > 3) {

                    speed = 3;
                }
            } else if (character.StatusAilment != Enums.StatusAilment.OK) {
                if (HasAbility(character, "Quick Feet")) {
                    speed++;
                }
            }

            if (speed > 6) speed = 6;
            if (speed < 1) speed = 1;

            if (map != null
            && (map.Moral == Enums.MapMoral.None || map.Moral == Enums.MapMoral.NoPenalty
            || (character.X >= 0 && character.X <= map.MaxX
            && character.Y >= 0 && character.Y <= map.MaxY
            && map.Tile[character.X, character.Y].Type == Enums.TileType.Arena))) {
                character.SpeedLimit = (Enums.Speed)speed;

            } else {
                character.SpeedLimit = Enums.Speed.Running;
            }

            if (character.VolatileStatus.GetStatus("Immobilize") != null ||
                character.VolatileStatus.GetStatus("Ingrain") != null ||
                character.VolatileStatus.GetStatus("FireSpin") != null ||
                character.VolatileStatus.GetStatus("Whirlpool") != null ||
                character.VolatileStatus.GetStatus("Infestation") != null ||
                character.VolatileStatus.GetStatus("SandTomb") != null ||
                character.VolatileStatus.GetStatus("MagmaStorm") != null ||
                character.VolatileStatus.GetStatus("Bind:0") != null ||
                character.VolatileStatus.GetStatus("Clamp:0") != null ||
                character.VolatileStatus.GetStatus("Wrap:0") != null ||
                character.VolatileStatus.GetStatus("SkyDrop:0") != null ||
                character.VolatileStatus.GetStatus("Bind:1") != null ||
                character.VolatileStatus.GetStatus("Clamp:1") != null ||
                character.VolatileStatus.GetStatus("Wrap:1") != null ||
                character.VolatileStatus.GetStatus("SkyDrop:1") != null ||
                character.VolatileStatus.GetStatus("SolarBeam") != null ||
                character.VolatileStatus.GetStatus("RazorWind") != null ||
//.........这里部分代码省略.........
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:StatusScript.cs

示例7: IsGroundImmune

        public static bool IsGroundImmune(ICharacter character, IMap map)
        {
            bool immune = false;
            if (character.Type1 == Enums.PokemonType.Flying || character.Type2 == Enums.PokemonType.Flying) {
                immune = true;
            }
            if (character.VolatileStatus.GetStatus("Roost") != null) {
                immune = false;
            }
            if (HasAbility(character, "Levitate")) {
                immune = true;
            }
            if (character.VolatileStatus.GetStatus("MagnetRise") != null) {
                immune = true;
            }
            if (character.VolatileStatus.GetStatus("Telekinesis") != null) {
                immune = true;
            }
            if (character.HasActiveItem(82)) {
                immune = true;
            }

            if (character.HasActiveItem(111)) {
                immune = false;
            }

            if (character.VolatileStatus.GetStatus("Grounded") != null) {
                immune = false;
            }
            if (map != null && map.TempStatus.GetStatus("Gravity") != null) {
                immune = false;
            }
            return immune;
        }
开发者ID:MandL27,项目名称:Server,代码行数:34,代码来源:StatusScript.cs

示例8: RefreshCharacterDarkness

        public static void RefreshCharacterDarkness(ICharacter character, IMap map, PacketHitList hitlist)
        {
            PacketHitList.MethodStart(ref hitlist);
            //sight range
            character.Darkness = -2;

            if (map != null && map.Darkness >= 0 && map.Darkness < 7 && HasAbility(character, "Keen Eye")) {
                character.Darkness = 7;
            }

            if (character.HasActiveItem(66)) {
                character.Darkness = -1;
            }
            if (character.HasActiveItem(348)) {
                character.Darkness = 0;
            }

            if (character.VolatileStatus.GetStatus("Blind") != null) {
                character.Darkness = 0;
            }

            if (character.CharacterType == Enums.CharacterType.Recruit) {
                PacketBuilder.AppendDarkness(((Recruit)character).Owner, hitlist);
            }
            PacketHitList.MethodEnded(ref hitlist);
        }
开发者ID:MandL27,项目名称:Server,代码行数:26,代码来源:StatusScript.cs

示例9: BlowBack

 public static void BlowBack(ICharacter character, IMap map, Enums.Direction dir, PacketHitList hitlist)
 {
     if (HasAbility(character, "Suction Cups")) {
         hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Suction Cups prevented it from being blown back!", Text.WhiteSmoke), character.X, character.Y, 10);
     } else if (character.HasActiveItem(111)) {
         hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s Iron Ball prevented it from being blown back!", Text.WhiteSmoke), character.X, character.Y, 10);
     } else {
         WarpToNearestWall(character, map, dir, hitlist);
         hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " was blown back!", Text.WhiteSmoke), character.X, character.Y, 10);
     }
 }
开发者ID:pzaps,项目名称:Server,代码行数:11,代码来源:MapInteractions.cs

示例10: CheckStatusProtection

        public static bool CheckStatusProtection(ICharacter character, ICharacter attacker, IMap map, string status, string tag, bool msg, PacketHitList hitlist)
        {
            try {
            PacketHitList.MethodStart(ref hitlist);
            ExtraStatus checkStatus;
            string[] statusParam = status.Split(':');

            //if (statusParam[0] == "Confusion" && statusParam[1].ToInt() <= 0) {
            //    if (character.CharacterType == Enums.CharacterType.Recruit && ((Recruit)character).Owner.Player.Confusion <= 0) {
            //        PacketHitList.MethodEnded(ref hitlist);
            //        return true;
            //    } else if (character.CharacterType == Enums.CharacterType.MapNpc && !((MapNpc)character).Confused) {
            //        PacketHitList.MethodEnded(ref hitlist);
            //        return true;
            //    }

            //    if (character.HasActiveItem(347)) {
            //        if (msg) {
            //            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " can't recover from confusion due to the Blight Clay!", Text.BrightRed), character.X, character.Y, 10);
            //        }
            //        PacketHitList.MethodEnded(ref hitlist);
            //        return true;
            //    }
            //}

            if (IsStatusBad(status)) {
                if (character.VolatileStatus.GetStatus("Safeguard") != null && (attacker == null || !(HasAbility(attacker, "Infiltrator") || HasActiveBagItem(attacker, 7, 0, 0)))) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by Safeguard!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;
                        }
                        //pokemon specific item
                        if (HasActiveBagItem(character, 4, -1, (int)GetCharacterWeather(character)) || HasActiveBagItem(character, 4, (int)GetCharacterWeather(character), -1) || HasActiveBagItem(character, 29, 0, 0)) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by its item!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;
                        }

                        //Type Gems
                        if (character.HasActiveItem(595) && GetCharacterWeather(character) == Enums.Weather.Cloudy) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the White Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(596) && GetCharacterWeather(character) == Enums.Weather.Sunny) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Fiery Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(597) && (GetCharacterWeather(character) == Enums.Weather.Raining || GetCharacterWeather(character) == Enums.Weather.Thunder)) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Aqua Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(600) && GetCharacterWeather(character) == Enums.Weather.Hail) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Icy Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(602) && GetCharacterWeather(character) == Enums.Weather.Cloudy) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Poison Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(603) && GetCharacterWeather(character) == Enums.Weather.Sandstorm) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Earth Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(605) && GetCharacterWeather(character) == Enums.Weather.Fog) {
                            if (msg) {
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + " is protected by the Psyche Gem!", Text.BrightCyan), character.X, character.Y, 10);
                            }
                            PacketHitList.MethodEnded(ref hitlist);
                            return true;

                        }
                        if (character.HasActiveItem(606) && (GetCharacterWeather(character) == Enums.Weather.None || GetCharacterWeather(character) == Enums.Weather.Ambiguous)) {
//.........这里部分代码省略.........
开发者ID:MandL27,项目名称:Server,代码行数:101,代码来源:StatusScript.cs

示例11: WillTrapActivate

        public static bool WillTrapActivate(ICharacter character, IMap map, int x, int y)
        {
            Tile tile = map.Tile[x, y];
            bool willActivate = true;

            if (character.CharacterType == Enums.CharacterType.MapNpc) {
                if (tile.String1 == "") willActivate = false;

                if (NpcManager.Npcs[((MapNpc)character).Num].Behavior == Enums.NpcBehavior.Friendly) willActivate = false;

            } else if (character.CharacterType == Enums.CharacterType.Recruit) {
                if (((Recruit)character).Owner.Player.CharID == tile.String1) {
                    willActivate = false;
                } else if (!string.IsNullOrEmpty(((Recruit)character).Owner.Player.GuildName) && ((Recruit)character).Owner.Player.GuildName == tile.String2) {
                    willActivate = false;
                } else if (((Recruit)character).Owner.Player.IsInParty()) {
                    Server.Players.Parties.Party party = PartyManager.FindPlayerParty(((Recruit)character).Owner);
                    if (party != null) {
                        if (party.IsPlayerInParty(tile.String1)) {
                            willActivate = false;
                        }
                    }
                }

                //if (((Recruit)character).Owner.Player.PK) willActivate = true;
            }

            if (character.HasActiveItem(142)) willActivate = false;

            return willActivate;
        }
开发者ID:pzaps,项目名称:Server,代码行数:31,代码来源:MapInteractions.cs

示例12: RandomWarp

        public static void RandomWarp(ICharacter character, IMap warpMap, bool msg, PacketHitList hitlist, int startX, int endX, int startY, int endY)
        {
            if (HasAbility(character, "Suction Cups")) {
                if (msg) {
                    hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Suction Cups prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
                }
            } else if (character.HasActiveItem(111)) {
                if (msg) {
                    hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Iron Ball prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
                }
            } else {
                PacketHitList.MethodStart(ref hitlist);

                if (startX < 0) startX = 0;
                if (startX > warpMap.MaxX) startX = warpMap.MaxX;
                if (endX < 0) endX = 0;
                if (endX > warpMap.MaxX) endX = warpMap.MaxX;
                if (startY < 0) startY = 0;
                if (startY > warpMap.MaxY) startY = warpMap.MaxY;
                if (endY < 0) endY = 0;
                if (endY > warpMap.MaxY) endY = warpMap.MaxY;

                int x, y;

                FindFreeTile(warpMap, startX, startY, endX, endY, out x, out y);

                if (x == -1) {
                    if (msg) {
                        hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + " didn't warp.", Text.BrightRed), character.X, character.Y, 10);
                    }
                } else {
                    PointWarp(character, warpMap, hitlist, x, y);
                }
                PacketHitList.MethodEnded(ref hitlist);
            }
        }
开发者ID:pzaps,项目名称:Server,代码行数:36,代码来源:MapInteractions.cs

示例13: PointWarp

        public static void PointWarp(ICharacter character, IMap warpMap, PacketHitList hitlist, int X, int Y, bool msg)
        {
            if (HasAbility(character, "Suction Cups")) {
                if (msg) {
                    hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Suction Cups prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
                }
            } else if (character.HasActiveItem(111)) {
                if (msg) {
                    hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + "'s Iron Ball prevented it from being warped!", Text.WhiteSmoke), character.X, character.Y, 10);
                }
            } else {
                PacketHitList.MethodStart(ref hitlist);

                if (msg) {
                    hitlist.AddPacketToMap(warpMap, PacketBuilder.CreateBattleMsg(character.Name + " warped!", Text.WhiteSmoke), character.X, character.Y, 10);
                }

                character.X = X;
                character.Y = Y;

                if (character.CharacterType == Enums.CharacterType.Recruit) {
                    PacketBuilder.AppendPlayerXY(((Recruit)character).Owner, hitlist);
                } else if (character.CharacterType == Enums.CharacterType.MapNpc) {
                    PacketBuilder.AppendNpcXY(warpMap, hitlist, ((MapNpc)character).MapSlot);
                }

                PacketHitList.MethodEnded(ref hitlist);
            }
        }
开发者ID:pzaps,项目名称:Server,代码行数:29,代码来源:MapInteractions.cs

示例14: OnStep

        public static void OnStep(IMap map, ICharacter character, Enums.Speed speed, PacketHitList hitlist)
        {
            try {
                ExtraStatus status;
                PacketHitList.MethodStart(ref hitlist);
                if (speed != Enums.Speed.Slip) {
                    int stepCounter;
                    if (character.CharacterType == Enums.CharacterType.Recruit) {

                        ((Recruit)character).Owner.Player.HPStepCounter++;
                        if (((Recruit)character).Owner.Player.Map.HungerEnabled) {
                            if (character.HasActiveItem(151)) {
                                ((Recruit)character).Owner.Player.BellyStepCounter += 5;
                            } else if (character.HasActiveItem(152)) {
                                //nothing
                            } else if (character.HasActiveItem(162)) {
                                ((Recruit)character).Owner.Player.BellyStepCounter += 20;
                            } else {
                                ((Recruit)character).Owner.Player.BellyStepCounter += 10;
                            }
                            if (HasAbility(character, "Gluttony")) {
                                ((Recruit)character).Owner.Player.BellyStepCounter += 10;
                            }
                        }
                        stepCounter = ((Recruit)character).Owner.Player.HPStepCounter;
                        ElectrostasisTower.OnPlayerStep(((Recruit)character).Owner);

                        if (stepCounter % 5 == 0) {
                            if (map.MapID == MapManager.GenerateMapID(737)) {
                                bool hasBeenWelcomed = ((Recruit)character).Owner.Player.StoryHelper.ReadSetting("[Gameplay]-HasBeenWelcomed").ToBool();
                                if (!hasBeenWelcomed) {
                                    hitlist.AddPacketToMap(map, PacketBuilder.CreateChatMsg(((Recruit)character).Owner.Player.Name + " is new to " + Settings.GameNameShort + "! Welcome!", Text.BrightGreen));
                                    ((Recruit)character).Owner.Player.StoryHelper.SaveSetting("[Gameplay]-HasBeenWelcomed", "True");
                                }
                            }
                        }
                    } else {
                        ((MapNpc)character).HPStepCounter++;
                        stepCounter = ((MapNpc)character).HPStepCounter;
                    }

                    if (MapManager.IsMapActive(character.MapID)) {

                        RemoveExtraStatus(character, map, "Roost", hitlist);
                        RemoveExtraStatus(character, map, "Endure", hitlist);
                        RemoveExtraStatus(character, map, "DestinyBond", hitlist);
                        status = character.VolatileStatus.GetStatus("Rage");
                        if (status != null) {
                            status.Counter--;
                            if (status.Counter <= 0) {
                                RemoveExtraStatus(character, map, "Rage", hitlist);
                            }
                        }
                        status = character.VolatileStatus.GetStatus("MetalBurst");
                        if (status != null) {
                            status.Counter--;
                            if (status.Counter <= 0) {
                                RemoveExtraStatus(character, map, "MetalBurst", hitlist);
                            }
                        }
                        //if (character.VolatileStatus.GetStatus("Taunt") != null) {
                        //	character.VolatileStatus.GetStatus("Taunt").Counter--;
                        //	if (character.VolatileStatus.GetStatus("Taunt").Counter <= 0) {
                        //		RemoveExtraStatus(character, map, "Taunt", hitlist);
                        //	}
                        //}

                        Tile steppedTile = map.Tile[character.X, character.Y];
                        if (steppedTile.Type == Enums.TileType.MobileBlock) {
                            if (steppedTile.Data1 % 32 >= 16) {
                                if (character.CharacterType == Enums.CharacterType.Recruit) {
                                    if (((Recruit)character).Owner.Player.Map.HungerEnabled && character.VolatileStatus.GetStatus("SuperMobile") == null) {
                                        ((Recruit)character).Owner.Player.BellyStepCounter += 400;
                                    }
                                }
                            } else if (steppedTile.Data1 % 4 >= 2) {
                                if (steppedTile.String1 == "1") {
                                    if (!CheckStatusProtection(character, map, Enums.StatusAilment.Burn.ToString(), false, hitlist)) {
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's boiling hot!", Text.BrightRed), character.X, character.Y, 10);
                                        SetStatusAilment(character, map, Enums.StatusAilment.Burn, 0, hitlist);
                                    }
                                } else if (steppedTile.String1 == "2") {
                                    if (!CheckStatusProtection(character, map, Enums.StatusAilment.Freeze.ToString(), false, hitlist)) {
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's freezing cold!", Text.BrightRed), character.X, character.Y, 10);
                                        SetStatusAilment(character, map, Enums.StatusAilment.Freeze, 0, hitlist);
                                    }
                                } else if (steppedTile.String1 == "3") {
                                    if (!CheckStatusProtection(character, map, Enums.StatusAilment.Paralyze.ToString(), false, hitlist)) {
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water is numbing!", Text.BrightRed), character.X, character.Y, 10);
                                        SetStatusAilment(character, map, Enums.StatusAilment.Paralyze, 0, hitlist);
                                    }
                                } else if (steppedTile.String1 == "4") {
                                    if (!CheckStatusProtection(character, map, Enums.StatusAilment.Poison.ToString(), false, hitlist)) {
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water's poisoned!", Text.BrightRed), character.X, character.Y, 10);
                                        SetStatusAilment(character, map, Enums.StatusAilment.Poison, 1, hitlist);
                                    }
                                } else if (steppedTile.String1 == "5") {
                                    if (!CheckStatusProtection(character, map, Enums.StatusAilment.Sleep.ToString(), false, hitlist)) {
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("The water is oddly calming...", Text.BrightRed), character.X, character.Y, 10);
                                        SetStatusAilment(character, map, Enums.StatusAilment.Sleep, 3, hitlist);
//.........这里部分代码省略.........
开发者ID:pzaps,项目名称:Server,代码行数:101,代码来源:MapInteractions.cs

示例15: Sticky

        private static void Sticky(ICharacter character, IMap map, PacketHitList hitlist)
        {
            PacketHitList.MethodStart(ref hitlist);
            if (character.HasActiveItem(421)) {
                hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s No-Stick Cap prevented any items from becoming sticky!", Text.WhiteSmoke), character.X, character.Y, 10);
            } else {

                if (character.CharacterType == Enums.CharacterType.Recruit) {
                    Client client = ((Recruit)character).Owner;
                    List<int> itemsToCheck = new List<int>();
                    for (int i = 1; i <= client.Player.MaxInv; i++) {
                        if (client.Player.Inventory[i].Num > 0 && !client.Player.Inventory[i].Sticky) {
                            itemsToCheck.Add(i);
                        }
                    }
                    if (itemsToCheck.Count > 0) {
                        int stickySlot = itemsToCheck[Server.Math.Rand(0, itemsToCheck.Count)];
                        if (client.Player.Inventory[stickySlot].Num > 0 && !client.Player.Inventory[stickySlot].Sticky) {
                            client.Player.SetItemSticky(stickySlot, true);
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s " + ItemManager.Items[client.Player.Inventory[stickySlot].Num].Name + " became sticky!", Text.BrightRed), character.X, character.Y, 10);
                        } else {
                            hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
                        }
                    } else {
                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
                    }
                } else if (character.CharacterType == Enums.CharacterType.MapNpc) {
                    MapNpc npc = character as MapNpc;
                    if (npc.HeldItem != null && !npc.HeldItem.Sticky) {
                        npc.HeldItem.Sticky = true;
                        if (npc.ActiveItems.Contains(npc.HeldItem.Num)) {
                            npc.RemoveFromActiveItemList(npc.HeldItem.Num);
                        }
                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg(character.Name + "'s " + ItemManager.Items[npc.HeldItem.Num].Name + " became sticky!", Text.BrightRed), character.X, character.Y, 10);
                    } else {
                        hitlist.AddPacketToMap(map, PacketBuilder.CreateBattleMsg("Nothing particularly bad happened to " + character.Name + "...", Text.Blue), character.X, character.Y, 10);
                    }
                }
            }
            PacketHitList.MethodEnded(ref hitlist);
        }
开发者ID:MandL27,项目名称:Server,代码行数:41,代码来源:Main.cs


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