home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TCE: Only calc_effort on tiles where it makes sense.
[plomrogue]
/
plugins
/
server
/
TheCrawlingEater.py
diff --git
a/plugins/server/TheCrawlingEater.py
b/plugins/server/TheCrawlingEater.py
index 056aa3d420bf16115a1f569fc8235cd79b5e0b02..02c9c3c0872f70137c249f0674a4bc87e8eda2f5 100644
(file)
--- a/
plugins/server/TheCrawlingEater.py
+++ b/
plugins/server/TheCrawlingEater.py
@@
-63,7
+63,8
@@
def actor_pee(t):
if not world_db["test_air"](t):
return
t["T_BLADDER"] -= 1
if not world_db["test_air"](t):
return
t["T_BLADDER"] -= 1
- world_db["wetmap"][t["pos"]] += 1
+ if chr(world_db["MAP"][t["pos"]]) not in "*&":
+ world_db["wetmap"][t["pos"]] += 1
def play_drop():
def play_drop():
@@
-87,7
+88,7
@@
def actor_drop(t):
world_db["MAP"][t["pos"]] = ord("-")
elif world_db["MAP"][t["pos"]] == ord("-"):
world_db["MAP"][t["pos"]] = ord("0")
world_db["MAP"][t["pos"]] = ord("-")
elif world_db["MAP"][t["pos"]] == ord("-"):
world_db["MAP"][t["pos"]] = ord("0")
- el
se
:
+ el
if chr(world_db["MAP"][t["pos"]]) not in "*&"
:
world_db["MAP"][t["pos"]] += 1
t["T_BOWEL"] -= 1
world_db["MAP"][t["pos"]] += 1
t["T_BOWEL"] -= 1
@@
-117,7
+118,10
@@
def play_move(str_arg):
world_db["Things"][0]["T_ARGUMENT"] = d
world_db["set_command"]("eat")
return
world_db["Things"][0]["T_ARGUMENT"] = d
world_db["set_command"]("eat")
return
- if chr(world_db["MAP"][pos]) in "34":
+ legal_targets = "34"
+ if world_db["GRACE"] >= 8:
+ legal_targets += "5"
+ if chr(world_db["MAP"][pos]) in legal_targets:
if t["T_STOMACH"] >= 32:
if t == world_db["Things"][0]:
log("You're too FULL to eat.")
if t["T_STOMACH"] >= 32:
if t == world_db["Things"][0]:
log("You're too FULL to eat.")
@@
-165,13
+169,17
@@
def actor_eat(t):
log("You try to EAT, but fail.")
else:
height = world_db["MAP"][pos] - ord("0")
log("You try to EAT, but fail.")
else:
height = world_db["MAP"][pos] - ord("0")
- if t["T_STOMACH"] >= 32 or height == 5:
+ if t["T_STOMACH"] >= 32:
+ return
+ if height == 5 and not \
+ (t == world_db["Things"][0] and world_db["GRACE"] >= 8):
return
t["T_STOMACH"] += 1
if t == world_db["Things"][0]:
log("You EAT.")
eaten = (height == 3 and 0 == int(rand.next() % 2)) or \
return
t["T_STOMACH"] += 1
if t == world_db["Things"][0]:
log("You EAT.")
eaten = (height == 3 and 0 == int(rand.next() % 2)) or \
- (height == 4 and 0 == int(rand.next() % 5))
+ (height == 4 and 0 == int(rand.next() % 5)) or \
+ (height == 5 and 0 == int(rand.next() % 10))
if eaten:
world_db["MAP"][pos] = ord("0")
if t["T_STOMACH"] > 32:
if eaten:
world_db["MAP"][pos] = ord("0")
if t["T_STOMACH"] > 32:
@@
-208,16
+216,21
@@
def actor_move(t):
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["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")
+ if world_db["GRACE"] < 8:
+ log("You can now eat ALL walls.")
+ if world_db["GRACE"] < 24:
+ log("You will now LEVITATE over holes.")
world_db["GRACE"] += 8
world_db["GRACE"] += 8
- log("BOO!")
elif t == world_db["Things"][0]:
log("You try to MOVE there, but fail.")
def test_hole(t):
elif t == world_db["Things"][0]:
log("You try to MOVE there, but fail.")
def test_hole(t):
- if world_db["MAP"][t["pos"]] == ord("&"):
+ if world_db["
GRACE"] >= 32 and world_db["
MAP"][t["pos"]] == ord("&"):
world_db["die"](t, "YOU WIN, CONGRATULATIONS.")
return False
world_db["die"](t, "YOU WIN, CONGRATULATIONS.")
return False
+ if world_db["GRACE"] >= 24:
+ return True
if chr(world_db["MAP"][t["pos"]]) in "*&":
world_db["die"](t, "You FALL in a hole, and die.")
return False
if chr(world_db["MAP"][t["pos"]]) in "*&":
world_db["die"](t, "You FALL in a hole, and die.")
return False
@@
-297,8
+310,9
@@
def calc_effort(ta, t):
t["T_POSY"], t["T_POSX"])
if 1 == move_result[0]:
pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2]
t["T_POSY"], t["T_POSX"])
if 1 == move_result[0]:
pos = (move_result[1] * world_db["MAP_LENGTH"]) + move_result[2]
- narrowness = world_db["MAP"][pos] - ord("0")
- return 2 ** narrowness
+ if chr(world_db["MAP"][pos]) in "012":
+ narrowness = world_db["MAP"][pos] - ord("0")
+ return 2 ** narrowness
return 1
world_db["calc_effort"] = calc_effort
return 1
world_db["calc_effort"] = calc_effort