Skip to content

Commit

Permalink
feat: summon food
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 15, 2023
1 parent ec3fa1c commit 5245738
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 39 deletions.
Binary file modified data/gfx.tgz
Binary file not shown.
4 changes: 2 additions & 2 deletions python/gfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ def init_tiles_16x16_main():
"spell_summon_monst_D",
"spell_summon_monst_E_activated",
"spell_summon_monst_E",
"",
"",
"spell_summon_food_activated",
"spell_summon_food",
"",
"",
"",
Expand Down
27 changes: 27 additions & 0 deletions python/spell_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

my.map_load_spell_tree(
spell_data=[
"fd", "spell_summon_food",
"mm", "spell_magic_missile",
"sA", "spell_summon_monst_A",
"sB", "spell_summon_monst_B",
Expand All @@ -15,6 +16,32 @@
tree_data=[
"mm ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
],
)

my.map_load_spell_tree(
tree_name="summoning",
tree_data=[
"fd ",
" ",
"sA->sB->sC->sD->sE ",
" ",
" ",
Expand Down
40 changes: 40 additions & 0 deletions python/things/spells/spell_summon_food.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import my
import tp


def on_targeted(me, x, y):
my.place_at(me, "random_food", x, y)


def tp_init(name, text_long_name, text_short_name):
global self
self = tp.Tp(name, text_long_name, text_short_name)
# begin sort marker
my.gfx_targeted_projectile(self, "projectile_magical_effect")
my.is_loggable(self, True)
my.is_spell(self, True)
my.is_target_select(self, True)
my.is_usable(self, True)
my.on_targeted_do(self, "me.on_targeted()")
my.range_max(self, 7)
my.spell_base_name(self, name)
my.spell_cost(self, 5)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Summon some tasty and freshly made dungeon food. Made by what or whom is best not to ask.")
my.text_description_long2(self, "This service is brought to you by Dungeon Dash.")
my.text_description_short(self, "Spell, summon food")
my.text_description_very_short(self, "SumFood")
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
# end sort marker

my.tile(self, tile="spell_summon_food")
my.tile(self, tile="spell_summon_food_activated")
my.tp_update(self)


def init():
tp_init(name="spell_summon_food", text_long_name="summon food", text_short_name="summon food")


init()
2 changes: 1 addition & 1 deletion src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void Game::place_player(void)
auto w = level->thing_new("sword_plutonium", point(x, y));
t->carry(w, carry_options);
}
if (0) {
if (1) {
auto w = level->thing_new("staff_descent", point(x, y));
t->carry(w, carry_options);
}
Expand Down
5 changes: 3 additions & 2 deletions src/thing_spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ bool Thing::spell_can_use(Thingp what)
//
if (what->spell_cost() > magic()) {
if (is_player()) {
msg("You do not have enough magic points to cast %s. You need %d.", what->text_the().c_str(),
what->spell_cost());
msg("%%fg=orange$You do not have enough magic points to cast %s. You need %d.%%fg=reset$",
what->text_the().c_str(), what->spell_cost());
spell_deactivate(what);
sound_play("bonk");
}
return false;
Expand Down
1 change: 1 addition & 0 deletions src/thing_template_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ std::initializer_list< std::string > tps = {
"somekindofmeat",
"spellbook",
"spell_magic_missile",
"spell_summon_food",
"spell_summon_monst_A",
"spell_summon_monst_B",
"spell_summon_monst_C",
Expand Down
36 changes: 18 additions & 18 deletions src/wid_inventory_ascii.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,23 +275,6 @@ bool wid_inventory_create_ascii(Thingp selected, Thingp over)
wid_set_pos(w, tl, br);
wid_set_text(w, "Eat");
y_at += 2;
} else if (! item->gfx_targeted_laser().empty()) {
TRACE_AND_INDENT();
if (item->charge_count()) {
auto p = wid_inventory_window;
auto w = wid_new_square_button(p, "use");

point tl = make_point(x_off, y_at);
point br = make_point(x_off + width, y_at);
wid_set_mode(w, WID_MODE_OVER);
wid_set_style(w, box_highlight_style);
wid_set_mode(w, WID_MODE_NORMAL);
wid_set_style(w, box_style);
wid_set_on_mouse_up(w, wid_inventory_item_option_use);
wid_set_pos(w, tl, br);
wid_set_text(w, "Use (choose target)");
y_at += 2;
}
} else if (item->is_able_to_be_equipped() && ! player->is_equipped(item)) {
TRACE_AND_INDENT();
auto p = wid_inventory_window;
Expand Down Expand Up @@ -326,7 +309,7 @@ bool wid_inventory_create_ascii(Thingp selected, Thingp over)
} else if (item->is_amulet()) {
wid_set_text(w, "Wear)");
} else {
wid_set_text(w, "Use");
wid_set_text(w, "Equip");
}
y_at += 2;
} else if (item->is_able_to_be_equipped() && player->is_equipped(item)) {
Expand Down Expand Up @@ -387,6 +370,23 @@ bool wid_inventory_create_ascii(Thingp selected, Thingp over)
wid_set_pos(w, tl, br);
wid_set_text(w, "%%fg=red$Spent");
y_at += 2;

} else if (! item->gfx_targeted_laser().empty()) {
TRACE_AND_INDENT();
auto p = wid_inventory_window;
auto w = wid_new_square_button(p, "use");

point tl = make_point(x_off, y_at);
point br = make_point(x_off + width, y_at);
wid_set_mode(w, WID_MODE_OVER);
wid_set_style(w, box_highlight_style);
wid_set_mode(w, WID_MODE_NORMAL);
wid_set_style(w, box_style);
wid_set_on_mouse_up(w, wid_inventory_item_option_use);
wid_set_pos(w, tl, br);
wid_set_text(w, "Use (choose target)");
y_at += 2;

} else {
//
// For example boots of teleport or an enchantstone
Expand Down
30 changes: 14 additions & 16 deletions src/wid_inventory_pixelart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,6 @@ bool wid_inventory_create_pixelart(Thingp selected, Thingp over)
wid_set_pos(w, tl, br);
wid_set_text(w, "Eat");
y_at += 3;
} else if (! item->gfx_targeted_laser().empty()) {
TRACE_AND_INDENT();
if (item->charge_count()) {
auto p = wid_inventory_window;
auto w = wid_new_square_button(p, "use");

point tl = make_point(x_off, y_at);
point br = make_point(x_off + width, y_at + 2);
wid_set_style(w, UI_WID_STYLE_NORMAL);
wid_set_on_mouse_up(w, wid_inventory_item_option_use);
wid_set_pos(w, tl, br);
wid_set_text(w, "Use (choose target)");
y_at += 3;
}
} else if (item->is_able_to_be_equipped() && ! player->is_equipped(item)) {
TRACE_AND_INDENT();
auto p = wid_inventory_window;
Expand Down Expand Up @@ -324,9 +310,9 @@ bool wid_inventory_create_pixelart(Thingp selected, Thingp over)
} else if (item->is_boots()) {
wid_set_text(w, "Wear");
} else if (item->is_amulet()) {
wid_set_text(w, "Wear)");
wid_set_text(w, "Wear");
} else {
wid_set_text(w, "Use");
wid_set_text(w, "Equip");
}
y_at += 3;
} else if (item->is_able_to_be_equipped() && player->is_equipped(item)) {
Expand Down Expand Up @@ -381,6 +367,18 @@ bool wid_inventory_create_pixelart(Thingp selected, Thingp over)
wid_set_pos(w, tl, br);
wid_set_text(w, "%%fg=red$Spent");
y_at += 3;
} else if (! item->gfx_targeted_laser().empty()) {
TRACE_AND_INDENT();
auto p = wid_inventory_window;
auto w = wid_new_square_button(p, "use");

point tl = make_point(x_off, y_at);
point br = make_point(x_off + width, y_at + 2);
wid_set_style(w, UI_WID_STYLE_NORMAL);
wid_set_on_mouse_up(w, wid_inventory_item_option_use);
wid_set_pos(w, tl, br);
wid_set_text(w, "Use (choose target)");
y_at += 3;
} else {
//
// For example boots of teleport
Expand Down

0 comments on commit 5245738

Please sign in to comment.