//public readonly WildPokemon[] OldRodWild = { }; //public readonly WildPokemon[] GoodRodWild = { }; //public readonly WildPokemon[] SuperRodWild = { }; public Map(int h, int w, Bitmap b, Event[] e, string m, string mu, string n, bool sl, WildPokemon[] tg = null) { height = h; width = w; border = b; events = e; tiles = new Block[height, width]; string[] nums = m.Replace("\r", "").Replace("\n", "").Split(','); for (int i = 0, k = 0; i < height; i++) { for (int j = 0; j < width; j++, k++) { tiles[i, j] = global[Int32.Parse(nums[k])]; } } music = mu; name = n; showLabel = sl; tallGrassWild = tg; }
private void World_KeyDown(object sender, KeyEventArgs e) { e.Handled = true; Array.Clear(this.OBJ, Player.Instance.location.Y * 10 + Player.Instance.location.X, 1); if (Player.Instance.location.Y == -1) { Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Up); Player.Instance.currentMap = connection.toMap; Player expr_A5_cp_0 = Player.Instance; expr_A5_cp_0.location.X = expr_A5_cp_0.location.X + connection.shift; Player.Instance.location.Y = Player.Instance.currentMap.height - 1; MusicPlayer.playBG(Player.Instance.currentMap.music); this.readMap(); } else { if (Player.Instance.location.Y == Player.Instance.currentMap.height) { Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Down); Player.Instance.currentMap = connection.toMap; Player expr_176_cp_0 = Player.Instance; expr_176_cp_0.location.X = expr_176_cp_0.location.X + connection.shift; Player.Instance.location.Y = 0; MusicPlayer.playBG(Player.Instance.currentMap.music); this.readMap(); } else { if (Player.Instance.location.X == Player.Instance.currentMap.width) { Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Right); Player.Instance.currentMap = connection.toMap; Player expr_237_cp_0 = Player.Instance; expr_237_cp_0.location.Y = expr_237_cp_0.location.Y + connection.shift; Player.Instance.location.X = 0; MusicPlayer.playBG(Player.Instance.currentMap.music); this.readMap(); } else { if (Player.Instance.location.X == -1) { Connection connection = Player.Instance.currentMap.connections.Single((Connection c) => c.dir == Direction.Left); Player.Instance.currentMap = connection.toMap; Player expr_2EA_cp_0 = Player.Instance; expr_2EA_cp_0.location.Y = expr_2EA_cp_0.location.Y + connection.shift; Player.Instance.location.X = Player.Instance.currentMap.width - 1; MusicPlayer.playBG(Player.Instance.currentMap.music); this.readMap(); } } } } Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].Occupied = false; switch (e.KeyCode) { case Keys.Space: { Event[] events = Player.Instance.currentMap.events; for (int i = 0; i < events.Length; i++) { Event @event = events[i]; if ((Player.Instance.dir == Direction.Up && Player.Instance.location.Y == @event.location.Y + 1 && Player.Instance.location.X == @event.location.X) || (Player.Instance.dir == Direction.Down && Player.Instance.location.Y == @event.location.Y - 1 && Player.Instance.location.X == @event.location.X) || (Player.Instance.dir == Direction.Right && Player.Instance.location.X == @event.location.X - 1 && Player.Instance.location.Y == @event.location.Y) || (Player.Instance.dir == Direction.Left && Player.Instance.location.X == @event.location.X + 1 && Player.Instance.location.Y == @event.location.Y)) { @event.script(); } } break; } case Keys.Left: { Direction dir = Player.Instance.dir; if (dir != Direction.Left) { Player.Instance.dir = Direction.Left; } else { if (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X - 1].Occupied) { Player expr_73B_cp_0 = Player.Instance; expr_73B_cp_0.location.X = expr_73B_cp_0.location.X - 1; } } break; } case Keys.Up: { Direction dir = Player.Instance.dir; if (dir != Direction.Up) { Player.Instance.dir = Direction.Up; } else { if (Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y - 1, Player.Instance.location.X].Occupied) { Player expr_474_cp_0 = Player.Instance; expr_474_cp_0.location.Y = expr_474_cp_0.location.Y - 1; } } break; } case Keys.Right: { Direction dir = Player.Instance.dir; if (dir != Direction.Right) { Player.Instance.dir = Direction.Right; } else { if (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X + 1].Occupied) { Player expr_64E_cp_0 = Player.Instance; expr_64E_cp_0.location.X = expr_64E_cp_0.location.X + 1; } } break; } case Keys.Down: { Direction dir = Player.Instance.dir; if (dir != Direction.Down) { Player.Instance.dir = Direction.Down; } else { if (Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].attribute != TerrainType.NotWalkable && Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].attribute != TerrainType.Water && !Player.Instance.currentMap[Player.Instance.location.Y + 1, Player.Instance.location.X].Occupied) { Player expr_561_cp_0 = Player.Instance; expr_561_cp_0.location.Y = expr_561_cp_0.location.Y + 1; } } break; } } Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].Occupied = true; this.pnlScreen.Invalidate(); if (Player.Instance.party.Count > 0) { WildPokemon[] array = new WildPokemon[0]; switch (Player.Instance.currentMap[Player.Instance.location.Y, Player.Instance.location.X].attribute) { case TerrainType.TallGrass: array = Player.Instance.currentMap.tallGrassWild; break; case TerrainType.LongGrass: array = Player.Instance.currentMap.longGrassWild; break; case TerrainType.Water: array = Player.Instance.currentMap.surfWild; break; case TerrainType.Cave: array = Player.Instance.currentMap.caveWild; break; } WildPokemon[] array2 = array; for (int i = 0; i < array2.Length; i++) { WildPokemon wildPokemon = array2[i]; if (PRNG.Instance.Next((int)(187.5 / (double)wildPokemon.rate)) == 1) { new Battle(new Pokemon(wildPokemon.mon, (int)PRNG.Instance.Next((int)wildPokemon.minLevel, (int)wildPokemon.maxLevel), null, null)).ShowDialog(); break; } } } }