public ActiveNpcCollection(DataManager.Maps.MapDump rawMap)
 {
     this.rawMap = rawMap;
     mapNpcs = new MapNpc[rawMap.ActiveNpc.Length];
     for (int i = 0; i < mapNpcs.Length; i++) {
         mapNpcs[i] = new MapNpc(rawMap.MapID, rawMap.ActiveNpc[i]);
     }
 }
Example #2
0
 public ActiveNpcCollection(DataManager.Maps.MapDump rawMap)
 {
     this.rawMap = rawMap;
     mapNpcs     = new MapNpc[rawMap.ActiveNpc.Length];
     for (int i = 0; i < mapNpcs.Length; i++)
     {
         mapNpcs[i] = new MapNpc(rawMap.MapID, rawMap.ActiveNpc[i]);
     }
 }
Example #3
0
        public Recruit CreateRecruitFromNpc(MapNpc npc)
        {
            Recruit recruit = new Recruit(client);

            recruit.Name = npc.Name;
            recruit.Species = npc.Species;
            recruit.Form = npc.Form;
            recruit.Sex = npc.Sex;

            if (npc.Level <= 0) {
                recruit.Level = 1;//NpcRec.RecruitLevel;
            } else {
                recruit.Level = npc.Level;
            }
            recruit.Exp = 0;
            recruit.IQ = 0;
            recruit.NpcBase = npc.Num;
            recruit.AtkBonus = npc.AtkBonus;
            recruit.DefBonus = npc.DefBonus;
            recruit.SpclAtkBonus = npc.SpclAtkBonus;
            recruit.SpclDefBonus = npc.SpclDefBonus;
            recruit.SpdBonus = npc.SpdBonus;
            recruit.MaxHPBonus = npc.MaxHPBonus;
            for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) {
                recruit.Moves[i].MoveNum = npc.Moves[i].MoveNum;
                recruit.Moves[i].MaxPP = npc.Moves[i].MaxPP;
            }

            return recruit;
        }
Example #4
0
        internal void AddToRequested(MapNpc npc)
        {
            if (requestedRecruit == null) {
                requestedRecruit = new Recruit(client);
            }
            requestedRecruit = CreateRecruitFromNpc(npc);
            //requestedRecruit.Name = npc.Name;
            //requestedRecruit.Species = npc.Species;
            //requestedRecruit.Form = npc.Form;
            //requestedRecruit.Sex = npc.Sex;
            Pokedex.PokemonForm pokemon = Pokedex.Pokedex.GetPokemonForm(npc.Species, npc.Form);

            //if (npc.Level <= 0) {
            //    requestedRecruit.Level = 1;//NpcRec.RecruitLevel;
            //} else {
            //    requestedRecruit.Level = npc.Level;
            //}
            //requestedRecruit.Exp = 0;
            //requestedRecruit.IQ = 0;
            //requestedRecruit.NpcBase = npc.Num;
            //requestedRecruit.AtkBonus = npc.AtkBonus;
            //requestedRecruit.DefBonus = npc.DefBonus;
            //requestedRecruit.SpclAtkBonus = npc.SpclAtkBonus;
            //requestedRecruit.SpclDefBonus = npc.SpclDefBonus;
            //requestedRecruit.SpdBonus = npc.SpdBonus;
            //requestedRecruit.MaxHPBonus = npc.MaxHPBonus;
            //for (int i = 0; i < Constants.MAX_PLAYER_MOVES; i++) {
            //    requestedRecruit.Moves[i].MoveNum = npc.Moves[i].MoveNum;
            //    requestedRecruit.Moves[i].MaxPP = npc.Moves[i].MaxPP;
            //}

            Hunted = false;
            if (pokemon != null) {
                Messenger.AskQuestion(client, "RecruitPokemon", requestedRecruit.Name + " wants to join your team! Will you accept it?", requestedRecruit.Species);
            } else {
                Messenger.AskQuestion(client, "RecruitPokemon", requestedRecruit.Name + " wants to join your team! Will you accept it?", -1);
            }
        }
Example #5
0
 public void ClearActiveNpc(int npcSlot)
 {
     ActiveNpc[npcSlot] = new MapNpc(MapID, npcSlot);
 }
Example #6
0
        public static void OnNpcDeath(PacketHitList hitlist, ICharacter attacker, MapNpc npc)
        {
            try {
                // Called when a npc faints
                PacketHitList.MethodStart(ref hitlist);

                hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg(npc.Name + " fainted!", Text.WhiteSmoke), npc.X, npc.Y, 10);

                //aftermath
                if (HasAbility(npc, "Aftermath")) {
                    bool explode = true;
                    if (!HasAbility(npc, "Mold Breaker")) {
                        TargetCollection checkedTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, MapManager.RetrieveActiveMap(npc.MapID), null, 0, 0, Enums.Direction.Up, true, true, false);
                        for (int i = 0; i < checkedTargets.Count; i++) {
                            if (HasAbility(checkedTargets[i], "Damp")) {
                                explode = false;
                            }
                        }
                    }

                    if (explode) {
                        hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg(npc.Name + " exploded!", Text.BrightRed), npc.X, npc.Y, 10);
                        hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSoundPacket("magic216.wav"), npc.X, npc.Y, 10);
                        for (int i = npc.X - 1; i <= npc.X + 1; i++) {
                            for (int j = npc.Y - 1; j <= npc.Y + 1; j++) {
                                if (i < 0 || j < 0 || i > MapManager.RetrieveActiveMap(npc.MapID).MaxX || j > MapManager.RetrieveActiveMap(npc.MapID).MaxY) {

                                } else {
                                    hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSpellAnim(497, i, j));
                                }
                            }
                        }

                            TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Room, 1, MapManager.RetrieveActiveMap(npc.MapID), npc, npc.X, npc.Y, Enums.Direction.Up, true, true, false);
                            for (int i = 0; i < targets.Count; i++) {
                                if (MapManager.RetrieveActiveMap(npc.MapID).Moral == Enums.MapMoral.None) {
                                if (targets[i].HP > 0) {
                                    if (HasActiveBagItem(targets[i], 6, 0, 0)) {
                                        DamageCharacter(targets[i], MapManager.RetrieveActiveMap(targets[i].MapID), 1, Enums.KillType.Tile, hitlist, true);
                                    } else {
                                        DamageCharacter(targets[i], MapManager.RetrieveActiveMap(targets[i].MapID), targets[i].MaxHP / 4, Enums.KillType.Tile, hitlist, true);
                                    }
                                }
                                }
                            }

                    } else {
                        hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSoundPacket("magic320.wav"), npc.X, npc.Y, 10);
                        hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateSpellAnim(505, npc.X, npc.Y));
                        hitlist.AddPacketToMap(MapManager.RetrieveActiveMap(npc.MapID), PacketBuilder.CreateBattleMsg("The damp conditions prevented an explosion!", Text.Blue), npc.X, npc.Y, 10);
                    }
                }

                //death flag
                TargetCollection witnesses = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, MapManager.RetrieveActiveMap(npc.MapID), npc, 0, 0, Enums.Direction.Up, false, true, false);
                for (int i = 0; i < witnesses.Count; i++) {
                    AddExtraStatus(witnesses[i], MapManager.RetrieveActiveMap(npc.MapID), "SawAllyFaint", 0, null, "", hitlist);
                }

                RemoveAllBondedExtraStatus(npc, MapManager.RetrieveActiveMap(npc.MapID), hitlist, false);
                IMap map = MapManager.RetrieveActiveMap(npc.MapID);
                Client client = null;
                foreach (Client n in map.GetClients()) {
                                client = n;
                                break;
                            }

                if (client != null) {

                    bool doBossCheck = false;

                    switch (npc.Num) {
                    /*
                        case 276:
                        case 277:
                        case 278: { //Dynamo Trio
                                map.RemoveNpc(npc.MapSlot);
                                if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3)) {
                                    map.Tile[9, 1].Mask = 96;
                                    map.Tile[9, 1].MaskSet = 4;
                                    map.Tile[9, 1].Type = Enums.TileType.Scripted;
                                    map.Tile[9, 1].Data1 = 46;
                                    map.Tile[9, 1].Data2 = 0;
                                    map.Tile[9, 1].Data3 = 0;
                                    map.Tile[9, 1].String1 = "19";
                                    map.Tile[9, 1].String2 = "1";
                                    map.Tile[9, 1].String3 = "10:7";
                                    hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 1, map));
                                }
                            }
                            break;
                        */
                        case 304: {//registeel
                                map.RemoveNpc(npc.MapSlot);
                                if (map.IsNpcSlotEmpty(5)) {
                                    BossBattles.EndRegisteelBattle(client);
                                }
                            }
                            break;/*
                        case 305: {//bronzong
                                map.RemoveNpc(npc.MapSlot);
                                if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && (npc.MapSlot == 1 || npc.MapSlot == 2)) {
                                    if (client.Player.GetStoryState(43) == true) {
                                        client.Player.SetStoryState(43, false);
                                    }
                                    StoryManager.PlayStory(client, 43);
                                } else if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3) && map.IsNpcSlotEmpty(4)) {
                                    if (client.Player.GetStoryState(56) == true) {
                                        client.Player.SetStoryState(56, false);
                                    }
                                    StoryManager.PlayStory(client, 56);
                                }
                            }
                            break;*/
                        case 220: {//Murkrow minions 2.0
                                if (map.IsNpcSlotEmpty(14)) {
                                    map.RemoveNpc(npc.MapSlot);
                                }

                                for (int i = 1; i < 14; i++) {
                                    if (map.IsNpcSlotEmpty(i) == false) {
                                        return;
                                    }
                                }
                                StoryManager.PlayStory(client, 160);
                            }
                            break;
                        case 221: {//Honchkrow
                                map.RemoveNpc(npc.MapSlot);
                                for (int i = 1; i < 14; i++) {
                                    if (map.IsNpcSlotEmpty(i) == false) {
                                        map.RemoveNpc(i);
                                    }
                                }
                                StoryManager.PlayStory(client, 161);
                            }
                            break;
                        case 224: {//Murkrow minions
                                map.RemoveNpc(npc.MapSlot);
                                for (int i = 1; i < 14; i++) {
                                    if (map.IsNpcSlotEmpty(i) == false) {
                                        return;
                                    }
                                }
                                StoryManager.PlayStory(client, 160);
                            }
                            break;
                        case 259:
                        case 306: {
                                if (map.Name == "Iceberg Cave") {
                                    map.RemoveNpc(npc.MapSlot);
                                    if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3)) {
                                        BossBattles.EndRegiceBattle(client);
                                    }
                                }
                            }
                            break;
                        //case 177: {
                        //    map.RemoveNpc(npc.MapSlot);
                        //    if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3) && map.IsNpcSlotEmpty(4) &&
                        //    map.IsNpcSlotEmpty(5) && map.IsNpcSlotEmpty(6) && map.IsNpcSlotEmpty(7)) {
                        //        BossBattles.RemoveLuxioTribe(client);
                        //    }
                        //}
                        //break;
                        case 167: {
                                //map.RemoveNpc(npc.MapSlot);
                                //if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3) && map.IsNpcSlotEmpty(4) &&
                                //map.IsNpcSlotEmpty(5) && map.IsNpcSlotEmpty(6) && map.IsNpcSlotEmpty(7)) {
                                //    BossBattles.RemoveLuxioTribe(client);
                                //}
                            }
                            break;
                            /*
                        case 465: {
                                map.RemoveNpc(1);
                                map.Tile[9, 4].Type = Enums.TileType.Scripted;
                                map.Tile[9, 4].Data1 = 46;
                                map.Tile[9, 4].Data2 = 0;
                                map.Tile[9, 4].Data3 = 0;
                                map.Tile[9, 4].String1 = "15";
                                map.Tile[9, 4].String2 = "93";
                                map.Tile[9, 4].String3 = "8:10";
                                map.Tile[9, 4].Mask = 96;
                                map.Tile[9, 4].MaskSet = 4;
                                hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 4, map));
                            }
                            break;
                            */
                        //case 212: {//fake Gengar (adjust for the actual NPC number)
                        //        if (map.MapType == Enums.MapType.RDungeonMap) {
                        //           int num = (map as RDungeonMap).RDungeonIndex;
                        //            if ((num + 1) == 20) {
                        //                StoryManager.PlayStory(client, 287);
                        //                StoryManager.PlayStory(client, 288);
                        //                StoryManager.PlayStory(client, 289);
                        //                StoryManager.PlayStory(client, 286);
                        //                StoryManager.PlayStory(client, 290);
                        //                StoryManager.PlayStory(client, 291);
                        //                StoryManager.PlayStory(client, 292);
                        //            }
                        //        }

                        //    }
                        //    break;
                        //case 804: {//real gengar defeated
                        //        map.RemoveNpc(npc.MapSlot);
                        //        for (int i = 2; i <= 3; i++) {
                        //            if (map.IsNpcSlotEmpty(i) == false) {
                        //                map.RemoveNpc(i);
                        //            }
                        //        }
                        //        map.SetAttribute(8, 4, Enums.TileType.Scripted, 36, 0, 0, "19", "1", "");
                        //        map.SetAttribute(9, 10, Enums.TileType.Scripted, 13, 0, 0, "", "", "");
                        //        map.SetAttribute(10, 10, Enums.TileType.Scripted, 13, 0, 0, "", "", "");
                        //        map.SetAttribute(8, 5, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
                        //        map.SetAttribute(13, 6, Enums.TileType.Notice, 0, 0, 0, "You hesitate...", "It's probably a good idea not to sleep here again...", "");
                        //        StoryManager.PlayStory(client, 285);
                        //    }
                        //    break;
                        //case 806:
                        //case 807: {//rotom forms
                        //        map.RemoveNpc(npc.MapSlot);
                        //        map.SetAttribute(9, 10, Enums.TileType.Scripted, 13, 0, 0, "", "", "");
                        //        map.SetAttribute(10, 10, Enums.TileType.Scripted, 13, 0, 0, "", "", "");
                        //        Messenger.PlayerMsg(client, "The exit was opened!", Text.Yellow);
                        //    }
                        //    break;
                        case 805: {//spiritomb defeated
                                map.RemoveNpc(npc.MapSlot);
                                map.SetAttribute(9, 2, Enums.TileType.Scripted, 36, 0, 0, "21", "30", "");
                                map.SetTile(9, 2, 96, 4, 1);
                                StoryManager.PlayStory(client, 303);
                            }
                            break;
                            /*
                        case 440: {//Articuno*
                                map.RemoveNpc(1);
                                map.SetTile(12, 5, 96, 4, 1);
                                map.SetAttribute(12, 5, Enums.TileType.Scripted, 46, 0, 0, "20", "342", "13:13");
                                StoryManager.PlayStory(client, 171);
                            }
                            break;
                            */
                        case 404: {//Heatran
                                map.RemoveNpc(1);
                                map.SetTile(10, 6, 96, 4, 3);
                                map.SetAttribute(10, 6, Enums.TileType.Scripted, 46, 0, 0, "18", "1313", "12:12");
                                //NetScript.PlayStory(index, 171);
                            }
                            break;
                        case 579:
                        case 558:
                        case 559:
                        case 560:
                        case 571:
                        case 572:
                        case 854:
                        case 855:
                        case 856:
                        case 857:
                        case 858:
                        case 859:
                        case 860:
                        case 861:
                        case 862:
                        case 863: { //normal PBA enemies + boss
                                if (map.Name == "Pitch-Black Pit") {
                                    int remainingEnemies = 0;
                                    for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) {
                                        if (!map.IsNpcSlotEmpty(i)) remainingEnemies++;
                                    }
                                    if (remainingEnemies <= 1) {
                                        BossBattles.EndBossBattle(client, "Pitch-Black Pit");
                                    }
                                } else PitchBlackAbyss.UnlockRoom(client, map);
                            }
                            break;
                        case 139: {
                                BossBattles.EndBossBattle(client, "ThunderstormForest");
                            }
                            break;
                        case 177: {
                                BossBattles.EndBossBattle(client, "ThunderstormForestPart2");
                            }
                            break;
                            /*
                        case 588:
                        case 587: { // EST Boss A Wave 1
                                if (map.Name == "Electrostasis Tower Chamber") {
                                    map.RemoveNpc(npc.MapSlot);
                                    if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3) && map.IsNpcSlotEmpty(4) &&
                                        (npc.MapSlot == 1 || npc.MapSlot == 2 || npc.MapSlot == 3 || npc.MapSlot == 4)) {

                                        map.SetTile(4, 12, 0, 0, 1);
                                        map.SetAttribute(4, 12, Enums.TileType.Walkable, 0, 0, 0, "", "", "");
                                        map.SetAttribute(9, 12, Enums.TileType.Story, 201, 0, 0, "", "", "");

                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(4, 12, map));
                                        hitlist.AddPacketToMap(map, PacketBuilder.CreateTilePacket(9, 12, map));
                                    } else if (map.IsNpcSlotEmpty(1) && map.IsNpcSlotEmpty(2) && map.IsNpcSlotEmpty(3) && map.IsNpcSlotEmpty(4) &&
                                                map.IsNpcSlotEmpty(5) && map.IsNpcSlotEmpty(6) && map.IsNpcSlotEmpty(7) &&
                                                (npc.MapSlot == 5 || npc.MapSlot == 6 || npc.MapSlot == 7)) {
                                        BossBattles.EndBossBattle(client, "ElectrostasisTowerA1");
                                    }
                                }
                            }
                            break;
                            */
                        case 963: {// Joey, Exbel Woods Clearing
                                int recruitIndex = -1;
                                using (DatabaseConnection dbConnection = new DatabaseConnection(DatabaseID.Players)) {
                                    recruitIndex = client.Player.AddToRecruitmentBank(dbConnection, client.Player.CreateRecruitFromNpc(npc));
                                }
                                int openSlot = client.Player.FindOpenTeamSlot();
                                if (recruitIndex != -1 && openSlot != -1) {

                                    client.Player.AddToTeam(recruitIndex, openSlot);
                                    client.Player.Team[openSlot].HP = client.Player.Team[openSlot].MaxHP;
                                    Messenger.BattleMsg(client, "You have recruited a new team member!", Text.BrightGreen);

                                    Messenger.SendActiveTeam(client);
                                } else {
                                    Messenger.BattleMsg(client, "You cant recruit! You have too many team members in the assembly!", Text.BrightRed);
                                }
                                doBossCheck = true;
                            }
                            break;
                        default: {
                                doBossCheck = true;
                            }
                            break;
                    }

                    if (doBossCheck) {
                        if (BossBattles.IsBossBattleMap(client)) {
                            int remainingEnemies = 0;
                            for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) {
                                if (!map.IsNpcSlotEmpty(i)) remainingEnemies++;
                            }
                            //Messenger.AdminMsg(remainingEnemies.ToString(), Text.Black);
                            if (remainingEnemies <= 1) BossBattles.EndBossBattle(client, map.Name);
                        }
                    }

                }

                PacketHitList.MethodEnded(ref hitlist);
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: OnNpcDeath", Text.Black);
                Messenger.AdminMsg("NPCNum: " + npc.Num, Text.Black);
            }
        }
Example #7
0
        public static int ScriptedRecruitBonus(Player player, MapNpc npc)
        {
            try
            {
                int bonus = 0;
                if (player.ExplorerRank >= Enums.ExplorerRank.MasterXXX)
                    bonus += 100;
                else if (player.ExplorerRank >= Enums.ExplorerRank.MasterXX)
                    bonus += 95;
                else if (player.ExplorerRank >= Enums.ExplorerRank.MasterX)
                    bonus += 90;
                else if (player.ExplorerRank >= Enums.ExplorerRank.Diamond)
                    bonus += 85;
                else if (player.ExplorerRank >= Enums.ExplorerRank.Gold)
                    bonus += 65;
                else if (player.ExplorerRank >= Enums.ExplorerRank.Silver)
                    bonus += 35;
                else if (player.ExplorerRank >= Enums.ExplorerRank.Bronze)
                    bonus += 15;

                bonus += player.GetActiveRecruit().Level;

                foreach (int itemNum in player.GetActiveRecruit().ActiveItems)
                {
                    bonus += ItemManager.Items[itemNum].RecruitBonus;
                }

                return bonus;
            }
            catch (Exception ex)
            {
                Messenger.AdminMsg("Error: ScriptedRecruitBonus", Text.Black);
                return 0;
            }
        }
Example #8
0
        public static void OnNpcSpawn(IMap map, MapNpcPreset npc, MapNpc spawnedNpc, PacketHitList hitlist)
        {
            try {
                if (spawnedNpc.Num == 0) return;
                bool listed = false;
                for (int i = 0; i < map.Npc.Count; i++) {
                    if (map.Npc[i].NpcNum == spawnedNpc.Num) {
                        listed = true;
                        break;
                    }
                }
                if (!listed && map.MapType == Enums.MapType.RDungeonMap) {
                    //Messenger.AdminMsg("[Admin] An unlisted NPC " + NpcManager.Npcs[spawnedNpc.Num].Name + " spawned on " + map.Name, Text.Red);
                    //map.ActiveNpc[spawnedNpc.MapSlot] = new MapNpc(map.MapID, spawnedNpc.MapSlot);
                    //hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("npcdead", spawnedNpc.MapSlot));
                }
                Client sprinko = ClientManager.FindClient("Sprinko");
                if (sprinko != null && sprinko.Player.Map == map) {
                    Messenger.PlayerMsg(sprinko, "Npc Spawned:" + spawnedNpc.Num, Text.Pink);

                }

                switch (spawnedNpc.Num) {
                    case 33:
                    case 230:
                    case 244:
                    case 245: {//friendly npcs
                            AddExtraStatus(spawnedNpc, map, "Immobilize", 0, null, "", hitlist, false);
                        }
                        break;
                    case 32: {//kecleon

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1233: {//hitmonchan

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1234: {//hitmonlee

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 340;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1235: {//hitmontop

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 480;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 306: {//regice
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 259);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 10;
                            spawnedNpc.SpDefBuff = 10;
                            spawnedNpc.MaxHPBonus = 550;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1401: {//Vespiquen (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 150;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1402: {//Roselia (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1403: {//Vileplume (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1404: {//Rhyperior (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 195;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1405: {//Golem (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 165;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1406: {//Rhydon (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 165;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1407: {//Lapras (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 335;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1408: {//Gorebyss (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 235;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1409: {//Huntail (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 215;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1410: {//Regice (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 150;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1411: {//Froslass (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1412: {//Beartic (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1413: {//Umbreon (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1414: {//Mogok (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 4;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1415: {//Silvan (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 5;
                            spawnedNpc.AttackBuff = 6;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1416: {//Erkenwald (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1417: {//Alistar (Boss Rush)

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1397: {//Vespiquen

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 325;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 177: {//Luxray

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1192: {//Entei
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 381);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1194: {//Suicune
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 382);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1193: {//Raikou
                            foreach (Client n in map.GetClients()) {
                                StoryManager.PlayStory(n, 380);
                            }
                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1195: {//Flareon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1196: {//Leafeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.MaxHPBonus = 385;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 7;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1197: {//Vaporeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 5;
                            spawnedNpc.MaxHPBonus = 425;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.SpeedBuff = 9;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1198: {//Glaceon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.AccuracyBuff = 3;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1199: {//Jolteon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.SpeedBuff = 9;
                            spawnedNpc.EvasionBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1200: {//Umbreon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 500;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1201: {//Espeon

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 1202: {//Ho-Oh

                            map.Npc.Remove(npc);
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.MaxHPBonus = 850;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.HP = spawnedNpc.MaxHP;

                        }
                        break;
                    case 806: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 807: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 434: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 422: {//rotom

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 886: {//lapras

                            spawnedNpc.MaxHPBonus = 550;
                            spawnedNpc.SpeedBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 397: {//golem

                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 578: {//froslass

                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpeedBuff = 7;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.EvasionBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1527: {//Nidoking

                            spawnedNpc.MaxHPBonus = 350;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1528: {//Nidoking

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.DefenseBuff = 3;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1529: {//Regirock

                            spawnedNpc.MaxHPBonus = 850;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1521: {//Steelix

                            spawnedNpc.MaxHPBonus = 255;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1523: {//Aggron

                            spawnedNpc.MaxHPBonus = 155;
                            spawnedNpc.SpDefBuff = 3;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1522: {//Golem

                            spawnedNpc.MaxHPBonus = 125;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1520: {//Crobat

                            spawnedNpc.MaxHPBonus = 100;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.AttackBuff = 3;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 389: {//rhyperior

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 145: {//mamoswine

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 381: {//rhydon

                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 640: {//huntail

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 641: {//gorebyss

                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 579: {//xatu

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 4;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 481: {//weepinbell

                            spawnedNpc.MaxHPBonus = 125;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpeedBuff = 3;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1220: {//Groundon

                            spawnedNpc.MaxHPBonus = 775;
                            spawnedNpc.SpeedBuff = 10;
                            spawnedNpc.SpDefBuff = 6;
                            spawnedNpc.DefenseBuff = 6;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1060: {//Abomsnow

                            spawnedNpc.MaxHPBonus = 400;
                            spawnedNpc.SpeedBuff = 1;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 480: {//vileplume

                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.SpAtkBuff = 2;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.SpeedBuff = 6;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1046: {//beartic
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.EvasionBuff = 1;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 4;
                        }
                        break;
                    case 1047: {//umbreon
                            spawnedNpc.MaxHPBonus = 450;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.DefenseBuff = 4;
                            spawnedNpc.SpDefBuff = 4;
                            spawnedNpc.AttackBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                        }
                        break;
                    case 1048: {//hitmonlee
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.AttackBuff = 5;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                        }
                        break;
                    case 1049: {//grumpig
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.SpAtkBuff = 5;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.SpeedBuff = 6;
                        }
                        break;
                    case 1050: {//clefable
                            spawnedNpc.MaxHPBonus = 250;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.EvasionBuff = 3;
                            spawnedNpc.SpDefBuff = 2;
                            spawnedNpc.DefenseBuff = 2;
                            spawnedNpc.SpeedBuff = 8;
                        }
                        break;
                    case 800: {//mew
                            map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 50;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            spawnedNpc.AttackBuff = 1;
                            spawnedNpc.DefenseBuff = 1;
                            spawnedNpc.SpAtkBuff = 1;
                            spawnedNpc.SpDefBuff = 1;
                            spawnedNpc.AccuracyBuff = 1;
                            spawnedNpc.EvasionBuff = 1;
                            AddExtraStatus(spawnedNpc, null, map, "Invisible", 1000, null, "", hitlist, false);
                            TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, null, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, true, true);
                            for (int i = 0; i < targets.Count; i++) {
                                if (targets[i].CharacterType == Enums.CharacterType.Recruit) {
                                    Messenger.PlayMusic(((Recruit)targets[i]).Owner, "PMDB) Friend Area ~ Final Island.ogg");
                                }
                            }
                        }
                        break;
                    case 846: {//zorua

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1394: {//Scyther

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 1395: {//Pinsir

                            map.Npc.Remove(npc);
                        }
                        break;
                    case 936: {//vanilluxe
                            //foreach (Client n in map.GetClients()) {
                            //    StoryManager.PlayStory(n, 187);
                            //}
                            map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 200;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                        }
                        break;
                    case 1061: {//ARTICUNO
                            //map.Npc.Remove(npc);
                            spawnedNpc.MaxHPBonus = 300;
                            spawnedNpc.HP = spawnedNpc.MaxHP;
                            if (map.PlayersOnMap.Count == 1) {
                                InventoryItem item = new InventoryItem();
                                item.Num = 156;
                                item.Tag = "144";
                                spawnedNpc.GiveItem(item);
                            }
                        }
                        break;
                }

                if ((map.MapType == Enums.MapType.RDungeonMap) && spawnedNpc.HeldItem == null) {
                    if (((RDungeonMap)map).RDungeonIndex != 21
                    && ((RDungeonMap)map).RDungeonIndex != 22) {
                        if (Server.Math.Rand(0, 50) <= 0) {
                            //create a chest
                            InventoryItem item = new InventoryItem();
                            item.Num = Server.Math.Rand(531, 542);
                            if (item.Num == 533) item.Num = 542;
                            List<int> possibleItems = new List<int>();
                            if (Server.Math.Rand(0, 31) < 5) {
                                //2* item
                                for (int i = 1001; i <= 1838; i++) {
                                    if (ItemManager.Items[i].Rarity == 2 && !ItemManager.Items[i].Name.EndsWith("`")) {
                                        possibleItems.Add(i);
                                    }
                                }
                            } else {
                                //1* item
                                for (int i = 1001; i <= 1838; i++) {
                                    if (ItemManager.Items[i].Rarity == 1 && !ItemManager.Items[i].Name.EndsWith("`")) {
                                        possibleItems.Add(i);
                                    }
                                }
                            }
                            item.Tag = possibleItems[Server.Math.Rand(0, possibleItems.Count)].ToString();
                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    if (((RDungeonMap)map).RDungeonIndex == 50 && ((RDungeonMap)map).RDungeonFloor >= 2) {
                        if (Server.Math.Rand(0, 10) == 0) {
                            InventoryItem item = new InventoryItem();
                            item.Num = Server.Math.Rand(244, 249);
                            if (item.Num == 247) item.Num = 213;
                            if (item.Num == 248) item.Num = 224;
                            spawnedNpc.GiveItem(item);
                        }
                    } else if (((RDungeonMap)map).RDungeonIndex == 17 && ((RDungeonMap)map).RDungeonFloor >= 25
                    || ((RDungeonMap)map).RDungeonIndex == 18) {
                        if (Server.Math.Rand(0, 10) == 0) {
                            InventoryItem item = new InventoryItem();
                            item.Num = 259;

                            switch (Server.Math.Rand(0, 5)) {
                                case 0: {
                                        item.Tag = "151";
                                    }
                                    break;
                                case 1: {
                                        item.Tag = "251";
                                    }
                                    break;
                                case 2: {
                                        item.Tag = "385";
                                    }
                                    break;
                                case 3: {
                                        item.Tag = "490";
                                    }
                                    break;
                                case 4: {
                                        item.Tag = "492";
                                    }
                                    break;
                            }

                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (HasAbility(spawnedNpc, "Pickup") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor];
                    if (floor.Items.Count > 0) {
                        int rand = Server.Math.Rand(0, floor.Items.Count);
                        if (Server.Math.Rand(0, 200) <= floor.Items[rand].AppearanceRate) {
                            int amount = (floor.Items[rand].MinAmount + floor.Items[rand].MaxAmount) / 2;
                            InventoryItem item = new InventoryItem();
                            item.Num = floor.Items[rand].ItemNum;
                            item.Amount = amount;
                            item.Tag = floor.Items[rand].Tag;
                            spawnedNpc.GiveItem(item);
                        }
                    }
                }

                if (HasAbility(spawnedNpc, "Honey Gather") && map.MapType == Enums.MapType.RDungeonMap && spawnedNpc.HeldItem == null) {
                    RDungeonFloor floor = RDungeonManager.RDungeons[((RDungeonMap)map).RDungeonIndex].Floors[((RDungeonMap)map).RDungeonFloor];
                    if (Server.Math.Rand(0, 400) <= spawnedNpc.Level) {
                        InventoryItem item = new InventoryItem();
                        item.Num = 11;
                        spawnedNpc.GiveItem(item);
                    }
                }

                if (HasAbility(spawnedNpc, "Illusion")) {
                    TargetCollection friendlyTargets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, false, true, false);
                    if (friendlyTargets.Friends.Count > 0) {
                        AddExtraStatus(spawnedNpc, map, "Illusion", friendlyTargets[Server.Math.Rand(0, friendlyTargets.Friends.Count)].Sprite, null, "", hitlist);
                    }
                }

                if (spawnedNpc.HasActiveItem(213)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 25, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(224)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 300, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(244)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 387, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(245)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 390, null, "", hitlist, false);
                }
                if (spawnedNpc.HasActiveItem(246)) {
                    AddExtraStatus(spawnedNpc, map, "Illusion", 393, null, "", hitlist, false);
                }
                //if (spawnedNpc.HasActiveItem(259) && spawnedNpc.HeldItem.Num == 259 && map.Moral == Enums.MapMoral.House) {
                //    AddExtraStatus(spawnedNpc, map, "Illusion", spawnedNpc.HeldItem.Tag.ToInt(), null, "", hitlist);
                //}

                RefreshCharacterTraits(spawnedNpc, map, hitlist);

                if (map.Tile[spawnedNpc.X, spawnedNpc.Y].Type == Enums.TileType.Arena || map.Moral == Enums.MapMoral.None || map.Moral == Enums.MapMoral.NoPenalty) {
                    if (HasAbility(spawnedNpc, "Sand Stream")) {
                        SetMapWeather(map, Enums.Weather.Sandstorm, hitlist);
                    } else if (HasAbility(spawnedNpc, "Snow Warning")) {
                        SetMapWeather(map, Enums.Weather.Hail, hitlist);
                    } else if (HasAbility(spawnedNpc, "Drizzle")) {
                        SetMapWeather(map, Enums.Weather.Raining, hitlist);
                    } else if (HasAbility(spawnedNpc, "Drought")) {
                        SetMapWeather(map, Enums.Weather.Sunny, hitlist);
                    } else if (HasAbility(spawnedNpc, "Air Lock")) {
                        SetMapWeather(map, Enums.Weather.None, hitlist);
                    } else if (HasAbility(spawnedNpc, "Cloud Nine")) {
                        SetMapWeather(map, Enums.Weather.None, hitlist);
                    }
                }

                if (HasAbility(spawnedNpc, "Download")) {
                    int totalDef = 0;
                    int totalSpDef = 0;
                    TargetCollection targets = MoveProcessor.GetTargetsInRange(Enums.MoveRange.Floor, 0, map, spawnedNpc, spawnedNpc.X, spawnedNpc.Y, Enums.Direction.Up, true, false, false);
                    for (int i = 0; i < targets.Foes.Count; i++) {
                        totalDef += targets.Foes[i].Def;
                        totalSpDef += targets.Foes[i].SpclDef;
                    }

                    if (totalDef < totalSpDef) {
                        ChangeAttackBuff(spawnedNpc, map, 1, hitlist);
                    } else {
                        ChangeSpAtkBuff(spawnedNpc, map, 1, hitlist);
                    }
                }

                if (HasAbility(spawnedNpc, "Stench")) {
                    if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount();
                    map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick + map.NpcSpawnTime * 500);
                }

                if (HasAbility(spawnedNpc, "Illuminate")) {
                    if (map.NpcSpawnWait == null) map.NpcSpawnWait = Core.GetTickCount();
                    map.NpcSpawnWait = new TickCount(map.NpcSpawnWait.Tick - map.NpcSpawnTime * 500);
                }

                //if (MapManager.ActiveMaps[spawnedNpc.MapID].MapType == Enums.MapType.RDungeonMap) {
                //	RDungeonMap map = (RDungeonMap)MapManager.ActiveMaps[spawnedNpc.MapID];
                //	if (map.RDungeonIndex == 34 && map.RDungeonFloor > 8) {
                //		if (Server.Math.Rand(0, 20) == 0 && !MapContainsNpc(map, 306)) {
                //			foreach(Client n in map.GetClients()) {
                //				StoryManager.PlayStory(n, 185);
                //			}
                //		}
                //	}
                //}
            } catch (Exception ex) {
                Messenger.AdminMsg("Error: OnNpcSpawn", Text.Black);
                Messenger.AdminMsg(map.Name + " with " + spawnedNpc.Num + " from " + spawnedNpc.MapSlot, Text.Pink);
                Messenger.AdminMsg(ex.ToString(), Text.Black);
            }
        }
Example #9
0
        //no longer needed?
        //public static void BothWaysBattleMsg(BattleSetup setup, string msg, Color color) {
        //    if (setup.Defender.CharacterType == Enums.CharacterType.Recruit) {
        //        Recruit recruit = setup.Defender as Recruit;
        //        if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit) {//PvP
        //            setup.AttackerPacketStack.AddPacket(PacketBuilder.CreateBattleMsg(msg, color));
        //            setup.DefenderPacketStack.AddPacket(PacketBuilder.CreateBattleMsg(msg, color));
        //        } else if (setup.Attacker.CharacterType == Enums.CharacterType.MapNpc) {//NvP
        //            setup.DefenderPacketStack.AddPacket(PacketBuilder.CreateBattleMsg(msg, color));
        //        }
        //      	} else if (setup.Attacker.CharacterType == Enums.CharacterType.Recruit){//PvN
        //        setup.AttackerPacketStack.AddPacket(PacketBuilder.CreateBattleMsg(msg, color));
        //      	}
        //}
        public static bool ShouldUseMove(IMap map, MapNpc attacker, int moveSlot)
        {
            Move move = null;
            if (moveSlot > -1 && moveSlot < 4 && attacker.Moves[moveSlot].MoveNum > 0) {
                move = MoveManager.Moves[attacker.Moves[moveSlot].MoveNum];
            } else {
                move = MoveManager.StandardAttack;
            }

            //Confusion check
            if (moveSlot == -1 || attacker.Moves[moveSlot].CurrentPP > 0) {
                // Attack any players that are in range
                switch (move.TargetType) {
                    case Enums.MoveTarget.Foes: {
                            if (attacker.IsInRangeOfFoes(map, move, moveSlot)) {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    case Enums.MoveTarget.User: {
                            return true;
                        }
                    case Enums.MoveTarget.UserAndAllies: {
                            return true;
                        }
                    case Enums.MoveTarget.UserAndFoe: {
                            return true;
                        }
                    case Enums.MoveTarget.All: {
                            return true;
                        }
                    case Enums.MoveTarget.AllAlliesButUser: {
                            if (attacker.IsInRangeOfAllies(map, move, moveSlot)) {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    case Enums.MoveTarget.AllButUser: {
                            if (attacker.IsInRangeOfAllies(map, move, moveSlot) ||
                                attacker.IsInRangeOfFoes(map, move, moveSlot)) {
                                return true;
                            } else {
                                return false;
                            }
                        }
                    default: {
                            return false;
                        }
                }
            } else {
                return false;
            }
        }
Example #10
0
 public void ClearActiveNpc(int npcSlot)
 {
     ActiveNpc[npcSlot] = new MapNpc(MapID, npcSlot);
 }
Example #11
0
 public int GetRecruitBonus(MapNpc npc)
 {
     return ((object)Scripting.ScriptManager.InvokeFunction("ScriptedRecruitBonus", this, npc)).ToInteger();
 }