You are on page 1of 3

Programmer:___________________________________ Period:________ Date: ________

Play-tester:____________________________________________________________________
COMBAT
1. Name file 151207_6_Last_First_Combat.py (year month day _ period#)
2. Place in WORK DROP FOLDER
3. Self-Evaluate or ask a partner to playtest
FILE RUNS (NO BUGS/ERRORS)

Yes

Spell Checked?

No

______/10

Yes

No

______/10

All bad guys and powers are renamed to match your game Yes

No

______/20

Game decides if player is hit or misses. (randint vs armor class optional)

____/10

Cause damage to player if hit (randint to calculate damage optional)

____/10

Ask player to make a choice between at least 2 options (attack, heal, guard, run, etc)

____/10
____/10

Cause damage to enemy (randint vs armor class optional)


____/10
Remove hitpoints from enemy (randint to calculate damage optional)
____/10
If hp <= 0: "Game Over" and if enemy's HP <= 0 you win!
+5
If player chooses to be healed, their HP is increased.

Total: __________/100

Does any words in code match the


videos code?

If yes :
Grade 0

Check back of paper to see teachers code for comparison.


Use .lower() or .upper() so the user can type any case. +5 extra credit

import random
from random import randint
def combat():
names = ("Maxine", "Charlotte", "Ben" , "Jeff")
nameint = randint(0, 3)
if nameint == 0:
fightername = names[0]
elif nameint == 1:
fightername = names[1]
elif nameint == 2:
fightername = names[2]
elif nameint == 3:
fightername = names[3]
name = raw_input("Hello, what's your name?\n")
print "Hello, %s. Today you will be fighting %s." %(name,
fightername)
playerhp = 10
enemyhp = 10
while True:
damage = randint(1, 4)
newdamage = randint(1, 4)
heal = randint(1, 5)
print "The enemy's health is %s." %(enemyhp)
print "Your health is", playerhp
choice = raw_input("Would you like to attack or heal?
(ATT/HEA) ")
if choice.upper() == "ATT":
enemyhp = enemyhp damage
playerhp = playerhp newdamage
if enemyhp <= 0:
print "Well done. You defeated", fightername
break
elif playerhp <= 0:
print "Oh no, you were defeated by", fightername
break
if choice.upper() == "HEA":
playerhp = playerhp + heal
playerhp = playerhp damage
elif enemyhp <= 0:
print "Well done. You defeated", fightername
break

if playerhp <= 0:
print "Oh no, you were defeated by"< fightername
break
endgame = raw_input("Press enter to end the game")
combat()

You might also like