X-Git-Url: https://plomlompom.com/repos/berlin_corona.txt?a=blobdiff_plain;ds=sidebyside;f=roguelike-server;h=4e46788595bc942f116ca2a913c628798ca29b1a;hb=c25e2499bcfcdc43202f7a59ab97ce802d418a6c;hp=0bb69884d40f31adbd73d16e23efe89c71e0cea4;hpb=7417e7083aef8ecdc22fd28b2a16630c8aca30d8;p=plomrogue diff --git a/roguelike-server b/roguelike-server index 0bb6988..4e46788 100755 --- a/roguelike-server +++ b/roguelike-server @@ -1167,11 +1167,13 @@ def get_dir_to_target(t, filter): if t["fovmap"] and "a" == filter: for id in world_db["Things"]: if animate_in_fov(world_db["Things"][id]): - return good_attack_target(world_db["Things"][id]) + if good_attack_target(world_db["Things"][id]): + return True elif t["fovmap"] and "f" == filter: for id in world_db["Things"]: if animate_in_fov(world_db["Things"][id]): - return good_flee_target(world_db["Things"][id]) + if good_flee_target(world_db["Things"][id]): + return True elif t["T_MEMMAP"] and "c" == filter: eat_cost = eat_vs_hunger_threshold(t["T_TYPE"]) for mt in t["T_MEMTHING"]: @@ -1346,7 +1348,7 @@ def ai(t): """Determine next command/argment for actor t via AI algorithms.""" # 7DRL add: Don't pick up or search things when inventory is full. if t == world_db["Things"][0]: - log("%AI------") + log("%AI------") t["T_COMMAND"] = [id for id in world_db["ThingActions"] if world_db["ThingActions"][id]["TA_NAME"] == "wait"][0] if get_dir_to_target(t, "f"): @@ -1387,6 +1389,7 @@ def ai(t): def turn_over(): """Run game world and its inhabitants until new player input expected.""" + # 7DRL: effort of move action is TA_EFFORT / sqrt(TT_LIFEPOINTS) id = 0 whilebreaker = False while world_db["Things"][0]["T_LIFEPOINTS"]: @@ -1415,7 +1418,14 @@ def turn_over(): taid = [a for a in world_db["ThingActions"] if a == Thing["T_COMMAND"]][0] ThingAction = world_db["ThingActions"][taid] - if Thing["T_PROGRESS"] == ThingAction["TA_EFFORT"]: + #if Thing["T_PROGRESS"] == ThingAction["TA_EFFORT"]: + effort = ThingAction["TA_EFFORT"] # # + if ThingAction["TA_NAME"] == "move": # # + type = Thing["T_TYPE"] # # + max_hp = (world_db["ThingTypes"][type] # # + ["TT_LIFEPOINTS"]) # # + effort = int(effort / math.sqrt(max_hp)) # # + if Thing["T_PROGRESS"] == effort: # # eval("actor_" + ThingAction["TA_NAME"])(Thing) Thing["T_COMMAND"] = 0 Thing["T_PROGRESS"] = 0