Skip to content

Commit

Permalink
bug: sword of duck summoning was summoning on swinging
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 12, 2023
1 parent 3da3443 commit 5cd7ed9
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 15 deletions.
Binary file modified data/gfx.tgz
Binary file not shown.
2 changes: 2 additions & 0 deletions python/things/boots/boots_teleport.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def on_enchant(me, x, y):


def on_use(owner, item, target, x, y):
if not target:
return
selection_x, selection_y = my.thing_coords_get(target)
my.thing_teleport(owner, selection_x, selection_y)

Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_devoted_thrust1.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_devoted_thrust_effect")
bonus = int(my.thing_stamina(owner) / 100) * 20

Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_devoted_thrust2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_devoted_thrust_effect")
bonus = int(my.thing_stamina(owner) / 100) * 30

Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_devoted_thrust3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_devoted_thrust_effect")
bonus = int(my.thing_stamina(owner) / 100) * 50

Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_devoted_thrust4.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_devoted_thrust_effect")
bonus = int(my.thing_stamina(owner) / 100) * 75

Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_double_strike1.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def on_use(owner, skill, target, x, y):
if attack == 0:
return

if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_double_strike_effect")

dmg = my.thing_dmg_current(owner)
Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_double_strike2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def on_use(owner, skill, target, x, y):
if attack == 0:
return

if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_double_strike_effect")

dmg = my.thing_dmg_current(owner)
Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_double_strike3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def on_use(owner, skill, target, x, y):
if attack == 0:
return

if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_double_strike_effect")

dmg = my.thing_dmg_current(owner)
Expand Down
3 changes: 3 additions & 0 deletions python/things/skills/skill_double_strike4.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def on_use(owner, skill, target, x, y):
if attack == 0:
return

if not target:
return

my.spawn_using_items_radius_range(owner, skill, target, "skill_double_strike_effect")

dmg = my.thing_dmg_current(owner)
Expand Down
3 changes: 3 additions & 0 deletions python/things/skills/skill_double_strike5.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def on_use(owner, skill, target, x, y):
if attack == 0:
return

if not target:
return

my.spawn_using_items_radius_range(owner, skill, target, "skill_double_strike_effect")

dmg = my.thing_dmg_current(owner)
Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_primal_rage2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_primal_rage_effect")
bonus = 4
my.thing_dmg_current_incr(owner, bonus)
Expand Down
2 changes: 2 additions & 0 deletions python/things/skills/skill_primal_rage5.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def on_tick_when_activated(owner, skill, x, y):


def on_use(owner, skill, target, x, y):
if not target:
return
my.spawn_using_items_radius_range(owner, skill, target, "skill_primal_rage_effect")
bonus = 6
my.thing_dmg_current_incr(owner, bonus)
Expand Down
2 changes: 2 additions & 0 deletions python/things/staffs/staff_energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ def on_idle(me, x, y):
def on_use(owner, item, target, x, y):
# my.topcon("owner {} {}".format(my.thing_name_get(owner), my.thing_health(owner)))
# my.topcon("item {} {}".format(my.thing_name_get(item), my.thing_health(item)))
if not target:
return
# my.topcon("target {} {}".format(my.thing_name_get(target), my.thing_health(target)))
damage = my.thing_dmg_energy(item)
enchant = my.thing_enchant_count_get(item)
Expand Down
2 changes: 2 additions & 0 deletions python/things/treasure/thunderstone.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def on_fall(me, x, y):
def on_use(owner, me, target, x, y):
# my.con("owner {} {:X}".format(my.thing_name_get(owner), owner))
# my.con("me {} {:X}".format(my.thing_name_get(me), me))
if not target:
return
# my.con("target {} {:X}".format(my.thing_name_get(target), target))
my.spawn_at_my_position(target, "explosion_major")
my.spawn_using_items_radius_range(owner, me, target, "explosion_destroy_floor")
Expand Down
5 changes: 5 additions & 0 deletions python/things/weapons/sword_duck_summoning.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def on_owner_attack_dmg_melee(me, owner, victim, x, y, damage):

def on_use(owner, item, target, x, y):
# my.con("owner {} {:X}".format(my.thing_name_get(owner), owner))
# my.con("item {} {:X}".format(my.thing_name_get(item), item))
if not target:
return
# my.con("target {} {:X}".format(my.thing_name_get(target), target))

nducks = my.pcg_randint(1, 6)
for n in range(0, nducks):
duck = my.spawn_at_my_position(target, "duck1")
Expand Down
16 changes: 8 additions & 8 deletions src/thing_killed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ void Thing::killed(Thingp defeater, const char *reason)
// Not sure what to show here yet.
//
} else if (is_undead()) {
msg("%%fg=white$%s is vanquished %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is vanquished, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (is_slime()) {
msg("%%fg=white$%s is splattered %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is splattered, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else {
msg("%%fg=white$%s is dead, killed %s.%%fg=reset$", The_no_dying.c_str(), reason);
}
Expand Down Expand Up @@ -424,9 +424,9 @@ void Thing::killed(Thingp defeater, const char *reason)

if (is_monst()) {
if (is_undead()) {
msg("%%fg=white$%s is vanquished %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is vanquished, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (is_slime()) {
msg("%%fg=white$%s is splattered %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is splattered, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else {
msg("%%fg=white$%s is dead, killed %s.%%fg=reset$", The_no_dying.c_str(), reason);
}
Expand All @@ -445,9 +445,9 @@ void Thing::killed(Thingp defeater, const char *reason)
TRACE_NO_INDENT();

if (is_undead()) {
msg("%%fg=white$%s is vanquished %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is vanquished, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (is_slime()) {
msg("%%fg=white$%s is splattered %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is splattered, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else {
msg("%%fg=white$%s is dead, killed %s.%%fg=reset$", The_no_dying.c_str(), reason);
}
Expand Down Expand Up @@ -476,9 +476,9 @@ void Thing::killed(Thingp defeater, const char *reason)
TRACE_NO_INDENT();
if (is_monst()) {
if (is_undead()) {
msg("%%fg=white$%s is vanquished %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is vanquished, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (is_slime()) {
msg("%%fg=white$%s is splattered %s.%%fg=reset$", The_no_dying.c_str(), reason);
msg("%%fg=white$%s is splattered, %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (level->is_gas_poison(curr_at.x, curr_at.y)) {
msg("%%fg=white$%s succumbs to the gas, killed %s.%%fg=reset$", The_no_dying.c_str(), reason);
} else if (level->is_trap(curr_at.x, curr_at.y)) {
Expand Down
6 changes: 0 additions & 6 deletions src/thing_target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,12 +568,6 @@ bool Thing::victim_attack_found_best(int equip, Thingp item, Thingp best, point
dbg2("Target-attack-best: Try to attack with item");
TRACE_AND_INDENT();

if (best) {
on_use(item, best);
} else {
on_use(item);
}

if (item->collision_check_and_handle_at(best_hit_at, attack_options)) {
lunge(best_hit_at);
}
Expand Down
2 changes: 1 addition & 1 deletion src/wid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5871,7 +5871,7 @@ void wid_key_down(const struct SDL_Keysym *key, int x, int y)
#endif
if (wid_focus && ! wid_is_hidden(wid_focus) && (wid_focus->on_key_down)) {
if ((wid_focus->on_key_down)(wid_focus, key)) {
CON("WID: key grabbed by focused wid: %s for (%d,%d)", wid_focus->name.c_str(), ascii_mouse_x, ascii_mouse_y);
DBG("WID: key grabbed by focused wid: %s at (%d,%d)", wid_focus->name.c_str(), ascii_mouse_x, ascii_mouse_y);
sound_play("keypress");
//
// Do not raise, gets in the way of popups the callback creates.
Expand Down
2 changes: 2 additions & 0 deletions src/wid_leftbar_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,8 @@ static void wid_leftbar_display_describe(Levelp level, Thingp t, int &y_at, int
wid_set_pos(w, tl, br);
if (t->is_undead()) {
wid_set_text(w, "(Vanquished)");
} else if (t->is_slime()) {
wid_set_text(w, "(Splatted)");
} else if (t->is_monst()) {
wid_set_text(w, "(Dead)");
} else {
Expand Down

0 comments on commit 5cd7ed9

Please sign in to comment.