/*
* <<D Q>>
*
* Author xkfx<wyzxk_fx@163.com>
*
* 游戏规则:利用适当的决策,在13回合内击杀恶龙取得胜利。
*
* 2016 - *
*/ #include<stdio.h>
#include<stdlib.h>
#include<time.h> void show_State(int round, int dragon_HP, int warrior_HP, int warrior_MP)
{
//输出起始分割栏
printf("- ROUND-%2d ---------------\n", round);
//输出dragon状态
printf(" <Deathwing> \n");
printf(" HP = %-4d , MP = ???? \n", dragon_HP);
//输出worrior状态
printf(" <Worrior> \n");
printf(" HP = %-4d , MP = %-4d \n", warrior_HP, warrior_MP);
//输出结束分割栏
printf("--------------------------------\n");
} void show_Skill()
{
printf("Here is your actions:\n");
//show hero skill
printf("1 Holy Light -140mp\n");
//show basic skill
printf("2 Normal Attack -20mp\n");
printf("3 Force of Nature -0mp\n");
//show final skill
printf("4 Sword of Judgement \n");
printf(">Warrior, please choose your action:");
} int main()
{
/*创建游戏所需的数据*/
int dragon_HP = ;
int warrior_HP = ;
int warrior_MP = ;
int score = ;
int skill_tmp = ;
int skill_tmp_2 = ;
int round;
int choice; srand((int)time());
system("cls");
for(round = ; round <= ; round ++){
srand(rand());
/*显示人物状态*/
show_State(round, dragon_HP, warrior_HP, warrior_MP);
/**/
if(round == )
printf("Deathwing: ALL WILL BURN...\n");
/*显示决策信息*/
show_Skill();
/*选择决策*/
scanf("%d", &choice);
system("cls");
/*执行决策&优先判定敌方*/
/*warrior*/
switch(choice){ case :
if(warrior_MP < )
break;
skill_tmp = - warrior_HP; warrior_HP = ;
warrior_MP = warrior_MP - ; score = score - skill_tmp; printf("Warrior: I am theone horseman of the Apocalypse!\n");
printf("You has restored %d HP.\n", skill_tmp);
break; case :
if(warrior_MP < )
break;
skill_tmp = skill_tmp_2 + + rand()%; dragon_HP = dragon_HP - skill_tmp;
warrior_MP = warrior_MP - ; skill_tmp_2 = ; score = score + skill_tmp; printf("Your cause %d damage !\n", skill_tmp);
break; case :
skill_tmp_2 = skill_tmp_2 + + rand()%;
printf("Your Damage Pool: %d\n", skill_tmp_2);
break; case :
skill_tmp = warrior_HP + + rand()%; dragon_HP = dragon_HP - skill_tmp;
warrior_HP = ; score = score + skill_tmp; printf("warrior: Embrace the end!\n");
printf("Your cause %d damage !\n", skill_tmp);
break; default:
break;
}
if(dragon_HP <= ){
printf("Deathwing: It is impossible !?...\n");
printf("warrior: Embrace the end! So be it!\n");
printf(".....\n");
printf("..YOU WIN!\n");
break;
}
/*dragon*/
skill_tmp = + rand()%;
warrior_HP = warrior_HP - skill_tmp;
printf("You got a few injuries - %d HP\n", skill_tmp);
if(warrior_HP <= ){
printf("...\n");
printf("......\n");
printf("..GAME OVER.\n");
break;
}
/*显示决策结果*/
}
/*显示游戏结果*/
if(dragon_HP <= ){
score = score + ( - round) * ;
}else{
score = score + round * ;
}
if(warrior_HP >= && dragon_HP >= )
printf("The game ended in a draw.\n");
printf("\nYour final score: %d\n", score);
  system("pause");
return ;
}

Doragon Kuesuto 1.6的更多相关文章

  1. Doragon Kuesuto 1.0

    #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { ; ; ; int actio ...

  2. Doragon Kuesuto 1.15

    #include<stdio.h> #include<stdlib.h> #include<time.h> int main() { ; ; ; int actio ...

  3. FIRST GAME.

    -Doragon Kuesuto(.c) Doragon Kuesuto 1.0 Doragon Kuesuto 1.15 Doragon Kuesuto 1.6

随机推荐

  1. jquery中的节点的操作

    节点的操作 Dom 文档对象 模型 解决 一.插入节点 Append() 在每个匹配的元素中追加内容 Var  $li_1= “<li></li>”; Var  $li_2 = ...

  2. android 比较靠谱的图片压缩

    第一:我们先看下质量压缩方法: private Bitmap compressImage(Bitmap image) { ByteArrayOutputStream baos = new ByteAr ...

  3. c# web 缓存管理

    using System; using System.Collections; using System.Text.RegularExpressions; using System.Web; usin ...

  4. YTU 2991: 链表节点逆置(线性表)

    2991: 链表节点逆置(线性表) 时间限制: 1 Sec  内存限制: 128 MB 提交: 14  解决: 6 题目描述 设计一个算法,将一个带头节点的数据域依次为a1,a2,-,an(n> ...

  5. java中@value的环境配置

    @value 在现阶段我想大家对注解都不陌生,@value的用法就是在后台获取配置文件的信息,从而方便修改一些固定的配置.不明白的可以百度@value的详解. 配置@value有以下几个步骤. 1.首 ...

  6. 搭建spring+mybatis+struts2环境的配置文件

    1.web.xml配置 <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi=& ...

  7. ssh 配置自动登录

    假定 机器A 连接至 机器B . 1. 在机器A上,生成RSA秘钥对 ssh-keygen -t rsa 期间passphrase不输入密码.默认生成文件至 ~/.ssh/ -rw------- we ...

  8. Intel Code Challenge Final Round (Div. 1 + Div. 2, Combined) A

    Description You are given names of two days of the week. Please, determine whether it is possible th ...

  9. CodeForces 628B New Skateboard

    New Skateboard time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  10. 【leetcode❤python】 438. Find All Anagrams in a String

    class Solution(object):    def findAnagrams(self, s, p):        """        :type s: s ...