@ADoctor/

RPGBattler 1 - Original

Python

A brand new RPG Battler! Original name: SizzlingWhirlwindConferences

fork
loading
Files
  • main.py
  • RPGCharacters.txt
  • RPGMonsters.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
import random

def NewStat(stat):
    while True: #BOOLEAN
        statcreated = input("What is the character's {0} stat? ".format(stat))#ASSIGNMENT OPERATOR, VARIABLE, STRING HANDLING
        try:
            statcomp = int(statcreated)
            if statcomp > 100 or statcomp < 1: #IF STATMENT, ARITHMETIC OPERATORS
                print("Sorry, but that's not a valid value. It must be a number from 1 to 100.")
            else:
                return statcreated
        except ValueError:
            print("Sorry, but that's not a valid value. It must be a number from 1 to 100.")

def Damage(attack):
    while True: #BOOLEAN
        attacktype = input("Is this a physical or magical action? Note that you must have at least 1 physical action, or the game may break when you try to use this character. ").title() #VARIABLE, ASSIGNMENT OPERATOR, STRING HANDLING
        if attacktype != "Physical" and attacktype != "Magical": #IF STATEMENT
          print("Sorry, you must enter 'Physical' or 'Magical'.")
        else:
          damageset = input("What is the damage for {0}? If the answer is negative, it will heal you. ".format(attack)) #VARIABLE, ASSIGNMENT OPERATOR, STRING HANDLING
          try:
            damagecomp = int(damageset) #STRING HANDLING, ASSIGNMENT OPERATOR, CONSTANT
            if damagecomp > 10 or damagecomp < -5 or damagecomp == 0: #IF STATEMENT, ARITHMETIC OPERATORS
                print("Sorry, but that's not a valid value. It must be a number from -5 to 10 but not 0.")
            else:
                if attacktype == "Magical":
                  if damagecomp < 0: #IF STATEMENT, ARITHMETIC OPERATORS
                    MPusage = damagecomp*-2 #ARITHMETIC OPERATOR, ASSIGNMENT OPERATOR, CONSTANT
                  else:
                    MPusage = damagecomp
                else:
                  MPusage = 0
                if damagecomp > 0: #ARITHMETIC OPERATOR, IF STATEMENT
                  critchance = (100-(damagecomp*10))/4 #LOTS OF ARITHMETIC OPERATORS, ASSIGNMENT OPERATOR
                else:
                  critchance = 0
                return damageset,critchance,MPusage
          except ValueError:
            print("Sorry, but that's not a valid value. It must be a number from -5 to 10 but not 0.")

def NewCharacter():
    name = input("What is the character's name? ") #ASSIGNMENT OPERATOR, VARIABLE
    TotalStats = 1000 #ASSIGNMENT OPERATOR, CONSTANT
    while TotalStats > 250: #ARITHMETIC OPERATOR
      attack = NewStat('attack') #ASSIGNMENT OPERATOR
      defence = NewStat('defence') #ASSIGNMENT OPERATOR
      HP = NewStat('HP') #ASSIGNMENT OPERATOR
      speed = NewStat('speed') #ASSIGNMENT OPERATOR
      MP = NewStat('magic capability') #ASSIGNMENT OPERATOR
      TotalStats = int(attack)+int(defence)+int(HP)+int(speed)+int(MP) #ASSIGNMENT OPERATOR, ARITHMETIC OPERATORS, CONSTANT
      if TotalStats > 250: #IF STATEMENT, ARITHMETIC OPERATOR
        print("Sorry, but the total stats must be 250 at most.")
    action1 = input("What is the character's first action? ") #ASSIGNMENT OPERATOR, VARIABLE
    action1damage,action1critchance,action1MPusage = Damage(action1) #ASSIGNMENT OPERATOR, CONSTANT
    action2 = input("What is the character's second action? ") #ASSIGNMENT OPERATOR, VARIABLE
    action2damage,action2critchance,action2MPusage = Damage(action2) #ASSIGNMENT OPERATOR, CONSTANT
    action3 = input("What is the character's third action? ") #ASSIGNMENT OPERATOR, VARIABLE
    action3damage,action3critchance,action3MPusage = Damage(action3) #ASSIGNMENT OPERATOR, CONSTANT
    action4 = input("What is the character's last action? ") #ASSIGNMENT OPERATOR, VARIABLE
    action4damage,action4critchance,action4MPusage = Damage(action4) #ASSIGNMENT OPERATOR, CONSTANT
    AddCharacter = open("RPGCharacters.txt","a") #ASSIGNMENT OPERATOR
    AddCharacter.write(name+"\nAttack\n"+attack)
    AddCharacter.write("\nDefence\n"+defence+"\n")
    AddCharacter.write("HP\n"+HP+"\n")
    AddCharacter.write("Speed\n"+speed+"\n")
    AddCharacter.write("MP\n"+MP+"\n")
    AddCharacter.write("Action 1\n"+str(action1)+"\n"+str(action1damage)+"\n"+str(action1critchance)+"\n"+str(action1MPusage)+"\n")
    AddCharacter.write("Action 2\n"+str(action2)+"\n"+str(action2damage)+"\n"+str(action2critchance)+"\n"+str(action2MPusage)+"\n")
    AddCharacter.write("Action 3\n"+str(action3)+"\n"+str(action3damage)+"\n"+str(action3critchance)+"\n"+str(action3MPusage)+"\n")
    AddCharacter.write("Action 4\n"+str(action4)+"\n"+str(action4damage)+"\n"+str(action4critchance)+"\n"+str(action4MPusage)+"\n\n") #STRING MANIPULATION
    

def ViewCharacters():
    ReadCharacters = open("RPGCharacters.txt","r") #ASSIGNMENT OPERATOR
    print("")
    for i in ReadCharacters:
      print(i.strip()) #STRING MANIPULATION

def Hit2(MP,MPUsage,Name,Action,ActionEffect,CritChance,Attack,Defence,OpposingHP,CharacterHP,MaxHP):
  if MP >= MPUsage:
    if ActionEffect < 0:
      CharacterHP -= ActionEffect
      if CharacterHP > MaxHP: #LOTS OF IF STATEMENTS AND ARITHMETIC OPERATORS
        if CharacterHP == MaxHP-ActionEffect:
          print("{0} damage would have been healed, but {2} was already at the max HP of {1}!".format(ActionEffect*-1,MaxHP,Name)) #STRING HANDLING
          CharacterHP = MaxHP #ASSIGNMENT OPERATOR
          return CharacterHP,OpposingHP,MP,False
        else:
          print("{0} damage would have been healed, but {2} reached the max HP of {1}!".format(ActionEffect*-1,MaxHP,Name)) #STRING HANDLING
          CharacterHP = MaxHP #ASSIGNMENT OPERATOR
          return CharacterHP,OpposingHP,MP,True

      else:
        print("{0} damage was healed.".format(ActionEffect*-1)) #STRING HANDLING
    else:
      damage = Hit(Name,Action,ActionEffect,CritChance,Attack,Defence) #ASSIGNMENT OPERATOR
      OpposingHP -= damage #ASSIGNMENT AND ARITHMETIC OPERATOR
    MP -= MPUsage #ASSIGNMENT AND ARITHMETIC OPERATOR
    return CharacterHP,OpposingHP,MP,True
  else:
    print("{0} didn't have enough MP to use {1}!".format(Name,Action)) #STRING HANDLING
    return CharacterHP,OpposingHP,MP,False

def Hit(name,action,damage,critchance,attack,defence):
  print("{0} used {1}!".format(name,action))
  damage = round(damage * attack/defence,0) #STRING HANDLING
  if random.randint(1,100) > critchance: #IF STATEMENT, ARITHMETIC OPERATOR
    print("It did {0} damage!".format(damage)) #STRING HANDLING
    return damage
  else:
    damage = damage * 1.5 + 10 #ASSIGNMENT OPERATOR, ARITHMETIC OPERATORS
    print("Critical hit! It did {0} damage!".format(damage)) #STRING HANDLING
    return damage

def BattleMonster():
    print("")
    CharacterPage = open("RPGCharacters.txt","r") #ASSIGNMENT OPERATOR
    CharacterStats = [] #ASSIGNMENT OPERATOR
    CharacterList = [] #ASSIGNMENT OPERATOR
    for i in CharacterPage:
      CharacterStats.append(i.strip()) #STRING HANDLING

    i = 0 #ASSIGNMENT OPERATOR
    while i < len(CharacterStats): #ARITHMETIC OPERATOR
      CharacterList.append(CharacterStats[i]) #STRING HANDLING
      i += 32 #ASSIGNMENT AND ARITHMETIC OPERATOR

    for i in range(0,len(CharacterList)):
      print("{0}: {1}".format(i+1,CharacterList[i])) #STRING HANDLING
    while True: #BOOLEAN
      try:
        CharacterNumber = int(input("What character would you like to choose? Type the number given to them."))-1 #ASSIGNMENT OPERATOR, VARIABLE
        if CharacterNumber > -1 and CharacterNumber < len(CharacterList): #ARITHMETIC OPERATORS, STRING HANDLING, IF STATEMENT
          break
        else:
          print("Sorry, that's not a valid number.")
      except ValueError:
        print("Sorry, you need to input the number.")
    CharacterName = CharacterStats[(CharacterNumber*32)]
    CharacterAttack = int(CharacterStats[(CharacterNumber*32+2)])
    CharacterDefence = int(CharacterStats[(CharacterNumber*32+4)])
    CharacterHP = int(CharacterStats[(CharacterNumber*32+6)])
    CharacterMaxHP = CharacterHP
    CharacterSpeed = int(CharacterStats[(CharacterNumber*32+8)])
    CharacterMP = int(CharacterStats[(CharacterNumber*32+10)])
    CharacterMaxMP = CharacterMP
    CharacterAction1 = CharacterStats[(CharacterNumber*32+12)]
    CharacterDamage1 = int(CharacterStats[(CharacterNumber*32+13)])
    CharacterCritChance1 = float(CharacterStats[(CharacterNumber*32+14)])
    CharacterMPUsage1 = int(CharacterStats[(CharacterNumber*32+15)])
    CharacterAction2 = CharacterStats[(CharacterNumber*32+17)]
    CharacterDamage2 = int(CharacterStats[(CharacterNumber*32+18)])
    CharacterCritChance2 = float(CharacterStats[(CharacterNumber*32+19)])
    CharacterMPUsage2 = int(CharacterStats[(CharacterNumber*32+20)])
    CharacterAction3 = CharacterStats[(CharacterNumber*32+22)]
    CharacterDamage3 = int(CharacterStats[(CharacterNumber*32+23)])
    CharacterCritChance3 = float(CharacterStats[(CharacterNumber*32+24)])
    CharacterMPUsage3 = int(CharacterStats[(CharacterNumber*32+25)])
    CharacterAction4 = CharacterStats[(CharacterNumber*32+27)]
    CharacterDamage4 = int(CharacterStats[(CharacterNumber*32+28)])
    CharacterCritChance4 = float(CharacterStats[(CharacterNumber*32+29)])
    CharacterMPUsage4 = int(CharacterStats[(CharacterNumber*32+30)]) #ASSIGNMENT OPERATORS

    print("")
    monsterlist = ["Spider","Frog","Witch","Royal Guard","Hound","Demon","Mermaid","Ganon"] #ASSIGNMENT OPERATOR
    monsternumber = random.randint(0,7) #ASSIGNMENT OPERATOR
    MonsterName = monsterlist[monsternumber] #ASSIGNMENT OPERATOR
    print("You will be fighting a {0}!".format(MonsterName)) #STRING HANDLING
    MonsterPage = open("RPGMonsters.txt","r") #ASSIGNMENT OPERATOR
    MonsterStats = [] #ASSIGNMENT OPERATOR
    for i in MonsterPage:
      MonsterStats.append(i.strip()) #STRING HANDLING
    
    MonsterAttack = int(MonsterStats[(monsternumber*32+2)])
    MonsterDefence = int(MonsterStats[(monsternumber*32+4)])
    MonsterHP = int(MonsterStats[(monsternumber*32+6)])
    MonsterMaxHP = MonsterHP
    MonsterSpeed = int(MonsterStats[(monsternumber*32+8)])
    MonsterMP = int(MonsterStats[(monsternumber*32+10)])
    MonsterMaxMP = MonsterMP
    MonsterAction1 = MonsterStats[(monsternumber*32+12)]
    MonsterDamage1 = int(MonsterStats[(monsternumber*32+13)])
    MonsterCritChance1 = float(MonsterStats[(monsternumber*32+14)])
    MonsterMPUsage1 = int(MonsterStats[(monsternumber*32+15)])
    MonsterAction2 = MonsterStats[(monsternumber*32+17)]
    MonsterDamage2 = int(MonsterStats[(monsternumber*32+18)])
    MonsterCritChance2 = float(MonsterStats[(monsternumber*32+19)])
    MonsterMPUsage2 = int(MonsterStats[(monsternumber*32+20)])
    MonsterAction3 = MonsterStats[(monsternumber*32+22)]
    MonsterDamage3 = int(MonsterStats[(monsternumber*32+23)])
    MonsterCritChance3 = float(MonsterStats[(monsternumber*32+24)])
    MonsterMPUsage3 = int(MonsterStats[(monsternumber*32+25)])
    MonsterAction4 = MonsterStats[(monsternumber*32+27)]
    MonsterDamage4 = int(MonsterStats[(monsternumber*32+28)])
    MonsterCritChance4 = float(MonsterStats[(monsternumber*32+29)])
    MonsterMPUsage4 = int(MonsterStats[(monsternumber*32+30)]) #ASSIGNMENT OPERATORS

    VictorDecided = False #ASSIGNMENT OPERATOR, BOOLEAN
    CharacterMPRecovery = CharacterMP/10 #ASSIGNMENT OPERATOR, ARITHMETIC OPERATOR
    MonsterMPRecovery = MonsterMP/10 #ASSIGNMENT OPERATOR, ARITHMETIC OPERATOR
    SpeedFlag = False #ASSIGNMENT OPERATOR, BOOLEAN
    MostRecentAction = 0 #ASSIGNMENT OPERATOR, CONSTANT
    while VictorDecided == False:
      ActionSuccess = False #ASSIGNMENT OPERATOR, BOOLEAN
      print("")
      if (SpeedFlag == False) and (MonsterSpeed > CharacterSpeed): #IF STATEMENT, ARITHMETIC OPERATOR
        print("The {0} goes first!".format(MonsterName)) #STRING HANDLING
        SpeedFlag = True #ASSIGNMENT OPERATOR, BOOLEAN
      else:
        print("""1. {0}
2. {1}
3. {2}
4. {3}""".format(CharacterAction1,CharacterAction2,CharacterAction3,CharacterAction4)) #STRING HANDLING
        while ActionSuccess == False:
          print("The {0} has {1} HP.".format(MonsterName,MonsterHP)) #STRING HANDLING
          print("You have {0} HP.".format(CharacterHP)) #STRING HANDLING
          try:
            Action = int(input("Which action would you like to use? Type in the relevant number. You cannot use the same action twice in a row. ")) #ASSIGNMENT OPERATOR, STRING HANDLING
            if Action == 1 and MostRecentAction != 1: #IF STATEMENT
              CharacterHP,MonsterHP,CharacterMP,ActionSuccess = Hit2(CharacterMP,CharacterMPUsage1,CharacterName,CharacterAction1,CharacterDamage1,CharacterCritChance1,CharacterAttack,MonsterDefence,MonsterHP,CharacterHP,CharacterMaxHP)
              if ActionSuccess == True:
                MostRecentAction=1
            elif Action == 2 and MostRecentAction != 2:
              CharacterHP,MonsterHP,CharacterMP,ActionSuccess = Hit2(CharacterMP,CharacterMPUsage2,CharacterName,CharacterAction2,CharacterDamage2,CharacterCritChance2,CharacterAttack,MonsterDefence,MonsterHP,CharacterHP,CharacterMaxHP)
              if ActionSuccess == True:
                MostRecentAction = 2
            elif Action == 3 and MostRecentAction != 3:
              CharacterHP,MonsterHP,CharacterMP,ActionSuccess = Hit2(CharacterMP,CharacterMPUsage3,CharacterName,CharacterAction3,CharacterDamage3,CharacterCritChance3,CharacterAttack,MonsterDefence,MonsterHP,CharacterHP,CharacterMaxHP)
              if ActionSuccess == True:
                MostRecentAction = 3
            elif Action == 4 and MostRecentAction != 4:
              CharacterHP,MonsterHP,CharacterMP,ActionSuccess = Hit2(CharacterMP,CharacterMPUsage4,CharacterName,CharacterAction4,CharacterDamage4,CharacterCritChance4,CharacterAttack,MonsterDefence,MonsterHP,CharacterHP,CharacterMaxHP)
              if ActionSuccess == True:
                MostRecentAction = 4
            else:
              print("Sorry, that's not a valid number. This may be because you tried to use your most recent action.")
              ActionSuccess = False
          except ValueError:
            print("Error - you need to input a number!")
      print("")
      if MonsterHP <= 0:
        print("You win!")
        print("The {0} has {1} HP.".format(MonsterName,MonsterHP))
        print("You have {0} HP.".format(CharacterHP))
        VictorDecided = True
        break
      ActionSuccess = False
      while ActionSuccess == False:
        print("The {0} has {1} HP.".format(MonsterName,MonsterHP))
        print("You have {0} HP.".format(CharacterHP))
        Action = random.randint(1,4)
        if Action == 1:
          MonsterHP,CharacterHP,MonsterMP,ActionSuccess = Hit2(MonsterMP,MonsterMPUsage1,MonsterName,MonsterAction1,MonsterDamage1,MonsterCritChance1,MonsterAttack,CharacterDefence,CharacterHP,MonsterHP,MonsterMaxHP)
        elif Action == 2:
          MonsterHP,CharacterHP,MonsterMP,ActionSuccess = Hit2(MonsterMP,MonsterMPUsage2,MonsterName,MonsterAction2,MonsterDamage2,MonsterCritChance2,MonsterAttack,CharacterDefence,CharacterHP,MonsterHP,MonsterMaxHP)
        elif Action == 3:
          MonsterHP,CharacterHP,MonsterMP,ActionSuccess = Hit2(MonsterMP,MonsterMPUsage3,MonsterName,MonsterAction3,MonsterDamage3,MonsterCritChance3,MonsterAttack,CharacterDefence,CharacterHP,MonsterHP,MonsterMaxHP)
        else:
          MonsterHP,CharacterHP,MonsterMP,ActionSuccess = Hit2(MonsterMP,MonsterMPUsage4,MonsterName,MonsterAction4,MonsterDamage4,MonsterCritChance4,MonsterAttack,CharacterDefence,CharacterHP,MonsterHP,MonsterMaxHP)
      if CharacterHP <= 0:
        print("The {0} has {1} HP.".format(MonsterName,MonsterHP))
        print("You have {0} HP.".format(CharacterHP))
        print("You lose...")
        VictorDecided = True
      CharacterMP += CharacterMPRecovery
      MonsterMP += MonsterMPRecovery
      if CharacterMP > CharacterMaxMP:
        CharacterMP = CharacterMaxMP
      if MonsterMP > MonsterMaxMP:
        MonsterMP = MonsterMaxMP

def BattlePVP():
    print("")
    CharacterPage = open("RPGCharacters.txt","r")
    CharacterStats = []
    CharacterList = []
    for i in CharacterPage:
      CharacterStats.append(i.strip())

    i = 0
    while i < len(CharacterStats): 
      CharacterList.append(CharacterStats[i])
      i += 32

    for i in range(0,len(CharacterList)):
      print("{0}: {1}".format(i+1,CharacterList[i]))
    while True:
      try:
        Character1Number = int(input("Player 1: What character would you like to choose? Type the number given to them."))-1
        if Character1Number > -1 and Character1Number < len(CharacterList):
          break
        else:
          print("Sorry, that's not a valid number.")
      except ValueError:
        print("Sorry, you need to input the number.")
    Character1Name = CharacterStats[(Character1Number*32)]
    Character1Attack = int(CharacterStats[(Character1Number*32+2)])
    Character1Defence = int(CharacterStats[(Character1Number*32+4)])
    Character1HP = int(CharacterStats[(Character1Number*32+6)])
    Character1MaxHP = Character1HP
    Character1Speed = int(CharacterStats[(Character1Number*32+8)])
    Character1MP = int(CharacterStats[(Character1Number*32+10)])
    Character1MaxMP = Character1MP
    Character1Action1 = CharacterStats[(Character1Number*32+12)]
    Character1Damage1 = int(CharacterStats[(Character1Number*32+13)])
    Character1CritChance1 = float(CharacterStats[(Character1Number*32+14)])
    Character1MPUsage1 = int(CharacterStats[(Character1Number*32+15)])
    Character1Action2 = CharacterStats[(Character1Number*32+17)]
    Character1Damage2 = int(CharacterStats[(Character1Number*32+18)])
    Character1CritChance2 = float(CharacterStats[(Character1Number*32+19)])
    Character1MPUsage2 = int(CharacterStats[(Character1Number*32+20)])
    Character1Action3 = CharacterStats[(Character1Number*32+22)]
    Character1Damage3 = int(CharacterStats[(Character1Number*32+23)])
    Character1CritChance3 = float(CharacterStats[(Character1Number*32+24)])
    Character1MPUsage3 = int(CharacterStats[(Character1Number*32+25)])
    Character1Action4 = CharacterStats[(Character1Number*32+27)]
    Character1Damage4 = int(CharacterStats[(Character1Number*32+28)])
    Character1CritChance4 = float(CharacterStats[(Character1Number*32+29)])
    Character1MPUsage4 = int(CharacterStats[(Character1Number*32+30)])
    print("")

    for i in range(0,len(CharacterList)):
      print("{0}: {1}".format(i+1,CharacterList[i]))
    while True:
      try:
        Character2Number = int(input("Player 2: What character would you like to choose? Type the number given to them."))-1
        if Character2Number > -1 and Character2Number < len(CharacterList):
          break
        else:
          print("Sorry, that's not a valid number.")
      except ValueError:
        print("Sorry, you need to input the number.")
    Character2Name = CharacterStats[(Character2Number*32)]
    Character2Attack = int(CharacterStats[(Character2Number*32+2)])
    Character2Defence = int(CharacterStats[(Character2Number*32+4)])
    Character2HP = int(CharacterStats[(Character2Number*32+6)])
    Character2MaxHP = Character2HP
    Character2Speed = int(CharacterStats[(Character2Number*32+8)])
    Character2MP = int(CharacterStats[(Character2Number*32+10)])
    Character2MaxMP = Character2MP
    Character2Action1 = CharacterStats[(Character2Number*32+12)]
    Character2Damage1 = int(CharacterStats[(Character2Number*32+13)])
    Character2CritChance1 = float(CharacterStats[(Character2Number*32+14)])
    Character2MPUsage1 = int(CharacterStats[(Character2Number*32+15)])
    Character2Action2 = CharacterStats[(Character2Number*32+17)]
    Character2Damage2 = int(CharacterStats[(Character2Number*32+18)])
    Character2CritChance2 = float(CharacterStats[(Character2Number*32+19)])
    Character2MPUsage2 = int(CharacterStats[(Character2Number*32+20)])
    Character2Action3 = CharacterStats[(Character2Number*32+22)]
    Character2Damage3 = int(CharacterStats[(Character2Number*32+23)])
    Character2CritChance3 = float(CharacterStats[(Character2Number*32+24)])
    Character2MPUsage3 = int(CharacterStats[(Character2Number*32+25)])
    Character2Action4 = CharacterStats[(Character2Number*32+27)]
    Character2Damage4 = int(CharacterStats[(Character2Number*32+28)])
    Character2CritChance4 = float(CharacterStats[(Character2Number*32+29)])
    Character2MPUsage4 = int(CharacterStats[(Character2Number*32+30)])
    print("")

    VictorDecided = False
    Character1MPRecovery = Character1MP/10
    Character2MPRecovery = Character2MP/10
    SpeedFlag = False
    MostRecentActionA = 0
    MostRecentActionB = 0
    while VictorDecided == False:
      ActionSuccess = False
      print("")
      if (SpeedFlag == False) and (Character2Speed > Character1Speed):
        print("{0} goes first!".format(Character2Name))
        SpeedFlag = True
      else:
        print("{0} goes first!".format(Character1Name))
        print("""1. {0}
2. {1}
3. {2}
4. {3}""".format(Character1Action1,Character1Action2,Character1Action3,Character1Action4))
        while ActionSuccess == False:
          print("{0} has {1} HP.".format(Character1Name,Character1HP))
          print("{0} has {1} HP.".format(Character2Name,Character2HP))
          try:
            print("Player 1:")
            Action = int(input("Which action would you like to use? Type in the relevant number. You cannot use the same action twice in a row. "))
            if Action == 1 and MostRecentActionA != 1:
              Character1HP,Character2HP,Character1MP,ActionSuccess = Hit2(Character1MP,Character1MPUsage1,Character1Name,Character1Action1,Character1Damage1,Character1CritChance1,Character1Attack,Character2Defence,Character2HP,Character1HP,Character1MaxHP)
              if ActionSuccess == True:
                MostRecentActionA = 1
            elif Action == 2 and MostRecentActionA != 2:
              Character1HP,Character2HP,Character1MP,ActionSuccess = Hit2(Character1MP,Character1MPUsage2,Character1Name,Character1Action2,Character1Damage2,Character1CritChance2,Character1Attack,Character2Defence,Character2HP,Character1HP,Character1MaxHP)
              if ActionSuccess == True:
                MostRecentActionA = 2
            elif Action == 3 and MostRecentActionA != 3:
              Character1HP,Character2HP,Character1MP,ActionSuccess = Hit2(Character1MP,Character1MPUsage3,Character1Name,Character1Action3,Character1Damage3,Character1CritChance3,Character1Attack,Character2Defence,Character2HP,Character1HP,Character1MaxHP)
              if ActionSuccess == True:
                MostRecentActionA = 3
            elif Action == 4 and MostRecentActionA != 4:
              Character1HP,Character2HP,Character1MP,ActionSuccess = Hit2(Character1MP,Character1MPUsage4,Character1Name,Character1Action4,Character1Damage4,Character1CritChance4,Character1Attack,Character2Defence,Character2HP,Character1HP,Character1MaxHP)
              if ActionSuccess == True:
                MostRecentActionA = 4
            else:
              print("Sorry, that's not a valid number. This may be because you tried to use your most recent action.")
              ActionSuccess = False
          except ValueError:
            print("Error - you need to input a number!")
      print("")
      if Character2HP <= 0:
        print("Player 1 wins!")
        print("{0} has {1} HP.".format(Character1Name,Character1HP))
        print("{0} has {1} HP.".format(Character2Name,Character2HP))
        VictorDecided = True
        break
      ActionSuccess = False
      while ActionSuccess == False:
        print("{0} has {1} HP.".format(Character1Name,Character1HP))
        print("{0} has {1} HP.".format(Character2Name,Character2HP))
        try:
            print("""1. {0}
2. {1}
3. {2}
4. {3}""".format(Character2Action1,Character2Action2,Character2Action3,Character2Action4))
            print("Player 2:")
            Action = int(input("Which action would you like to use? Type in the relevant number. You cannot use the same action twice in a row. "))
            if Action == 1 and MostRecentActionB != 1:
              Character2HP,Character1HP,Character2MP,ActionSuccess = Hit2(Character2MP,Character2MPUsage1,Character2Name,Character2Action1,Character2Damage1,Character2CritChance1,Character2Attack,Character1Defence,Character1HP,Character2HP,Character2MaxHP)
              if ActionSuccess == True:
                MostRecentActionB = 1
            elif Action == 2 and MostRecentActionB != 2:
              Character2HP,Character1HP,Character2MP,ActionSuccess = Hit2(Character2MP,Character2MPUsage2,Character2Name,Character2Action2,Character2Damage2,Character2CritChance2,Character2Attack,Character1Defence,Character1HP,Character2HP,Character2MaxHP)
              if ActionSuccess == True:
                MostRecentActionB = 2
            elif Action == 3 and MostRecentActionB != 3:
              Character2HP,Character1HP,Character2MP,ActionSuccess = Hit2(Character2MP,Character2MPUsage3,Character2Name,Character2Action3,Character2Damage3,Character2CritChance3,Character2Attack,Character1Defence,Character1HP,Character2HP,Character2MaxHP)
              if ActionSuccess == True:
                MostRecentActionB = 3
            elif Action == 4 and MostRecentActionB != 4:
              Character2HP,Character1HP,Character2MP,ActionSuccess = Hit2(Character2MP,Character2MPUsage4,Character2Name,Character2Action4,Character2Damage4,Character2CritChance4,Character2Attack,Character1Defence,Character1HP,Character2HP,Character2MaxHP)
              if ActionSuccess == True:
                MostRecentActionB = 4
            else:
              print("Sorry, that's not a valid number. This may be because you tried to use your most recent action.")
              ActionSuccess = False
        except ValueError:
            print("Error - you need to input a number!")
      print("")
      if Character1HP <= 0:
        print("{0} has {1} HP.".format(Character1Name,Character1HP))
        print("{0} has {1} HP.".format(Character2Name,Character2HP))
        print("Player 2 wins!")
        VictorDecided = True
      Character1MP += Character1MPRecovery
      Character2MP += Character2MPRecovery
      if Character1MP > Character1MaxMP:
        Character1MP = Character1MaxMP
      if Character2MP > Character2MaxMP:
        Character2MP = Character2MaxMP

def Menu():
    while True:
        print("""1. Create new character
2. View all characters
3. Battle against monster
4. Battle PVP
5. Quit""")
        try:
            option = int(input("Choose an option. "))
            if option == 1:
                NewCharacter()
            elif option == 2:
                ViewCharacters()
            elif option == 3:
                BattleMonster()
            elif option == 4:
                BattlePVP()
            elif option == 5:
                break
            else:
                print("Sorry, but that's not an option. Please state the number of the option you want.")
        except ValueError:
            print("Sorry, but that's not an option. Please state the number - yes, the number - of the option you want.")

Menu()
print("Bye!")