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


Python View.input_mission_decision方法代码示例

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


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

示例1: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import input_mission_decision [as 别名]
class Mission:
    def __init__(self, description, actions, level):
        self.description = description
        self.actions = actions
        self.level = level
        self.view = View()

    def start(self, player):
        self.player = player
        self.view.mission_description(self.description)
       
        decision = self.view.input_mission_decision(self.actions)
        
        passed_mission = self.determine_outcome(decision)
        if passed_mission:
            battle = Battle(self.player, self.level)
            while battle.take_turn():
                pass
            if battle.lost == False:
                return True
        return False

    #TODO make random decision
    def determine_outcome(self, action):
        if action not in self.actions:
            return None
        elif action == self.actions[0]:
            return True
        else:
            return False
开发者ID:hrgunn,项目名称:MLH,代码行数:32,代码来源:controller.py

示例2: __init__

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import input_mission_decision [as 别名]
class Mission:
	def __init__ (self, descriptions, actions, level):
		self.description = description
		self.actions = actions
		self.level = level
		self.view = View()

	def start(self, player):
	self.player = player
	self.mission_description(self.description)

	decision = self.view.input_mission_decision(self.actions)   

	passed_mission = self.determine_outcome(decision)
	if passed_mission:
		battle = Battle(self.player, self.level)
		while battle.take_turn():
			pass
		if battle.lost == False:
			return True
	return False

# Bad Guys!

class Bad_Guy:
	def __init__ (self, name, job, hp, attack):
		self.name = name
		self.job = job
		self.hp = hp
		self.attack = attack
	def take_damage(self, take_damage):
		self.hp -= damage

	def is_dead(self):
		return self.hp < 0



	class Thug(Bad_Guy):
		hp = 30
		attack = 15
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)


	# This could eventually become a Boss Player, possible special attributes/weapons
	class Badass_Thug(Bad_Guy):
		hp = 120
		attack = 40
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)


	# These could be added in to create some (chase/run away scenereos. The snitch would "get spotted" and bail, and the user decides to chase and potentially stop the snitch from giving away their position, or run and try to get away...???...)
	class Government_Snitch(Bad_Guy):
		hp = 20
		attack = 20
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)

	class Totem_Soldier(Bad_Guy):
		hp = 60
		attack = 40
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)



	# This would only take into effect in Act 2 (Act 1 ending when you and the Price sucessfully take off). They could chase you on your way to safety once you break atmosphere
	class Enemy_Pilot(Bad_Guy):
		hp = 120
		attack = 40
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)


	# Leader of the Totems, my dad wanted to be in the game.
	class Phil_Da(Bad_Guy):
		hp = 150
		attack = 70
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)


	# Put in charge of the man-hunt, my mom wanted to be involved too.
	class LaLuK(Bad_Guy):
		hp = 120
		attack = 40
		def __init__(self, name, job):
			Bad_Guy.__init__(self,name,job)



	class Battle:
		def __init__(self, player, level):
			self.player = player
			self.level = level
			self.monster = 
开发者ID:hrgunn,项目名称:MLH,代码行数:100,代码来源:new_cont.py


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