#include<stdio.h>
#include<math.h> //Rand
#include<stdlib.h>
#include<time.h>
#include<string.h>
// 기값
#define SORAHEAL 60000
#define SORAKICK 9000
#define SORAPUNCH 10000
/// 갯
#define SKILLSIZE 3
#define CLASSSIZE 3
#define USERNUM 1 // 갯
char ima[150][150] = {
" :~:, ~ZMM, ",
" ,:=?I?I$Z8DD8DNMMMMD?=~:, :=7DMMMD, ",
" :?$8DMMMMMMMMMNOZ8DNMMZZMMMMMMNMMMMM8MM= ",
" =IZNMMMMMMMMM8I, ,?NM$:~+?777$7?=,7M7 ",
" =8MMMD$?~,,:~+I8MM7, :ZM8: :MM, ",
" :OMMO+: :ZMM$~= IMN$~ $M$ ",
" $MMD= ~OMMM: IMM+ DM= ",
" IMM7=IOOO$?: :8M$ 7M7 ~MZ ",
" 7MMMNN87+IZDMN$: OMZ 8M: IM+ ",
" =MMMZ=, :?NMZ, $M7 +M7 7M~ ",
" 8MM? ,,,: +MN= ,OM? NN ZM, ",
" ,,=NMMDMMMMMMD7 :DMI :NN, $M: ZM ",
" :7DMMMMDD$?7778MM8~ ,8M= ?M$ +M+ $M, ",
" ~$MMM8I= =8MM$ :NN: 8M~ ~M7 7M: ",
" 7MMMO~ ,IMM8: =MZ, 7M$ ,N8 7M~ ",
" :?DMMO~ ?8MMN+ $MO $NN, DM $M~ ",
" ?MM8: :,IMMM+ :M8 IM= 8N ?M: ",
" , 8MZ IMMM= $N =MI $M, ?M~ ",
" :MN: ,8MMM~ ~MI ,MO 7M: ?M~ ",
" =87= $MMMZ DM, DD ?M: OM~ ",
" ,NO ,MMMMM~ +M7 8N IM= ~MD, ",
" $M, $NMMM7 DN, 8N ZM, 8M7 ",
" ,M$ , :=~$+I,?:~O7:, ZNMMD IM= 8N DN ,$M8: ",
" =M~ 87Z=N:7DIMZD=M++MMONND$ =MMMM: :M7 8N :MZ+NMD~ ",
" 7N =MON=M+8Z$D88?M~7MMZMMMMI ?MMMM: DN :MD $MMMM$?, ",
" OM: NMDMZM8MDNNN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? ~M? ,=8Z ",
" 8O IM$ $N, ?M: ,D8 ",
" , ~M~ IMI Z8 ZM= ",
" :M+,ZM$ ZO ,OM? ",
" OMMN+ IM7DM? ",
" ~~, ,7DZ: , ",'\0'
};
typedef struct _skill{
int health;
int heal;
int kick;
int punch;
}SKILL;
typedef struct _player{
char name[40];
SKILL skill;
}PLAYER;
typedef struct _select{
int select;
void (*func)(PLAYER *, PLAYER *); //
}SELECT;
typedef struct _class{
int type;
char name[40];
SKILL skill;
}CLASS;
//select .
void heal(PLAYER *, PLAYER *);
void kick(PLAYER *, PLAYER *);
void punch(PLAYER *, PLAYER *);
////////////////게 .
int gameinit(PLAYER *); //게기
int printplayerstate(PLAYER *, PLAYER *); //
int gameprocess(PLAYER *, PLAYER *); //게
int playersave(PLAYER *); //
int playerload(PLAYER *); //
const SELECT menu[SKILLSIZE] ={
{1,heal},
{2,kick},
{3,punch}
};
const CLASS classList[CLASSSIZE]= {
{1,"",{50000,1000,5000,5000}},
{2,"",{20000,500,15000,15000}},
{3,"",{15000,1000,1500,1000}}
};
int main(){
// , 기.
PLAYER sora = {"",{100000,SORAHEAL,SORAKICK,SORAPUNCH}};
PLAYER player;
int i;
srand(time(NULL)); //Rand 값 경.
for(i = 0;i<80;i++)
printf("%s",ima[i]);
printf("기 Mk-2 게 .\n");
//printf(" : 06 Target : 11 \n");
gameinit(&player);
while(1){
printplayerstate(&sora, &player);
gameprocess(&sora, &player);
// 그고
if(sora.skill.health <= 0 && player.skill.health <= 0){
printf("\nDouble KO. .\n");
break;
}
else if(sora.skill.health <= 0){
printf("\n 겼!!! \\(* ^ * )/ \n");
break;
}
else if(player.skill.health <= 0 ){
printf("\n게 .. OTL \n");
break;//while 간.
}
// ?
}
printf("\nGame Over\n");
return 0;
}
//select .
void heal(PLAYER * who, PLAYER * target){
int temp;
temp = ( ( rand() % who->skill.heal));
who->skill.health += temp;
printf("%s %s . : %d !\n",who->name,who->name,temp);
}
void kick(PLAYER * who, PLAYER * target){
int temp;
temp = ( ( rand() % who->skill.kick));
target->skill.health -= temp;
printf("%s %s . : %d !\n",who->name,target->name,temp);
}
void punch(PLAYER * who, PLAYER * target){
int temp;
temp = ( ( rand() % who->skill.punch));
target->skill.health -= temp;
printf("%s %s . : %d !\n",who->name,target->name,temp);
}
////////////////게 .
int gameinit(PLAYER * me){
int i;
int select=-1;
printf(" 구 (! 그게 )\n");
scanf("%s",me->name);
while(select == -1){
printf(" .\n");
for(i =0;i<CLASSSIZE;i++) printf("%d %s\n",classList[i].type,classList[i].name);
scanf("%d",&select);
if(select <= 0 || select > CLASSSIZE) select = -1;
}
printf(" %s .\n",classList[select-1].name);
me->skill = classList[select-1].skill;
return 0;
}
int printplayerstate(PLAYER * sora, PLAYER * me){
printf(" : %d\n",sora->skill.health);
printf(" : %d\n",me->skill.health);
}
//
int gameprocess(PLAYER * sora, PLAYER * player){
int i;
int select = 0;
printf(" : 1 기 : 2 : 3 \n");
while(1){
scanf("%d",&select);
if(select > 0 || select <= SKILLSIZE){
break;
}
printf(" \n");
}
for(i = 0; i < SKILLSIZE; i++){
if(select == menu[i].select){
(menu[i].func(player,sora));
break;
}
}
while(1){
select = rand() % SKILLSIZE +1;//
if(select > 0 || select <= SKILLSIZE){
break;
}
printf(" \n");
}
for(i = 0; i < SKILLSIZE; i++){
if(select == menu[i].select){
(menu[i].func(sora,player));
}
}
// 공격
}//게
int playersave(PLAYER * who){
return 0;
}//
int playerload(PLAYER * who){
return 0;
}//