• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python calculator.calcSetup函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tppVisu.calculator.calcSetup函数的典型用法代码示例。如果您正苦于以下问题:Python calcSetup函数的具体用法?Python calcSetup怎么用?Python calcSetup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了calcSetup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:31,代码来源:testAbilities.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:7,代码来源:testMoves.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:7,代码来源:testMoves.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:7,代码来源:testMoves.py


示例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)
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:7,代码来源:testMoves.py


示例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
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:8,代码来源:testAbilities.py


示例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])
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:8,代码来源:testMoves.py


示例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])
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:9,代码来源:testAbilities.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:9,代码来源:testMoves.py


示例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)
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:10,代码来源:testAbilities.py


示例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)))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:10,代码来源:testAbilities.py


示例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
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:10,代码来源:testAbilities.py


示例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
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:10,代码来源:testAbilities.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:11,代码来源:testMoves.py


示例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))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:11,代码来源:testAbilities.py


示例16: test_ability_levitate

 def test_ability_levitate(self):
     p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="levitate")
     attackingmon = self.genPkmn(stats=self.genStats(ATK=100))
     groundmove = self.genMove(type="ground", power=70)
     attackingmon.moves = [groundmove]
     pdamage, attackdamage, env = calcSetup(p, attackingmon, self.genEnv())
     self.assertEqual(attackdamage[0].eff, Eff.NOT)
     # But can still be hit through Mold Breaker!
     moldbreakimon = self.genPkmn(stats=self.genStats(ATK=100), ability="mold breaker")
     moldbreakimon.moves = [groundmove]
     pdamage, attackdamage, env = calcSetup(p, moldbreakimon, self.genEnv())
     self.assertEqual(attackdamage[0].eff, Eff.NORMAL)
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:12,代码来源:testAbilities.py


示例17: test_ability_white_smoke

 def test_ability_white_smoke(self):
     p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="white smoke")
     p2 = self.genPkmn(stats=self.genStats(ATK=100))
     p2.moves = [self.genMove(name="Swagger"), self.genMove(name="Growl")]
     d2 = calcSetup(p2, p, self.genEnv()).blues
     self.assertNormalEffective(d2[0])
     self.assertNotEffective(d2[1])
     
     p2.ability = "Mold Breaker"
     d2 = calcSetup(p2, p, self.genEnv()).blues
     self.assertNormalEffective(d2[0])
     self.assertNormalEffective(d2[1])
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:12,代码来源:testAbilities.py


示例18: test_ability_normalize

 def test_ability_normalize(self):
     p = self.genPkmn(stats=self.genStats(ATK=100, DEF=100), ability="normalize", moves=[self.genMove(power=70, type="fire")])
     p2 = self.genPkmn(type1="ghost")
     
     pdamage = calcSetup(p, p2, self.genEnv()).blues
     # Fire should be able to hit ghost-types; with normalize it won't
     self.assertNotEffective(pdamage[0])
 
     # Test for STAB; the move remains a fire-type move
     p3 = self.genPkmn(type1="fire")
     pdamage = calcSetup(p, p3, self.genEnv()).blues
     self.assertEqual(pdamage[0].damage, self.getDamage(70, 100, 100, 1.5))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:12,代码来源:testAbilities.py


示例19: test_move_grass_knot

 def test_move_grass_knot(self):
     m = self.genMove(name='Grass Knot')
     p1 = self.genPkmn(stats=self.genStats(ATK=99), type1='water', moves=[m])
     p2 = self.genPkmn(stats=self.genStats(DEF=166))
     p2.weight = 59
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(80, 99, 166))
     p2.weight = 0.6
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(20, 99, 166))
     p2.weight = 187
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(100, 99, 166))
     p2.weight = 347
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(120, 99, 166))
     p2.weight = 0.012
     self.assertNotEffective(calcSetup(p1, p2, self.genEnv()).blues[0])
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:14,代码来源:testMoves.py


示例20: test_move_punishment

 def test_move_punishment(self):
     m = self.genMove(name='Punishment')
     p1 = self.genPkmn(stats=self.genStats(ATK=85), type1='dark', moves=[m])
     p2 = self.genPkmn(stats=self.genStats(DEF=165, ATK=123, SPD=245, SPE=201))
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(60, 85, 165))
     p1.DEF.stageAdd(1)
     p2.ATK.stageAdd(1)
     p2.SPD.stageAdd(1)
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(100, 85, 165))
     p2.SPD.stageAdd(1)
     p2.SPE.stageAdd(-1)
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(120, 85, 165))
     p2.SPD.stageAdd(-2)
     p2.SPE.stageAdd(2)
     self.assertEqual(calcSetup(p1, p2, self.genEnv()).blues[0].damage, self.getDamage(100, 85, 165))
开发者ID:TwitchPlaysPokemon,项目名称:tppVisu,代码行数:15,代码来源:testMoves.py



注:本文中的tppVisu.calculator.calcSetup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python tq_config.TaskQueueConfig类代码示例发布时间:2022-05-27
下一篇:
Python tpot.TPOTClassifier类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap