Doragon Kuesuto 1.15

#include<stdio.h>
#include<stdlib.h>
#include<time.h>

int main()
{
    int bloodD = 3200;
    int bloodW = 1788;
    int MP = 240;
    int action;
    int tmp = 0;
    int tmp2 = 0;
    int score = 0;
    int round = 0;
    
    printf("Update by xkfx ( E-mail: wyzxk_fx@163.com ) 2016-10-27\n");
    srand((int)time(0));
    for(round = 1; round <= 13; round ++){
        srand(rand());
        //输出回合数
        printf("---Details above------ Round - %d -----\n", round);
        //输出恶龙血量
        printf("<Deathwing> \n");
        printf("HP = %d , MP = ??? \n", bloodD);
        //输出勇者血量 与 MP
        printf("<Warrior> \n");
        printf("HP = %d , MP = %d \n", bloodW, MP);
        printf("---------------------------------------\n");
        //输出勇者的技能列表
        //printf("\n");
        printf("YOUR ACTIONS:\n");
        printf("    1 --- ATTACK --- 20 MP\n");
        printf("    2 --- DEFENSE --- 10 MP\n");
        printf("    3 --- GATHER STRENGTH --- 0 MP \n");
        printf("    4 -SWORD OF JUDGEMENT --- ALL HP \n");
        printf("> Warrior , please choose your action:");
        //选择下一步行动
        scanf("%d", &action);
        //计算下一回合数据
        system("cls");
        switch(action){
        case 1:
            tmp = 100 + rand()%217;
            bloodD = bloodD - tmp - tmp2;
            MP = MP - 20;
            printf("\nYour cause %d damage !\n", tmp+tmp2);
            score = score + tmp+tmp2;
            tmp2 = 0;
            break;
        case 2:
            tmp = 400 + rand()%300;
            bloodW = bloodW + tmp;
            MP = MP - 10;
            printf("\nYour recovery %d HP !\n", tmp);
            break;
        case 3:
            tmp2 = tmp2 + rand()%827;
            printf("\nWarrior:I will find you and I will kill you...\n");
            break;
        case 4:
            bloodW = 1;
            tmp = 754 + rand()%1230;
            score = score + tmp;
            bloodD = bloodD - tmp;
            printf("\nWarrior:SWORD OF JUDGEMENT!!!\n");
            printf("Your cause %d damage !\n", tmp);
            break;
        default:
            break;
        }
        printf("Deathwing:All will burn!\n");
        tmp = 200+rand()%546;
        printf("You got a few injuries - %d HP\n", tmp);
        bloodW = bloodW - tmp;
        if((bloodD < 0) || (bloodW < 0))
            break;
    }
    if(bloodD < 0 && bloodW > 0){
        printf("...\n");
        printf("......\n");
        printf("You have kill the Dragon!\n");
        printf(".....\n");
        printf("What a brave Warrior!");
        printf("You final score: %d\n", 3270 + (10-round)*478+score);
        printf("......\n");
    }else if(bloodW < 0 && bloodD > 0){
        printf("...\n");
        printf("......\n");
        printf("GAME OVER\n");
        printf("You final score: %d\n", round*328 +score);
    }else
        printf("The game ended in a draw\n");
    
    system("pause");
    return 0;
}

 

posted @ 2016-10-27 13:36  xkfx  阅读(311)  评论(0)    收藏  举报