- world_db["GOD_FAVOR"] -= 1
- chop_power = world_db["ThingTypes"][type]["TT_TOOLPOWER"]
-
- case_X = world_db["MAP"][pos] == ord("X")
- if (chop_power > 0
- and ((case_X and
- 0 == int(rand.next() / chop_power))
- or (not case_X and
- 0 == int(rand.next() / (3 * chop_power))))):
- if t == world_db["Things"][0]:
- log("You chop it DOWN.")
- if ord("X") == world_db["MAP"][pos]:
- world_db["GOD_FAVOR"] -= 10
- world_db["MAP"][pos] = ord(".")
- i = 3 if case_X else 1
- for i in range(i):
- id = id_setter(-1, "Things")
- world_db["Things"][id] = \
- new_Thing(world_db["LUMBER"],
- (move_result[1], move_result[2]))
- build_fov_map(t)
- return
- passable = chr(world_db["MAP"][pos]) in symbols_passable
- global directions_db
- dir = [dir for dir in directions_db
- if directions_db[dir] == chr(t["T_ARGUMENT"])][0]
- if passable:
- t["T_POSY"] = move_result[1]
- t["T_POSX"] = move_result[2]
- for id in t["T_CARRIES"]:
- world_db["Things"][id]["T_POSY"] = move_result[1]
- world_db["Things"][id]["T_POSX"] = move_result[2]
- build_fov_map(t)
- if t == world_db["Things"][0]:
- log("You MOVE " + dir + ".")
- if (move_result[1] == world_db["altar"][0] and
- move_result[2] == world_db["altar"][1]):
- enter_altar()
-
-def command_ttid(id_string):
- id = id_setter(id_string, "ThingTypes", command_ttid)
- if None != id:
- world_db["ThingTypes"][id] = {
- "TT_NAME": "(none)",
- "TT_TOOLPOWER": 0,
- "TT_LIFEPOINTS": 0,
- "TT_PROLIFERATE": 0,
- "TT_START_NUMBER": 0,
- "TT_STORAGE": 0,
- "TT_SYMBOL": "?",
- "TT_CORPSE_ID": id,
- "TT_TOOL": ""
- }
-
-def command_worldactive(worldactive_string):
- val = integer_test(worldactive_string, 0, 1)
- if None != val:
- if 0 != world_db["WORLD_ACTIVE"]:
- if 0 == val:
- set_world_inactive()
- else:
- print("World already active.")
- elif 0 == world_db["WORLD_ACTIVE"]:
- for ThingAction in world_db["ThingActions"]:
- if "wait" == world_db["ThingActions"][ThingAction]["TA_NAME"]:
- break
- else:
- print("Ignored: No wait action defined for world to activate.")
- return
- for Thing in world_db["Things"]:
- if 0 == Thing:
- break
- else:
- print("Ignored: No player defined for world to activate.")
- return
- if world_db["MAP"]:
- pos = world_db["MAP"].find(b'_')
- if pos > 0:
- y = int(pos / world_db["MAP_LENGTH"])
- x = pos % world_db["MAP_LENGTH"]
- world_db["altar"] = (y, x)
- else:
- print("Ignored: No altar defined for world to activate.")
- return
+ world_db["GOD_FAVOR"] -= 10
+ world_db["MAP"][pos] = ord(".")
+ i = 3 if case_X else 1
+ for i in range(i):
+ tid = id_setter(-1, "Things")
+ world_db["Things"][tid] = \
+ new_Thing(world_db["LUMBER"],
+ (move_result[1], move_result[2]))
+ build_fov_map(t)
+ return True
+ return False
+
+def decrement_lifepoints(t):
+ from server.decrement_lifepoints import decrement_lifepoints
+ live_tid = t["T_TYPE"]
+ test = decrement_lifepoints(t)
+ if test > 0 and t != world_db["Things"][0]:
+ n_species = len([tid for tid in world_db["Things"]
+ if world_db["Things"][tid]["T_TYPE"] == live_tid])
+ if 0 == n_species:
+ from server.new_thing import new_Thing
+ if world_db["FAVOR_STAGE"] >= 3 and \
+ live_tid == world_db["ANIMAL_0"]:
+ world_db["GOD_FAVOR"] += 3000
+ log("CONGRATULATIONS! The "
+ + world_db["ThingTypes"][live_tid]["TT_NAME"]
+ + " species has died out. The Island God is pleased.")