Fixes working explosions and artifacts
Artifacts: - Explosive daggers - Explosive kills
This commit is contained in:
parent
68f4e152d3
commit
1d988d7f2f
Binary file not shown.
|
@ -77,6 +77,9 @@ artifact_set_effect(Artifact *a, MagicalEffect effect)
|
|||
a->info.name = "Stick of dynamite";
|
||||
a->info.desc = "You are an explosive slayer";
|
||||
break;
|
||||
case VOLATILE_DAGGERS:
|
||||
a->info.name = "Glowing dagger";
|
||||
a->info.desc = "Your daggers are volatile";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -92,7 +95,8 @@ static int WarriorArtifacts[] = {
|
|||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
CHARGE_THROUGH // 9
|
||||
VOLATILE_DAGGERS, // 9
|
||||
CHARGE_THROUGH // 10
|
||||
};
|
||||
|
||||
static int RogueArtifacts[] = {
|
||||
|
@ -105,7 +109,8 @@ static int RogueArtifacts[] = {
|
|||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
PHASE_IMPROVEMENT // 9
|
||||
VOLATILE_DAGGERS, // 9
|
||||
PHASE_IMPROVEMENT // 10
|
||||
};
|
||||
|
||||
static int MageArtifacts[] = {
|
||||
|
@ -118,7 +123,8 @@ static int MageArtifacts[] = {
|
|||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
SKILL_RADIUS // 9
|
||||
VOLATILE_DAGGERS, // 9
|
||||
SKILL_RADIUS // 10
|
||||
};
|
||||
|
||||
/* Not in play yet */
|
||||
|
@ -132,7 +138,8 @@ static int PaladinArtifacts[] = {
|
|||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
SKILL_RADIUS // 9
|
||||
VOLATILE_DAGGERS, // 9
|
||||
SKILL_RADIUS // 10
|
||||
};
|
||||
|
||||
/* Not in play yet */
|
||||
|
@ -146,7 +153,8 @@ static int EngineerArtifacts[] = {
|
|||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
PHASE_IMPROVEMENT // 9
|
||||
VOLATILE_DAGGERS, // 9
|
||||
PHASE_IMPROVEMENT // 10
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -268,6 +276,11 @@ artifact_sprite_for(MagicalEffect effect)
|
|||
sprite_set_texture(sprite, t, 0);
|
||||
sprite->clip = CLIP16(32, 0);
|
||||
break;
|
||||
case VOLATILE_DAGGERS:
|
||||
t = texturecache_add("Extras/Artifacts.png");
|
||||
sprite_set_texture(sprite, t, 0);
|
||||
sprite->clip = CLIP16(16, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ typedef enum MagicalEffect {
|
|||
SKILL_RADIUS,
|
||||
DAGGER_BOUNCE,
|
||||
EXPLOSIVE_KILLS,
|
||||
VOLATILE_DAGGERS,
|
||||
LAST_ARTIFACT_EFFECT // Sentinel
|
||||
} MagicalEffect;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
void
|
||||
effect_damage_surroundings(Position *pos,
|
||||
RoomMatrix *rm,
|
||||
Player *player,
|
||||
Stats *attackerStats,
|
||||
unsigned int radius,
|
||||
unsigned int pushRadius,
|
||||
|
@ -48,7 +49,7 @@ effect_damage_surroundings(Position *pos,
|
|||
Vector2d dir = vector2d_to_direction(&VEC2D((float) i, (float) j));
|
||||
for (unsigned int k = 0; k < pushRadius; ++k) {
|
||||
monster_push(r->monster,
|
||||
roommatrix_get_player(rm),
|
||||
player,
|
||||
rm,
|
||||
dir);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
void
|
||||
effect_damage_surroundings(Position *pos,
|
||||
RoomMatrix *rm,
|
||||
Player *player,
|
||||
Stats *attackerStats,
|
||||
unsigned int radius,
|
||||
unsigned int pushRadius,
|
||||
|
|
|
@ -92,6 +92,7 @@ load_effects(void)
|
|||
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");
|
||||
effects[EXPLOSION_EFFECT] = load_effect("Sounds/FX/explosion.wav");
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -68,6 +68,7 @@ typedef enum Fx_t {
|
|||
KEY_PICKUP,
|
||||
BLINK_EFFECT,
|
||||
BLAST_EFFECT,
|
||||
EXPLOSION_EFFECT,
|
||||
LAST_EFFECT
|
||||
} Fx;
|
||||
|
||||
|
|
12
src/player.c
12
src/player.c
|
@ -37,6 +37,7 @@
|
|||
#include "trap.h"
|
||||
#include "gamecontroller.h"
|
||||
#include "event.h"
|
||||
#include "effect_util.h"
|
||||
|
||||
#ifdef STEAM_BUILD
|
||||
#include "steam/steamworks_api_wrapper.h"
|
||||
|
@ -150,6 +151,17 @@ on_monster_collision(Player *player,
|
|||
player->stat_data.misses += 1;
|
||||
}
|
||||
player_monster_kill_check(player, monster);
|
||||
if (monster->stats.hp <= 0 && (player_has_artifact(player, EXPLOSIVE_KILLS))) {
|
||||
mixer_play_effect(EXPLOSION_EFFECT);
|
||||
particle_engine_fire_explosion(monster->sprite->pos, DIM(32, 32));
|
||||
effect_damage_surroundings(&monster->sprite->pos,
|
||||
matrix,
|
||||
player,
|
||||
&player->stats,
|
||||
player_has_artifact(player, EXPLOSIVE_KILLS),
|
||||
0,
|
||||
false);
|
||||
}
|
||||
|
||||
if (monster->stats.hp > 0) {
|
||||
if (get_random(10) < player_has_artifact(player, PUSH_BACK)) {
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "item_builder.h"
|
||||
#include "random.h"
|
||||
#include "update_data.h"
|
||||
#include "effect_util.h"
|
||||
#include "particle_engine.h"
|
||||
|
||||
static void
|
||||
onDaggerRender(Sprite *s)
|
||||
|
@ -95,6 +97,22 @@ clear_processed_spaces(Projectile *p)
|
|||
sizeof(p->processedSpaces[0][0]) * MAP_ROOM_WIDTH * MAP_ROOM_HEIGHT);
|
||||
}
|
||||
|
||||
static void
|
||||
perform_dagger_explosion(Player *player, RoomMatrix *rm, Position *collisionPos)
|
||||
{
|
||||
if (player_has_artifact(player, VOLATILE_DAGGERS)) {
|
||||
mixer_play_effect(EXPLOSION_EFFECT);
|
||||
particle_engine_fire_explosion(*collisionPos, DIM(32, 32));
|
||||
effect_damage_surroundings(collisionPos,
|
||||
rm,
|
||||
player,
|
||||
&player->stats,
|
||||
player_has_artifact(player, VOLATILE_DAGGERS),
|
||||
0,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
projectile_update(Projectile *p, UpdateData *data)
|
||||
{
|
||||
|
@ -132,6 +150,7 @@ projectile_update(Projectile *p, UpdateData *data)
|
|||
if (result.dmg > 0) {
|
||||
gui_log("Your dagger pierced %s for %u damage", space->monster->lclabel, result.dmg);
|
||||
data->player->stat_data.hits += 1;
|
||||
perform_dagger_explosion(data->player, data->matrix, &collisionPos);
|
||||
} else {
|
||||
gui_log("%s dodged your dagger", space->monster->label);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue