# rules.ludic — pure game rules & map data (functions only, no systems). function tile_sprite(c: int) -> int { match c { 'T', '#' => return SPR_TREE 'H' => return SPR_HOUSE 'D' => return SPR_DOOR 'r', 'h' => return SPR_PATH ',', 'S', 'B' => return SPR_FLOOR '=' => return SPR_WALL } return SPR_GRASS } function walkable(x: int, y: int) -> bool { let c = Map.tile(x, y) return c == '.' or c == 'D' or c == 'r' or c == ',' or c == 'S' or c == 'B' or c == 'h' } function is_confirm(k: int) -> bool { return k == ' ' or k == '\n' or k == '\r' } function enemy_name(et: int) -> string { if et == 0 { return "SLIME" } if et == 1 { return "SKELETON" } return "RIFT WARDEN" } function build_field(x: int) -> int { Map.size(40, 18) Map.row(0, "########################################") Map.row(1, "#......................................#") Map.row(2, "#...TT.........................TT.....D#") Map.row(3, "#..TT.......................TT.........#") Map.row(4, "#..T.........................T.........#") Map.row(5, "#....................................T.#") Map.row(6, "#.....TT....................TT.......T.#") Map.row(7, "#....TT.....................T..........#") Map.row(8, "#...........rrrrrrrr........HH.........#") Map.row(9, "#..........r........r.......HH.........#") Map.row(10, "#......TT...r........rrrrrrrrhr......T.#") Map.row(11, "#.....TT...r.................r.......T.#") Map.row(12, "#..........r.......TT.......r..........#") Map.row(13, "#..........rrrrrrrrrrrrrrrrr.........T.#") Map.row(14, "#.........TT.........................T.#") Map.row(15, "#........TT..........................T.#") Map.row(16, "#....................................T.#") Map.row(17, "########################################") return 0 } function build_dungeon(x: int) -> int { Map.size(40, 18) Map.row(0, "========================================") Map.row(1, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(2, "=,S,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(3, "=,,,,,====,,,,,,,,,,,,,,,====,,,,,,,,,,=") Map.row(4, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(5, "=,,,,,,,,,,,,,====,,,,,,,,,,,,,,,,,,,,,=") Map.row(6, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,====,,,,,=") Map.row(7, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(8, "=,,,====,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(9, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(10, "=,,,,,,,,,,,,,,,,,,====,,,,,,,,,,,,,,,,=") Map.row(11, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(12, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,====,,,,,,,=") Map.row(13, "=,,,,,,,,,====,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(14, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(15, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,B,,=") Map.row(16, "=,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,=") Map.row(17, "========================================") return 0 } function grant_xp(amount: int) -> int { for (t) in query [Stats, {Party}] { if t.hp > 0 { t.xp += amount while t.xp >= t.lvl * 20 { t.xp = t.xp - t.lvl * 20 t.lvl += 1 t.maxhp += 8 t.hp = t.maxhp t.maxmp += 2 t.atk += 2 t.def += 1 } } } return 0 }