X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=roguelike-server;h=1edafc57f863e85e2d15c4d03f494ee3856edf7a;hb=e3b127a4f08ea8759be117eb9ac1a4e872e0066e;hp=3f94f44b03b8d71466351fd83d0999d2a2681822;hpb=ba69a51351689b764a399d78b95f1d0b665b4a7b;p=plomrogue diff --git a/roguelike-server b/roguelike-server index 3f94f44..1edafc5 100755 --- a/roguelike-server +++ b/roguelike-server @@ -418,7 +418,7 @@ def play_game(): obey(read_command(), "in file", do_record=True) -def remake_map(): +def make_map(): """(Re-)make island map. Let "~" represent water, "." land, "X" trees: Build island shape randomly, @@ -655,7 +655,8 @@ def actor_move(t): t["T_POSY"], t["T_POSX"]) if 1 == move_result[0]: pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2] - passable = "." == chr(world_db["MAP"][pos]) + passable = "." == chr(world_db["MAP"][pos]) or \ + ":" == chr(world_db["MAP"][pos]) # # hitted = [id for id in world_db["Things"] if world_db["Things"][id] != t if world_db["Things"][id]["T_LIFEPOINTS"] @@ -768,7 +769,7 @@ def thingproliferation(t, prol_map): """To chance of 1/TT_PROLIFERATE,create t offspring in open neighbor cell. Naturally only works with TT_PROLIFERATE > 0. The neighbor cell must be be - marked '.' in prol_map. If there are several map cell candidates, one is + marked "." in prol_map. If there are several map cell candidates, one is selected randomly. """ # # 7DRL: success increments God's mood @@ -777,7 +778,7 @@ def thingproliferation(t, prol_map): candidates = [] for dir in [directions_db[key] for key in directions_db]: mv_result = mv_yx_in_dir_legal(dir, t["T_POSY"], t["T_POSX"]) - if mv_result[0] and ord('.') == prol_map[mv_result[1] + if mv_result[0] and ord(".") == prol_map[mv_result[1] * world_db["MAP_LENGTH"] + mv_result[2]]: candidates.append((mv_result[1], mv_result[2])) @@ -1261,7 +1262,7 @@ def command_makeworld(seed_string): Seed rand with seed. Do more only with a "wait" ThingAction and world["PLAYER_TYPE"] matching ThingType of TT_START_NUMBER > 0. Then, - world_db["Things"] emptied, call remake_map() and set + world_db["Things"] emptied, call make_map() and set world_db["WORLD_ACTIVE"], world_db["TURN"] to 1. Build new Things according to ThingTypes' TT_START_NUMBERS, with Thing of ID 0 to ThingType of ID = world["PLAYER_TYPE"]. Place Things randomly, and actors not on each @@ -1275,7 +1276,9 @@ def command_makeworld(seed_string): while 1: y = rand.next() % world_db["MAP_LENGTH"] x = rand.next() % world_db["MAP_LENGTH"] - if "." == chr(world_db["MAP"][y * world_db["MAP_LENGTH"] + x]): + pos = y * world_db["MAP_LENGTH"] + x; + if "." == chr(world_db["MAP"][pos]) \ + or ":" == chr(world_db["MAP"][pos]): # # break i += 1 if i == 65535: @@ -1311,7 +1314,7 @@ def command_makeworld(seed_string): print("Ignoring: No thing action with name 'wait' defined.") return world_db["Things"] = {} - remake_map() + make_map() world_db["WORLD_ACTIVE"] = 1 world_db["TURN"] = 1 for i in range(world_db["ThingTypes"][playertype]["TT_START_NUMBER"]):