Better flurry sounds

This commit is contained in:
Linus Probert 2018-03-01 06:47:16 +01:00
parent da2ec32981
commit 06cdebc3b3
7 changed files with 20 additions and 5 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -28,8 +28,8 @@ static Music loaded_song = LAST_MUSIC;
static char *music[LAST_MUSIC] = {
"Sounds/Music/fantasy-game-background-looping.ogg", // GAME_MUSIC0
"Sounds/Music/bog-creatures-on-the-move-looping.ogg", // GAME_MUSIC1
"Sounds/Music/fantascape-looping.ogg", // GAME_MUSIC2
"Sounds/Music/fantasy-forest-battle.ogg" // MENU_MUSIC
"Sounds/Music/fantascape-looping.ogg", // GAME_MUSIC2
"Sounds/Music/fantasy-forest-battle.ogg" // MENU_MUSIC
};
static bool sound_enabled = true;
@ -60,7 +60,10 @@ load_effects(void)
effects[SWING0] = load_effect("Sounds/FX/swing.wav");
effects[SWING1] = load_effect("Sounds/FX/swing2.wav");
effects[SWING2] = load_effect("Sounds/FX/swing3.wav");
effects[TRIPPLE_SWING] = load_effect("Sounds/FX/tripple_swing.wav");
effects[SWORD_HIT] = load_effect("Sounds/FX/sword_hit.wav");
effects[DOUBLE_SWORD_HIT] = load_effect("Sounds/FX/double_sword_hit.wav");
effects[TRIPPLE_SWORD_HIT] = load_effect("Sounds/FX/tripple_sword_hit.wav");
effects[BONK] = load_effect("Sounds/FX/bonk.wav");
effects[DEATH] = load_effect("Sounds/FX/death.wav");
effects[COIN] = load_effect("Sounds/FX/coin.wav");

View File

@ -34,7 +34,10 @@ typedef enum Fx_t {
SWING0,
SWING1,
SWING2,
TRIPPLE_SWING,
SWORD_HIT,
DOUBLE_SWORD_HIT,
TRIPPLE_SWORD_HIT,
BONK,
DEATH,
COIN,

View File

@ -55,17 +55,26 @@ skill_use_flurry(Skill *skill, SkillData *data)
targetPos.y += (int) data->direction.y;
Monster *monster = data->matrix->spaces[targetPos.x][targetPos.y].monster;
mixer_play_effect(TRIPPLE_SWING);
if (monster) {
gui_log("You attack %s with a flurry of strikes", monster->lclabel);
unsigned int hitCount = 0;
for (size_t i = 0; i < 3; ++i) {
unsigned int originalHp = monster->stats.hp;
unsigned int dmg = stats_fight(&data->player->stats, &monster->stats);
mixer_play_effect((SWING0 - 1) + get_random(3));
if (dmg > 0) {
if (dmg > 0 && originalHp > 0) {
gui_log("You hit for %u damage", dmg);
mixer_play_effect(SWORD_HIT);
monster_hit(monster, dmg);
hitCount++;
}
}
if (hitCount == 1) {
mixer_play_effect(SWORD_HIT);
} else if (hitCount == 2) {
mixer_play_effect(DOUBLE_SWORD_HIT);
} else if (hitCount == 3) {
mixer_play_effect(TRIPPLE_SWORD_HIT);
}
} else {
gui_log("You swing at thin air with a flurry of strikes");