public override (GscTile TileToWarpTo, Action ActionRequired) WarpCheck() { GscWarp warp = Map.Warps[X, Y]; if (warp != null) { GscWarp destWarp = Map.Game.Maps[warp.MapId].Warps[warp.DestinationIndex]; if (destWarp != null) { GscTile destTile = destWarp.Map[destWarp.X, destWarp.Y]; if (destTile != null) { Action actionRequired = Action.None; switch (Collision) { case 0x70: actionRequired = Action.Down; break; case 0x76: actionRequired = Action.Left; break; case 0x78: actionRequired = Action.Up; break; case 0x7e: actionRequired = Action.Right; break; } return(destWarp.Map[destWarp.X, destWarp.Y], actionRequired); } } } return(null, Action.None); }
public override bool IsPassable(GscTile from, PermissionSet permissions) { GscWarp warp = Map.Warps[X, Y]; if (warp != null && !warp.Allowed) { return(false); } GscSprite sprite = Map.Sprites[X, Y]; if (sprite != null && sprite.MovementFunction != GscSpriteMovement.Wander && sprite.MovementFunction != GscSpriteMovement.SwimWander && sprite.MovementFunction != GscSpriteMovement.WalkLeftRight && sprite.MovementFunction != GscSpriteMovement.WalkUpDown) { return(false); } return(permissions.IsAllowed(Collision)); }
public override int WalkTo(int targetX, int targetY) { GscMap map = Map; GscTile current = Tile; GscTile target = map[targetX, targetY]; GscWarp warp = map.Warps[current.X, current.Y]; 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 GscTile WarpCheck() { GscWarp sourceWarp = Map.Warps[X, Y]; if (sourceWarp != null && sourceWarp.Allowed) { GscMap destMap = Map.Game.Maps[sourceWarp.MapId]; if (destMap != null) { GscWarp destWarp = destMap.Warps[sourceWarp.DestinationIndex]; if (destWarp != null) { GscTile destTile = destMap[destWarp.X, destWarp.Y]; if (destTile.Collision == 113) { destTile = destTile.Neighbor(Action.Down); // Door tiles automatically move the player 1 tile down. } return(destTile); } } } return(this); }