Esempio n. 1
0
File: tarot.py Progetto: AKJ/sage
def tarot_death_tick(line, time, backrefs):
	global death_ticks
	user = backrefs[0]
	if user in death_ticks.keys():
		death_ticks[user] += 1
	else:
		death_ticks[user] = 1

	core.alert("Warning - %s is using Death Tarot on you! (%d)" % (user, death_ticks[user]))
Esempio n. 2
0
File: failures.py Progetto: AKJ/sage
def failure_moss(line, time, backrefs):
	player.moss_balance = 1
	core.config['eat_moss'] = False
	core.disable_trigger('moss_balance', 'balances')
	core.disable_trigger('cures_moss', 'cures')
	core.alert("Ran out of moss! Disabling moss eating.")
Esempio n. 3
0
File: cures.py Progetto: 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()