我正在制作一个计算器,该计算器可以导入2个单位文件,并计算哪个单位将获胜,以及剩下的数字(已删除tkinter的内容,因为堆栈溢出没有足够的空间来容纳我)。我运行代码,并得到以下信息:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\The Ginger Knight\Documents\Uni\Software\Python\Anaconda3\lib\tkinter\__init__.py", line 1699, in __call__
return self.func(*args)
File "C:/Users/The Ginger Knight/Documents/Game/Game Folder/Combat Calculator.py", line 718, in allstates
cavef1a = efsmounta(mountefsa)[0] + efsprima(primefsa)[0]
TypeError: 'NoneType' object is not subscriptable
我已经尝试了多种方法,但都没有奏效。有人可以看看(长代码,对不起),然后告诉我我做错了什么吗?我已经看过其他一些没有回报的东西,但是我无法将它们与我所做的匹配。 干杯(下面的代码):
from glob import glob
import os
import ast
from tkinter import *
files_black = glob(os.path.join('Black', '*.txt'))
files_red = glob(os.path.join('Red', '*.txt'))
files_blue = glob(os.path.join('Blue', '*.txt'))
files_yellow = glob(os.path.join('Yellow', '*.txt'))
files_green = glob(os.path.join('Green', '*.txt'))
files_purple = glob(os.path.join('Purple', '*.txt'))
side_list = ['Black', 'Blue', 'Red', 'Purple', 'Yellow', 'Green']
combats = ['Melee', 'Ranged', 'Ram']
primsecat = ['Primary', 'Secondary', 'Ram']
primsecde = ['Primary', 'Secondary', 'Hull']
files_black_neat = []
files_red_neat = []
files_blue_neat = []
files_yellow_neat = []
files_green_neat = []
files_purple_neat = []
for file_black in files_black:
a = file_black.split('\\')[1]
b = a.split('.txt')[0]
files_black_neat.append(b)
for file_red in files_red:
a = file_red.split('\\')[1]
b = a.split('.txt')[0]
files_red_neat.append(b)
for file_blue in files_blue:
a = file_blue.split('\\')[1]
b = a.split('.txt')[0]
files_blue_neat.append(b)
for file_yellow in files_yellow:
a = file_yellow.split('\\')[1]
b = a.split('.txt')[0]
files_yellow_neat.append(b)
for file_green in files_green:
a = file_green.split('\\')[1]
b = a.split('.txt')[0]
files_green_neat.append(b)
for file_purple in files_purple:
a = file_purple.split('\\')[1]
b = a.split('.txt')[0]
files_purple_neat.append(b)
def allstates():
attackbool = list(attacker.state())
at = []
for i in range(len(attackbool)):
if attackbool[i] == 1:
at.append(side_list[i])
combool = list(combatstyles.state())
c = []
for i in range(len(combool)):
if combool[i] == 1:
c.append(combats[i])
blackbool = list(black.state())
b = []
for i in range(len(blackbool)):
if blackbool[i] == 1:
b.append(files_black[i])
bluebool = list(blue.state())
bl = []
for i in range(len(bluebool)):
if bluebool[i] == 1:
bl.append(files_blue[i])
redbool = list(red.state())
r = []
for i in range(len(redbool)):
if redbool[i] == 1:
r.append(files_red[i])
yellowbool = list(yellow.state())
y = []
for i in range(len(yellowbool)):
if yellowbool[i] == 1:
y.append(files_yellow[i])
purplebool = list(purple.state())
p = []
for i in range(len(purplebool)):
if purplebool[i] == 1:
p.append(files_purple[i])
greenbool = list(green.state())
g = []
for i in range(len(greenbool)):
if greenbool[i] == 1:
g.append(files_green[i])
atprimbool = list(at_primsec.state())
at_ps = []
for i in range(len(atprimbool)):
if atprimbool[i] == 1:
at_ps.append(primsecat[i])
defprimbool = list(def_primsec.state())
def_ps = []
for i in range(len(defprimbool)):
if defprimbool[i] == 1:
def_ps.append(primsecde[i])
charge_size = charge_dist.get()
num_attack = num_attack_entry.get()
num_defend = num_def_entry.get()
if b != []:
if at[0] == 'Black':
filename = b[0]
fin = open(filename, 'r')
txt1b = fin.read()
txt1b = txt1b.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1b = txt1b.split('\n')[0]
txt2b = ast.literal_eval(txt1b)
healtha = txt2b[3]
attackprima = txt2b[4]
attackseca = txt2b[7]
rangedat = txt2b[5]
chargeprima = txt2b[9]
chargeseca = txt2b[10]
defprima = txt2b[11]
defseca = txt2b[12]
shipram = txt2b[2]
mountefsa = txt2b[0]
primefsa = txt2b[6]
secefsa = txt2b[8]
else:
filename = b[0]
fin = open(filename, 'r')
txt1b = fin.read()
txt1b = txt1b.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1b = txt1b.split('\n')[0]
txt2b = ast.literal_eval(txt1b)
healthd = txt2b[3]
attackprimd = txt2b[4]
attacksecd = txt2b[7]
chargeprimd = txt2b[9]
chargesecd = txt2b[10]
defprimd = txt2b[11]
defsecd = txt2b[12]
cover = txt2b[13]
armour = txt2b[14]
shiphealth = txt2b[1]
mountefsd = txt2b[0]
primefsd = txt2b[6]
secefsd = txt2b[8]
else:
nout = 0
if bl != []:
if at[0] == 'Blue':
filename = bl[0]
fin = open(filename, 'r')
txt1bl1 = fin.read()
txt1bl = txt1bl1.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1bl = txt1bl.split('\n')[0]
txt2bl = ast.literal_eval(txt1bl)
healtha = txt2bl[3]
attackprima = txt2bl[4]
attackseca = txt2bl[7]
rangedat = txt2bl[5]
chargeprima = txt2bl[9]
chargeseca = txt2bl[10]
defprima = txt2bl[11]
defseca = txt2bl[12]
shipram = txt2bl[2]
mountefsa = txt2bl[0]
primefsa = txt2bl[6]
secefsa = txt2bl[8]
else:
filename = bl[0]
fin = open(filename, 'r')
txt1bl = fin.read()
txt1bl = txt1bl.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1bl = txt1bl.split('\n')[0]
txt2bl = ast.literal_eval(txt1bl)
healthd = txt2bl[3]
attackprimd = txt2bl[4]
attacksecd = txt2bl[7]
chargeprimd = txt2bl[9]
chargesecd = txt2bl[10]
defprimd = txt2bl[11]
defsecd = txt2bl[12]
cover = txt2bl[13]
armour = txt2bl[14]
shiphealth = txt2bl[1]
mountefsd = txt2bl[0]
primefsd = txt2bl[6]
secefsd = txt2bl[8]
else:
nout = 0
if y != []:
if at[0] == 'Yellow':
filename = y[0]
fin = open(filename, 'r')
txt1y = fin.read()
txt1y = txt1y.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1y = txt1y.split('\n')[0]
txt2y = ast.literal_eval(txt1y)
healtha = txt2y[3]
attackprima = txt2y[4]
attackseca = txt2y[7]
rangedat = txt2y[5]
chargeprima = txt2y[9]
chargeseca = txt2y[10]
defprima = txt2y[11]
defseca = txt2y[12]
shipram = txt2y[2]
mountefsa = txt2y[0]
primefsa = txt2y[6]
secefsa = txt2y[8]
else:
filename = y[0]
fin = open(filename, 'r')
txt1y = fin.read()
txt1y = txt1y.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1y = txt1y.split('\n')[0]
txt2y = ast.literal_eval(txt1y)
healthd = txt2y[3]
attackprimd = txt2y[4]
attacksecd = txt2y[7]
chargeprimd = txt2y[9]
chargesecd = txt2y[10]
defprimd = txt2y[11]
defsecd = txt2y[12]
cover = txt2y[13]
armour = txt2y[14]
shiphealth = txt2y[1]
mountefsd = txt2y[0]
primefsd = txt2y[6]
secefsd = txt2y[8]
else:
nout = 0
if p != []:
if at[0] == 'Purple':
filename = p[0]
fin = open(filename, 'r')
txt1p = fin.read()
txt1p = txt1p.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1p = txt1p.split('\n')[0]
txt2p = ast.literal_eval(txt1p)
healtha = txt2p[3]
attackprima = txt2p[4]
attackseca = txt2p[7]
rangedat = txt2p[5]
chargeprima = txt2p[9]
chargeseca = txt2p[10]
defprima = txt2p[11]
defseca = txt2p[12]
shipram = txt2p[2]
mountefsa = txt2p[0]
primefsa = txt2p[6]
secefsa = txt2p[8]
else:
filename = p[0]
fin = open(filename, 'r')
txt1p = fin.read()
txt1p = txt1p.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1p = txt1p.split('\n')[0]
txt2p = ast.literal_eval(txt1p)
healthd = txt2p[3]
attackprimd = txt2p[4]
attacksecd = txt2p[7]
chargeprimd = txt2p[9]
chargesecd = txt2p[10]
defprimd = txt2p[11]
defsecd = txt2p[12]
cover = txt2p[13]
armour = txt2p[14]
shiphealth = txt2p[1]
mountefsd = txt2p[0]
primefsd = txt2p[6]
secefsd = txt2p[8]
else:
nout = 0
if g != []:
if at[0] == 'Green':
filename = g[0]
fin = open(filename, 'r')
txt1g = fin.read()
txt1g = txt1g.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1g = txt1g.split('\n')[0]
txt2g = ast.literal_eval(txt1g)
healtha = txt2g[3]
attackprima = txt2g[4]
attackseca = txt2g[7]
rangedat = txt2g[5]
chargeprima = txt2g[9]
chargeseca = txt2g[10]
defprima = txt2g[11]
defseca = txt2g[12]
shipram = txt2g[2]
mountefsa = txt2g[0]
primefsa = txt2g[6]
secefsa = txt2g[8]
else:
filename = g[0]
fin = open(filename, 'r')
txt1g = fin.read()
txt1g = txt1g.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1g = txt1g.split('\n')[0]
txt2g = ast.literal_eval(txt1g)
healthd = txt2g[3]
attackprimd = txt2g[4]
attacksecd = txt2g[7]
chargeprimd = txt2g[9]
chargesecd = txt2g[10]
defprimd = txt2g[11]
defsecd = txt2g[12]
cover = txt2g[13]
armour = txt2g[14]
shiphealth = txt2g[1]
mountefsd = txt2g[0]
primefsd = txt2g[6]
secefsd = txt2g[8]
else:
nout = 0
if r != []:
if at[0] == 'Red':
filename = r[0]
fin = open(filename, 'r')
txt1r = fin.read()
txt1r = txt1r.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1r = txt1r.split('\n')[0]
txt2r = ast.literal_eval(txt1r)
healtha = txt2r[3]
attackprima = txt2r[4]
attackseca = txt2r[7]
rangedat = txt2r[5]
chargeprima = txt2r[9]
chargeseca = txt2r[10]
defprima = txt2r[11]
defseca = txt2r[12]
shipram = txt2r[2]
mountefsa = txt2r[0]
primefsa = txt2r[6]
secefsa = txt2r[8]
else:
filename = r[0]
fin = open(filename, 'r')
txt1r = fin.read()
txt1r = txt1r.split('BELOW IS FOR COMBAT CODE ONLY:\n')[1]
txt1r = txt1r.split('\n')[0]
txt2r = ast.literal_eval(txt1r)
healthd = txt2r[3]
attackprimd = txt2r[4]
attacksecd = txt2r[7]
chargeprimd = txt2r[9]
chargesecd = txt2r[10]
defprimd = txt2r[11]
defsecd = txt2r[12]
cover = txt2r[13]
armour = txt2r[14]
shiphealth = txt2r[1]
mountefsd = txt2r[0]
primefsd = txt2r[6]
secefsd = txt2r[8]
else:
nout = 0
def efsmounta(mountefsa):
for mountef in mountefsa:
if mountef == '+10% vs Mounted Units':
cavefb1 = 1.1
infefb1 = 1.0
armefb1 = 1.0
charefb1 = 1.0
return cavefb1, infefb1, armefb1, charefb1
elif mountef == '+20 vs Mounted Units':
cavefb1 = 1.2
infefb1 = 1.0
armefb1 = 1.0
charefb1 = 1.0
return cavefb1, infefb1, armefb1, charefb1
elif mountefsa[0] == '+20 vs Infantry' and mountefsa[1] == '-20% vs Mounted Units':
cavefb1 = 0.8
infefb1 = 1.2
armefb1 = 1.0
charefb1 = 1.0
return cavefb1, infefb1, armefb1, charefb1
else:
cavefb1 = 1.0
infefb1 = 1.0
armefb1 = 1.0
charefb1 = 1.0
return cavefb1, infefb1, armefb1, charefb1
def efsprima(primefsa):
for primef in primefsa:
if primefsa[0] == 'Ignore 1/4 Armour' and primefsa[1] == '+30% vs Mounted Units':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/4 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/8 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(1/8)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/3 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(2/3)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif primef == '+30% vs Cavalry':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = 0.0
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif primefsa[0] == '+60% vs Mounted Units' and primefsa[1] == '1/2 Enemy Charge Bonus':
cavefb2 = 0.6
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -0.5
return cavefb2, infefb2, armefb2, charefb2
elif primefsa[0] == '+80% vs Mounted Units' and primefsa[1] == 'Ignore Enemy Charge Bonus':
cavefb2 = 0.8
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -1.0
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0.0
armefb2 = 0.0
cavefb2 = 0.0
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
def efsseca(secefsa):
for secef in secefsa:
if secefsa[0] == 'Ignore 1/4 Armour' and secefsa[1] == '+30% vs Mounted Units':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/4 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/8 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(1/8)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/3 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(2/3)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == '+30% vs Cavalry':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = 0.0
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secefsa[0] == '+60% vs Mounted Units' and secefsa[1] == '1/2 Enemy Charge Bonus':
cavefb2 = 0.6
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -0.5
return cavefb2, infefb2, armefb2, charefb2
elif secefsa[0] == '+80% vs Mounted Units' and secefsa[1] == 'Ignore Enemy Charge Bonus':
cavefb2 = 0.8
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -1
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0.0
armefb2 = 0.0
cavefb2 = 0.0
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
return cavefb2, infefb2, armefb2, charefb2
def efsmountd(mountefsd):
for mountef in mountefsd:
if mountef == '+10% vs Mounted Units':
cavefb1 = 1.1
infefb1 = 1
armefb1 = 1
charefb1 = 1
return cavefb1, infefb1, armefb1, charefb1
elif mountef == '+20 vs Mounted Units':
cavefb1 = 1.2
infefb1 = 1
armefb1 = 1
charefb1 = 1
return cavefb1, infefb1, armefb1, charefb1
elif mountefsd[0] == '+20 vs Infantry' and mountefsd[1] == '-20% vs Mounted Units':
cavefb1 = 0.8
infefb1 = 1.2
armefb1 = 1
charefb1 = 1
return cavefb1, infefb1, armefb1, charefb1
else:
cavefb1 = 1
infefb1 = 1
armefb1 = 1
charefb1 = 1
return cavefb1, infefb1, armefb1, charefb1
def efsprimd(primefsd):
for primef in primefsd:
if primefsd[0] == 'Ignore 1/4 Armour' and primefsd[1] == '+30% vs Mounted Units':
cavefb2 = 0.3
infefb2 = 0
armefb2 = -0.25
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/4 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -0.25
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/8 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -(1/8)
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif primef == 'Ignore 1/3 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -(2/3)
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif primef == '+30% vs Cavalry':
cavefb2 = 0.3
infefb2 = 0
armefb2 = 0
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif primefsd[0] == '+60% vs Mounted Units' and primefsd[1] == '1/2 Enemy Charge Bonus':
cavefb2 = 0.6
infefb2 = 0
armefb2 = 0
charefb2 = -0.5
return cavefb2, infefb2, armefb2, charefb2
elif primefsa[0] == '+80% vs Mounted Units' and primefsa[1] == 'Ignore Enemy Charge Bonus':
cavefb2 = 0.8
infefb2 = 0
armefb2 = 0
charefb2 = -1
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0
armefb2 = 0
cavefb2 = 0
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
def efssecd(secefsd):
for secef in secefsd:
if secefsd[0] == 'Ignore 1/4 Armour' and secefsd[1] == '+30% vs Mounted Units':
cavefb2 = 0.3
infefb2 = 0
armefb2 = -0.25
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/4 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -0.25
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/8 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -(1/8)
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/3 Armour':
cavefb2 = 0
infefb2 = 0
armefb2 = -(2/3)
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif secef == '+30% vs Cavalry':
cavefb2 = 0.3
infefb2 = 0
armefb2 = 0
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
elif secefsd[0] == '+60% vs Mounted Units' and secefsd[1] == '1/2 Enemy Charge Bonus':
cavefb2 = 0.6
infefb2 = 0
armefb2 = 0
charefb2 = -0.5
return cavefb2, infefb2, armefb2, charefb2
elif secefsd[0] == '+80% vs Mounted Units' and secefsd[1] == 'Ignore Enemy Charge Bonus':
cavefb2 = 0.8
infefb2 = 0
armefb2 = 0
charefb2 = -1
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0
armefb2 = 0
cavefb2 = 0
charefb2 = 0
return cavefb2, infefb2, armefb2, charefb2
cavef1a = efsmounta(mountefsa)[0] + efsprima(primefsa)[0]
cavef2a = efsmounta(mountefsa)[0] + efsseca(secefsa)[0]
infef1a = efsmounta(mountefsa)[1] + efsprima(primefsa)[1]
infef2a = efsmounta(mountefsa)[1] + efsseca(secefsa)[1]
armef1a = efsmounta(mountefsa)[2] + efsprima(primefsa)[2]
armef2a = efsmounta(mountefsa)[2] + efsseca(secefsa)[2]
charef1a = efsmounta(mountefsa)[3] + efsprima(primefsa)[3]
charef2a = efsmounta(mountefsa)[3] + efsseca(secefsa)[3]
cavef1d = efsmountd(mountefsd)[0] + efsprimd(primefsd)[0]
cavef2d = efsmountd(mountefsd)[0] + efssecd(secefsd)[0]
infef1d = efsmountd(mountefsd)[1] + efsprimd(primefsd)[1]
infef2d = efsmountd(mountefsd)[1] + efssecd(secefsd)[1]
armef1d = efsmountd(mountefsd)[2] + efsprimd(primefsd)[2]
armef2d = efsmountd(mountefsd)[2] + efssecd(secefsd)[2]
charef1d = efsmountd(mountefsd)[3] + efsprimd(primefsd)[3]
charef2d = efsmountd(mountefsd)[3] + efssecd(secefsd)[3]
print(attackprima, attackprimd)
Button(root, text='Fight!', command=allstates).pack(side=RIGHT)
root.mainloop()
答案 0 :(得分:1)
对,所以我自己发现了问题。我在上面实际执行的操作是,如果mountefsa / mountefsd / primefsa / primefsd / secefsa / secefsd等于[](即没有),则定义随后搜索该空列表并从该空列表中分配值,这意味着当我引用这些值时,我返回了None类型。这是正确完成的示例定义:
def efssecd(secefsd):
if secefsd != []:
for i in range(len(secefsd)):
secef = secefsd[i]
print(secef)
if secefsd[0] == 'Ignore 1/4 Armour' and secefsd[1] == '+30% vs Mounted Units':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
print(cavefb2, infefb2, armefb2, charefb2)
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/4 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -0.25
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/8 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(1/8)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == 'Ignore 1/3 Armour':
cavefb2 = 0.0
infefb2 = 0.0
armefb2 = -(2/3)
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secef == '+30% vs Cavalry':
cavefb2 = 0.3
infefb2 = 0.0
armefb2 = 0.0
charefb2 = 0.0
return cavefb2, infefb2, armefb2, charefb2
elif secefsd[0] == '+60% vs Mounted Units' and secefsd[1] == '1/2 Enemy Charge Bonus':
cavefb2 = 0.6
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -0.5
return cavefb2, infefb2, armefb2, charefb2
elif secefsd[0] == '+80% vs Mounted Units' and secefsd[1] == 'Ignore Enemy Charge Bonus':
cavefb2 = 0.8
infefb2 = 0.0
armefb2 = 0.0
charefb2 = -1
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0.0
armefb2 = 0.0
cavefb2 = 0.0
charefb2 = 0.0
print(cavefb2, infefb2, armefb2, charefb2)
return cavefb2, infefb2, armefb2, charefb2
else:
infefb2 = 0.0
armefb2 = 0.0
cavefb2 = 0.0
charefb2 = 0.0
print(cavefb2, infefb2, armefb2, charefb2)
return cavefb2, infefb2, armefb2, charefb2