Skip to content

Commit

Permalink
feat: more spellbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Jul 16, 2023
1 parent ba22083 commit 143d076
Show file tree
Hide file tree
Showing 10 changed files with 299 additions and 19 deletions.
Binary file modified data/gfx.tgz
Binary file not shown.
10 changes: 5 additions & 5 deletions python/gfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1464,7 +1464,11 @@ def init_tiles_16x16_main():
"thunderstone",
"enchantstone",
"skillstone",
"spellbook",
"spellbook1",
"spellbook2",
"spellbook3",
"spellbook4",
"spellbook5",
"map_treasure",
"map_beast",
"horseshoe",
Expand All @@ -1473,10 +1477,6 @@ def init_tiles_16x16_main():
"rock",
"rock2",
"",
"",
"",
"",
"",
############################################################
"sword_wood",
"sword_rusty",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def tp_init(name, text_long_name, text_short_name):
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_show_outlined(self, True)
my.gfx_pixelart_submergible(self, True)
my.charge_count(self, 1)
my.gold_value_dice(self, "500")
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
Expand All @@ -32,13 +33,14 @@ def tp_init(name, text_long_name, text_short_name):
my.is_moveable(self, True)
my.is_spellbook(self, True)
my.is_throwable(self, True)
my.is_treasure_class_C(self, True)
my.is_treasure_class_B(self, True)
my.is_treasure(self, True)
my.is_treasure_type(self, True)
my.is_usable(self, True)
my.item_height(self, 4)
my.item_width(self, 4)
my.noise_on_dropping(self, 50)
my.rarity(self, my.RARITY_COMMON)
my.normal_placement_rules(self, True)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Read this spellbook to learn some new spells into your brain matter thing.")
Expand All @@ -56,7 +58,7 @@ def tp_init(name, text_long_name, text_short_name):


def init():
tp_init(name="spellbook", text_long_name="spellbook", text_short_name="spellbook")
tp_init(name="spellbook1", text_long_name="spellbook", text_short_name="spellbook")


init()
64 changes: 64 additions & 0 deletions python/things/treasure/spellbook2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import my
import tp


def tp_init(name, text_long_name, text_short_name):
self = tp.Tp(name, text_long_name, text_short_name)
# begin sort marker
my.collision_hit_priority(self, 5)
my.environ_dislikes_fire(self, 10)
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_show_outlined(self, True)
my.gfx_pixelart_submergible(self, True)
my.charge_count(self, 2)
my.gold_value_dice(self, "1000")
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
my.is_biome_dungeon(self, True)
my.is_biome_flooded(self, True)
my.is_biome_ice(self, True)
my.is_biome_lava(self, True)
my.is_collectable(self, True)
my.is_described_when_hovering_over(self, True)
my.is_droppable(self, True)
my.is_interesting(self, True)
my.is_item(self, True)
my.is_loggable(self, True)
my.is_moveable(self, True)
my.is_spellbook(self, True)
my.is_throwable(self, True)
my.is_treasure_class_B(self, True)
my.is_treasure(self, True)
my.rarity(self, my.RARITY_UNCOMMON)
my.is_usable(self, True)
my.item_height(self, 4)
my.item_width(self, 4)
my.noise_on_dropping(self, 50)
my.normal_placement_rules(self, True)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Read this spellbook to learn some new spells into your brain matter thing.")
my.text_description_long2(self, "This rare book is bursting with knowledge. Well, two spells. Use them well.")
my.text_description_short(self, "A dusty spellbook.")
my.tick_prio(self, my.MAP_TICK_PRIO_NORMAL)
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
# end sort marker

my.tile(self,
ascii_fg_char="diamond_solid", ascii_bg_col_name="", ascii_fg_col_name="yellow",
tile=name, delay_ms=100)

my.tp_update(self)


def init():
tp_init(name="spellbook2", text_long_name="spellbook", text_short_name="spellbook")


init()
66 changes: 66 additions & 0 deletions python/things/treasure/spellbook3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import my
import tp


def tp_init(name, text_long_name, text_short_name):
self = tp.Tp(name, text_long_name, text_short_name)
# begin sort marker
my.collision_hit_priority(self, 5)
my.environ_dislikes_fire(self, 10)
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_show_outlined(self, True)
my.gfx_pixelart_submergible(self, True)
my.charge_count(self, 3)
my.gold_value_dice(self, "1500")
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
my.is_biome_dungeon(self, True)
my.is_biome_flooded(self, True)
my.is_biome_ice(self, True)
my.is_biome_lava(self, True)
my.is_collectable(self, True)
my.is_described_when_hovering_over(self, True)
my.is_droppable(self, True)
my.is_interesting(self, True)
my.is_item(self, True)
my.is_loggable(self, True)
my.is_moveable(self, True)
my.is_spellbook(self, True)
my.is_throwable(self, True)
my.is_treasure_class_C(self, True)
my.is_treasure(self, True)
my.rarity(self, my.RARITY_RARE)
my.stat_luck_bonus(self, -2)
my.is_treasure_type(self, True)
my.is_usable(self, True)
my.item_height(self, 4)
my.item_width(self, 4)
my.noise_on_dropping(self, 50)
my.normal_placement_rules(self, True)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Read this spellbook to learn some new spells into your brain matter thing.")
my.text_description_long2(self, "This book is beautifully crafted with gold. The only worrying thing is that the bookmark inside appears to be a tongue...")
my.text_description_short(self, "A dark and dusty spellbook.")
my.tick_prio(self, my.MAP_TICK_PRIO_NORMAL)
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
# end sort marker

my.tile(self,
ascii_fg_char="diamond_solid", ascii_bg_col_name="", ascii_fg_col_name="pink",
tile=name, delay_ms=100)

my.tp_update(self)


def init():
tp_init(name="spellbook3", text_long_name="spellbook", text_short_name="spellbook")


init()
66 changes: 66 additions & 0 deletions python/things/treasure/spellbook4.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import my
import tp


def tp_init(name, text_long_name, text_short_name):
self = tp.Tp(name, text_long_name, text_short_name)
# begin sort marker
my.collision_hit_priority(self, 5)
my.environ_dislikes_fire(self, 10)
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_show_outlined(self, True)
my.gfx_pixelart_submergible(self, True)
my.charge_count(self, 4)
my.gold_value_dice(self, "2000")
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
my.is_biome_dungeon(self, True)
my.is_biome_flooded(self, True)
my.is_biome_ice(self, True)
my.is_biome_lava(self, True)
my.is_collectable(self, True)
my.is_described_when_hovering_over(self, True)
my.is_droppable(self, True)
my.is_interesting(self, True)
my.is_item(self, True)
my.is_loggable(self, True)
my.is_moveable(self, True)
my.is_spellbook(self, True)
my.is_throwable(self, True)
my.is_treasure_class_C(self, True)
my.is_treasure(self, True)
my.is_treasure_type(self, True)
my.is_usable(self, True)
my.stat_luck_bonus(self, -4)
my.item_height(self, 5)
my.item_width(self, 5)
my.noise_on_dropping(self, 80)
my.rarity(self, my.RARITY_VERY_RARE)
my.normal_placement_rules(self, True)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Read this spellbook to learn some new spells into your brain matter thing.")
my.text_description_long2(self, "This book is emblazoned with a skull on its cover and the ink inside is a disconcerting red color. This book is very rare. Use its contents wisely.")
my.text_description_short(self, "A skull emblazoned dusty spellbook.")
my.tick_prio(self, my.MAP_TICK_PRIO_NORMAL)
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
# end sort marker

my.tile(self,
ascii_fg_char="diamond_solid", ascii_bg_col_name="", ascii_fg_col_name="gray30",
tile=name, delay_ms=100)

my.tp_update(self)


def init():
tp_init(name="spellbook4", text_long_name="spellbook", text_short_name="spellbook")


init()
66 changes: 66 additions & 0 deletions python/things/treasure/spellbook5.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import my
import tp


def tp_init(name, text_long_name, text_short_name):
self = tp.Tp(name, text_long_name, text_short_name)
# begin sort marker
my.collision_hit_priority(self, 5)
my.environ_dislikes_fire(self, 10)
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_show_outlined(self, True)
my.gfx_pixelart_submergible(self, True)
my.charge_count(self, 5)
my.gold_value_dice(self, "3000")
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
my.is_biome_dungeon(self, True)
my.is_biome_flooded(self, True)
my.is_biome_ice(self, True)
my.is_biome_lava(self, True)
my.is_collectable(self, True)
my.is_described_when_hovering_over(self, True)
my.is_droppable(self, True)
my.is_interesting(self, True)
my.is_item(self, True)
my.is_loggable(self, True)
my.is_moveable(self, True)
my.is_spellbook(self, True)
my.is_throwable(self, True)
my.is_treasure_class_C(self, True)
my.is_treasure(self, True)
my.rarity(self, my.RARITY_VERY_RARE)
my.is_treasure_type(self, True)
my.is_usable(self, True)
my.item_height(self, 5)
my.item_width(self, 5)
my.stat_luck_bonus(self, -8)
my.noise_on_dropping(self, 90)
my.normal_placement_rules(self, True)
my.text_a_or_an(self, "a")
my.text_description_long(self, "Read this darkest of spellbooks to learn some new spells into your brain matter thing.")
my.text_description_long2(self, "This book is emblazoned with a monstrous demonic face on its cover. It has a dark energy about it. Best to learn the spells inside quickly and get rid of it soon!")
my.text_description_short(self, "A dusty spellbook.")
my.tick_prio(self, my.MAP_TICK_PRIO_NORMAL)
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
# end sort marker

my.tile(self,
ascii_fg_char="diamond_solid", ascii_bg_col_name="", ascii_fg_col_name="red",
tile=name, delay_ms=100)

my.tp_update(self)


def init():
tp_init(name="spellbook5", text_long_name="spellbook", text_short_name="spellbook")


init()
21 changes: 14 additions & 7 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ void Game::place_player(void)
auto b = level->thing_new("enchantstone", point(x, y));
t->carry(b, carry_options);
}
if (1) {
if (0) {
{
for (auto sk = 0; sk < 1; sk++) {
auto b = level->thing_new("skillstone", point(x, y));
Expand All @@ -346,12 +346,19 @@ void Game::place_player(void)
}
}
if (0) {
{
for (auto sk = 0; sk < 2; sk++) {
auto b = level->thing_new("spellbook", point(x, y));
t->carry(b, carry_options);
}
}
level->thing_new("spellbook1", point(x + 1, y));
}
if (0) {
level->thing_new("spellbook2", point(x + 2, y));
}
if (0) {
level->thing_new("spellbook3", point(x + 3, y));
}
if (0) {
level->thing_new("spellbook4", point(x + 1, y + 1));
}
if (0) {
level->thing_new("spellbook5", point(x + 1, y + 2));
}
if (0) {
auto b = level->thing_new("thunderstone", point(x, y));
Expand Down
13 changes: 9 additions & 4 deletions src/thing_spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,15 @@ bool Thing::spell_add(Tpp what)
// Drop a spellbook
//
auto found = false;
for (const auto t : carried_item_only_vector()) {
if (t->is_spellbook()) {
t->is_drained = true;
t->dead("drained and used");
for (const auto spellbook : carried_item_only_vector()) {
if (spellbook->is_spellbook()) {
if (spellbook->charge_count()) {
spellbook->charge_count_decr();
if (! spellbook->charge_count()) {
spellbook->is_drained = true;
spellbook->dead("drained and used");
}
}
found = true;
break;
}
Expand Down
6 changes: 5 additions & 1 deletion src/thing_template_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,11 @@ std::initializer_list< std::string > tps = {
"snake_dreadfire",
"snake_viper",
"somekindofmeat",
"spellbook",
"spellbook1",
"spellbook2",
"spellbook3",
"spellbook4",
"spellbook5",
"spell_magic_missile",
"spell_summon_food",
"spell_summon_rock",
Expand Down

0 comments on commit 143d076

Please sign in to comment.