From: Christian Heller Date: Sun, 13 Mar 2016 19:20:30 +0000 (+0100) Subject: TCE: Add altars that deliver grace score. X-Git-Tag: tce~14 X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%7B%7Bprefix%7D%7D/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=757c2d72e97a023f1806760aff4259579e0ba3e3;p=plomrogue TCE: Add altars that deliver grace score. --- diff --git a/libplomrogue.c b/libplomrogue.c index 5fd86f8..33da37a 100644 --- a/libplomrogue.c +++ b/libplomrogue.c @@ -603,6 +603,9 @@ extern uint8_t TCE_set_movement_cost_map(char * mem_map) for (pos = 0; pos < map_size; pos++) { switch(mem_map[pos]) { + case '-': + case '+': + case '$': case '0': TCE_move_cost_map[pos] = 1; break; diff --git a/plugins/client/TheCrawlingEater.py b/plugins/client/TheCrawlingEater.py index 6798e9c..0f4b9a2 100644 --- a/plugins/client/TheCrawlingEater.py +++ b/plugins/client/TheCrawlingEater.py @@ -3,6 +3,7 @@ # see the file NOTICE in the root directory of the PlomRogue source package. +curses.init_pair(76, curses.COLOR_BLACK, curses.COLOR_WHITE) curses.init_pair(77, curses.COLOR_WHITE, curses.COLOR_GREEN) curses.init_pair(78, curses.COLOR_BLACK, curses.COLOR_RED) curses.init_pair(79, curses.COLOR_WHITE, curses.COLOR_BLUE) @@ -13,6 +14,8 @@ def win_bar_maker(color_number, symbol, title): def win_bar(self): winmap = [] for i in range(world_data[title]): + if i == 32: + break winmap += [(symbol, curses.color_pair(color_number))] winmap_size = [1, len(winmap)] offset = [0, 0] @@ -48,7 +51,7 @@ def win_map(self): winmap = [] curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLACK) #curses.init_pair(2, curses.COLOR_BLUE, curses.COLOR_BLACK) - #curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) + curses.init_pair(3, curses.COLOR_CYAN, curses.COLOR_BLACK) curses.init_pair(4, curses.COLOR_GREEN, curses.COLOR_BLACK) curses.init_pair(5, curses.COLOR_YELLOW, curses.COLOR_BLACK) curses.init_pair(6, curses.COLOR_RED, curses.COLOR_BLACK) @@ -63,6 +66,7 @@ def win_map(self): col_unknown = curses.color_pair(1) col_creature = curses.color_pair(13) col_player = curses.color_pair(8) + col_altar = curses.color_pair(3) earth_colors = [ curses.color_pair(4), curses.color_pair(5), @@ -112,6 +116,8 @@ def win_map(self): attribute = earth_colors[mapval] if char == "&": attribute = col_player + elif char == "$": + attribute = col_altar if char in charmap: char = charmap[char] elif char == "@": @@ -126,6 +132,7 @@ def win_map(self): from client.config.world_data import world_data +world_data["grace"] = 0 world_data["kidney"] = 0 world_data["stomach"] = 0 world_data["bowel"] = 0 @@ -139,30 +146,35 @@ io["worldstate_read_order"] += [["bowel", "int"]] io["worldstate_read_order"] += [["bladder", "int"]] io["worldstate_read_order"] += [["wetmap", "map"]] io["worldstate_read_order"] += [["soundmap", "map"]] +io["worldstate_read_order"] += [["grace", "int"]] from client.config.windows import windows_config from client.windows import win_log windows_config[:] = [ - {"config": [0, -34], + {"config": [0, -33], "func": win_map, "scroll_hints": False, "title": "THE CRAWLING EATER"}, - {"config": [1, 33], + {"config": [1, 32], "func": win_bar_maker(77, "%", "stomach"), "scroll_hints": False, "title": "stomach"}, - {"config": [1, 33], + {"config": [1, 32], "func": win_bar_maker(79, "~", "kidney"), "scroll_hints": False, "title": "kidney"}, - {"config": [1, 33], + {"config": [1, 32], "func": win_bar_maker(78, "%", "bowel"), "scroll_hints": False, "title": "bowel"}, - {"config": [1, 33], + {"config": [1, 32], "func": win_bar_maker(80, "~", "bladder"), "scroll_hints": False, "title": "bladder"}, - {"config": [-8, 33], + {"config": [1, 32], + "func": win_bar_maker(76, "+", "grace"), + "scroll_hints": False, + "title": "grace"}, + {"config": [-10, 32], "func": win_log, "scroll_hints": False, "title": "log"} diff --git a/plugins/server/TheCrawlingEater.py b/plugins/server/TheCrawlingEater.py index 93606f7..056aa3d 100644 --- a/plugins/server/TheCrawlingEater.py +++ b/plugins/server/TheCrawlingEater.py @@ -206,6 +206,10 @@ def actor_move(t): t["T_POSX"] = move_result[2] t["pos"] = move_result[1] * world_db["MAP_LENGTH"] + move_result[2] world_db["soundmap"][t["pos"]] = ord("9") + if t == world_db["Things"][0] and world_db["MAP"][t["pos"]] == ord("$"): + world_db["MAP"][t["pos"]] = ord("0") + world_db["GRACE"] += 8 + log("BOO!") elif t == world_db["Things"][0]: log("You try to MOVE there, but fail.") @@ -236,7 +240,8 @@ def die(t, message): t["T_MEMMAP"][t["pos"]] = ord("@") log(message) else: - world_db["MAP"][t["pos"]] = ord("5") + if world_db["MAP"][t["pos"]] != ord("$"): + world_db["MAP"][t["pos"]] = ord("5") world_db["HUMILITY"] = t["T_KIDNEY"] + t["T_BLADDER"] + \ (world_db["wetmap"][t["pos"]] - ord("0")) world_db["wetmap"][t["pos"]] = 0 @@ -276,6 +281,13 @@ def make_map(): ord("0") == world_db["wetmap"][pos]: world_db["wetmap"][pos] = ord("3") i_water += 1 + n_altars = 4 + i_altars = 0 + while (i_altars < n_altars): + y, x, pos = new_pos() + if ord("0") == world_db["MAP"][pos]: + world_db["MAP"][pos] = ord("$") + i_altars += 1 def calc_effort(ta, t): @@ -347,6 +359,8 @@ def turn_over(): height = -1 elif world_db["MAP"][pos] == ord("+"): height = -2 + elif world_db["MAP"][pos] == ord("$"): + height = -3 if height == -2 and wetness > 1 \ and 0 == rand.next() % ((2 ** 11) / (2 ** wetness)): world_db["MAP"][pos] = ord("*") @@ -792,9 +806,10 @@ io_db["worldstate_write_order"] += [["T_BOWEL", "player_int"]] io_db["worldstate_write_order"] += [["T_BLADDER", "player_int"]] io_db["worldstate_write_order"] += [[write_wetmap, "func"]] io_db["worldstate_write_order"] += [[write_soundmap, "func"]] +io_db["worldstate_write_order"] += [["GRACE", "world_int"]] import server.config.world_data server.config.world_data.symbols_hide = "345" -server.config.world_data.symbols_passable = "012-+*&" +server.config.world_data.symbols_passable = "012-+*&$" server.config.world_data.thing_defaults["T_STOMACH"] = 16 server.config.world_data.thing_defaults["T_BOWEL"] = 0 server.config.world_data.thing_defaults["T_KIDNEY"] = 16 @@ -805,6 +820,8 @@ if not "NEW_SPAWN" in world_db: world_db["NEW_SPAWN"] = 0 if not "HUMIDITY" in world_db: world_db["HUMIDITY"] = 0 +if not "GRACE" in world_db: + world_db["GRACE"] = 0 io_db["hook_save"] = save_maps import server.config.make_world_helpers server.config.make_world_helpers.make_map = make_map @@ -820,6 +837,7 @@ commands_db["drink"] = (0, False, play_drink) commands_db["pee"] = (0, False, play_pee) commands_db["use"] = (1, False, lambda x: None) commands_db["pickup"] = (0, False, lambda: None) +commands_db["GRACE"] = (1, False, setter(None, "GRACE", 0, 255)) commands_db["NEW_SPAWN"] = (1, False, setter(None, "NEW_SPAWN", 0, 255)) commands_db["HUMIDITY"] = (1, False, setter(None, "HUMIDITY", 0, 65535)) commands_db["T_STOMACH"] = (1, False, setter("Thing", "T_STOMACH", 0, 255))