Implements the erupt skill

Also fixed monsters dying through bleeding logic
This commit is contained in:
Linus Probert 2019-05-09 16:02:33 +02:00
parent 223a3b00c1
commit c043ad09cf
7 changed files with 83 additions and 5 deletions

BIN
assets/Sounds/FX/blast.wav Normal file

Binary file not shown.

View File

@ -91,6 +91,7 @@ load_effects(void)
effects[DOOR_OPEN] = load_effect("Sounds/FX/door_open.wav");
effects[KEY_PICKUP] = load_effect("Sounds/FX/key_pickup.wav");
effects[BLINK_EFFECT] = load_effect("Sounds/FX/blink.wav");
effects[BLAST_EFFECT] = load_effect("Sounds/FX/blast.wav");
}
void

View File

@ -67,6 +67,7 @@ typedef enum Fx_t {
DOOR_OPEN,
KEY_PICKUP,
BLINK_EFFECT,
BLAST_EFFECT,
LAST_EFFECT
} Fx;

View File

@ -552,7 +552,7 @@ monster_perform_aoe_attack(Monster *m, RoomMatrix *rm)
}
static void
apply_bleed_damage(Monster *m)
apply_bleed_damage(Player *p, Monster *m)
{
if (!m->emitters.bleed->enabled)
return;
@ -560,12 +560,13 @@ apply_bleed_damage(Monster *m)
uint32_t dmg = m->stats.lvl * 2;
monster_hit(m, dmg);
m->stats.hp -= dmg;
player_monster_kill_check(p, m);
}
bool
monster_move(Monster *m, RoomMatrix *rm, Map *map)
{
apply_bleed_damage(m);
apply_bleed_damage(roommatrix_get_player(rm), m);
Player *player = roommatrix_get_player(rm);
if (player && player->phase_count)

View File

@ -542,6 +542,7 @@ player_create(class_t class, Camera *cam)
case MAGE:
m_strcpy(asset, 100, "Commissions/Mage.png");
player->stats = (Stats) MAGE_STATS;
player->skills[1] = skill_create(ERUPT, cam);
player->skills[2] = skill_create(BLINK, cam);
break;
case PALADIN:

View File

@ -163,7 +163,7 @@ static char *blink_tooltip[] = {
" object. Monsters will not obstruct your blink.", "",
"",
"COOLDOWN:", "",
" 5 turns", "",
" 4 turns", "",
"",
"USAGE:",
" activate the skill (press ", "3", ")", "",
@ -174,6 +174,23 @@ static char *blink_tooltip[] = {
NULL
};
static char *erupt_tooltip[] = {
"ERUPT", "",
"",
" You erupt in a magical explosion damaging monsters", "",
" around you and causing bleeding.", "",
"",
"COOLDOWN:", "",
" 3 turns", "",
"",
"USAGE:",
" Erupt (press ", "2", ")", "",
"",
"",
"Press ", "ESC", " to close", "",
NULL
};
static char *dagger_tooltip[] = {
"THROW DAGGER", "",
"",
@ -835,8 +852,60 @@ create_blink(void)
s->clip = CLIP32(32, 0);
s->fixed = true;
Skill *skill = create_default("Blink", s);
skill->levelcap = 4;
skill->levelcap = 3;
skill->use = skill_blink;
skill->resetTime = 4;
return skill;
}
static bool
skill_erupt(Skill *skill, SkillData *data)
{
UNUSED(skill);
Player *player = data->player;
RoomMatrix *rm = data->matrix;
gui_log("You erupt in a magical explosion");
particle_engine_eldritch_explosion(player->sprite->pos, DIM(32, 32));
mixer_play_effect(BLAST_EFFECT);
Position playerMPos = position_to_matrix_coords(&player->sprite->pos);
for (Sint32 i = -1; i <= 1; ++i) {
for (Sint32 j = -1; j <= 1; ++j) {
if (i == 0 && j == 0)
continue;
RoomSpace *r = &rm->spaces[playerMPos.x + i][playerMPos.y + j];
if (r->monster) {
player->stats.advantage = true;
int dmg = stats_fight(&player->stats, &r->monster->stats);
player->stats.advantage = false;
monster_hit(r->monster, dmg);
gui_log("%s takes %d damage from the explosion", r->monster->label, dmg);
monster_set_bleeding(r->monster);
}
}
}
return true;
}
static Skill *
create_erupt(void)
{
Texture *t = texturecache_add("Extras/Skills.png");
Sprite *s = sprite_create();
sprite_set_texture(s, t, 0);
s->dim = GAME_DIMENSION;
s->clip = CLIP32(32, 0);
s->fixed = true;
Skill *skill = create_default("Erupt", s);
skill->levelcap = 3;
skill->use = skill_erupt;
skill->instantUse = true;
skill->resetTime = 3;
return skill;
}
@ -861,6 +930,10 @@ skill_create(enum SkillType t, Camera *cam)
skill = create_blink();
skill->tooltip = tooltip_create(blink_tooltip, cam);
break;
case ERUPT:
skill = create_erupt();
skill->tooltip = tooltip_create(erupt_tooltip, cam);
break;
case DAGGER_THROW:
skill = create_throw_dagger();
skill->tooltip = tooltip_create(dagger_tooltip, cam);

View File

@ -36,7 +36,8 @@ enum SkillType {
BACKSTAB,
TRIP,
PHASE,
BLINK
BLINK,
ERUPT
};
typedef struct SkillData_t {