mirror of https://github.com/bgiraudr/Adoranda.git
Moves are now JSON
This commit is contained in:
parent
e139f5df6d
commit
f997efb737
|
@ -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()
|
||||
liste_file = list(pathlib.Path(input).parent.glob('*.json'))
|
||||
|
||||
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.Structure()
|
||||
capacities += fxconv.u32(len(liste_file))
|
||||
for f in liste_file:
|
||||
file = open(f,"r")
|
||||
data = json.load(file)
|
||||
move = fxconv.Structure()
|
||||
|
||||
capacities += fxconv.ptr(moves)
|
||||
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)
|
||||
|
||||
|
|
|
@ -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…
Reference in New Issue