Skip to content

Commit

Permalink
feat: slime protection armor
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Nov 1, 2023
1 parent 3512f35 commit 4174b83
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 12 deletions.
Binary file modified data/gfx.tgz
Binary file not shown.
14 changes: 7 additions & 7 deletions python/gfx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1458,13 +1458,13 @@ def init_tiles_16x16_main():
"armor_dragon_carry.4",
"armor_dragon_carry.5",
"armor_dragon_carry.6",
"",
"",
"",
"",
"",
"",
"",
"armor_slime",
"armor_slime_carry.1",
"armor_slime_carry.2",
"armor_slime_carry.3",
"armor_slime_carry.4",
"armor_slime_carry.5",
"armor_slime_carry.6",
"",
"",
"",
Expand Down
2 changes: 1 addition & 1 deletion python/things/armor/armor_dragon.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def tp_init(name, text_long_name, text_short_name):
my.stat_def_bonus(self, 6)
my.text_a_or_an(self, "a")
my.text_description_enchant(self, "+1 DEF")
my.text_description_long(self, "Better hope the dragon doesn't want those scales back.")
my.text_description_long2(self, "Better hope the dragon doesn't want those scales back.")
my.text_description_long(self, "Dragon armor. Flexible, fire proof and crafted from fine dragon scales.")
my.text_description_short(self, "Dragon armor.")
my.tick_prio(self, my.MAP_TICK_PRIO_NORMAL)
Expand Down
3 changes: 3 additions & 0 deletions python/things/armor/armor_golden.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ def tp_init(name, text_long_name, text_short_name):
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gold_value_dice(self, "1000")
my.gfx_ascii_show_light_once_seen(self, True)
my.is_able_to_be_equipped(self, True)
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_armor(self, True)
my.light_color(self, "yellow")
my.light_dist(self, 1)
my.is_auto_equipped(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
Expand Down
96 changes: 96 additions & 0 deletions python/things/armor/armor_slime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import my
import tp

self = None


def on_enchant(me, x, y):
owner = my.thing_top_owner_id_get(me)
if owner and my.thing_is_player(owner):
my.thing_msg_if_not_dead_or_dying(me, "The armor glows a bright green.")
my.thing_stat_def_bonus_incr(me, 1)


def on_equip(owner, me, x, y):
my.thing_buff_add(owner, "buff_permanent_slime_protection")


def on_unequip(owner, me, x, y):
my.thing_buff_remove(owner, "buff_permanent_slime_protection")


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.chance_d10000_damaged(self, 5)
my.chance_d10000_enchanted(self, 200)
my.chance_d10000_runic(self, 100)
my.collision_hit_priority(self, 6)
my.equip_carry_anim(self, "armor_slime_carry")
my.gfx_ascii_show_light_once_seen(self, True)
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.gold_value_dice(self, "1000")
my.is_able_to_be_equipped(self, True)
my.is_able_to_be_teleported(self, True)
my.is_able_to_fall(self, True)
my.is_armor(self, True)
my.is_auto_equipped(self, True)
my.is_bag_item(self, True)
my.is_biome_chasms(self, True)
my.is_biome_dungeon(self, True)
my.is_biome_lava(self, True)
my.is_biome_swamp(self, True)
my.is_collectable(self, True)
my.is_described_in_leftbar(self, True)
my.is_described_when_hovering_over(self, True)
my.is_droppable(self, True)
my.is_enchantable(self, True)
my.is_heavy(self, True)
my.is_interesting(self, True)
my.is_item(self, True)
my.is_loggable(self, True)
my.is_treasure_class_C(self, True)
my.is_treasure(self, True)
my.is_treasure_type(self, True)
my.is_value_defensive(self, 1)
my.item_height(self, 4)
my.item_width(self, 4)
my.light_color(self, "green")
my.light_dist(self, 1)
my.noise_on_dropping(self, 10)
my.normal_placement_rules(self, True)
my.on_enchant_do(self, "me.on_enchant()")
my.on_equip_do(self, "me.on_equip()")
my.on_unequip_do(self, "me.on_unequip()")
my.rarity(self, my.RARITY_RARE)
my.stat_def_bonus(self, 3)
my.text_a_or_an(self, "a")
my.text_description_enchant(self, "+1 DEF")
my.text_description_long(self, "Slime resistant armor for all your slime related needs.")
my.text_description_short(self, "Slime resistant armor.")
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_ITEM)
# end sort marker

my.tile(self,
ascii_fg_char="[", ascii_bg_col_name="", ascii_fg_col_name="limegreen",
tile=name)

my.tp_update(self)


def init():
tp_init(
name="armor_slime",
text_long_name="slime armor",
text_short_name="armor, slime",
)


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


def tp_init(name):
self = tp.Tp(name)
# begin sort marker
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_animated_can_hflip(self, True)
my.gfx_pixelart_animated(self, True)
my.gfx_pixelart_anim_synced_with_owner(self, True)
my.gfx_pixelart_bounce_on_move(self, True)
my.gfx_pixelart_equip_carry_anim(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gfx_pixelart_submergible(self, True)
my.is_animation(self, True)
my.is_loggable(self, True)
my.is_moveable(self, True)
my.text_a_or_an(self, "a")
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_CARRY)
# end sort marker

# This should be synced with its owner, but just in case it is not, we have delay set
delay = 900
my.tile(self,
tile=name + ".1", delay_ms=delay, frame=1)
my.tile(self,
tile=name + ".2", delay_ms=delay, frame=2)
my.tile(self,
tile=name + ".3", delay_ms=delay, frame=3)
my.tile(self,
tile=name + ".4", delay_ms=delay, frame=4)
my.tile(self,
tile=name + ".5", delay_ms=delay, frame=5)
my.tile(self,
tile=name + ".6", delay_ms=delay, frame=6)

my.tp_update(self)


def init():
tp_init(name="armor_slime_carry")


init()
3 changes: 3 additions & 0 deletions python/things/cloaks/cloak_slime.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def tp_init(name, text_long_name, text_short_name):
my.gfx_ascii_shown(self, True)
my.gfx_pixelart_reflection(self, True)
my.gfx_pixelart_shadow(self, True)
my.gfx_ascii_show_light_once_seen(self, True)
my.gfx_pixelart_shadow_short(self, True)
my.gfx_pixelart_show_highlighted(self, True)
my.gold_value_dice(self, "100")
Expand Down Expand Up @@ -51,6 +52,8 @@ def tp_init(name, text_long_name, text_short_name):
my.item_width(self, 4)
my.noise_on_dropping(self, -20)
my.normal_placement_rules(self, True)
my.light_color(self, "green")
my.light_dist(self, 1)
my.on_equip_do(self, "me.on_equip()")
my.on_unequip_do(self, "me.on_unequip()")
my.rarity(self, my.RARITY_COMMON)
Expand Down
6 changes: 5 additions & 1 deletion src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,13 @@ void Game::place_player(void)
auto w = level->thing_new("horseshoe", point(x, y));
t->carry(w, carry_options);
}
if (0) {
auto w = level->thing_new("armor_slime", point(x + 3, y));
t->carry(w, carry_options);
}
if (0) {
auto w = level->thing_new("armor_dragon", point(x + 3, y));
// t->carry(w, carry_options);
t->carry(w, carry_options);
}
if (0) {
auto w = level->thing_new("armor_unobtanium", point(x, y));
Expand Down
8 changes: 5 additions & 3 deletions src/thing_template_ids.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
// to be in this list
//
std::initializer_list< std::string > tps = {
"", // ID 0 means unused
"acid1",
"acid_blob",
"ai_path1",
Expand All @@ -29,6 +28,8 @@ std::initializer_list< std::string > tps = {
"apple2",
"apple_cider",
"applepie",
"armor_dragon",
"armor_dragon_carry",
"armor_fish_scale",
"armor_fish_scale_carry",
"armor_golden",
Expand All @@ -43,10 +44,10 @@ std::initializer_list< std::string > tps = {
"armor_lime_scale_carry",
"armor_obsidian",
"armor_obsidian_carry",
"armor_dragon",
"armor_dragon_carry",
"armor_plate",
"armor_plate_carry",
"armor_slime",
"armor_slime_carry",
"armor_unobtanium",
"armor_unobtanium_carry",
"ascend_dungeon",
Expand Down Expand Up @@ -550,6 +551,7 @@ std::initializer_list< std::string > tps = {
"horseshoe",
"hotsauce",
"iceman",
"", // ID 0 means unused
"jackalope",
"key",
"key_crystal",
Expand Down

0 comments on commit 4174b83

Please sign in to comment.