Beispiel #1
0
        incant = Incantation.incant_list[level]
        for res in Resource:
            if incant.prerequisites.get_qt(res) > trantor.inventory.get_qt(
                    res):
                return False
        return True

    def missing_resources(trantor):
        level = trantor.level
        incant = Incantation.incant_list[level]
        to_return = []
        for res in Resource:
            if incant.prerequisites.get_qt(res) > trantor.inventory.get_qt(
                    res):
                to_return.append(res)
        return to_return

    def incantation_to_level_up(level):
        return Incantation.incant_list[level]


Incantation.incant_list = {
    1: Incantation(1, Inventory.from_nbrs(0, 1, 0, 0, 0, 0, 0)),
    2: Incantation(2, Inventory.from_nbrs(0, 1, 1, 1, 0, 0, 0)),
    3: Incantation(2, Inventory.from_nbrs(0, 2, 0, 1, 0, 2, 0)),
    4: Incantation(4, Inventory.from_nbrs(0, 1, 1, 2, 0, 1, 0)),
    5: Incantation(4, Inventory.from_nbrs(0, 1, 2, 1, 3, 0, 0)),
    6: Incantation(6, Inventory.from_nbrs(0, 1, 2, 3, 0, 1, 0)),
    7: Incantation(6, Inventory.from_nbrs(0, 2, 2, 2, 2, 2, 1))
}
Beispiel #2
0
		if level > 8:
			print('invalid incantation level ' + str(level))
			exit(0)
		incant = Incantation.incant_list[level]
		for res in Resource:
			if incant.prerequisites.get_qt(res) > trantor.inventory.get_qt(res):
				return False
		return True

	def missing_resources(trantor):
		level = trantor.level
		incant = Incantation.incant_list[level]
		to_return = []
		for res in Resource:
			if incant.prerequisites.get_qt(res) > trantor.inventory.get_qt(res):
				to_return.append(res)
		return to_return

	def incantation_to_level_up(level):
		return Incantation.incant_list[level]

Incantation.incant_list = {
	1 : Incantation(1, Inventory.from_nbrs(0, 1, 0, 0, 0, 0, 0)),
	2 : Incantation(2, Inventory.from_nbrs(0, 1, 1, 1, 0, 0, 0)),
	3 : Incantation(2, Inventory.from_nbrs(0, 2, 0, 1, 0, 2, 0)),
	4 : Incantation(4, Inventory.from_nbrs(0, 1, 1, 2, 0, 1, 0)),
	5 : Incantation(4, Inventory.from_nbrs(0, 1, 2, 1, 3, 0, 0)),
	6 : Incantation(6, Inventory.from_nbrs(0, 1, 2, 3, 0, 1, 0)),
	7 : Incantation(6, Inventory.from_nbrs(0, 2, 2, 2, 2, 2, 1))
}
Beispiel #3
0
 def test_action_to_perform(self):
     trantor = TestTrantor.new_trantor(2, Inventory.from_nbrs(5, 5, 5, 5, 5, 5, 5))
     trantor.messages.add_msg('message 0 0 0 0 0 ' + message.incantation_call(2)[10:])
     action = trantor.action_to_perform()
     self.assertTrue(action == State.JOIN_TRANTOR_FOR_INCANTATION)