public override (RbyTile TileToWarpTo, Action ActionRequired) WarpCheck() { RbyWarp srcWarp = Map.Warps[X, Y]; if (srcWarp != null) { RbyMap destMap = Map.Game.Maps[srcWarp.DestinationMap]; if (destMap != null) { RbyWarp destWarp = destMap.Warps[srcWarp.DestinationIndex]; if (destWarp != null) { RbyTile destTile = destMap[destWarp.X, destWarp.Y]; if (Array.IndexOf(Map.Tileset.WarpTiles, Collision) != -1) { return(destTile, Action.None); } else { Action action = ExtraWarpCheck(); if (action != Action.None) { return(destTile, action); } } } } } return(null, Action.None); }
public override RbyTile WarpCheck() { // TODO: This code does not take cave exits into account that don't always warp when walked on. (i.e. walked on from the side) RbyWarp sourceWarp = Map.Warps[X, Y]; if (sourceWarp != null && sourceWarp.Allowed) { RbyMap destMap = Map.Game.Maps[sourceWarp.DestinationMap]; if (destMap != null) { RbyWarp destWarp = destMap.Warps[sourceWarp.DestinationIndex]; if (destWarp != null) { RbyTile destTile = destMap[destWarp.X, destWarp.Y]; if (destTile.Collision == 27) { destTile = destTile.Neighbor(Action.Down); // Door tiles automatically move the player 1 tile down. } return(destTile); } } } return(this); }
public override int WalkTo(int targetX, int targetY) { RbyMap map = Map; RbyTile current = map[XCoord, YCoord]; RbyTile target = map[targetX, targetY]; RbyWarp warp = map.Warps[XCoord, YCoord]; bool original = false; if (warp != null) { original = warp.Allowed; warp.Allowed = true; } List <Action> path = Pathfinding.FindPath(map, current, 17, map.Tileset.LandPermissions, target); if (warp != null) { warp.Allowed = original; } return(Execute(path.ToArray())); }
public override bool IsPassable(RbyTile from, PermissionSet permissions) { RbyWarp warp = Map.Warps[X, Y]; if (warp != null && !warp.Allowed) { return(false); } RbySprite sprite = Map.Sprites[X, Y]; if (sprite != null && sprite.Movement != RbySpriteMovement.Walk) { return(false); } foreach (RbyTrainer trainer in Map.Trainers) { // NOTE: This is not checking whether or not the trainer has been defeated. // To implement this there are two options: // (1) Read it from wram (using trainer.IsDefeated); but using the right GB instance to do this can become annoying. Perhaps this is a non issue anyways though. // (2) Have some kind of flag that the user sets manually. if (trainer.VisionTiles.Contains(this)) { return(false); } } // TODO: Don't always assume on land. if (Map.Tileset.TilePairCollisionsLand.Contains(new RbyTilePairCollision { Tile1 = from.Collision, Tile2 = Collision })) { return(false); } return(permissions.IsAllowed(Collision)); }