fork download
  1. #!/usr/bin/env python
  2.  
  3. import time
  4. import random
  5. gamespeed = 3
  6. life = 15
  7. def syspause():
  8. time.sleep(1)
  9.  
  10. def syspause2():
  11. time.sleep(gamespeed)
  12.  
  13. def dice1d6():
  14. n = random.randrange(1,7)
  15. return n
  16.  
  17.  
  18.  
  19.  
  20.  
  21. syspause()
  22. print' player one enter name'
  23. print' '
  24. p1name = raw_input()
  25.  
  26. syspause()
  27. print' hello ', p1name
  28. print' '
  29.  
  30. syspause()
  31. print 'player two enter name'
  32. print' '
  33. p2name = raw_input()
  34.  
  35. syspause()
  36. print' hello', p2name
  37. print' '
  38.  
  39. syspause()
  40. print' '
  41. print p1name, ' vs ', p2name, '!'
  42.  
  43. syspause2()
  44. print' '
  45. print 'Begin!!!'
  46. print' '
  47. syspause2()
  48.  
  49.  
  50. def getporder():
  51. a = dice1d6()
  52. b = dice1d6()
  53. c = 0
  54. d = 1
  55.  
  56. if a == b:
  57. print'tie'
  58. getporder()
  59.  
  60. if a > b:
  61. return c
  62.  
  63. else:
  64. return d
  65.  
  66.  
  67. porder = getporder()
  68.  
  69. if porder == 0:
  70. playerA = p2name
  71. playerB = p1name
  72.  
  73.  
  74. else:
  75. playerA = p1name
  76. playerB = p2name
  77.  
  78. print playerB,'GOES FIRST!'
  79. print ' '
  80. syspause2()
  81. p1hp = life
  82. p2hp = life
  83.  
  84.  
  85.  
  86.  
  87. def p1dmg(p1hp):
  88.  
  89. hit = dice1d6()
  90. hit2 = dice1d6()
  91. hit3 = dice1d6()
  92.  
  93. if hit == 6 and hit2 < 6:
  94.  
  95. print 'CRITICAL STRIKE'
  96. hit = ( hit+hit2 )
  97.  
  98. if hit == 6 and hit2 == 6:
  99.  
  100. print 'ULTIMATE CRITICAL'
  101. hit = (hit + hit2) + hit3
  102.  
  103. print hit,'Damage'
  104. syspause2()
  105.  
  106. p1hp = (p1hp - hit)
  107. print' '
  108. print playerA,'life',p1hp
  109. print playerB,'life',p2hp
  110. print' '
  111. syspause2()
  112. return p1hp
  113.  
  114. def p2dmg(p2hp):
  115.  
  116. hit = dice1d6()
  117. hit2 = dice1d6()
  118. hit3 = dice1d6()
  119.  
  120. if hit == 6 and hit2 < 6:
  121.  
  122. print 'CRITICAL STRIKE'
  123. hit = ( hit+hit2 )
  124.  
  125. if hit == 6 and hit2 == 6:
  126.  
  127. print 'ULTIMATE CRITICAL'
  128. hit = (hit + hit2) + hit3
  129.  
  130.  
  131.  
  132. print hit,'Damage'
  133. syspause2()
  134. p2hp = (p2hp - hit)
  135. print' '
  136. print playerA,'life',p1hp
  137. print playerB,'life',p2hp
  138. print' '
  139. syspause2()
  140. return p2hp
  141.  
  142.  
  143.  
  144. def dice():
  145. n = random.randrange(1,14)
  146. return n
  147.  
  148.  
  149. def word1():
  150.  
  151. n = dice()
  152.  
  153.  
  154. if n == 1:
  155. word = 'punches'
  156. return word
  157.  
  158. if n == 2:
  159. word = 'kicks'
  160. return word
  161.  
  162. if n == 3:
  163. word = 'super donkey roundhouse kicks'
  164. return word
  165.  
  166. if n == 4:
  167. word = 'stabs'
  168. return word
  169.  
  170. if n == 5:
  171. word = 'strikes'
  172. return word
  173.  
  174. if n == 6:
  175. word = 'slashes'
  176. return word
  177.  
  178. if n == 7:
  179. word = 'chops'
  180. return word
  181.  
  182. if n == 8:
  183. word = 'drop kicks'
  184. return word
  185.  
  186. if n == 9:
  187. word = 'karate chops'
  188. return word
  189.  
  190. if n == 10:
  191. word = 'bashes'
  192. return word
  193.  
  194. if n == 11:
  195. word = 'headbutts'
  196. return word
  197.  
  198. if n == 12:
  199. word = 'hulk punches'
  200. return word
  201.  
  202. if n == 13:
  203. word = 'pokes'
  204. return word
  205.  
  206.  
  207.  
  208. def word2():
  209.  
  210. n = dice()
  211.  
  212. if n == 1:
  213. word = 'in the ass'
  214. return word
  215.  
  216. if n == 2:
  217. word = 's head'
  218. return word
  219.  
  220. if n == 3:
  221. word ='s throat'
  222. return word
  223.  
  224. if n == 4:
  225. word ='in the face'
  226. return word
  227.  
  228. if n == 5:
  229. word = 's knee'
  230. return word
  231.  
  232. if n == 6:
  233. word = 's chest'
  234. return word
  235.  
  236. if n == 7:
  237. word = 'in the eye'
  238. return word
  239.  
  240. if n == 8:
  241. word = 's stomach'
  242. return word
  243.  
  244. if n == 9:
  245. word = 's jaw'
  246. return word
  247.  
  248. if n == 10:
  249. word = 'in the foot'
  250. return word
  251.  
  252. if n == 11:
  253. word = 'right in the chin'
  254. return word
  255.  
  256. if n == 12:
  257. word = 'in the mouth'
  258. return word
  259.  
  260. if n == 13:
  261. word = 's kidney'
  262. return word
  263.  
  264.  
  265.  
  266. def word3():
  267.  
  268.  
  269. n = dice()
  270.  
  271. if n == 1:
  272. word = 'blocks'
  273. return word
  274.  
  275. if n == 2:
  276. word = 'sidesteps'
  277. return word
  278.  
  279. if n ==3:
  280. word = 'ducks'
  281. return word
  282.  
  283. if n == 4:
  284. word = 'dodges'
  285. return word
  286.  
  287. if n == 5:
  288. word = 'bobs and weaves'
  289. return word
  290.  
  291. if n == 6:
  292. word = 'pulled a ninja'
  293. return word
  294.  
  295. if n == 7:
  296. word = 'defends'
  297. return word
  298.  
  299. if n == 8:
  300. word = 'repels the attack'
  301. return word
  302.  
  303. if n == 9:
  304. word = 'isnt hit'
  305. return word
  306.  
  307. if n == 10:
  308. word = 'rolls out of harms way'
  309. return word
  310.  
  311. if n == 11:
  312. word = 'laughs and counters'
  313. return word
  314.  
  315. if n == 12:
  316. word = 'summons roostershield'
  317. return word
  318.  
  319. if n == 13:
  320. word = 'evades the assualt'
  321. return word
  322.  
  323.  
  324.  
  325. def playerAturn(p2hp,):
  326.  
  327. p1dice = dice1d6()
  328. p2dice = dice1d6()
  329.  
  330. if p1dice <= p2dice:
  331.  
  332. print playerA,word1(),'but',playerB,word3()
  333. syspause2()
  334. return p2hp
  335.  
  336.  
  337. if p1dice > p2dice:
  338.  
  339. print playerA,word1(),playerB,word2()
  340. syspause2()
  341. p2hp = p2dmg(p2hp)
  342. return p2hp
  343.  
  344.  
  345.  
  346. def playerBturn(p1hp):
  347.  
  348. p1dice = dice1d6()
  349. p2dice = dice1d6()
  350.  
  351. if p2dice <= p1dice:
  352.  
  353. print playerB,word1(),'but',playerA,word3()
  354. syspause2()
  355. return p1hp
  356.  
  357.  
  358. if p2dice > p1dice:
  359.  
  360. print playerB,word1(),playerA,word2()
  361. syspause2()
  362. p1hp = p1dmg(p1hp)
  363. return p1hp
  364.  
  365.  
  366.  
  367. def getturn(turn):
  368.  
  369. if turn == 1:
  370. turn = 0
  371. return turn
  372. if turn == 0:
  373. turn = 1
  374. return turn
  375.  
  376.  
  377.  
  378. turn = 1
  379.  
  380.  
  381.  
  382. gameloop = True
  383.  
  384. while gameloop:
  385.  
  386.  
  387.  
  388. if turn == 0 and p1hp >= 1:
  389.  
  390. turn = getturn(turn)
  391. p2hp = playerAturn(p2hp)
  392. if p2hp <= 0:
  393. print playerB,'losses to',playerA
  394. syspause2()
  395. gameloop = False
  396.  
  397. if turn == 1 and p2hp >= 1:
  398.  
  399. turn = getturn(turn)
  400. p1hp = playerBturn(p1hp)
  401. if p1hp <= 0:
  402. print playerA,'losses to',playerB
  403. syspause2()
  404. gameloop= False
  405.  
  406.  
  407. #else:
  408.  
  409. #p1hp = p1dmg(p1hp)
  410. #p2hp = p2dmg(p2hp)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:2: error: invalid preprocessing directive #!
prog.cpp:22:6: warning: character constant too long for its type [enabled by default]
prog.cpp:27:6: warning: character constant too long for its type [enabled by default]
prog.cpp:31:7: warning: character constant too long for its type [enabled by default]
prog.cpp:36:6: warning: character constant too long for its type [enabled by default]
prog.cpp:41:15: warning: multi-character character constant [-Wmultichar]
prog.cpp:45:7: warning: character constant too long for its type [enabled by default]
prog.cpp:57:14: warning: multi-character character constant [-Wmultichar]
prog.cpp:78:15: warning: character constant too long for its type [enabled by default]
prog.cpp:95:15: warning: character constant too long for its type [enabled by default]
prog.cpp:100:15: warning: character constant too long for its type [enabled by default]
prog.cpp:103:15: warning: character constant too long for its type [enabled by default]
prog.cpp:108:19: warning: multi-character character constant [-Wmultichar]
prog.cpp:109:19: warning: multi-character character constant [-Wmultichar]
prog.cpp:122:15: warning: character constant too long for its type [enabled by default]
prog.cpp:127:15: warning: character constant too long for its type [enabled by default]
prog.cpp:132:15: warning: character constant too long for its type [enabled by default]
prog.cpp:136:19: warning: multi-character character constant [-Wmultichar]
prog.cpp:137:19: warning: multi-character character constant [-Wmultichar]
prog.cpp:155:16: warning: character constant too long for its type [enabled by default]
prog.cpp:159:16: warning: character constant too long for its type [enabled by default]
prog.cpp:163:16: warning: character constant too long for its type [enabled by default]
prog.cpp:167:16: warning: character constant too long for its type [enabled by default]
prog.cpp:171:16: warning: character constant too long for its type [enabled by default]
prog.cpp:175:16: warning: character constant too long for its type [enabled by default]
prog.cpp:179:16: warning: character constant too long for its type [enabled by default]
prog.cpp:183:16: warning: character constant too long for its type [enabled by default]
prog.cpp:187:16: warning: character constant too long for its type [enabled by default]
prog.cpp:191:16: warning: character constant too long for its type [enabled by default]
prog.cpp:195:16: warning: character constant too long for its type [enabled by default]
prog.cpp:199:16: warning: character constant too long for its type [enabled by default]
prog.cpp:203:16: warning: character constant too long for its type [enabled by default]
prog.cpp:213:16: warning: character constant too long for its type [enabled by default]
prog.cpp:217:16: warning: character constant too long for its type [enabled by default]
prog.cpp:221:15: warning: character constant too long for its type [enabled by default]
prog.cpp:225:15: warning: character constant too long for its type [enabled by default]
prog.cpp:229:16: warning: character constant too long for its type [enabled by default]
prog.cpp:233:16: warning: character constant too long for its type [enabled by default]
prog.cpp:237:16: warning: character constant too long for its type [enabled by default]
prog.cpp:241:16: warning: character constant too long for its type [enabled by default]
prog.cpp:245:16: warning: character constant too long for its type [enabled by default]
prog.cpp:249:16: warning: character constant too long for its type [enabled by default]
prog.cpp:253:16: warning: character constant too long for its type [enabled by default]
prog.cpp:257:16: warning: character constant too long for its type [enabled by default]
prog.cpp:261:17: warning: character constant too long for its type [enabled by default]
prog.cpp:272:16: warning: character constant too long for its type [enabled by default]
prog.cpp:276:16: warning: character constant too long for its type [enabled by default]
prog.cpp:280:16: warning: character constant too long for its type [enabled by default]
prog.cpp:284:16: warning: character constant too long for its type [enabled by default]
prog.cpp:288:16: warning: character constant too long for its type [enabled by default]
prog.cpp:292:16: warning: character constant too long for its type [enabled by default]
prog.cpp:296:16: warning: character constant too long for its type [enabled by default]
prog.cpp:300:16: warning: character constant too long for its type [enabled by default]
prog.cpp:304:16: warning: character constant too long for its type [enabled by default]
prog.cpp:308:16: warning: character constant too long for its type [enabled by default]
prog.cpp:312:16: warning: character constant too long for its type [enabled by default]
prog.cpp:316:16: warning: character constant too long for its type [enabled by default]
prog.cpp:320:16: warning: character constant too long for its type [enabled by default]
prog.cpp:332:30: warning: multi-character character constant [-Wmultichar]
prog.cpp:353:30: warning: multi-character character constant [-Wmultichar]
prog.cpp:393:27: warning: character constant too long for its type [enabled by default]
prog.cpp:402:26: warning: character constant too long for its type [enabled by default]
prog.cpp:407:6: error: #else without #if
prog.cpp:409:10: error: invalid preprocessing directive #p1hp
prog.cpp:410:10: error: invalid preprocessing directive #p2hp
prog.cpp:3:1: error: ‘import’ does not name a type
stdout
Standard output is empty