#!/usr/bin/env python

import time
import random
gamespeed = 3
life = 15
def syspause():
    time.sleep(1)

def syspause2():
    time.sleep(gamespeed)

def dice1d6():
    n = random.randrange(1,7)
    return n





syspause()
print' player one enter name'
print' '
p1name = raw_input()

syspause()
print' hello ', p1name
print' '

syspause()
print 'player two enter name'
print' '
p2name = raw_input()

syspause()
print' hello', p2name
print' '

syspause()
print' ' 
print p1name, ' vs ', p2name, '!'

syspause2()
print' '
print 'Begin!!!'
print' '
syspause2()


def getporder():
    a = dice1d6()
    b = dice1d6()
    c = 0
    d = 1

    if a == b:
        print'tie'
        getporder()

    if a > b:
        return c

    else:
        return d
    

porder = getporder()

if porder == 0:
    playerA = p2name
    playerB = p1name
    

else:
    playerA = p1name
    playerB = p2name
    
print playerB,'GOES FIRST!'    
print ' '
syspause2()
p1hp = life
p2hp = life




def p1dmg(p1hp):

    hit = dice1d6()
    hit2 = dice1d6()
    hit3 = dice1d6()

    if hit == 6 and hit2 < 6:

        print 'CRITICAL STRIKE'
        hit = ( hit+hit2 )

    if hit == 6 and hit2 == 6:

        print 'ULTIMATE CRITICAL'
        hit = (hit + hit2) + hit3
        
    print hit,'Damage'
    syspause2()
    
    p1hp = (p1hp - hit)
    print' '
    print playerA,'life',p1hp
    print playerB,'life',p2hp
    print' '
    syspause2()
    return p1hp

def p2dmg(p2hp):

    hit = dice1d6()
    hit2 = dice1d6()
    hit3 = dice1d6()
   
    if hit == 6 and hit2 < 6:

        print 'CRITICAL STRIKE'
        hit = ( hit+hit2 )

    if hit == 6 and hit2 == 6:

        print 'ULTIMATE CRITICAL'
        hit = (hit + hit2) + hit3



    print hit,'Damage'
    syspause2()
    p2hp = (p2hp - hit)
    print' '
    print playerA,'life',p1hp
    print playerB,'life',p2hp
    print' '
    syspause2()
    return p2hp



def dice():
    n = random.randrange(1,14)
    return n


def word1():

    n = dice()
    

    if n == 1:
        word = 'punches'
        return word

    if n == 2:
        word = 'kicks'
        return word

    if n == 3:
        word = 'super donkey roundhouse kicks'
        return word

    if n == 4:
        word = 'stabs'
        return word

    if n == 5:
        word = 'strikes'
        return word

    if n == 6:
        word = 'slashes'
        return word

    if n == 7:
        word = 'chops'
        return word

    if n == 8:
        word = 'drop kicks'
        return word

    if n == 9:
        word = 'karate chops'
        return word

    if n == 10:
        word = 'bashes'
        return word

    if n == 11:
        word = 'headbutts'
        return word

    if n == 12:
        word = 'hulk punches'
        return word

    if n == 13:
        word = 'pokes'
        return word



def word2():

    n = dice()

    if n == 1:
        word = 'in the ass'
        return word

    if n == 2:
        word = 's head'
        return word

    if n == 3:
        word ='s throat'
        return word

    if n == 4:
        word ='in the face'
        return word

    if n == 5:
        word = 's knee'
        return word

    if n == 6:
        word = 's chest'
        return word

    if n == 7:
        word = 'in the eye'
        return word

    if n == 8:
        word = 's stomach'
        return word

    if n == 9:
        word = 's jaw'
        return word

    if n == 10:
        word = 'in the foot'
        return word

    if n == 11:
        word = 'right in the chin'
        return word 

    if n == 12:
        word = 'in the mouth'
        return word

    if n == 13:
        word  = 's kidney'
        return word



def word3():

    
    n = dice()

    if n == 1:
        word = 'blocks'
        return word

    if n == 2:
        word = 'sidesteps'
        return word

    if n ==3:
        word = 'ducks'
        return word

    if n == 4:
        word = 'dodges'
        return word

    if n == 5:
        word = 'bobs and weaves'
        return word

    if n == 6:
        word = 'pulled a ninja'
        return word

    if n == 7:
        word = 'defends'
        return word

    if n == 8:
        word = 'repels the attack'
        return word

    if n == 9:
        word = 'isnt hit'
        return word

    if n == 10:
        word = 'rolls out of harms way'
        return word
    
    if n == 11:
        word = 'laughs and counters'
        return word

    if n == 12:
        word = 'summons roostershield'
        return word

    if n == 13:
        word = 'evades the assualt'
        return word



def playerAturn(p2hp,):
    
    p1dice = dice1d6()
    p2dice = dice1d6()

    if p1dice <= p2dice:

       print playerA,word1(),'but',playerB,word3()
       syspause2()
       return p2hp
        
    
    if p1dice > p2dice:

        print playerA,word1(),playerB,word2()
        syspause2()
        p2hp = p2dmg(p2hp)
        return p2hp



def playerBturn(p1hp):
    
    p1dice = dice1d6()
    p2dice = dice1d6()

    if p2dice <= p1dice:
       
       print playerB,word1(),'but',playerA,word3()
       syspause2()
       return p1hp
        
    
    if p2dice > p1dice:
        
        print playerB,word1(),playerA,word2()
        syspause2()
        p1hp = p1dmg(p1hp)
        return p1hp



def getturn(turn):

    if turn == 1:
        turn = 0
        return turn
    if turn == 0:
        turn = 1
        return turn



turn = 1



gameloop = True

while gameloop:

   

    if turn == 0 and p1hp >= 1:
        
        turn = getturn(turn)
        p2hp = playerAturn(p2hp)
        if p2hp <= 0:
            print playerB,'losses to',playerA
            syspause2()
            gameloop = False
        
    if turn == 1 and p2hp >= 1:
       
       turn = getturn(turn)
       p1hp = playerBturn(p1hp)
       if p1hp <= 0:
           print playerA,'losses to',playerB
           syspause2()
           gameloop= False
    

    #else:
        
        #p1hp = p1dmg(p1hp)
        #p2hp = p2dmg(p2hp)