Skip to content

Commit

Permalink
bug: various fireball staff bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil McGill committed Jul 7, 2023
1 parent 10e92f5 commit 06a10be
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 33 deletions.
8 changes: 6 additions & 2 deletions python/things/staffs/staff_fire.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ def on_targetted(me, x, y):
if my.thing_possible_to_attack(me, it):
my.thing_hit(0, me, it)

my.thing_sound_play_channel(me, my.CHANNEL_EXPLOSION, "explosion_b")


def on_targetted_radially(me, x, y):
radius = my.thing_effect_radius_get(me)
Expand Down Expand Up @@ -160,7 +162,9 @@ def tp_init(name, text_long_name, text_short_name):
my.text_a_or_an(self, "a")
my.text_description_enchant(self, "+1 radius")
my.text_description_long(self, "Discharges a single fireball at an ungrateful recipient...")
my.text_description_short(self, "A staff of fire.")
my.text_description_long2(self, "When enchanted, creates a blast radius effect. Ideal for taking out multiple enemies.")
my.text_description_long3(self, "Please use responsibly.")
my.text_description_short(self, "A staff of fireballs.")
my.tick_prio(self, my.MAP_TICK_PRIO_LOW)
my.z_depth(self, my.MAP_DEPTH_OBJ)
my.z_prio(self, my.MAP_Z_PRIO_BEHIND)
Expand Down Expand Up @@ -189,7 +193,7 @@ def tp_init(name, text_long_name, text_short_name):


def init():
tp_init(name="staff_fire", text_long_name="staff of fire", text_short_name="staff of fire")
tp_init(name="staff_fire", text_long_name="staff of fireballs", text_short_name="staff of fireballs")


init()
2 changes: 2 additions & 0 deletions src/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ void Game::place_player(void)
}
if (1) {
auto w = level->thing_new("staff_fire", point(x, y));
// w->enchant_randomly();
// w->enchant_randomly();
t->carry(w, carry_options);
}
if (0) {
Expand Down
4 changes: 0 additions & 4 deletions src/projectile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ void Level::new_projectile(ThingId id, ThingId victim_id, ProjectileInfo info, u
uint32_t now = time_game_ms();
info.ts_start = now;

if (g_opt_ascii) {
dur *= 2;
}

info.ts_stop = now + dur;
new_projectiles.push_back(Projectile(this, id, victim_id, info));
}
Expand Down
10 changes: 9 additions & 1 deletion src/thing_attack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,15 @@ bool Thing::attack(Thingp victim, ThingAttackOptionsp attack_options)
bool tried_to_attack = false;
int attack_count = 0;

auto attacks = owner ? owner->dmg_num_of_attacks() : dmg_num_of_attacks();
//
// For melee attacks, skills can increase the number of attacks
// Don't allow skills for melee to increase the number of attacks for magical items.
//
auto attacks = dmg_num_of_attacks();
if (owner && is_weapon()) {
attacks = owner->dmg_num_of_attacks();
}

dbg("Attack count #%d", attacks);
TRACE_AND_INDENT();

Expand Down
8 changes: 0 additions & 8 deletions src/thing_dmg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,6 @@ int Thing::dmg_num_of_attacks(void)
}

if (maybe_itemsp()) {
FOR_ALL_CARRYING(id)
{
auto iter = level->thing_find(id);
if (iter) {
attacks = std::max(attacks, iter->dmg_num_of_attacks());
}
}

FOR_ALL_BUFFS(id)
{
auto iter = level->thing_find(id);
Expand Down
22 changes: 11 additions & 11 deletions src/thing_hit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to poison!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to poison damage!", text_The().c_str());
}
} else {
Expand Down Expand Up @@ -463,7 +463,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to cold!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to cold damage!", text_The().c_str());
} else {
dbg("Takes no cold damage");
Expand Down Expand Up @@ -508,7 +508,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to fire!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to fire damage!", text_The().c_str());
} else {
dbg("Is immune to fire damage");
Expand Down Expand Up @@ -573,7 +573,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to electrical damage!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to electrical damage!", text_The().c_str());
} else {
dbg("Takes no electrical damage");
Expand Down Expand Up @@ -645,7 +645,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to negation damage!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to negation damage!", text_The().c_str());
} else {
dbg("Takes no negation damage");
Expand Down Expand Up @@ -680,7 +680,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to acid damage!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to acid damage!", text_The().c_str());
} else {
dbg("Is immune to acid damage");
Expand Down Expand Up @@ -721,7 +721,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to water damage!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to water damage!", text_The().c_str());
} else {
dbg("Is immune to water damage");
Expand Down Expand Up @@ -785,7 +785,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to unpleasant!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to unpleasant!", text_The().c_str());
} else {
dbg("Takes no unpleasant damage");
Expand Down Expand Up @@ -826,7 +826,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to physical draining!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to physical draining attacks!", text_The().c_str());
} else {
dbg("Is immune to physical draining damage");
Expand Down Expand Up @@ -862,7 +862,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to magical draining!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to magical draining attacks!", text_The().c_str());
} else {
dbg("Is immune to magical draining damage");
Expand Down Expand Up @@ -920,7 +920,7 @@ int Thing::ai_hit_actual(Thingp hitter, // an arrow / monst /.
if (real_hitter->is_player()) {
if (is_player()) {
msg("You are immune to heat!");
} else if (is_item() || is_alive_monst()) {
} else if (is_mob() || is_item() || is_alive_monst()) {
msg("%s is immune to heat damage!", text_The().c_str());
} else {
dbg("Is immune to heat damage");
Expand Down
13 changes: 6 additions & 7 deletions src/wid_thing_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,6 @@ WidPopup *Game::wid_thing_info_create_popup(Thingp t, point tl, point br)
wid_thing_info_add_carry_info(wid_popup_window, t);
}

//
// Not sure if we will have shops
//
wid_thing_info_add_gold_value(wid_popup_window, t);

wid_thing_info_add_spell_cost(wid_popup_window, t);

if (t->is_mimic() && t->is_sleeping) {
//
// Do not describe
Expand Down Expand Up @@ -287,6 +280,12 @@ WidPopup *Game::wid_thing_info_create_popup(Thingp t, point tl, point br)
wid_thing_info_add_danger_level(wid_popup_window, t);
}

//
// Not sure if we will have shops
//
wid_thing_info_add_gold_value(wid_popup_window, t);
wid_thing_info_add_spell_cost(wid_popup_window, t);

t->show_botcon_description();

if (game->current_wid_thing_info != t) {
Expand Down

0 comments on commit 06a10be

Please sign in to comment.