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


Python BuildPokemonBattleWrapper.setStatus方法代码示例

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


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

示例1: checkCurable

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setStatus [as 别名]
class checkCurable(unittest.TestCase):
    """ Test that checkCurable actually cures a status when possible """
    
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        
        self.statusAbbr = "PAR"
        self.status = Paralysis()
        self.statusAbbr2 = "FRZ"
        
        self.delegate = CureStatusDelegate(self.statusAbbr, 1)
        self.delegate2 = CureStatusDelegate(self.statusAbbr2, 1)
        
    def isCurable(self):
        """ Tests if checkCurable cures the status when it can """
        self.pkmn.setStatus(self.status)
        self.delegate.checkCurable(self.pkmn)
        
        assert self.pkmn.getStatus() != self.status, "Status should be cured"
        
    def notCurable(self):
        """ Tests if checkCurable cures the status when it can """
        self.pkmn.setStatus(self.status)
        self.delegate2.checkCurable(self.pkmn)
        
        assert self.pkmn.getStatus() == self.status, "Status should not be cured"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:29,代码来源:curestatus_test.py

示例2: coreDamage

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setStatus [as 别名]
class coreDamage(unittest.TestCase):
    """ Test that core damage is calculated correctly """ 
    
    def setUp(self):
        """ Setup the attack and Pokemon to use the attack """
        self.user = BuildPokemonBattleWrapper()
        self.target = BuildPokemonBattleWrapper()
        
        regDelegate = DamageDelegate(None, 50, 1)
        self.core = regDelegate.coreDamage(self.user, self.target)
        
        self.delegate = BoostDamageOnStatusDelegate(None, 50, 1)
        
    def noStatus(self):
        """ Test that damage is core when the target has no status """
        self.target.setStatus(Status())
        damage = self.delegate.coreDamage(self.user, self.target)
        
        assert damage == self.core, "Damage should be the core when target has no status"
        
    def status(self):
        """ Test that damage is double the core when the target has a status """
        self.target.setStatus(Burn())
        damage = self.delegate.coreDamage(self.user, self.target)
        
        assert damage == 2*self.core, "Damage should double when target has a status"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:28,代码来源:boost_on_status_test.py

示例3: checkStatusAlready

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setStatus [as 别名]
class checkStatusAlready(unittest.TestCase):
    """ Test that checkStatusAlready returns correctly """
    
    def setUp(self):
        """ Builds the delegate and pkmn for use in the tests """
        self.pkmn = BuildPokemonBattleWrapper()
        self.status = "PAR"
        attack = Attack()
        attack.type = ""
        self.delegate = ApplyStatusDelegate(attack, self.status, 1)
        
    def hasStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Paralysis())
        assert self.delegate.checkStatusAlready(self.pkmn), "Should have a status already"
        
    def hasNoStatusAlready(self):
        """ Tests checkStatusAlready returns correctly if the pkmn has a status already """
        self.pkmn.setStatus(Status())
        assert not self.delegate.checkStatusAlready(self.pkmn), "Should not have a status already"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:22,代码来源:applystatus_test.py

示例4: immobilized

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setStatus [as 别名]
class immobilized(unittest.TestCase):
    """ Test that immobilized performs correctly """
    
    def setUp(self):
        """ Builds the Sleep status"""
        self.status = Sleep()
        self.pkmn = BuildPokemonBattleWrapper()
        self.pkmn.setStatus(self.status)
        self.turns = 1
    
    def notDone(self):
        """ Test if immobilized returns correctly when it is not done """
        self.status.turns = self.turns
        
        immobilized, messages = self.status.immobilized(self.pkmn)
        
        assert immobilized, "Should be immobilized"
        assert messages == [self.pkmn.getHeader() + Sleep.intermittent],\
                "Should return Sleep's intermittent message"
        assert self.status.turns == self.turns - 1, "Turns should be decremented"
        
    def done(self):
        """ Test if immobilized returns correctly when it is done """
        self.status.turns = 0
        
        assert self.pkmn.getStatus() == self.status, "Should have status to start"
        
        immobilized, messages = self.status.immobilized(self.pkmn)
        
        assert not immobilized, "Should not be immobilized"
        assert len(messages) == 2, "Should have two messages"
        
        assert messages[0] == self.pkmn.getHeader() + Sleep.intermittent,\
                "Should return Sleep's intermittent message"
        assert messages[1] == self.pkmn.getHeader() + Sleep.done,\
                "Should return Sleep's done message"
                
        assert self.pkmn.getStatus() != self.status, "Status should be removed"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:40,代码来源:sleep_test.py

示例5: immune

# 需要导入模块: from Test.test_helper import BuildPokemonBattleWrapper [as 别名]
# 或者: from Test.test_helper.BuildPokemonBattleWrapper import setStatus [as 别名]
class immune(unittest.TestCase):
    """ Test that immune returns the correct values """
    
    def setUp(self):
        """ Build side for use in test cases """
        self.pkmn = BuildPokemonBattleWrapper()
        self.parent = Attack()
        self.parent.type ="NORMAL"
        
    def buildDelegate(self, effect):
        """ Builds a staushit delegate and its parent attack """
        self.parent.effectDelegates = [effect]
        self.delegate = StatusHitDelegate(self.parent, 100)
        
    def notImmune(self):
        """ Test an effect that is not immune returns correctly  """
        status = Status()
        self.pkmn.setStatus(status)
        
        effect = ApplyStatusDelegate(self.parent, "PAR", 1)
        self.buildDelegate(effect)
        assert not self.delegate.immune(self.pkmn, None), "Should not be immune"
    
    def immune(self):
        """ Test an effect that is immune will result in a miss """
        status, message = StatusFactory.buildStatusFromAbbr("PAR")
        self.pkmn.setStatus(status)
        
        effect = ApplyStatusDelegate(self.parent, "PAR", 1)
        self.buildDelegate(effect)
        assert self.delegate.immune(self.pkmn, None), "Should be immune"
        
    def noImmune(self):
        """ Test an effect that has no immune function isn't immune """
        effect = StatModDelegate("ATK", 1, 1)
        self.buildDelegate(effect)
        assert not  self.delegate.immune(self.pkmn, None), "Should never be immune"
开发者ID:cloew,项目名称:Pokemon-Project,代码行数:39,代码来源:statushit_test.py


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