Skip to content

Commit a265b91

Browse files
committed
feat: paralysis trap
1 parent f758300 commit a265b91

12 files changed

+163
-65
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<!-- Bugs -->
22
<!-- ------ -->
3+
<!-- player reflection off -->
4+
<!-- insta death from onyx widow -->
35
<!-- ------ -->
46
<!-- -->
57
<!-- Performance -->
@@ -196,14 +198,14 @@ Content:
196198
- 6 x boots
197199
- 5 x rings
198200
- 5 x keys
201+
- 5 x debuffs
199202
- 4 x gauntlets
200-
- 4 x debuffs
201203
- 4 x armor
202204
- 4 x amulets
205+
- 3 x traps
203206
- 3 x mobs
204207
- 3 x doors
205208
- 3 x cloaks
206-
- 2 x traps
207209
- 2 x potions
208210
- 1 x player
209211
<!-- end type marker -->

python/level_biome_dungeon.py

Lines changed: 68 additions & 51 deletions
Large diffs are not rendered by default.

python/things/traps/trap_monster.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def on_activated(me, victim, x, y):
1414
my.thing_msg(victim, "%%fg=red$Surprise!%%fg=reset$")
1515
else:
1616
my.thing_msg(victim, "The pressure plate clicks...")
17+
my.thing_popup(victim, "!!!")
1718
my.thing_dead(me, "activated")
1819

1920

@@ -54,7 +55,7 @@ def tp_init(name, text_long_name):
5455

5556

5657
def init():
57-
tp_init(name="trap_monster", text_long_name="inconspicious floor tile")
58+
tp_init(name="trap_monster", text_long_name="inconspicuous floor tile")
5859

5960

6061
init()

python/things/traps/trap_paralysis.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import my
2+
import tp
3+
4+
5+
def on_death(me, x, y):
6+
my.thing_sound_play_channel(me, my.CHANNEL_IMPACT, "pressure_plate")
7+
for it in my.level_get_all(me, x, y):
8+
if my.thing_paralysis_count_incr(it, 10):
9+
if my.thing_is_player(it):
10+
my.thing_popup(it, "!!!")
11+
12+
13+
def on_activated(me, victim, x, y):
14+
if my.thing_is_player(victim):
15+
my.thing_msg(victim, "You hear a pressure plate click beneath you...")
16+
else:
17+
my.thing_msg(victim, "The pressure plate clicks...")
18+
my.thing_dead(me, "activated")
19+
20+
21+
def tp_init(name, text_long_name):
22+
self = tp.Tp(name, text_long_name)
23+
# begin sort marker
24+
my.gfx_ascii_shown(self, True)
25+
my.is_biome_chasms(self, True)
26+
my.is_biome_dungeon(self, True)
27+
my.is_biome_ice(self, True)
28+
my.is_biome_lava(self, True)
29+
my.is_cursor_can_hover_over(self, True)
30+
my.is_described_in_leftbar(self, True)
31+
my.is_described_when_hovering_over(self, True)
32+
my.is_interesting(self, True)
33+
my.is_loggable(self, True)
34+
my.is_pressure_plate(self, True)
35+
my.is_trap(self, True)
36+
my.noise_on_hit_and_now_dead(self, 50)
37+
my.noise_on_hit_and_still_alive(self, 50)
38+
my.normal_placement_rules(self, True)
39+
my.on_activated_do(self, "me.on_activated()")
40+
my.on_death_do(self, "me.on_death()")
41+
my.text_a_or_an(self, "a")
42+
my.text_description_short(self, "A strange looking floor tile.")
43+
my.z_depth(self, my.MAP_DEPTH_FLOOR2)
44+
my.z_prio(self, my.MAP_Z_PRIO_ALWAYS_BEHIND)
45+
# end sort marker
46+
47+
my.tile(self,
48+
ascii_fg_char="middle_dot", ascii_fg_col_name="brown", tile="trap.1")
49+
my.tile(self,
50+
ascii_fg_char="middle_dot", ascii_fg_col_name="brown", tile="trap.2")
51+
my.tile(self,
52+
ascii_fg_char="middle_dot", ascii_fg_col_name="brown", tile="trap.3")
53+
54+
my.tp_update(self)
55+
56+
57+
def init():
58+
tp_init(name="trap_paralysis", text_long_name="inconspicuous floor tile")
59+
60+
61+
init()

python/things/traps/trap_pressure_plate_gas.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def on_activated(me, victim, x, y):
1515
else:
1616
my.thing_msg(victim, "The pressure plate clicks...")
1717
my.thing_dead(me, "activated")
18+
my.thing_popup(victim, "!!!")
1819

1920

2021
def tp_init(name, text_long_name):
@@ -54,7 +55,7 @@ def tp_init(name, text_long_name):
5455

5556

5657
def init():
57-
tp_init(name="trap_pressure_plate_gas", text_long_name="inconspicious floor tile")
58+
tp_init(name="trap_pressure_plate_gas", text_long_name="inconspicuous floor tile")
5859

5960

6061
init()

src/game_player.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ void Game::place_player(void)
202202
}
203203

204204
if (0) {
205+
level->thing_new("trap_paralysis", point(x - 2, y));
205206
level->thing_new("wall_dungeon.1", point(x - 2, y + 2));
206207
level->thing_new("wall_dungeon.1", point(x - 1, y + 2));
207208
level->thing_new("wall_dungeon.1", point(x, y + 2));

src/my_py_thing.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ PyObject *thing_noise_set(PyObject *obj, PyObject *args, PyObject *keywds);
727727
PyObject *thing_on_death_is_stone(PyObject *obj, PyObject *args, PyObject *keywds);
728728
PyObject *thing_paralysis_count_decr(PyObject *obj, PyObject *args, PyObject *keywds);
729729
PyObject *thing_paralysis_count_incr(PyObject *obj, PyObject *args, PyObject *keywds);
730+
PyObject *thing_paralysis_count(PyObject *obj, PyObject *args, PyObject *keywds);
730731
PyObject *thing_paralysis_count_set(PyObject *obj, PyObject *args, PyObject *keywds);
731732
PyObject *thing_paralysis(PyObject *obj, PyObject *args, PyObject *keywds);
732733
PyObject *thing_perma_death(PyObject *obj, PyObject *args, PyObject *keywds);
@@ -860,7 +861,6 @@ PyObject *thing_stat_thv_total(PyObject *obj, PyObject *args, PyObject *keywds);
860861
PyObject *thing_stuck_count_decr(PyObject *obj, PyObject *args, PyObject *keywds);
861862
PyObject *thing_stuck_count_incr(PyObject *obj, PyObject *args, PyObject *keywds);
862863
PyObject *thing_stuck_count(PyObject *obj, PyObject *args, PyObject *keywds);
863-
PyObject *thing_paralysis_count(PyObject *obj, PyObject *args, PyObject *keywds);
864864
PyObject *thing_stuck_count_set(PyObject *obj, PyObject *args, PyObject *keywds);
865865
PyObject *thing_teleport_distance_get(PyObject *obj, PyObject *args, PyObject *keywds);
866866
PyObject *thing_teleport_distance(PyObject *obj, PyObject *args, PyObject *keywds);

src/my_thing.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,7 +2647,6 @@ typedef class Thing_
26472647
void achieve_goals_in_death(void);
26482648
void achieve_goals_in_life(void);
26492649
void acid_tick(void);
2650-
void paralysis_tick(void);
26512650
void add_attacker(Thingp attacker, bool is_recursing = false);
26522651
void add_avoid(Thingp attacker);
26532652
void add_enemy(Thingp attacker, bool is_recursing = false);
@@ -2890,6 +2889,8 @@ typedef class Thing_
28902889
void on_you_nat_attack_success(void);
28912890
void owner_set(Thingp owner);
28922891
void owner_unset(void);
2892+
void paralysis_tick(void);
2893+
void paralysis_update(void);
28932894
void path_shorten(std::vector< point > &path);
28942895
void physical_training_tick(void);
28952896
void place_blood(bool force = false);

src/python_methods.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,9 @@ static PyMethodDef python_c_METHODS[] = {
979979
MY_ADD_PYTHON_FUNCTION(thing_noise_on_open_or_close),
980980
MY_ADD_PYTHON_FUNCTION(thing_noise_set),
981981
MY_ADD_PYTHON_FUNCTION(thing_on_death_is_stone),
982+
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count),
983+
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count_decr),
984+
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count_incr),
982985
MY_ADD_PYTHON_FUNCTION(thing_perma_death),
983986
MY_ADD_PYTHON_FUNCTION(thing_poisoned_amount_decr),
984987
MY_ADD_PYTHON_FUNCTION(thing_poisoned_amount_get),
@@ -993,12 +996,6 @@ static PyMethodDef python_c_METHODS[] = {
993996
MY_ADD_PYTHON_FUNCTION(thing_score),
994997
MY_ADD_PYTHON_FUNCTION(thing_score_decr),
995998
MY_ADD_PYTHON_FUNCTION(thing_score_incr),
996-
MY_ADD_PYTHON_FUNCTION(thing_stuck_count),
997-
MY_ADD_PYTHON_FUNCTION(thing_stuck_count_decr),
998-
MY_ADD_PYTHON_FUNCTION(thing_stuck_count_incr),
999-
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count),
1000-
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count_decr),
1001-
MY_ADD_PYTHON_FUNCTION(thing_paralysis_count_incr),
1002999
MY_ADD_PYTHON_FUNCTION(thing_set_leader),
10031000
MY_ADD_PYTHON_FUNCTION(thing_set_mob),
10041001
MY_ADD_PYTHON_FUNCTION(thing_shoot_at),
@@ -1113,6 +1110,9 @@ static PyMethodDef python_c_METHODS[] = {
11131110
MY_ADD_PYTHON_FUNCTION(thing_stat_thv_incr),
11141111
MY_ADD_PYTHON_FUNCTION(thing_stat_thv_set),
11151112
MY_ADD_PYTHON_FUNCTION(thing_stat_thv_total),
1113+
MY_ADD_PYTHON_FUNCTION(thing_stuck_count),
1114+
MY_ADD_PYTHON_FUNCTION(thing_stuck_count_decr),
1115+
MY_ADD_PYTHON_FUNCTION(thing_stuck_count_incr),
11161116
MY_ADD_PYTHON_FUNCTION(thing_teleport),
11171117
MY_ADD_PYTHON_FUNCTION(thing_teleport_distance),
11181118
MY_ADD_PYTHON_FUNCTION(thing_teleport_distance_get),

src/thing_display_pixelart.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ bool Thing::coords_get(point &blit_tl, point &blit_br, point &pre_effect_blit_tl
473473

474474
if (is_player()) {
475475
tile = player_tile;
476-
if (! player_tile) { DIE("no player tile"); }
476+
if (! player_tile) { tile = {}; }
477477
}
478478

479479
//

0 commit comments

Comments
 (0)