本文整理汇总了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"
示例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"
示例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"
示例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"
示例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"