本文整理汇总了Python中tppVisu.calculator.calcSetup函数的典型用法代码示例。如果您正苦于以下问题:Python calcSetup函数的具体用法?Python calcSetup怎么用?Python calcSetup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了calcSetup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_ability_trace
def test_ability_trace(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="trace", type1="normal")
# Test #1: Wonder Guard
wondermon = self.genPkmn(ability="wonder guard", moves=[self.genMove(type="normal"), self.genMove(type="fighting")])
attackdamages = calcSetup(p, wondermon, self.genEnv()).reds
self.assertNotEffective(attackdamages[0])
self.assertSuperEffective(attackdamages[1])
# Test #2: Vital Spirit should prevent sleep
vitalmon = self.genPkmn(ability="vital spirit", moves=[self.genMove(name="Spore")])
attackdamages = calcSetup(p, wondermon, self.genEnv()).reds
self.assertNotEffective(attackdamages[0])
# Test #3: Technician
technimon = self.genPkmn(ability="technician")
p.moves = [self.genMove(power=50), self.genMove(power=60), self.genMove(power=70)]
p.type1 = "fire" # avoid STAB
pdamages = calcSetup(p, technimon, self.genEnv()).blues
self.assertEqual(pdamages[0].damage, self.getDamage(50 * 1.5, 100, 100))
self.assertEqual(pdamages[1].damage, self.getDamage(60 * 1.5, 100, 100))
self.assertEqual(pdamages[2].damage, self.getDamage(70, 100, 100))
# Test #4: Tracing Trace doesn't cause an infinite loop of death
tracimon = self.genPkmn(ability="technician")
try:
calcSetup(p, tracimon, self.genEnv()).blues
except RuntimeError as e:
# oops
self.assertIsNone(e)
示例2: test_move_smelling_salts
def test_move_smelling_salts(self):
m = self.genMove(name='Smelling Salts', power=60)
p1 = self.genPkmn(stats=self.genStats(ATK=154), type1='dark', moves=[m])
p2 = self.genPkmn(stats=self.genStats(DEF=235))
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(60, 154, 235))
p2.status = 'par'
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(120, 154, 235))
示例3: test_move_seismic_toss
def test_move_seismic_toss(self):
m = self.genMove(name='Seismic Toss')
p1 = self.genPkmn(moves=[m])
p2 = self.genPkmn()
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, (100, 100))
p2.level = 39
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, (39, 39))
示例4: test_move_facade
def test_move_facade(self):
m = self.genMove(name='Facade', power=70, type='normal')
p1 = self.genPkmn(stats=self.genStats(ATK=121), type1='fire', moves=[m]) # no stab
p2 = self.genPkmn(stats=self.genStats(DEF=212), type1='normal')
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(70, 121, 212))
p1.status = 'par'
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(140, 121, 212))
示例5: test_move_thunder
def test_move_thunder(self):
m = self.genMove(name='Thunder', accuracy=70)
p = self.genPkmn(moves=[m])
self.assertEqual(calcSetup(p, self.genPkmn(), self.genEnv()).blues[0].accuracy, 70)
self.assertEqual(calcSetup(p, self.genPkmn(), self.genEnv(weather='rain')).blues[0].accuracy, 100)
self.assertEqual(calcSetup(p, self.genPkmn(), self.genEnv(weather='sun')).blues[0].accuracy, 50)
self.assertEqual(calcSetup(p, self.genPkmn(), self.genEnv(weather='sandstorm')).blues[0].accuracy, 70)
示例6: test_ability_solar_power
def test_ability_solar_power(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="solar power", moves=[self.genMove(power=70, category=MoveCategory.special)], type1="dragon")
p2 = self.genPkmn()
pdamage = calcSetup(p, p2, self.genEnv()).blues
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100, 100))
pdamage = calcSetup(p, p2, self.genEnv(weather="sun")).blues
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100 * 1.5, 100)) # SpAttack * 1.5
示例7: test_move_attract
def test_move_attract(self):
p1 = self.genPkmn(gender=Gender.male, moves=[self.genMove(name='Attract')])
p2 = self.genPkmn(gender=Gender.male)
self.assertNotEffective(calcSetup(p1, p2, self.genEnv()).blues[0])
p2.gender = Gender.female
self.assertNormalEffective(calcSetup(p1, p2, self.genEnv()).blues[0])
p1.gender = Gender.none
self.assertNotEffective(calcSetup(p1, p2, self.genEnv()).blues[0])
示例8: test_ability_hydration
def test_ability_hydration(self):
# In rain, status conditions go away
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="hydration")
p2 = self.genPkmn(moves=[self.genMove(name="Thunder Wave")])
attackdamage = calcSetup(p, p2, self.genEnv()).reds
self.assertNormalEffective(attackdamage[0])
attackdamage = calcSetup(p, p2, self.genEnv(weather="rain")).reds
self.assertNotEffective(attackdamage[0])
示例9: test_move_gyro_ball
def test_move_gyro_ball(self):
m = self.genMove(name='Gyro Ball')
p1 = self.genPkmn(stats=self.genStats(ATK=99, SPE=204), type1='ground', moves=[m])
p2 = self.genPkmn(stats=self.genStats(DEF=166, SPE=172))
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(25 * (172 / 204), 99, 166))
p1.SPE.stageAdd(2)
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(25 * (172 / 408), 99, 166))
p2.SPE.stageAdd(3)
self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(25 * (430 / 408), 99, 166))
示例10: test_ability_leaf_guard
def test_ability_leaf_guard(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="leaf guard")
p2 = self.genPkmn(moves=[self.genMove(name="Thunder Wave"), self.genMove(name="Yawn"), self.genMove(name="Toxic")])
attackdamage = calcSetup(p, p2, self.genEnv()).reds
for atk in attackdamage:
self.assertNormalEffective(atk)
attackdamage = calcSetup(p, p2, self.genEnv(weather="sun")).reds
for atk in attackdamage:
self.assertNotEffective(atk)
示例11: test_ability_snow_cloak
def test_ability_snow_cloak(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="snow cloak")
p2 = self.genPkmn(moves=[self.genMove(accuracy=100), self.genMove(accuracy=50)])
attackdamage = calcSetup(p, p2, self.genEnv()).reds
self.assertEqual(attackdamage[0].accuracy, 100)
self.assertEqual(attackdamage[1].accuracy, 50)
attackdamage = calcSetup(p, p2, self.genEnv(weather="hail")).reds
self.assertEqual(attackdamage[0].accuracy, int(100 * 1 / (1.2)))
self.assertEqual(attackdamage[1].accuracy, int(50 * 1 / (1.2)))
示例12: test_ability_flower_gift
def test_ability_flower_gift(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="flower gift", moves=[self.genMove(power=70, category=MoveCategory.physical)], type1="dragon")
p2 = self.genPkmn(moves=[self.genMove(power=70, category=MoveCategory.special)], type1="dragon")
pdamage, attackdamage, env = calcSetup(p, p2, self.genEnv())
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100, 100))
self.assertEqual(attackdamage[0].damage, self.getDamage(70, 100, 100))
pdamage, attackdamage, env = calcSetup(p, p2, self.genEnv(weather="sun"))
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100 * 1.5, 100)) # Attack * 1.5
self.assertEqual(attackdamage[0].damage, self.getDamage(70, 100, 100 * 1.5)) # Spdef * 1.5
示例13: test_ability_guts
def test_ability_guts(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="guts", moves=[self.genMove(power=70)], type1="dragon")
self.assertEqual(p.hasStatusCondition(), False)
pdamage = calcSetup(p, self.genPkmn(), self.genEnv()).blues
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100, 100))
p.status = "brn"
self.assertEqual(p.hasStatusCondition(), True)
pdamage = calcSetup(p, self.genPkmn(), self.genEnv()).blues
self.assertEqual(pdamage[0].damage, self.getDamage(70, 100 * 1.5, 100)) # No attack drop from burn
示例14: test_move_solar_beam
def test_move_solar_beam(self):
p1 = self.genPkmn(type1="dragon",moves=[self.genMove(name="SolarBeam",power=70),self.genMove(name="Solar Beam",power=70)])
pdamages = calcSetup(p1,self.genPkmn(),self.genEnv()).blues
for result in pdamages:
self.assertEqual(result.damage, self.getDamage(70,100,100))
pdamages = calcSetup(p1,self.genPkmn(),self.genEnv(weather='rain')).blues
for result in pdamages:
self.assertEqual(result.damage, self.getDamage(70*0.5,100,100))
示例15: test_ability_marvel_scale
def test_ability_marvel_scale(self):
p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="marvel scale")
p2 = self.genPkmn(moves=[self.genMove(name="Tackle", power=70)], type1="dragon")
attackdamage = calcSetup(p, p2, self.genEnv()).reds
self.assertEqual(attackdamage[0].damage, self.getDamage(70, 100, 100))
p.status = "psn"
self.assertEqual(p.hasStatusCondition(), True)
attackdamage = calcSetup(p, p2, self.genEnv()).reds
self.assertEqual(attackdamage[0].damage, self.getDamage(70, 100, 100 * 1.5))