-def decrement_lifepoints(t):
- t["T_LIFEPOINTS"] -= 1
- live_type = t["T_TYPE"]
- _id = [_id for _id in world_db["Things"] if world_db["Things"][_id] == t][0]
- if 0 == t["T_LIFEPOINTS"]:
- for id in t["T_CARRIES"]:
- t["T_CARRIES"].remove(id)
- world_db["Things"][id]["T_POSY"] = t["T_POSY"]
- world_db["Things"][id]["T_POSX"] = t["T_POSX"]
- world_db["Things"][id]["carried"] = False
- t["T_TYPE"] = world_db["ThingTypes"][t["T_TYPE"]]["TT_CORPSE_ID"]
- if world_db["Things"][0] == t:
- t["fovmap"] = bytearray(b' ' * (world_db["MAP_LENGTH"] ** 2))
- log("You die.")
- log("See README on how to start over.")
- else:
- t["fovmap"] = False
- t["T_MEMMAP"] = False
- t["T_MEMDEPTHMAP"] = False
- t["T_MEMTHING"] = []
- n_species = len([id for id in world_db["Things"]
- if world_db["Things"][id]["T_TYPE"] == live_type])
- if 0 == n_species:
- from server.new_thing import new_Thing
- if world_db["FAVOR_STAGE"] >= 3 and \
- live_type == world_db["ANIMAL_0"]:
- world_db["GOD_FAVOR"] += 3000
- log("CONGRATULATIONS! The "
- + world_db["ThingTypes"][live_type]["TT_NAME"]
- + " species has died out. The Island God is pleased.")
- else:
- id = id_setter(-1, "Things")
- world_db["Things"][id] = new_Thing(live_type,
- world_db["altar"])
- log("The "
- + world_db["ThingTypes"][live_type]["TT_NAME"]
- + " species has temporarily died out. "
- + "One new-born is spawned at the altar.")
- return world_db["ThingTypes"][t["T_TYPE"]]["TT_LIFEPOINTS"]
- return 0
-