Exemplo n.º 1
0
def basic(line, time, backrefs):
	core.echo('Basic Defences Mode')
	player.mode = 'basic'
	player.moss_health_percentage = core.config['basic_moss_health_percentage']
	player.moss_mana_percentage = core.config['basic_moss_mana_percentage']
	player.keepup = player.keepup_basic
	for defence in player.basic:
		if player.basic[defence] is True and player.keepup[defence] is False:
			if player.defences[defence] == 0:
				defences.load_def(defence)
	input.run_events(time)
Exemplo n.º 2
0
def combat(line, time, backrefs):
	core.echo('Combat Defences Mode')
	player.mode = 'combat'
	player.moss_health_percentage = core.config['combat_moss_health_percentage']
	player.moss_mana_percentage = core.config['combat_moss_mana_percentage']
	player.keepup = player.keepup_combat
	for defence in player.combat:
		if player.basic[defence] is True and player.keepup[defence] is False:
			if player.defences[defence] == 0:
				defences.load_def(defence)
	input.run_events(time)
Exemplo n.º 3
0
Arquivo: input.py Projeto: 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