Пример #1
0
Файл: events.py Проект: AKJ/sage
def sileris_event(now):
	player.sileris_event_last = now
	if player.keepup['sileris']:
		if player.afflictions['slickness'] \
		or player.afflictions['sleep'] \
		or player.stunned \
		or player.afflictions['amnesia']:
			return

		if player.defences['sileris'] != 1 \
		and player.waiting_for_sileris == 1:
			if now - player.sileris_last > 5.6 + player.latency:
				if player.multi_flay:
					player.waiting_for_sileris = 0
					player.defences['sileris'] = 1
					player.multi_flay = False
				else:
					player.waiting_for_sileris = 0
					player.defences['sileris'] = 0

		if player.defences['sileris'] == 0 \
		and player.waiting_for_sileris == 0:
			if herbs.herbs['sileris'].inv <= 0:
				if player.is_hindered() is False and player.can_outr():
					if now - player.sileris_lastoutr > 1:
						player.sileris_lastoutr = now
						herbs.herbs['sileris'].outr()
			else:
				core.enable_trigger('sileris_balance', 'balances')
				core.enable_trigger('failure_sileris_slickness', 'failures')
				player.waiting_for_sileris = .5
				core.write('apply sileris')
Пример #2
0
def herbs_outr(line, time, backrefs):
	num = int(backrefs[0])
	herb = backrefs[1]
	rift = int(backrefs[2])
	valid_herbs = (
		'bayberry bark',
		'bellwort flower',
		'black cohosh',
		'bloodroot leaf',
		'echinacea',
		'ginseng root',
		'goldenseal root',
		'hawthorn berry',
		'irid moss',
		'kelp',
		'kola nut',
		'lobelia seed',
		'prickly ash bark',
		'prickly pear',
		'skullcap',
		'slippery elm',
		'valerian',
		'sileris'
	)
	if herb in valid_herbs:
		herb = herbs.rift_name_conversion[herb]
		herbs.herbs[herb].inv += num
		herbs.herbs[herb].rift = rift
		herbs.herbs[herb].wait_for_outr = False
	player.waiting_for_aeon = 0
	core.disable_trigger('herbs_outr', 'herbs')
	player.stunned = False
	impossible_afflictions = (
		'webbed',
		'transfixed',
		'roped',
		'impale',
		'bound',
	)
	for aff in impossible_afflictions:
		player.afflictions[aff] = False

	if player.can_outr() is False:
		impossible_afflictions = (
			'leftarm_lvl1',
			'leftarm_lvl2',
			'leftarm_lvl3',
			'rightarm_lvl1',
			'rightarm_lvl2',
			'rightarm_lvl3'
		)
		for aff in impossible_afflictions:
			player.afflictions[aff] = False
Пример #3
0
Файл: events.py Проект: AKJ/sage
def inv_event():
	if player.can_outr() is False or player.is_hindered() or player.stunned:
		return

	for herb in herbs.herbs:
		obj = herbs.herbs[herb]
		if obj.keep_out != 0 and obj.waiting_for_outr() is False:
			diff = obj.keep_out - obj.inv
			if diff > 0:
				obj.outr(diff)
				break #only one at a time
			elif obj.inv > obj.keep_out:
				obj.inr(obj.inv - obj.keep_out)
Пример #4
0
Файл: events.py Проект: AKJ/sage
def tree_event(now):
	if now - player.tree_lastfire > 10 and player.tree_balance == 0 and now - player.last_tree_echo > 1:
		core.echo('Tree balance regained')
		player.last_tree_echo = now

	if now - player.tree_lastfire > 10 + player.latency:
		player.tree_balance = 1

	if player.tree_balance == 1:
		if player.fire_tree:
			if player.afflictions['sleep'] or \
			player.stunned or \
			player.afflictions['amnesia'] or \
			player.afflictions['paralysis'] or \
			player.is_hindered() or \
			player.can_outr() is False or \
			player.tattoos['tree'] <= 0:
				return

			player.tree_balance = .5
			player.tree_lastfire = now
			core.enable_trigger('cure_enablers_tree', 'cure_enablers')
			core.write('touch tree')
Пример #5
0
Файл: cures.py Проект: AKJ/sage
def affliction_event(now):
	"""Prompt-fired event that loads queues for curing."""
	global ai, focus_unknown
	player.fire_tree = False
	flush_aff_from_queues()
	process_pre_afflictions(now)
	process_dynamic_priorities()

	if player.afflictions['blackout'] == False:
		core.disable_trigger_group('venoms')
		core.disable_trigger_group('evileye')
		core.disable_trigger('failure_apply_slickness', 'failures')
		disable_restro_break_triggers()

	if player.afflictions['amnesia'] \
	and player.afflictions['aeon'] is False \
	and player.afflictions['sleep'] is False \
	and core.is_paused() is False \
	and player.stunned is False \
	and now - player.last_amnesia > player.latency:
		if player.herb_balance == .5:
			player.herb_balance = 1
		if player.salve_balance == .5:
			player.salve_balance = 1
		if player.focus_balance == .5:
			player.focus_balance = 1
		if player.hmsip_balance == .5:
			player.hmsip_balance = 1
		if player.asip_balance == .5:
			player.asip_balance = 1
		if player.writhe_balance == .5:
			player.writhe_balance = 1
		if player.moss_balance == .5:
			player.moss_balance  = 1
		core.enable_trigger('cures_amnesia', 'cures')
		core.write("touch amnesia\ntouch amnesia\n")
		player.last_amnesia = now
		return

	# Load cures
	if player.afflictions['aeon'] \
	and core.retardation_mode == False \
	and 'aeon' not in player.ignored_afflictions:
		core.aeon_mode = True
		aeon_cures.load_queue()
		flush_queues()
		core.disable_trigger('symptoms_aeon', 'symptoms')
		core.enable_trigger('cures_aeon', 'cures')
		player.waiting_for_aeon = 0
		if core.paused == False:
			input.lock = True
			core.alert("AEON! Input is locked down! " + ansi.color['lcyan'] + "BREAK" + ansi.color['default'] + " out to allow input again.")
		return

	# Use Tree to catch up on limb breaks
	if num_broken_limbs() >= 2:
		if num_lvl1_breaks() >= 1 and player.salve_balance == 0:
			player.fire_tree = True

	focus_engaged = False
	for aff in player.afflictions:
		if player.afflictions[aff] is True:

			if aff in player.ignored_afflictions:
				continue

			symptoms.symptoms[aff].reset()
			focus = False
			cure = cures[aff]
			priority = 0
			if cure[0] == 'ignore':
				priority = 0
			else:
				priority = cure[len(cure)-1:][0]

			if aff in temporary_priorities.keys():
				priority = temporary_priorities[aff]

			if aff == 'sleep':
				player.afflictions['prone'] = True
				player.defences['insomnia'] = 0

			#if aff == 'shivering' or aff == 'frozen':
				#player.afflictions['disruption'] = True

			elif aff == 'impale':
				player.afflictions['prone'] = True

			if aff == 'impatience':
				if core.config['focus_on_impatience_mana_threshold'] != 0 \
				and core.config['focus_on_impatience_mana_threshold'] < player.mana_percentage \
				and player.ableto_focus \
				and player.allow_focus \
				and player.fire_focus == False \
				and player.proximity_to_vlock() > 3:
					focus_unknown = True
					player.focus_on_impatience = True
					continue


			# If affliction is focusable, we trigger focus and hold off loading a cure for it until next prompt
			if aff in focusable and player.afflictions['impatience'] is False:
				if player.ableto_focus \
				and player.allow_focus:
					use_focus = True
					# Focus special handling
					if aff == 'anorexia':
						if salve_queue.length() == 0 \
						and player.afflictions['slickness'] is False \
						and player.salve_balance == 1:
							use_focus = False

					if use_focus:
						if player.focus_balance == 1 and player.fire_focus is False:
							player.fire_focus = True
							focus = True
							focus_engaged = True
						elif player.focus_balance == 1 and player.fire_focus is True:
							# it didn't fire?
							focus = True
							focus_engaged = True
						elif player.focus_balance == .5 and player.fire_focus is True:
							# another misfire?
							#player.focus_balance = 1
							focus = True
							focus_engaged = True

			if focus is False:
				load_cure = True
				if cure[0] == 'salve':
					for x in range(cure[3]):
						salve_queue.add(aff, cure[1] + ' to ' + cure[2], priority)

				elif cure[0] == 'limb':
					limb_affliction(aff)

				elif cure[0] == 'herb':
					herb_queue.add(aff, cure[1], priority)

				elif cure[0] == 'smoke':
					# Fight against pufflock
					if player.can_outr() is False \
					and player.afflictions['slickness'] \
					and player.valerian_puffs == 0:
						herb_queue.add('slickness', 'bloodroot', 990)

					smoke_queue.add(aff, cure[1], priority)

				elif cure[0] == 'action':
					action_queue.add(aff, cure[1], priority)

				elif cure[0] == 'balance':
					balance_queue.add(aff, cure[1], priority)

				elif cure[0] == 'asip':
					asip_queue.add(aff, cure[1], priority)

				elif cure[0] == 'free':
					free_queue.add(aff, cure[1], priority)

				elif cure[0] == 'equilibrium':
					equilibrium_queue.add(aff, cure[1], priority)

				elif cure[0] == 'immediate':
					if aff == 'disruption':
						if player.equilibrium is True:
							load_cure = False
							player.afflictions['disruption'] = False
					if load_cure:
						immediate_queue.add(aff, cure[1], priority)

				elif cure[0] == 'writhe':
					writhe_queue.add(aff, 'writhe', priority)
		else:
			# If the aff is False, make sure it's not in any queues
			flush_queues(aff)

	if len(lusted) > 0 and 'lust' not in player.ignored_afflictions:
		core.enable_trigger('cures_lust', 'cures')
		for person in lusted:
			action_queue.add('lust', 'reject ' + person, 693)

	if len(emperor) > 0 and 'emperor' not in player.ignored_afflictions:
		core.enable_trigger('cures_emperor', 'cures')
		for person in emperor:
			action_queue.add('emperor', 'lose ' + person, 392)

	if focus_unknown is True:
		player.fire_focus = True
		focus_engaged = True
		focus_unknown = False
	elif focus_engaged == False:
		player.fire_focus = False

	# Disable all cure triggers
	disable_cure_triggers()
Пример #6
0
Файл: events.py Проект: AKJ/sage
def pipe_event(now):
	if player.afflictions['sleep'] or \
	player.afflictions['amnesia'] or \
	player.stunned:
		return

	if player.elm_puffs <= 0:
		if herbs.herbs['elm'].inv > 0:
			if player.afflictions['paralysis'] is False and player.balance and player.equilibrium:
				if now - player.elm_lastfill > player.latency:
					core.enable_trigger('elm', 'pipes')
					core.enable_trigger('pipe_full', 'pipes')
					core.enable_trigger('pipes_paralysis_nofill', 'pipes')
					player.elm_lastfill = now
					core.write('put elm in ' + player.elm_pipe)
		else:
			if player.is_hindered() is False and player.can_outr():
				if now - player.elm_lastoutr > player.latency:
					player.elm_lastoutr = now
					herbs.herbs['elm'].outr()

	if player.skullcap_puffs <= 0:
		if herbs.herbs['skullcap'].inv > 0:
			if player.afflictions['paralysis'] is False and player.balance and player.equilibrium:
				if now - player.skullcap_lastfill > player.latency:
					core.enable_trigger('skullcap', 'pipes')
					core.enable_trigger('pipe_full', 'pipes')
					core.enable_trigger('pipes_paralysis_nofill', 'pipes')
					player.skullcap_lastfill = now
					core.write('put skullcap in ' + player.skullcap_pipe)
		else:
			if player.is_hindered() is False and player.can_outr():
				if now - player.skullcap_lastoutr > player.latency:
					player.skullcap_lastoutr = now
					herbs.herbs['skullcap'].outr()

	if player.valerian_puffs <= 0:
		if herbs.herbs['valerian'].inv > 0:
			if player.afflictions['paralysis'] is False and player.balance and player.equilibrium:
				if now - player.valerian_lastfill > player.latency:
					core.enable_trigger('valerian', 'pipes')
					core.enable_trigger('pipe_full', 'pipes')
					core.enable_trigger('pipes_paralysis_nofill', 'pipes')
					player.valerian_lastfill = now
					core.write('put valerian in ' + player.valerian_pipe)
		else:
			if player.is_hindered() is False and player.can_outr():
				if now - player.valerian_lastoutr > player.latency:
					player.valerian_lastoutr = now
					herbs.herbs['valerian'].outr()

	if player.elm_puffs <= core.config['min_elm'] \
	and player.elm_puffs > 0 \
	and player.balance \
	and player.equilibrium \
	and player.is_hindered() is False \
	and player.can_outr():
		player.pipe_reloading = 'elm'
		core.enable_trigger('smoke_puff', 'balances')
		core.enable_trigger('failure_smoking', 'failures')
		core.enable_trigger('failure_asthma_smoking', 'failures')
		player.puffs.append('elm')
		core.write('smoke ' + player.elm_pipe)

	if player.skullcap_puffs <= core.config['min_skullcap'] \
	and player.skullcap_puffs > 0 \
	and player.balance \
	and player.equilibrium \
	and player.is_hindered() is False \
	and player.can_outr():
		player.pipe_reloading = 'skullcap'
		core.enable_trigger('smoke_puff', 'balances')
		core.enable_trigger('failure_smoking', 'failures')
		core.enable_trigger('failure_asthma_smoking', 'failures')
		player.puffs.append('skullcap')
		core.write('smoke ' + player.skullcap_pipe)

	if player.valerian_puffs <= core.config['min_valerian'] \
	and player.valerian_puffs > 0 \
	and player.balance \
	and player.equilibrium \
	and player.is_hindered() is False \
	and player.can_outr():
		player.pipe_reloading = 'valerian'
		core.enable_trigger('smoke_puff', 'balances')
		core.enable_trigger('failure_smoking', 'failures')
		core.enable_trigger('failure_asthma_smoking', 'failures')
		player.puffs.append('valerian')
		core.write('smoke ' + player.valerian_pipe)