Compare commits

...

2 Commits

Author SHA1 Message Date
bgiraudr df3e9ab714 remove json on gitignore 8 months ago
bgiraudr f997efb737 Moves are now JSON 8 months ago
  1. 2
      .gitignore
  2. 7
      assets-cg/capacites/Charge.json
  3. 7
      assets-cg/capacites/Cheat.json
  4. 7
      assets-cg/capacites/Deuxieme.json
  5. 7
      assets-cg/capacites/TestCapacite.json
  6. 4
      assets-cg/capacites/capacites.txt
  7. 38
      assets-cg/converters.py
  8. 17
      assets-cg/monsters/test.json
  9. 6
      include/battle.h
  10. 7
      include/capacite.h
  11. 14
      include/map.h
  12. 2
      src/battle.c
  13. 9
      src/capacite.c

2
.gitignore vendored

@ -3,7 +3,7 @@
/build-cg
/*.g1a
/*.g3a
*.json
/assets-cg/maps/**/*.json
*~
/images

@ -0,0 +1,7 @@
{
"name":"Charge",
"id":2,
"pp":25,
"atk":15,
"precision":100
}

@ -0,0 +1,7 @@
{
"name":"Cheat",
"id":3,
"pp":25,
"atk":45,
"precision":100
}

@ -0,0 +1,7 @@
{
"name":"Deuxième",
"id":1,
"pp":100,
"atk":11,
"precision":50
}

@ -0,0 +1,7 @@
{
"name":"Test capacité",
"id":0,
"pp":5,
"atk":20,
"precision":50
}

@ -1,4 +0,0 @@
Test capacité;5;5;3;20
Deuxième;100;100;11;50
Charge;25;25;15;100
Cheat;25;25;45;100

@ -1,5 +1,6 @@
import fxconv
import json
import pathlib
def convert(input, output, params, target):
if params["custom-type"] == "map":
@ -194,23 +195,26 @@ def parseZone(layer):
return zone
def convert_capa(input, output, params, target):
with open(input, "r") as file:
capacities = fxconv.Structure()
lines = file.read().splitlines()
matrix = [i.split(";") for i in lines]
capacities += fxconv.u32(len(lines))
for i in matrix:
moves = fxconv.Structure()
for j in range(len(i)):
if j == 0:
moves += fxconv.string(i[j])
else:
moves += fxconv.u32(int(i[j]))
capacities += fxconv.ptr(moves)
liste_file = list(pathlib.Path(input).parent.glob('*.json'))
capacities = fxconv.Structure()
capacities += fxconv.u32(len(liste_file))
for f in liste_file:
file = open(f,"r")
data = json.load(file)
move = fxconv.Structure()
try:
move += fxconv.string(data["name"])
move += fxconv.u32(data["id"])
move += fxconv.u32(data["pp"])
move += fxconv.u32(data["pp"])
move += fxconv.u32(data["atk"])
move += fxconv.u32(data["precision"])
except KeyError:
raise Exception(f"convert_capa() : La capacité {data['name']} est mal configurée")
capacities += fxconv.ptr(move)
fxconv.elf(capacities, output, "_" + params["name"], **target)

@ -0,0 +1,17 @@
{
"name":"test",
"sprite":"test",
"stats":{
"atk":10,
"def":10,
"pv":20,
"level":1,
"xp":300,
"max_pv":20
},
"moves":[
0,
1,
2
]
}

@ -3,9 +3,9 @@
#include "monster.h"
enum battle_state {
EXIT = 0,
LOSE = 1,
WIN = 2,
EXIT,
LOSE,
WIN,
};
void create_battle(struct Game *game);

@ -3,6 +3,7 @@
struct Move {
char *name;
int id;
int init_pp;
int pp;
int atk;
@ -15,9 +16,9 @@ struct Capacities {
};
enum status {
MISS = 0,
SUCCESS = 1,
CRIT = 2
MISS,
SUCCESS,
CRIT,
};
struct Move default_move();

@ -31,13 +31,13 @@ struct Map {
};
enum map_state {
TILE_AIR = 0,
TILE_SOLID = 1,
TILE_DOOR_IN = 2,
TILE_DOOR_OUT = 3,
TILE_TALKABLE = 4,
TILE_TELEPORTER = 5,
TILE_GRASS = 6,
TILE_AIR,
TILE_SOLID,
TILE_DOOR_IN,
TILE_DOOR_OUT,
TILE_TALKABLE,
TILE_TELEPORTER,
TILE_GRASS,
};
/*check if a tile is walkable*/

@ -78,7 +78,7 @@ void check_move_status(int status, struct Player *player, struct Monster *monste
if(status == MISS) {
draw_battle(player, monster);
draw_status("Mais il rate !");
draw_status("Mais cela échoue !");
dupdate();
wait_for_input(KEY_SHIFT);
}

@ -15,10 +15,16 @@ struct Move default_move() {
}
struct Move get_move_id(int id) {
return *capacities.moves[id];
for(int i = 0; i < capacities.nbCapacities; i++) {
if(capacities.moves[i]->id == id) return *capacities.moves[i];
}
return *capacities.moves[0];
}
struct Move *get_move_id_pointer(int id) {
for(int i = 0; i < capacities.nbCapacities; i++) {
if(capacities.moves[i]->id == id) return capacities.moves[i];
}
return capacities.moves[id];
}
@ -26,6 +32,7 @@ struct Move *copy_move(struct Move move) {
struct Move *copyMove = malloc(sizeof(struct Move));
copyMove->name = move.name;
copyMove->init_pp = move.init_pp;
copyMove->id = move.id;
copyMove->pp = move.pp;
copyMove->atk = move.atk;

Loading…
Cancel
Save