comparison libmlk-adventure/adventure/action/spawner.c @ 289:63d9fb56c609

rpg: rework selection
author David Demelier <markand@malikania.fr>
date Thu, 07 Jan 2021 15:52:56 +0100
parents 3991779aaba9
children 196264679079
comparison
equal deleted inserted replaced
288:cc0f02ae9005 289:63d9fb56c609
23 #include <core/alloc.h> 23 #include <core/alloc.h>
24 #include <core/game.h> 24 #include <core/game.h>
25 #include <core/util.h> 25 #include <core/util.h>
26 26
27 #include <rpg/battle.h> 27 #include <rpg/battle.h>
28 #include <rpg/character.h>
28 #include <rpg/map.h> 29 #include <rpg/map.h>
29 30
30 #include <adventure/molko.h> 31 #include <adventure/molko.h>
31 32
32 #include <adventure/character/black-cat.h> 33 #include <adventure/character/black-cat.h>
49 { 50 {
50 /* TODO: */ 51 /* TODO: */
51 struct battle *bt; 52 struct battle *bt;
52 53
53 bt = alloc_new0(sizeof (*bt)); 54 bt = alloc_new0(sizeof (*bt));
54 bt->enemies[0].ch = &character_black_cat; 55
56 bt->enemies[0].ch = alloc_dup(&character_black_cat, sizeof (character_black_cat));
55 bt->enemies[0].x = 400; 57 bt->enemies[0].x = 400;
56 bt->enemies[0].y = 50; 58 bt->enemies[0].y = 50;
59 bt->enemies[1].ch = alloc_dup(&character_black_cat, sizeof (character_black_cat));
60 bt->enemies[1].x = 200;
61 bt->enemies[1].y = 100;
62
57 bt->inventory = &molko.inventory; 63 bt->inventory = &molko.inventory;
58 64
59 for (size_t i = 0; i < TEAM_MEMBER_MAX; ++i) 65 for (size_t i = 0; i < TEAM_MEMBER_MAX; ++i) {
60 bt->team[i].ch = molko.team.members[i]; 66 if (molko.team.members[i]) {
67 bt->team[i].ch = alloc_dup(molko.team.members[i], sizeof (*molko.team.members[i]));
68 character_reset(bt->team[i].ch);
69 bt->team[i].ch->hp = bt->team[i].ch->hpmax;
70 bt->team[i].ch->mp = bt->team[i].ch->mpmax;
71 }
72 }
61 73
62 molko_fight(bt); 74 molko_fight(bt);
63 } 75 }
64 76
65 static bool 77 static bool