当前位置: 首页>>代码示例>>Python>>正文


Python BuildPokemonBattleWrapper.setTypes方法代码示例

本文整理汇总了Python中Test.test_helper.BuildPokemonBattleWrapper.setTypes方法的典型用法代码示例。如果您正苦于以下问题:Python BuildPokemonBattleWrapper.setTypes方法的具体用法?Python BuildPokemonBattleWrapper.setTypes怎么用?Python BuildPokemonBattleWrapper.setTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Test.test_helper.BuildPokemonBattleWrapper的用法示例。


在下文中一共展示了BuildPokemonBattleWrapper.setTypes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hitGhost

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setTypes [as 别名]
class hitGhost(unittest.TestCase):
    """ Test that hitGhost returns the correct values """
    
    def setUp(self):
        """ Build Pkmn and Delegate for use in test cases """
        self.attack = BuildAttack()
        self.pkmn =  BuildPokemonBattleWrapper()
        self.delegate = HitDelegate(self.attack, 100)
        
        self.damage = self.attack.damageDelegate
        
    def cantHit(self):
        """ Test hitGhost function returns false when the opp is a Ghost and a FIGHTING or NORMAL attack is used """
        self.pkmn.setTypes(["GHOST"])
        
        self.attack.type = "NORMAL"
        assert not  self.delegate.hitGhost(self.pkmn), "Should not be able to hit a Ghost with a Normal Attack"
        
        self.attack.type = "FIGHTING"
        assert not  self.delegate.hitGhost(self.pkmn), "Should not be able to hit a Ghost with a Fighting Attack"
        
    def status(self):
        """ Test hitGhost function returns true correctly when the attack is a status attack """
        self.attack.damageDelegate = NullDamageDelegate()
        self.pkmn.setTypes(["GHOST"])
        self.attack.type = "NORMAL"
        assert self.delegate.hitGhost(self.pkmn), "Should hit a Ghost if it is a status move"
        
    def notGhost(self):
        """ Test hitGhost function returns true when the opp is not a Ghost Type """
        self.pkmn.setTypes(["NORMAL"])
        assert self.delegate.hitGhost(self.pkmn), "Should be able to hit a Normal Type Pkmn"
        
    def notFightingOrNormal(self):
        """ Test hitGhost function returns true when the opp is a Ghost but not hit with a type that should miss """
        self.pkmn.setTypes(["GHOST"])
        
        self.attack.type = "FIRE"
        assert self.delegate.hitGhost(self.pkmn), "Should be able to hit a Ghost with any attack that isn't Normal or Fighting Attack"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:41,代码来源:hit_test.py

示例2: getPkmnWithTypes

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setTypes [as 别名]
 def getPkmnWithTypes(self, types):
     """ Returns a Pokemon Battle Wrapper with the given types """
     pkmn = BuildPokemonBattleWrapper()
     pkmn.setTypes(types)
     return pkmn
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:7,代码来源:effectiveness_test.py


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