コード例 #1
0
	def __init__(self, session, cond_dict):
		self.session = session
		assert_type(cond_dict, dict, "condition specification")

		try:
			self.cond_type = cond_dict['type']
		except KeyError:
			raise InvalidScenarioFileFormat("Encountered condition without type\n"+str(cond_dict))
		try:
			self.callback = CONDITIONS.get(self.cond_type)
		except KeyError:
			raise InvalidScenarioFileFormat('Found invalid condition type: %s' % self.cond_type)

		self.arguments = cond_dict.get('arguments', [])
コード例 #2
0
	def __init__(self, session, cond_dict):
		self.session = session
		assert_type(cond_dict, dict, "condition specification")

		try:
			self.cond_type = cond_dict['type']
		except KeyError:
			raise InvalidScenarioFileFormat("Encountered condition without type\n"+str(cond_dict))
		try:
			self.callback = CONDITIONS.get(self.cond_type)
		except KeyError:
			raise InvalidScenarioFileFormat('Found invalid condition type: %s' % self.cond_type)

		self.arguments = cond_dict.get('arguments', [])
コード例 #3
0
ファイル: helper.py プロジェクト: Antagonym/unknown-horizons
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# ###################################################

from horizons.scenario import CONDITIONS


var_eq = CONDITIONS.get('var_eq')
settlement_res_stored_greater = CONDITIONS.get('settlement_res_stored_greater')
settler_level_greater = CONDITIONS.get('settler_level_greater')


def assert_win(gui):
	"""Returns once the scenario was won."""
	while True:
		if getattr(gui.session, '_scenariotest_won', False):
			break
		gui.run()


def assert_defeat(gui):
	"""Returns once the scenario was lost."""
	while True:
コード例 #4
0
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
# ###################################################

from horizons.scenario import CONDITIONS

var_eq = CONDITIONS.get('var_eq')
settlement_res_stored_greater = CONDITIONS.get('settlement_res_stored_greater')
settler_level_greater = CONDITIONS.get('settler_level_greater')


def assert_win(gui):
    """Returns once the scenario was won."""
    while True:
        if getattr(gui.session, '_scenariotest_won', False):
            break
        gui.run()


def assert_defeat(gui):
    """Returns once the scenario was lost."""
    while True: