當前位置: 首頁>>代碼示例>>Python>>正文


Python Effect.total_defense方法代碼示例

本文整理匯總了Python中effect.Effect.total_defense方法的典型用法代碼示例。如果您正苦於以下問題:Python Effect.total_defense方法的具體用法?Python Effect.total_defense怎麽用?Python Effect.total_defense使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在effect.Effect的用法示例。


在下文中一共展示了Effect.total_defense方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestEffect

# 需要導入模塊: from effect import Effect [as 別名]
# 或者: from effect.Effect import total_defense [as 別名]
class TestEffect(unittest.TestCase):

	def setUp(self):
		self.expected_str = 'Effect:\n\tATT - MAGIC: 5 PHYSICAL: 5\n\tDEF - MAGIC: 5 PHYSICAL: 5\n\tSTATS - HP: 5 STR: 5 INT: 5 AGI: 5'
		self.expected_attack = Damage(6,6)
		self.expected_defense = Damage(6,6)
		self.expected_stats = Stats(6,6,6,6)
		self.test_effect = Effect(Damage(5,5), Damage(5,5), Stats(5,5,5,5))

	def tearDown(self):
		self.expected_attack = None
		self.expected_defense = None
		self.expected_stats = None
		self.test_effect = None

	def test_total_strength(self):
		self.assertEqual(5, self.test_effect.total_strength())

	def test_total_intelligence(self):
		self.assertEqual(5, self.test_effect.total_intelligence())

	def test_total_agility(self):
		self.assertEqual(5, self.test_effect.total_agility())

	def test_total_hp(self):
		self.assertEqual(5, self.test_effect.total_hp())

	def test_total_attack(self):
		self.assertEqual(Damage(5,5), self.test_effect.total_attack())

	def test_total_defense(self):
		self.assertEqual(Damage(5,5), self.test_effect.total_defense())

	# def test_increase_attack(self):
	# 	self.test_effect.increase_attack((1,1))
	# 	self.assertEqual(self.expected_attack, self.test_effect.attack)

	# def test_increase_defense(self):
	# 	self.test_effect.increase_defense((1,1))
	# 	self.assertEqual(self.expected_defense, self.test_effect.defense)

	# def test_increase_stats(self):
	# 	self.test_effect.increase_stats((1,1,1,1))
	# 	self.assertEqual(self.expected_stats, self.test_effect.stats)
	
	def test_str(self):
		self.assertEqual(self.expected_str, str(self.test_effect))
開發者ID:brandonDeen,項目名稱:Text_RPG_Python,代碼行數:49,代碼來源:effect_test.py


注:本文中的effect.Effect.total_defense方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。