Compare commits

..

No commits in common. "df3e9ab714c67c49242fabb45887d43e9c273ab9" and "e139f5df6dd5ba5d952b2f61e4a2764baea7da91" have entirely different histories.

13 changed files with 35 additions and 88 deletions

2
.gitignore vendored
View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,5 @@
import fxconv
import json
import pathlib
def convert(input, output, params, target):
if params["custom-type"] == "map":
@ -195,26 +194,23 @@ def parseZone(layer):
return zone
def convert_capa(input, output, params, target):
liste_file = list(pathlib.Path(input).parent.glob('*.json'))
with open(input, "r") as file:
capacities = fxconv.Structure()
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()
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]))
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)
capacities += fxconv.ptr(moves)
fxconv.elf(capacities, output, "_" + params["name"], **target)

View File

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

View File

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

View File

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

View File

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

View File

@ -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 cela échoue !");
draw_status("Mais il rate !");
dupdate();
wait_for_input(KEY_SHIFT);
}

View File

@ -15,16 +15,10 @@ struct Move default_move() {
}
struct Move get_move_id(int id) {
for(int i = 0; i < capacities.nbCapacities; i++) {
if(capacities.moves[i]->id == id) return *capacities.moves[i];
}
return *capacities.moves[0];
return *capacities.moves[id];
}
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];
}
@ -32,7 +26,6 @@ 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;