예제 #1
0
파일: channels.py 프로젝트: AKJ/sage
def channels(line, time, backrefs):
	core.disable_trigger_group('start_channels')
	core.enable_trigger_group('channels')
	channels = ('earth', 'fire', 'water', 'air', 'spirit')
	for channel in channels:
		player.defences[channel] = False
	core.trigger_groups_pending_disable.append('channels')
예제 #2
0
파일: diagnose.py 프로젝트: AKJ/sage
def clear_diagnose(line, time, backrefs):
	core.disable_trigger_group('start_diagnose')
	core.disable_trigger_group('diagnose')
	for aff in player.afflictions:
		player.afflictions[aff] = False
		flush_queues(aff)
	if core.retardation_mode == False:
		core.aeon_mode = False
	player.defences['insomnia'] = 0
예제 #3
0
파일: diagnose.py 프로젝트: AKJ/sage
def start_diagnose(line, time, backrefs):
	# we reset insomnia to 0 because we expect to see it in this list...
	player.defences['insomnia'] = 0
	for aff in player.afflictions:
		player.afflictions[aff] = False
		flush_queues(aff)

	if core.retardation_mode == False:
		core.aeon_mode = False
	player.unknown_affliction = 0
	core.disable_trigger_group('start_diagnose')
	core.enable_trigger_group('diagnose')
	core.trigger_groups_pending_disable.append('diagnose')
예제 #4
0
파일: deflist.py 프로젝트: AKJ/sage
def def_list_disable(line, time, backrefs):
	# TODO: compare this to our keepup list and correct!
	core.disable_trigger_group('def_list')
	# Flush player defences except channels
	for defence in player.defences:
		if defence not in ('earth', 'air', 'water', 'fire', 'spirit'):
			player.defences[defence] = 0

	for defence in player.pre_def:
		try:
			type = defences.defup_actions[defence][0]
			defences.clean_queues(type, defence)
		except KeyError:
			pass
		player.defences[defence] = 1
		core.debug("deflist added defence " + defence)

	player.pre_def = []
예제 #5
0
파일: aeon_cures.py 프로젝트: AKJ/sage
def affliction_event():
	global temporary_priorities, temps_focus, preempt_cures

	core.disable_trigger_group('venoms')
	cures.disable_restro_break_triggers()

	real = True
	if len(cures.pre_afflictions) > 0:
		for aff in cures.pre_afflictions:
			if cures.ai['reflection_strike']:
				if aff in ('roped', 'impale'):
					real = False

			if cures.lifevision:
				real = False
				core.debug("lifevision nulled out affliction " + aff)

			# stupidity failures
			if aff == 'stupidity' and player.afflictions['stupidity'] is True:
				player.waiting_for_aeon = 0

			# sleep resetting
			if aff == 'sleep':
				player.waiting_for_aeon = 0

			if real:
				cures.escalate_breaks(aff)
				player.afflictions[aff] = True

		cures.pre_afflictions = []
		cures.ai['reflection_strike'] = False

	if core.retardation_mode:
		dynamic_retardation_priorities()
	else:
		dynamic_priorities()

	load_queue()
예제 #6
0
파일: input.py 프로젝트: AKJ/sage
def prompt_receiver(line):
	global buffer, pfunctions, pfunction_args, previous_stats, current_stats, gagnext

	if len(line) == 0:
		return line

	clean_line = ansi.filter_ansi(line)
	# Strip newlines
	if clean_line[0] == NL:
		clean_line = clean_line[1:]

	match = prompt.match(clean_line)
	if match:
	
		# pending triggers to be disabled
		if len(core.triggers_pending_disable) > 0:
			for trigger in core.triggers_pending_disable:
				core.disable_trigger(trigger[0], trigger[1])

			core.triggers_pending_disable = []

		if len(core.trigger_groups_pending_disable) > 0:
			for group in core.trigger_groups_pending_disable:
				core.disable_trigger_group(group)

			core.trigger_groups_pending_disable = []

		backrefs = match.groups()

		player.last_health = player.health
		player.health = int(backrefs[0])
		player.delta_health = player.health - player.last_health
		player.last_mana = player.mana
		player.mana	= int(backrefs[1])
		player.delta_mana = player.mana - player.last_mana

		player.health_percentage = percentage(player.health, player.max_health)
		player.mana_percentage = percentage(player.mana, player.max_mana)

		previous_stats = current_stats
		current_stats = backrefs[2]
		status = backrefs[2]
		ex = ''
		stats = ''
		if status is None:
			player.equilibrium = False
			player.balance = False
			player.defences['cloak'] = 0
			player.defences['blind'] = 0
			player.defences['deaf'] = 0
			player.defences['kelventari'] = 0
		else:
			if 'e' in status:
				player.equilibrium = True
				ex = ex + 'e'
			else:
				player.equilibrium = False
			if 'y' or 'z' in status:
				#balance stuff. Work on this
				if player.combat_class == 'monk':
					if player.leftarm_balance and player.rightarm_balance:
						player.balance = True
					else:
						player.balance = False
				else:
					player.balance = True
				ex = ex + 'x'
			else:
				player.balance = False
			if 'c' in status:
				player.defences['cloak'] = 1
				stats = stats + 'c'
				queues.action_queue.remove_by_name('cloak')
			else:
				player.defences['cloak'] = 0
			if 'b' in status:
				player.defences['blind'] = 1
				stats = stats + 'b'
				queues.herb_queue.remove_by_name('blind')
			else:
				player.defences['blind'] = 0
			if 'd' in status:
				player.defences['deaf'] = 1
				stats = stats + 'd'
				queues.herb_queue.remove_by_name('deaf')
			else:
				player.defences['deaf'] = 0
			if 'k' in status:
				player.defences['kelventari'] = 1
				stats = stats + 'k'
			else:
				if player.defences['kelventari'] != .5:
					player.defences['kelventari'] = 0

		# quick reckless check
		if player.health < player.max_health or player.mana < player.max_mana:
			player.afflictions['reckless'] = False

		# death handling
		if player.health == 0:
			player.dead = True
		else:
			player.dead = False

		# we -might- be dead
		if player.dead == False:
			dead = True
			if player.death_check:
				if player.equilibrium is False:
					dead = False
				elif player.balance is False:
					dead = False
				elif player.defences['cloak'] == 1:
					dead = False
				elif player.defences['blind'] == 1:
					dead = False
				elif player.defences['deaf'] == 1:
					dead = False
				elif player.defences['kola'] == 1:
					dead = False
				if dead:
					player.dead = True

				if player.dead and player.starburst_check:
					hooks.burst.run()
					player.mode = 'starburst'
					player.keepup = player.keepup_starburst
					for defence in player.starburst:
						if player.starburst[defence] is True and player.keepup[defence] is False:
							if player.defences[defence] == 0:
								defences.load_def(defence)
				player.death_check = False
				player.starburst_check = False
		else:
			dead = False

		if player.dead:
			if dead:
				core.echo("You're no daisy. You're no daisy at all!")
			if player.health == 0:
				core.paused = True

			for aff in player.afflictions:
				player.afflictions[aff] = False
			for defence in player.defences:
				player.defences[defence] = 0
			queues.flush_queues()
			player.stunned = False
			player.herb_balance = 1
			player.hmsip_balance = 1
			player.asip_balance = 1
			player.lestagii_balance = 1
			player.herb_balance = 1
			player.free_balance = 1
			player.waiting_for_kelventari = 0
			player.focus_balance = 1
			player.fire_focus = False
			player.ableto_focus = True
			player.tree_balance = 1
			player.writhe_balance = 1
			core.aeon_mode = False
			core.retardation_mode = False
			herbs.reset()
			hooks.death.run()

		now = time.time()

		if len(pfunctions) > 0:
			i = 0
			for function in pfunctions:
				function(pfunction_args[i][0], pfunction_args[i][1], pfunction_args[i][2])
				i += 1

		pfunctions = []
		pfunction_args = []

		# Cure and Affliction Events
		defences.defence_event(now)
		cures.cure_event()
		if core.aeon_mode is False:
			cures.affliction_event(now)
		else:
			aeon_cures.affliction_event()

		cures.lifevision = False # reset lifevision
		cures.temporary_priorities = {}

		# prompt events
		run_events(now)

		# restyle prompt
		new_prompt = format_prompt(ex, stats)

		buffer = []

		if gagging or gagnext:
			if gagnext:
				gagnext = False

			return None
		else:
			return new_prompt

	# Blackout prompt
	else:
		if clean_line[0] == '-':
			player.afflictions['blackout'] = True

			core.enable_trigger_group('blackout_cures')
			core.enable_trigger_group('venoms')

			now = time.time()

			if len(pfunctions) > 0:
				for function in pfunctions:
					pfunctions[function](pfunction_args[function][0], pfunction_args[function][1], pfunction_args[function][2])

			pfunctions = []
			pfunction_args = []

			defences.defence_event(now)
			cures.cure_event()

			if core.aeon_mode is False:
				cures.affliction_event(now)
			else:
				aeon_cures.affliction_event()

			cures.lifevision = False # reset lifevision
			cures.temporary_priorities = {}

			run_events(now)

			buffer = []
			return blackout_prompt()

	return line
예제 #7
0
파일: woodlore.py 프로젝트: AKJ/sage
def woodlore_disable_venoms():
	core.disable_trigger_group('venoms_traps')
예제 #8
0
def disable_group(group):
	core.disable_trigger_group(group)
예제 #9
0
def forced_sleep(line, time, backrefs):
	core.disable_trigger_group('symptoms')
	core.write('sleep')
예제 #10
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()
예제 #11
0
파일: hypnosis.py 프로젝트: AKJ/sage
def hypnosis_disable():
	core.disable_trigger_group('hypnosis')
예제 #12
0
파일: deflist.py 프로젝트: AKJ/sage
def def_list_nodef(line, time, backrefs):
	for defence in player.defences:
		if defence not in ('earth', 'air', 'water', 'fire', 'spirit'):
			player.defences[defence] = 0
	core.disable_trigger_group('def_list')
예제 #13
0
파일: deflist.py 프로젝트: AKJ/sage
def start_def(line, time, backrefs):
	core.disable_trigger_group('start_def')
	core.enable_trigger_group('def_list')
	core.trigger_groups_pending_disable.append('def_list')
예제 #14
0
파일: qsc.py 프로젝트: AKJ/sage
def qsc_line2(line, time, backrefs):
	player.max_endurance = int(backrefs[2])
	player.max_willpower = int(backrefs[5])
	core.disable_trigger_group('qsc')
예제 #15
0
파일: inra.py 프로젝트: AKJ/sage
def inra_no_commodities(line, time, backrefs):
	# last one
	core.disable_trigger_group('inra')
	player.inramode = False
예제 #16
0
파일: misc.py 프로젝트: AKJ/sage
def stupidity_emote(line, time, backrefs):
	core.disable_trigger_group('emotes')
	core.enable_trigger_group('symptoms')
예제 #17
0
파일: events.py 프로젝트: AKJ/sage
def keepup_event(now):
	defences_awaiting = 0
	for defence in player.keepup:
		# defences ignored by keepup event
		if defence not in ('sileris', 'deaf'):
			if player.keepup[defence] and player.defences[defence] == .5:
				if now - defences.def_redundancy_ticks[defence] >= 6:
					defences_awaiting += 1
					player.defences[defence] = 0
					defences.def_redundancy_ticks[defence] = 0

			elif player.keepup[defence] and player.defences[defence] == 0:
				defences_awaiting += 1
				player.defences[defence] = .5
				defences.def_redundancy_ticks[defence] = now
				cmd = defences.defup_actions[defence]
				core.enable_trigger('ondef_' + defence, 'ondef')
				if defence == 'riding':
					core.enable_trigger('failure_mount', 'failures')
					if core.config['vaulting']:
						queues.action_queue.add('riding', 'vault ' + player.mount, cmd[2])
					else:
						queues.action_queue.add('riding', 'mount ' + player.mount, cmd[2])
				if cmd[0] == 'action':
					if queues.action_queue.get_index(defence) == -1:
						if defence in ('air', 'earth', 'fire', 'water', 'spirit'):
							if player.defences['air'] != 1 and \
							player.defences['water'] != 1 and \
							player.defences['fire'] != 1 and \
							player.defences['earth'] != 1:
								queues.action_queue.add('simultaneity', 'simultaneity', 387)
								core.enable_trigger('ondef_earth', 'ondef')
								core.enable_trigger('ondef_water', 'ondef')
								core.enable_trigger('ondef_fire', 'ondef')
								core.enable_trigger('ondef_air', 'ondef')
								core.enable_trigger('ondef_spirit', 'ondef')
						else:
							queues.action_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'immediate':
					if queues.immediate_queue.get_index(defence) == -1:
						queues.immediate_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'free':
					if queues.free_queue.get_index(defence) == -1:
						queues.free_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'herb':
					if queues.herb_queue.get_index(defence) == -1:
						queues.herb_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'salve':
					if queues.salve_queue.get_index(defence) == -1:
						queues.salve_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'asip':
					if queues.asip_queue.get_index(defence) == -1:
						queues.asip_queue.add(defence, cmd[1], cmd[2])
				elif cmd[0] == 'smoke':
					if defence == 'rebounding' and player.rebounding_pending is True:
						if now - player.skullcap_lastfire > 9:
							# Something's wrong... rebounding should come up
							# in 8 seconds. We're waiting on it but it hasn't
							# come up yet...
							queues.smoke_queue.remove_by_name(defence)
							queues.smoke_queue.add(defence, cmd[1], cmd[2])
						return

					queues.smoke_queue.remove_by_name(defence)
					queues.smoke_queue.add(defence, cmd[1], cmd[2])
	if defences_awaiting > 0:
		core.enable_trigger_group('defence_redundancy')
	else:
		core.disable_trigger_group('defence_redundancy')