Skip to content

Commit

Permalink
Add reset 86 nb + new final boss path
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumeAbel committed May 8, 2022
1 parent 2ea98a3 commit ca4bb39
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 17 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ SRC_NPC_UPDATE := update_dialog_text.c \
SRC_NPC_UPDATE := $(addprefix update/,$(SRC_NPC_UPDATE))

SRC_CHEST := dropping_infinity_86.c \
reset_86_number.c \
update_chest.c
SRC_CHEST := $(addprefix chest_npc/,$(SRC_CHEST))

Expand Down
20 changes: 10 additions & 10 deletions assets/data/ennemy/magician.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"move": [
[[20, 16, 77, 148], [142, 17, 73, 150], [260, 15, 77, 154], [380, 17, 79, 157]],
[[21, 173, 69, 150], [147, 172, 54, 145], [260, 171, 62, 150], [388, 173, 56, 150]],
[[9, 335, 78, 159], [130, 333, 73, 153], [257, 338, 66, 147], [372, 336, 72, 146]],
[[21, 173, 69, 150], [147, 172, 54, 145], [260, 171, 62, 150], [388, 173, 56, 150]]
[[33, 144, 24, 41], [80, 144, 20, 41], [124, 144, 21, 40], [167, 144, 23, 41], [210, 144, 20, 41], [254, 145, 19, 40]],
[[0, 48, 26, 39], [42, 48, 30, 40], [90, 47, 23, 41], [138, 46, 20, 42], [179, 46, 22, 42], [217, 46, 27, 42], [255, 46, 31, 41], [301, 46, 31, 42]],
[[47, 0, 28, 41], [90, 3, 27, 40], [134, 1, 33, 40], [177, 2, 30, 41], [220, 1, 31, 42], [263, 1, 33, 40]],
[[0, 48, 26, 39], [42, 48, 30, 40], [90, 47, 23, 41], [138, 46, 20, 42], [179, 46, 22, 42], [217, 46, 27, 42], [255, 46, 31, 41], [301, 46, 31, 42]]
],
"stop": [
[464, 176, 62, 151],
[460, 374, 123, 78],
[464, 176, 62, 151],
[460, 374, 123, 78]
[33, 144, 24, 41],
[0, 48, 26, 39],
[47, 0, 28, 41],
[0, 48, 26, 39]
],
"dash time": 2.0,
"charge time": 0.5,
"scale": 1.0,
"scale": 3.0,
"rect actualisation": 0.2,
"speed": 200.0,
"range": 800.0,
"life": 200.0,
"dammage": 40.0,
"blink time": 0.7,
"sprite path": "./assets/image/ennemy/dark_ennemy.png",
"sprite path": "./assets/image/ennemy/final_boss.png",
"xp loot": 200.0,
"range dash": 160.0,
"knock back coef": 30.0,
Expand Down
Binary file added assets/image/ennemy/final_boss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions include/my_rpg.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ void level_up(scene_t *scene, window_t *win);

void set_up_scale(object_t *obj, float time, player_t *player);

void reset_86_number(player_t *player);

void set_down_scale(object_t *obj, float time, player_t *player);

void activate_up_scale(object_t *obj, scene_t *scene,
Expand Down
6 changes: 3 additions & 3 deletions src/npc/npc/chest_npc/dropping_infinity_86.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ void check_have_enough_infinity_86(player_t *player, object_t *chest,
object_set_custom(obj);
obj->components = dico_t_add_data(obj->components, chest_key, chest, NULL);
rect = dico_t_get_value(chest->components, scd_rect_key);
if (rect != NULL) {
chest->bigdata.sprite_bigdata.rect = *rect;
}
chest->bigdata.sprite_bigdata.rect = (rect != NULL) ? *rect :
(sfIntRect) {0, 0, 0, 0};
reset_86_number(player);
add_text_dialog_json(win, open_chest_dialog, &reaload_dialogs, chest);
chest->components = dico_t_rem(chest->components, scd_rect_key);
}
30 changes: 30 additions & 0 deletions src/npc/npc/chest_npc/reset_86_number.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
** EPITECH PROJECT, 2022
** rpg
** File description:
** reset 86 number
*/

#include "my_rpg.h"
#include "rpg_struct.h"
#include "player.h"

extern const char stats_path_key[];

void reset_86_number(player_t *player)
{
any_t *stats = NULL;
any_t *infinity_86 = NULL;

if (player == NULL || player->obj == NULL) {
return;
}
stats = dico_t_get_value(player->obj->components, PLAYER_STATS);
infinity_86 = get_from_any(stats, "d", INFINITY_86);
if (infinity_86 == NULL || infinity_86->type != INT) {
return;
}
infinity_86->value.i = 0;
write_json(stats, dico_t_get_value(player->obj->components,
stats_path_key));
}
10 changes: 6 additions & 4 deletions src/npc/npc/chest_npc/update_chest.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

extern const char npc_path_key[];

static const sfIntRect detection = {-50, -50, 100, 300};

static const char check_into_chest_json[] =
"./assets/data/npc/check_into_chest.json";

Expand Down Expand Up @@ -46,10 +48,10 @@ static sfFloatRect get_chest_detection_rect(object_t *obj)
{
sfFloatRect chest_rect = sfSprite_getGlobalBounds(obj->drawable.sprite);

chest_rect.left -= 50;
chest_rect.top -= 50;
chest_rect.width += 100;
chest_rect.height += 300;
chest_rect.left += detection.left;
chest_rect.top += detection.top;
chest_rect.width += detection.width;
chest_rect.height += detection.height;
return chest_rect;
}

Expand Down

0 comments on commit ca4bb39

Please sign in to comment.