A beginning to the new exploding artifacts
This commit is contained in:
parent
12aff9afad
commit
7f232beb32
|
@ -238,6 +238,7 @@ add_executable(breakhack
|
|||
src/gui_util
|
||||
src/tooltip
|
||||
src/gamecontroller
|
||||
src/effect_util
|
||||
${STEAM_SOURCES}
|
||||
)
|
||||
|
||||
|
|
|
@ -73,6 +73,10 @@ artifact_set_effect(Artifact *a, MagicalEffect effect)
|
|||
a->info.name = "Magnet";
|
||||
a->info.desc = "You are attractive to daggers";
|
||||
break;
|
||||
case EXPLOSIVE_KILLS:
|
||||
a->info.name = "Stick of dynamite";
|
||||
a->info.desc = "You are an explosive slayer";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -87,7 +91,8 @@ static int WarriorArtifacts[] = {
|
|||
FEAR_INDUCING, // 5
|
||||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
CHARGE_THROUGH // 8
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
CHARGE_THROUGH // 9
|
||||
};
|
||||
|
||||
static int RogueArtifacts[] = {
|
||||
|
@ -99,7 +104,8 @@ static int RogueArtifacts[] = {
|
|||
FEAR_INDUCING, // 5
|
||||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
PHASE_IMPROVEMENT // 8
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
PHASE_IMPROVEMENT // 9
|
||||
};
|
||||
|
||||
static int MageArtifacts[] = {
|
||||
|
@ -111,7 +117,8 @@ static int MageArtifacts[] = {
|
|||
FEAR_INDUCING, // 5
|
||||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
SKILL_RADIUS // 8
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
SKILL_RADIUS // 9
|
||||
};
|
||||
|
||||
/* Not in play yet */
|
||||
|
@ -124,7 +131,8 @@ static int PaladinArtifacts[] = {
|
|||
FEAR_INDUCING, // 5
|
||||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
SKILL_RADIUS // 8
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
SKILL_RADIUS // 9
|
||||
};
|
||||
|
||||
/* Not in play yet */
|
||||
|
@ -137,7 +145,8 @@ static int EngineerArtifacts[] = {
|
|||
FEAR_INDUCING, // 5
|
||||
INCREASED_STUN, // 6
|
||||
DAGGER_BOUNCE, // 7
|
||||
PHASE_IMPROVEMENT // 8
|
||||
EXPLOSIVE_KILLS, // 8
|
||||
PHASE_IMPROVEMENT // 9
|
||||
};
|
||||
|
||||
static void
|
||||
|
@ -157,7 +166,7 @@ add_level_sprite(Artifact *a)
|
|||
Artifact *
|
||||
artifact_create_random(Player *p, Uint8 level)
|
||||
{
|
||||
int option = get_random(8);
|
||||
int option = get_random(9);
|
||||
|
||||
int * artifactPool = NULL;
|
||||
if (p->class == ROGUE)
|
||||
|
@ -254,6 +263,11 @@ artifact_sprite_for(MagicalEffect effect)
|
|||
sprite_set_texture(sprite, t, 0);
|
||||
sprite->clip = CLIP16(0, 0);
|
||||
break;
|
||||
case EXPLOSIVE_KILLS:
|
||||
t = texturecache_add("Extras/Artifacts.png");
|
||||
sprite_set_texture(sprite, t, 0);
|
||||
sprite->clip = CLIP16(32, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ typedef enum MagicalEffect {
|
|||
PHASE_IMPROVEMENT,
|
||||
SKILL_RADIUS,
|
||||
DAGGER_BOUNCE,
|
||||
EXPLOSIVE_KILLS,
|
||||
LAST_ARTIFACT_EFFECT // Sentinel
|
||||
} MagicalEffect;
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* BreakHack - A dungeone crawler RPG
|
||||
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gui.h"
|
||||
#include "monster.h"
|
||||
#include "roommatrix.h"
|
||||
#include "effect_util.h"
|
||||
|
||||
void
|
||||
effect_damage_surroundings(Position *pos,
|
||||
RoomMatrix *rm,
|
||||
Stats *attackerStats,
|
||||
unsigned int radius,
|
||||
unsigned int pushRadius,
|
||||
bool damagePlayer)
|
||||
{
|
||||
Position roomPos = position_to_matrix_coords(pos);
|
||||
for (Sint32 i = -radius; i <= (Sint32) radius; ++i) {
|
||||
for (Sint32 j = -radius; j <= (Sint32) radius; ++j) {
|
||||
if (i == 0 && j == 0)
|
||||
continue;
|
||||
|
||||
Position matrixPos = POS(roomPos.x + i, roomPos.y + j);
|
||||
if (!position_in_roommatrix(&matrixPos))
|
||||
continue;
|
||||
|
||||
RoomSpace *r = &rm->spaces[matrixPos.x][matrixPos.y];
|
||||
if (r->monster) {
|
||||
CombatResult result = stats_fight(attackerStats, &r->monster->stats);
|
||||
monster_hit(r->monster, result.dmg, result.critical);
|
||||
gui_log("%s takes %d damage from the explosion", r->monster->label, result.dmg);
|
||||
|
||||
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),
|
||||
rm,
|
||||
dir
|
||||
);
|
||||
}
|
||||
} else if (r->player && damagePlayer) {
|
||||
CombatResult result = stats_fight(attackerStats, &r->player->stats);
|
||||
player_hit(r->player, result.dmg);
|
||||
gui_log("You take %d damage from the explosion", result.dmg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* BreakHack - A dungeone crawler RPG
|
||||
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "roommatrix.h"
|
||||
#include "position.h"
|
||||
#include "stats.h"
|
||||
|
||||
void
|
||||
effect_damage_surroundings(Position *pos,
|
||||
RoomMatrix *rm,
|
||||
Stats *attackerStats,
|
||||
unsigned int radius,
|
||||
unsigned int pushRadius,
|
||||
bool damagePlayer);
|
39
src/skill.c
39
src/skill.c
|
@ -37,6 +37,7 @@
|
|||
#include "trap.h"
|
||||
#include "tooltip.h"
|
||||
#include "actiontextbuilder.h"
|
||||
#include "effect_util.h"
|
||||
|
||||
static char *flurry_tooltip[] = {
|
||||
"FLURRY", "",
|
||||
|
@ -953,39 +954,13 @@ skill_erupt(Skill *skill, SkillData *data)
|
|||
particle_engine_eldritch_explosion(player->sprite->pos, DIM(32, 32));
|
||||
mixer_play_effect(BLAST_EFFECT);
|
||||
|
||||
Position playerMPos = position_to_matrix_coords(&player->sprite->pos);
|
||||
int range = player_has_artifact(player, SKILL_RADIUS);
|
||||
for (Sint32 i = -1 - range; i <= 1 + range; ++i) {
|
||||
for (Sint32 j = -1 - range; j <= 1 + range; ++j) {
|
||||
|
||||
if (i == 0 && j == 0)
|
||||
continue;
|
||||
|
||||
Position matrixPos = POS(playerMPos.x + i, playerMPos.y + j);
|
||||
if (!position_in_roommatrix(&matrixPos))
|
||||
continue;
|
||||
|
||||
RoomSpace *r = &rm->spaces[matrixPos.x][matrixPos.y];
|
||||
if (r->monster) {
|
||||
player->stats.advantage = true;
|
||||
CombatResult result = stats_fight(&player->stats, &r->monster->stats);
|
||||
player->stats.advantage = false;
|
||||
monster_hit(r->monster, result.dmg, result.critical);
|
||||
gui_log("%s takes %d damage from the explosion", r->monster->label, result.dmg);
|
||||
monster_set_state(r->monster, SCARED, 3);
|
||||
|
||||
int lvl = 1 + player_has_artifact(player, PUSH_BACK);
|
||||
Vector2d dir = vector2d_to_direction(&VEC2D((float) i, (float) j));
|
||||
for (int k = 0; k < lvl; ++k) {
|
||||
monster_push(r->monster,
|
||||
player,
|
||||
int range = 1 + player_has_artifact(player, SKILL_RADIUS);
|
||||
effect_damage_surroundings(&player->sprite->pos,
|
||||
rm,
|
||||
dir
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
&player->stats,
|
||||
range,
|
||||
1 + player_has_artifact(player, PUSH_BACK),
|
||||
false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue