mirror of https://github.com/bgiraudr/Adoranda.git
Add spe-atk/def
This commit is contained in:
parent
790af39fd2
commit
3c15b5d4a5
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name":"Test capacité",
|
||||
"id":0,
|
||||
"categorie":"PHYSICAL",
|
||||
"categorie":"SPECIAL",
|
||||
"pp":5,
|
||||
"atk":20,
|
||||
"precision":80
|
||||
"precision":100
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name":"Test capacité2",
|
||||
"id":4,
|
||||
"categorie":"PHYSICAL",
|
||||
"pp":5,
|
||||
"atk":20,
|
||||
"precision":100
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 267 B After Width: | Height: | Size: 302 B |
|
@ -223,14 +223,16 @@ def convert_capa(input, output, params, target):
|
|||
move = fxconv.Structure()
|
||||
|
||||
try:
|
||||
categorie = data["categorie"]
|
||||
id_categorie = ["STATUT", "PHYSICAL", "SPECIAL"]
|
||||
|
||||
move += fxconv.string(data["name"])
|
||||
move += fxconv.u32(data["id"])
|
||||
move += fxconv.u32(1 if data["categorie"]=="PHYSICAL" else 0)
|
||||
move += fxconv.u32(id_categorie.index(categorie))
|
||||
move += fxconv.u32(data["pp"])
|
||||
move += fxconv.u32(data["pp"])
|
||||
|
||||
categorie = data["categorie"]
|
||||
if categorie=="PHYSICAL":
|
||||
if categorie=="PHYSICAL" or categorie=="SPECIAL":
|
||||
move += fxconv.u32(data["atk"])
|
||||
move += fxconv.u32(data["precision"])
|
||||
move += fxconv.u32(0) + fxconv.u32(0) + fxconv.u32(0)
|
||||
|
@ -256,11 +258,13 @@ def convert_monster(input, output, params, target):
|
|||
data = json.load(file)
|
||||
stats = fxconv.Structure()
|
||||
|
||||
if len(data["stats"]) != 4: raise Exception(f"convert_monster : Les statistiques de {data['name']} sont mauvaises")
|
||||
if len(data["stats"]) != 6: raise Exception(f"convert_monster : Les statistiques de {data['name']} sont mauvaises")
|
||||
stats+=fxconv.u32(data["stats"]["atk"])
|
||||
stats+=fxconv.u32(data["stats"]["def"])
|
||||
stats+=fxconv.u32(data["stats"]["pv"])
|
||||
stats+=fxconv.u32(1)
|
||||
stats+=fxconv.u32(data["stats"]["spe_atk"])
|
||||
stats+=fxconv.u32(data["stats"]["spe_def"])
|
||||
stats+=fxconv.u32(1) # level, will be calculated later
|
||||
stats+=fxconv.u32(data["stats"]["xp"])
|
||||
stats+=fxconv.u32(data["stats"]["pv"])
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
"stats":{
|
||||
"atk":10,
|
||||
"def":10,
|
||||
"spe_atk":10,
|
||||
"spe_def":10,
|
||||
"pv":20,
|
||||
"xp":300
|
||||
},
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
"stats":{
|
||||
"atk":80,
|
||||
"def":5,
|
||||
"spe_atk":10,
|
||||
"spe_def":130,
|
||||
"pv":45,
|
||||
"xp":150
|
||||
},
|
||||
|
|
|
@ -34,6 +34,7 @@ enum status {
|
|||
enum categorie {
|
||||
STATUT,
|
||||
PHYSICAL,
|
||||
SPECIAL,
|
||||
};
|
||||
|
||||
struct Move default_move();
|
||||
|
|
|
@ -16,7 +16,7 @@ void engine_tick(struct Game *game, int dt);
|
|||
/*set the background color*/
|
||||
void engine_set_background(struct Game *game, int color);
|
||||
/*make an interaction with something*/
|
||||
void engine_action(struct Game const *game, int action);
|
||||
void engine_action(struct Game *game, int action);
|
||||
/*check the current position of the player. To perform action depends of his location*/
|
||||
void engine_check_position(struct Game *game);
|
||||
void engine_center_camera(struct Game *game);
|
|
@ -4,6 +4,8 @@ struct Stats {
|
|||
int atk;
|
||||
int def;
|
||||
int pv;
|
||||
int spe_atk;
|
||||
int spe_def;
|
||||
int level;
|
||||
int xp;
|
||||
int max_pv;
|
||||
|
|
|
@ -161,7 +161,7 @@ int select_move(struct Player *player, struct Monster *monster, int prec_selecte
|
|||
if(keydown(KEY_EXIT)) {
|
||||
break;
|
||||
}
|
||||
while(keydown_any(KEY_RIGHT, KEY_LEFT, KEY_SHIFT, 0)) clearevents();
|
||||
while(keydown_any(KEY_RIGHT, KEY_LEFT, KEY_SHIFT, KEY_OPTN, 0)) clearevents();
|
||||
}
|
||||
return selection;
|
||||
}
|
||||
|
|
|
@ -59,13 +59,13 @@ void draw_move(int x, int y, int x2, int y2, struct Move *move) {
|
|||
(int)((y+y2)/2)-font_size/2,
|
||||
C_BLACK, "%s", move->name);
|
||||
|
||||
if(move->categorie == PHYSICAL) {
|
||||
dprint(x+15, y2-17, C_BLACK, "ATK : %d", move->atk);
|
||||
dprint(x+70, y2-17, C_BLACK, "PRE : %d", move->precision);
|
||||
} else {
|
||||
if(move->categorie == STATUT) {
|
||||
if(move->boost_atk > 0) dprint(x+10, y2-17, C_BLACK, "A+%d%%", move->boost_atk);
|
||||
if(move->boost_hp > 0) dprint(x+47, y2-17, C_BLACK, "H+%d%%", move->boost_hp);
|
||||
if(move->boost_def > 0) dprint(x+85, y2-17, C_BLACK, "D+%d%%", move->boost_def);
|
||||
} else {
|
||||
dprint(x+15, y2-17, C_BLACK, "ATK : %d", move->atk);
|
||||
dprint(x+70, y2-17, C_BLACK, "PRE : %d", move->precision);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void draw_classic_move(int x, int y, struct Move *move) {
|
|||
|
||||
int execute_move(struct Stats *player_stats, struct Stats *monster_stats, struct Move *move, int ismonster) {
|
||||
srand(rtc_ticks());
|
||||
if(move->categorie == PHYSICAL) {
|
||||
if(move->categorie == PHYSICAL || move->categorie == SPECIAL) {
|
||||
if(is_miss(move)) {
|
||||
move->pp--;
|
||||
return MISS;
|
||||
|
@ -102,7 +102,11 @@ int execute_move(struct Stats *player_stats, struct Stats *monster_stats, struct
|
|||
}
|
||||
|
||||
int calc_damage(struct Stats *attacker, struct Stats *target, struct Move *move) {
|
||||
return floor((floor(((2*attacker->level / 5 + 2) * attacker->atk * move->atk / target->def) / 50) + 2)*crit(attacker));
|
||||
if(move->categorie == PHYSICAL)
|
||||
return floor((floor(((2*attacker->level / 5 + 2) * attacker->atk * move->atk / target->def) / 50) + 2)*crit(attacker));
|
||||
if(move->categorie == SPECIAL)
|
||||
return floor((floor(((2*attacker->level / 5 + 2) * attacker->spe_atk * move->atk / target->spe_def) / 50) + 2)*crit(attacker));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_crit() {
|
||||
|
|
|
@ -117,7 +117,7 @@ void engine_set_background(struct Game *game, int color) {
|
|||
}
|
||||
|
||||
/*make an interaction with something*/
|
||||
void engine_action(struct Game const *game, int action) {
|
||||
void engine_action(struct Game *game, int action) {
|
||||
if(action == ACTION_SHIFT) {
|
||||
if(player_facing(game) == TILE_TALKABLE) {
|
||||
draw_dialog(game);
|
||||
|
|
|
@ -17,6 +17,8 @@ struct Player init_player(void) {
|
|||
struct Stats bstats = {
|
||||
.atk = 15,
|
||||
.def = 15,
|
||||
.spe_atk = 15,
|
||||
.spe_def = 15,
|
||||
.level = 1,
|
||||
.pv = 30,
|
||||
};
|
||||
|
@ -40,7 +42,8 @@ struct Player init_player(void) {
|
|||
.anim.dir = DIR_DOWN
|
||||
};
|
||||
player.idle = !anim_player_idle(&player.anim, 1);
|
||||
player.moves[0] = copy_move(get_move_id(1));
|
||||
player.moves[0] = copy_move(get_move_id(0));
|
||||
player.moves[1] = copy_move(get_move_id(4));
|
||||
|
||||
set_stats_level_from(&player.base_stats, &player.stats);
|
||||
return player;
|
||||
|
|
|
@ -12,19 +12,25 @@ void draw_stats(struct Stats stats) {
|
|||
dprint(300,60,C_BLACK,"XP : %d",stats.xp);
|
||||
dprint(300,80,C_BLACK,"ATK : %d",stats.atk);
|
||||
dprint(300,100,C_BLACK,"DEF : %d",stats.def);
|
||||
dprint(300,120,C_BLACK,"LVLUP : %d",(int)(pow(stats.level+1, 3.03))-stats.xp);
|
||||
dprint(300,120,C_BLACK,"ATKS : %d",stats.spe_atk);
|
||||
dprint(300,140,C_BLACK,"DEFS : %d",stats.spe_def);
|
||||
dprint(300,160,C_BLACK,"LVLUP : %d",(int)(pow(stats.level+1, 3.03))-stats.xp);
|
||||
}
|
||||
|
||||
void set_stats_level_from(const struct Stats *from, struct Stats *to) {
|
||||
to->max_pv = calc_stats(from->pv, to->level);
|
||||
to->atk = calc_stats(from->atk, to->level);
|
||||
to->def = calc_stats(from->def, to->level);
|
||||
to->spe_atk = calc_stats(from->spe_atk, to->level);
|
||||
to->spe_def = calc_stats(from->spe_def, to->level);
|
||||
}
|
||||
|
||||
void set_stats_level(struct Stats *stats) {
|
||||
stats->max_pv = calc_stats(stats->pv, stats->level);
|
||||
stats->atk = calc_stats(stats->atk, stats->level);
|
||||
stats->def = calc_stats(stats->def, stats->level);
|
||||
stats->spe_atk = calc_stats(stats->spe_atk, stats->level);
|
||||
stats->spe_def = calc_stats(stats->spe_def, stats->level);
|
||||
}
|
||||
|
||||
int calc_stats(int base, int level) {
|
||||
|
|
Loading…
Reference in New Issue