Skip to content

Commit

Permalink
Play poison/slow/petrify sounds from game_config when status inflicted
Browse files Browse the repository at this point in the history
  • Loading branch information
ln-zookeeper committed Aug 28, 2015
1 parent f6c6c48 commit 9f27fb7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/actions/attack.cpp
Expand Up @@ -894,6 +894,8 @@ namespace {
int ran_num = random_new::generator->get_random_int(0,99);
bool hits = (ran_num < attacker.cth_);

std::vector<std::string> extra_hit_sounds;

int damage = 0;
if (hits) {
damage = attacker.damage_;
Expand Down Expand Up @@ -983,23 +985,29 @@ namespace {
if (attacker_stats->poisons && !defender_unit.get_state(unit::STATE_POISONED)) {
float_text << (defender_unit.gender() == unit_race::FEMALE ?
_("female^poisoned") : _("poisoned")) << '\n';

extra_hit_sounds.push_back(game_config::sounds::status::poisoned);
}

if (attacker_stats->slows && !defender_unit.get_state(unit::STATE_SLOWED)) {
float_text << (defender_unit.gender() == unit_race::FEMALE ?
_("female^slowed") : _("slowed")) << '\n';

extra_hit_sounds.push_back(game_config::sounds::status::slowed);
}

if (attacker_stats->petrifies) {
float_text << (defender_unit.gender() == unit_race::FEMALE ?
_("female^petrified") : _("petrified")) << '\n';

extra_hit_sounds.push_back(game_config::sounds::status::petrified);
}
}

unit_display::unit_attack(game_display::get_singleton(), *resources::gameboard,
attacker.loc_, defender.loc_, damage,
*attacker_stats->weapon, defender_stats->weapon,
abs_n, float_text.str(), drains_damage, "");
abs_n, float_text.str(), drains_damage, "", &extra_hit_sounds);
}

bool dies = defender.get_unit().take_hit(damage);
Expand Down

0 comments on commit 9f27fb7

Please sign in to comment.