Skip to content

Commit

Permalink
bug: various skill fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 16, 2023
1 parent c17618f commit ba22083
Show file tree
Hide file tree
Showing 22 changed files with 88 additions and 33 deletions.
3 changes: 1 addition & 2 deletions python/things/skills/skill_artful_dodging0.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
def tp_init(self):
# begin sort marker
my.gfx_ascii_shown(self, True)
my.is_auto_activated(self, True)
my.is_always_activated(self, True)
my.is_loggable(self, True)
my.is_skill(self, True)
my.is_tickable(self, True)
my.on_tick_when_activated_do(self, "me.on_tick_when_activated()")
my.skill_base_name(self, "skill_artful_dodging")
my.skill_base_name(self, "skill_devoted_thrust")
my.text_description_long2(self, "As part of your training you will receive enhanced dexterity and defensive bonuses and the ability to recover stamina more quickly.")
my.text_description_long(self, "This skill allows you to artfully dodge blows that rains down upon you with cat-like reflexes.")
my.text_description_short(self, "Artful dodging skill.")
Expand Down
4 changes: 2 additions & 2 deletions python/things/skills/skill_healing1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@


def on_tick_when_activated(owner, skill, x, y):
my.topcon("owner {} {}".format(my.thing_name_get(owner), my.thing_health(owner)))
my.topcon("skill {} {}".format(my.thing_name_get(skill), my.thing_health(skill)))
# my.topcon("owner {} {}".format(my.thing_name_get(owner), my.thing_health(owner)))
# my.topcon("skill {} {}".format(my.thing_name_get(skill), my.thing_health(skill)))

if not owner:
return False # did nothing
Expand Down
2 changes: 1 addition & 1 deletion python/things/skills/skill_intimidating_strength0.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def tp_init(self):
# begin sort marker
my.gfx_ascii_shown(self, True)
my.is_auto_activated(self, True)
my.is_always_activated(self, True)
my.is_loggable(self, True)
my.is_skill(self, True)
my.is_tickable(self, True)
Expand Down
1 change: 1 addition & 0 deletions python/things/skills/skill_primal_rage0.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
def tp_init(self):
# begin sort marker
my.gfx_ascii_shown(self, True)
my.is_auto_activated(self, True)
my.is_loggable(self, True)
my.is_skill(self, True)
my.is_tickable(self, True)
Expand Down
2 changes: 1 addition & 1 deletion python/things/skills/skill_super_health0.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
def tp_init(self):
# begin sort marker
my.gfx_ascii_shown(self, True)
my.is_auto_activated(self, True)
my.is_always_activated(self, True)
my.is_loggable(self, True)
my.is_skill(self, True)
my.is_tickable(self, True)
Expand Down
8 changes: 4 additions & 4 deletions python/things/skills/skill_vampiric_touch0.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


def do_vampiric_touch(me, owner, hitter, real_hitter, x, y, damage, damage_reduction_percent):
# my.con("me {} {:X}".format(my.thing_name_get(me), me))
# my.con("owner {} {:X}".format(my.thing_name_get(owner), owner))
# my.con("hitter {} {:X}".format(my.thing_name_get(hitter), hitter))
# my.con("rhitter {} {:X}".format(my.thing_name_get(real_hitter), real_hitter))
# my.topcon("me {} {:X}".format(my.thing_name_get(me), me))
# my.topcon("owner {} {:X}".format(my.thing_name_get(owner), owner))
# my.topcon("hitter {} {:X}".format(my.thing_name_get(hitter), hitter))
# my.topcon("rhitter {} {:X}".format(my.thing_name_get(real_hitter), real_hitter))

if real_hitter == me:
return damage
Expand Down
30 changes: 25 additions & 5 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ void Game::place_player(void)
auto w = level->thing_new("skill_primal_rage1", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_intimidating_strength1", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_devoted_thrust1", point(x, y));
t->skill_add(w);
Expand All @@ -159,6 +163,27 @@ void Game::place_player(void)
auto w = level->thing_new("skill_double_strike1", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_super_health5", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_vampiric_touch5", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_healing1", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("skill_artful_dodging1", point(x, y));
t->skill_add(w);
}
if (0) {
level->thing_new("gold6", point(x + 1, y));
auto w = level->thing_new("skill_gold_to_health1", point(x, y));
t->skill_add(w);
}

if (0) {
level->thing_new("wall_dungeon.1", point(x - 2, y + 2));
Expand All @@ -184,11 +209,6 @@ void Game::place_player(void)
level->thing_new("dry_grass", point(x + 3, y + 1));
}

if (0) {
level->thing_new("gold6", point(x + 1, y));
auto w = level->thing_new("skill_gold_to_health", point(x, y));
t->skill_add(w);
}
if (0) {
auto w = level->thing_new("amulet_endurance", point(x, y - 2));
t->carry(w, carry_options);
Expand Down
2 changes: 1 addition & 1 deletion src/my_py_thing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ PyObject *thing_is_aerodynamic(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_air_breather(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_alive_monst(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_alive_on_end_of_anim(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_always_activated(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_always_hit(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_always_submerged_in_water(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_amulet(PyObject *obj, PyObject *args, PyObject *keywds);
Expand Down Expand Up @@ -566,7 +567,6 @@ PyObject *thing_is_unused_flag123(PyObject *obj, PyObject *args, PyObject *keywd
PyObject *thing_is_unused_flag124(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag125(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag126(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag127(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag12(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag13(PyObject *obj, PyObject *args, PyObject *keywds);
PyObject *thing_is_unused_flag142(PyObject *obj, PyObject *args, PyObject *keywds);
Expand Down
2 changes: 1 addition & 1 deletion src/my_py_tp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ TP_SET_PROTO(is_aerodynamic)
TP_SET_PROTO(is_air_breather)
TP_SET_PROTO(is_alive_on_end_of_anim)
TP_SET_PROTO(is_allied_with)
TP_SET_PROTO(is_always_activated)
TP_SET_PROTO(is_always_hit)
TP_SET_PROTO(is_always_submerged_in_water)
TP_SET_PROTO(is_amulet)
Expand Down Expand Up @@ -655,7 +656,6 @@ TP_SET_PROTO(is_unused_flag123)
TP_SET_PROTO(is_unused_flag124)
TP_SET_PROTO(is_unused_flag125)
TP_SET_PROTO(is_unused_flag126)
TP_SET_PROTO(is_unused_flag127)
TP_SET_PROTO(is_unused_flag13)
TP_SET_PROTO(is_unused_flag14)
TP_SET_PROTO(is_unused_flag142)
Expand Down
2 changes: 1 addition & 1 deletion src/my_thing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1411,6 +1411,7 @@ typedef class Thing_
int is_air_breather(void);
int is_alive_monst(void);
int is_alive_on_end_of_anim(void);
int is_always_activated(void);
int is_always_hit(void);
int is_always_submerged_in_water(void);
int is_amulet(void);
Expand Down Expand Up @@ -1782,7 +1783,6 @@ typedef class Thing_
int is_unused_flag124(void);
int is_unused_flag125(void);
int is_unused_flag126(void);
int is_unused_flag127(void);
int is_unused_flag12(void);
int is_unused_flag13(void);
int is_unused_flag142(void);
Expand Down
6 changes: 3 additions & 3 deletions src/my_thing_template.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ class Tp
int _is_aerodynamic {};
int _is_air_breather {};
int _is_alive_on_end_of_anim {};
int _is_always_activated {};
int _is_always_hit {};
int _is_always_submerged_in_water {};
int _is_amulet {};
Expand Down Expand Up @@ -668,7 +669,6 @@ class Tp
int _is_unused_flag124 {};
int _is_unused_flag125 {};
int _is_unused_flag126 {};
int _is_unused_flag127 {};
int _is_unused_flag13 {};
int _is_unused_flag14 {};
int _is_unused_flag142 {};
Expand Down Expand Up @@ -1664,6 +1664,7 @@ class Tp
int is_aerodynamic(void) const;
int is_air_breather(void) const;
int is_alive_on_end_of_anim(void) const;
int is_always_activated(void) const;
int is_always_hit(void) const;
int is_always_submerged_in_water(void) const;
int is_amulet(void) const;
Expand Down Expand Up @@ -2008,7 +2009,6 @@ class Tp
int is_unused_flag124(void) const;
int is_unused_flag125(void) const;
int is_unused_flag126(void) const;
int is_unused_flag127(void) const;
int is_unused_flag12(void) const;
int is_unused_flag13(void) const;
int is_unused_flag142(void) const;
Expand Down Expand Up @@ -2426,6 +2426,7 @@ class Tp
void is_air_breather_set(int v);
void is_alive_on_end_of_anim_set(int v);
void is_allied_with_set(const std::string &v);
void is_always_activated_set(int v);
void is_always_hit_set(int v);
void is_always_submerged_in_water_set(int v);
void is_amulet_set(int v);
Expand Down Expand Up @@ -2770,7 +2771,6 @@ class Tp
void is_unused_flag124_set(int v);
void is_unused_flag125_set(int v);
void is_unused_flag126_set(int v);
void is_unused_flag127_set(int v);
void is_unused_flag12_set(int v);
void is_unused_flag13_set(int v);
void is_unused_flag142_set(int v);
Expand Down
2 changes: 1 addition & 1 deletion src/py_thing_get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ THING_BODY_GET_BOOL(thing_is_aerodynamic, is_aerodynamic)
THING_BODY_GET_BOOL(thing_is_air_breather, is_air_breather)
THING_BODY_GET_BOOL(thing_is_alive_monst, is_alive_monst)
THING_BODY_GET_BOOL(thing_is_alive_on_end_of_anim, is_alive_on_end_of_anim)
THING_BODY_GET_BOOL(thing_is_always_activated, is_always_activated)
THING_BODY_GET_BOOL(thing_is_always_hit, is_always_hit)
THING_BODY_GET_BOOL(thing_is_always_submerged_in_water, is_always_submerged_in_water)
THING_BODY_GET_BOOL(thing_is_amulet, is_amulet)
Expand Down Expand Up @@ -584,7 +585,6 @@ THING_BODY_GET_BOOL(thing_is_unused_flag123, is_unused_flag123)
THING_BODY_GET_BOOL(thing_is_unused_flag124, is_unused_flag124)
THING_BODY_GET_BOOL(thing_is_unused_flag125, is_unused_flag125)
THING_BODY_GET_BOOL(thing_is_unused_flag126, is_unused_flag126)
THING_BODY_GET_BOOL(thing_is_unused_flag127, is_unused_flag127)
THING_BODY_GET_BOOL(thing_is_unused_flag12, is_unused_flag12)
THING_BODY_GET_BOOL(thing_is_unused_flag13, is_unused_flag13)
THING_BODY_GET_BOOL(thing_is_unused_flag142, is_unused_flag142)
Expand Down
2 changes: 1 addition & 1 deletion src/py_tp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ TP_BODY_SET_INT(is_acid)
TP_BODY_SET_INT(is_aerodynamic)
TP_BODY_SET_INT(is_air_breather)
TP_BODY_SET_INT(is_alive_on_end_of_anim)
TP_BODY_SET_INT(is_always_activated)
TP_BODY_SET_INT(is_always_hit)
TP_BODY_SET_INT(is_always_submerged_in_water)
TP_BODY_SET_INT(is_amulet)
Expand Down Expand Up @@ -1364,7 +1365,6 @@ TP_BODY_SET_INT(is_unused_flag123)
TP_BODY_SET_INT(is_unused_flag124)
TP_BODY_SET_INT(is_unused_flag125)
TP_BODY_SET_INT(is_unused_flag126)
TP_BODY_SET_INT(is_unused_flag127)
TP_BODY_SET_INT(is_unused_flag13)
TP_BODY_SET_INT(is_unused_flag14)
TP_BODY_SET_INT(is_unused_flag142)
Expand Down
4 changes: 2 additions & 2 deletions src/python_methods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ static PyMethodDef python_c_METHODS[] = {
MY_ADD_PYTHON_FUNCTION(thing_is_air_breather),
MY_ADD_PYTHON_FUNCTION(thing_is_alive_monst),
MY_ADD_PYTHON_FUNCTION(thing_is_alive_on_end_of_anim),
MY_ADD_PYTHON_FUNCTION(thing_is_always_activated),
MY_ADD_PYTHON_FUNCTION(thing_is_always_hit),
MY_ADD_PYTHON_FUNCTION(thing_is_always_submerged_in_water),
MY_ADD_PYTHON_FUNCTION(thing_is_amulet),
Expand Down Expand Up @@ -822,7 +823,6 @@ static PyMethodDef python_c_METHODS[] = {
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag124),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag125),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag126),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag127),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag13),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag14),
MY_ADD_PYTHON_FUNCTION(thing_is_unused_flag142),
Expand Down Expand Up @@ -1370,6 +1370,7 @@ static PyMethodDef python_c_METHODS[] = {
MY_ADD_PYTHON_TP_FUNCTION(is_air_breather),
MY_ADD_PYTHON_TP_FUNCTION(is_alive_on_end_of_anim),
MY_ADD_PYTHON_TP_FUNCTION(is_allied_with),
MY_ADD_PYTHON_TP_FUNCTION(is_always_activated),
MY_ADD_PYTHON_TP_FUNCTION(is_always_hit),
MY_ADD_PYTHON_TP_FUNCTION(is_always_submerged_in_water),
MY_ADD_PYTHON_TP_FUNCTION(is_amulet),
Expand Down Expand Up @@ -1716,7 +1717,6 @@ static PyMethodDef python_c_METHODS[] = {
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag124),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag125),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag126),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag127),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag13),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag14),
MY_ADD_PYTHON_TP_FUNCTION(is_unused_flag142),
Expand Down
4 changes: 2 additions & 2 deletions src/thing_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,10 +830,10 @@ int Thing::is_unused_flag126(void)
TRACE_NO_INDENT();
return (tp()->is_unused_flag126());
}
int Thing::is_unused_flag127(void)
int Thing::is_always_activated(void)
{
TRACE_NO_INDENT();
return (tp()->is_unused_flag127());
return (tp()->is_always_activated());
}
int Thing::is_mummy(void)
{
Expand Down
6 changes: 3 additions & 3 deletions src/thing_match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ bool Tp::matches(const std::string &what)
if (is_aerodynamic() && (what == "is_aerodynamic")) { return true; }
if (is_air_breather() && (what == "is_air_breather")) { return true; }
if (is_alive_on_end_of_anim() && (what == "is_alive_on_end_of_anim")) { return true; }
if (is_always_activated() && (what == "is_always_activated")) { return true; }
if (is_always_hit() && (what == "is_always_hit")) { return true; }
if (is_always_submerged_in_water() && (what == "is_always_submerged_in_water")) { return true; }
if (is_amulet() && (what == "is_amulet")) { return true; }
Expand Down Expand Up @@ -455,7 +456,6 @@ bool Tp::matches(const std::string &what)
if (is_unused_flag124() && (what == "is_unused_flag124")) { return true; }
if (is_unused_flag125() && (what == "is_unused_flag125")) { return true; }
if (is_unused_flag126() && (what == "is_unused_flag126")) { return true; }
if (is_unused_flag127() && (what == "is_unused_flag127")) { return true; }
if (is_unused_flag12() && (what == "is_unused_flag12")) { return true; }
if (is_unused_flag13() && (what == "is_unused_flag13")) { return true; }
if (is_unused_flag142() && (what == "is_unused_flag142")) { return true; }
Expand Down Expand Up @@ -724,6 +724,7 @@ bool Thing::matches(const std::string &what)
if (is_air_breather() && (what == "is_air_breather")) { return true; }
if (is_alive_monst() && (what == "is_alive_monst")) { return true; }
if (is_alive_on_end_of_anim() && (what == "is_alive_on_end_of_anim")) { return true; }
if (is_always_activated() && (what == "is_always_activated")) { return true; }
if (is_always_hit() && (what == "is_always_hit")) { return true; }
if (is_always_submerged_in_water() && (what == "is_always_submerged_in_water")) { return true; }
if (is_amulet() && (what == "is_amulet")) { return true; }
Expand Down Expand Up @@ -1056,7 +1057,6 @@ bool Thing::matches(const std::string &what)
if (is_unused_flag124() && (what == "is_unused_flag124")) { return true; }
if (is_unused_flag125() && (what == "is_unused_flag125")) { return true; }
if (is_unused_flag126() && (what == "is_unused_flag126")) { return true; }
if (is_unused_flag127() && (what == "is_unused_flag127")) { return true; }
if (is_unused_flag12() && (what == "is_unused_flag12")) { return true; }
if (is_unused_flag13() && (what == "is_unused_flag13")) { return true; }
if (is_unused_flag142() && (what == "is_unused_flag142")) { return true; }
Expand Down Expand Up @@ -1322,6 +1322,7 @@ std::function< int(Thingp) > Thing::matches_to_func(const std::string &what)
if (what == "is_air_breather") { return &Thing::is_air_breather; }
if (what == "is_alive_monst") { return &Thing::is_alive_monst; }
if (what == "is_alive_on_end_of_anim") { return &Thing::is_alive_on_end_of_anim; }
if (what == "is_always_activated") { return &Thing::is_always_activated; }
if (what == "is_always_hit") { return &Thing::is_always_hit; }
if (what == "is_always_submerged_in_water") { return &Thing::is_always_submerged_in_water; }
if (what == "is_amulet") { return &Thing::is_amulet; }
Expand Down Expand Up @@ -1645,7 +1646,6 @@ std::function< int(Thingp) > Thing::matches_to_func(const std::string &what)
if (what == "is_unused_flag124") { return &Thing::is_unused_flag124; }
if (what == "is_unused_flag125") { return &Thing::is_unused_flag125; }
if (what == "is_unused_flag126") { return &Thing::is_unused_flag126; }
if (what == "is_unused_flag127") { return &Thing::is_unused_flag127; }
if (what == "is_unused_flag12") { return &Thing::is_unused_flag12; }
if (what == "is_unused_flag13") { return &Thing::is_unused_flag13; }
if (what == "is_unused_flag142") { return &Thing::is_unused_flag142; }
Expand Down
6 changes: 5 additions & 1 deletion src/thing_skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ bool Thing::skill_add(Thingp new_skill)
{
TRACE_NO_INDENT();

if (! new_skill) {
return false;
}

dbg("Try to add skill %s", new_skill->to_short_string().c_str());
TRACE_AND_INDENT();

Expand Down Expand Up @@ -78,7 +82,7 @@ bool Thing::skill_add(Thingp new_skill)
sound_play("powerup");
}

if (new_skill->is_auto_activated()) {
if (new_skill->is_always_activated()) {
skill_activate(new_skill);
}

Expand Down
9 changes: 9 additions & 0 deletions src/thing_skillbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,15 @@ bool Level::skill_chosen(Thingp what)
return false;
}

//
// e.g. rage activates itself when low on health
//
if (what->is_auto_activated()) {
player->msg("%%fg=orange$This skill activates when needed.%%fg=reset$");
sound_play("bonk");
return false;
}

DBG2("Skillbox: Request to remake skillbox");
game->set_request_to_remake_skillbox();

Expand Down
4 changes: 4 additions & 0 deletions src/thing_spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ bool Thing::spell_add(Thingp new_spell)
{
TRACE_NO_INDENT();

if (! new_spell) {
return false;
}

dbg("Try to add spell %s", new_spell->to_short_string().c_str());
TRACE_AND_INDENT();

Expand Down

0 comments on commit ba22083

Please sign in to comment.