Beispiel #1
0
def execute_choice(choice, user, receiver, verbose):
    if choice[0] == 'switch':
        user.poke = user.team.get_Member(choice[1])
    elif choice[0] == 'move':
        # Get and Write move Info
        atker = user.poke
        recvr = receiver.poke
        move = user.poke.Moves.Moves[choice[1]]
        if verbose:
            print '%s used %s' %(pkstr(atker), move.Name)
        move.CurPP -= 1
        
        # Calculate Damage
        try:
            dmg = battle.calc_Damage(atker, recvr, move)
        except:
            dmg = 0
        
        # Check Accuracy
        if battle.acc_check(move):
            recvr.mod_HP(-1*dmg)
            if verbose:
                print '%s took %i damage' %(pkstr(recvr), dmg)
                if recvr.CurHP == 0:
                    print '%s fainted' %(recvr.Name)
        else:
            if verbose:
                print 'The attack missed'
                
    return
Beispiel #2
0
 def execute_choice(choice, user, receiver):
     if choice[0] == 'switch':
         old_name = user.poke.Name
         user.poke = user.team.get_Member(choice[1])
         new_name = user.poke.Name
         turn_setup()
         box2.box()
         box2.addstr(1, 1, old_name + ' return!')
         box2.addstr(2, 1, new_name + ' go!')
         box2.refresh()
         screen.getch()
         box2.clear()
         box2.box()
         box2.refresh()
     elif choice[0] == 'move':
         atker = user.poke
         recvr = receiver.poke
         move = user.poke.Moves.Moves[choice[1]]
         move.CurPP -= 1
         try:
             dmg = battle.calc_Damage(atker, recvr, move)
         except:
             dmg = int(recvr.Stats['HP']*0.25)
         box2.addstr(1, 1, atker.Name + ' used ' + move.Name + '.')
         if battle.acc_check(move):
             box2.addstr(2, 1, recvr.Name + ' took ' + str(dmg) + ' damage.')
             recvr.mod_HP(-1*dmg)
         else:
             box2.addstr(2, 1, 'The attack missed!')
         box2.refresh()
         screen.getch()
         box2.clear()
         box2.box()
         box2.refresh()
     return
Beispiel #3
0
 def execute_choice(choice, user, receiver):
     if choice[0] == 'switch':
         old_name = user.poke.Name
         user.poke = user.team.get_Member(choice[1])
         new_name = user.poke.Name
         turn_setup()
         box2.box()
         box2.addstr(1, 1, old_name + ' return!')
         box2.addstr(2, 1, new_name + ' go!')
         box2.refresh()
         screen.getch()
         box2.clear()
         box2.box()
         box2.refresh()
     elif choice[0] == 'move':
         atker = user.poke
         recvr = receiver.poke
         move = user.poke.Moves.Moves[choice[1]]
         move.CurPP -= 1
         try:
             dmg = battle.calc_Damage(atker, recvr, move)
         except:
             dmg = int(recvr.Stats['HP'] * 0.25)
         box2.addstr(1, 1, atker.Name + ' used ' + move.Name + '.')
         if battle.acc_check(move):
             box2.addstr(2, 1,
                         recvr.Name + ' took ' + str(dmg) + ' damage.')
             recvr.mod_HP(-1 * dmg)
         else:
             box2.addstr(2, 1, 'The attack missed!')
         box2.refresh()
         screen.getch()
         box2.clear()
         box2.box()
         box2.refresh()
     return