Ejemplo n.º 1
0
def intrigue_player(situation):
	_player = LIFE[SETTINGS['controlling']]
	_event_number = 0#random.randint(0, 1)
	
	#0: Cache drop (mid-game only: faction ordered)
	#1: Heli crash site (military)
	#2: Weather balloon (radio, PDA info: forecast)
	
	if _event_number == 1:
		_crash_pos = spawns.get_spawn_point_around(_player['pos'], area=150, min_area=90)
		
		events.create_heli_crash(_crash_pos, [])
		events.attract_tracked_alife_to(_crash_pos)
		core.record_dangerous_event(6)
	else:
		_land_pos = spawns.get_spawn_point_around(_player['pos'], area=160, min_area=90)
		_storage_items = [{'item': 'AK-74', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm round', 'rarity': 0.6},
		                  {'item': '5.45x39mm magazine', 'rarity': 0.75}]
		_storage = [{'item': 'military crate', 'rarity': 1.0, 'spawn_list': _storage_items}]
		
		if situation['armed']:
			_group = spawns.generate_group('bandit', amount=3, spawn_chunks=[spawns.get_spawn_point_around(_land_pos, area=140, min_area=80, chunk_key=True)])
			
			for ai in _group:
				alife.brain.meet_alife(ai, _player)
				alife.stats.establish_hostile(ai, _player['id'])
			
			core.record_encounter(3, life_ids=[l['id'] for l in _group])
			events.attract_tracked_alife_to(_land_pos)
		
		events.create_cache_drop(_land_pos, _storage)
		
		core.record_dangerous_event(3)
Ejemplo n.º 2
0
def hurt_player(situation):
	_player = LIFE[SETTINGS['controlling']]
	
	if situation['group']:
		if situation['armed']:
			_bandit_group_leader = get_group_leader_with_motive('crime', online=True)
			_military_group_leader = get_group_leader_with_motive('military', online=False)
			
			if not _military_group_leader:
				_military_group_leader = spawns.generate_group('soldier', amount=3, spawn_chunks=[spawns.get_spawn_in_ref('outposts', chunk_key=True)])[0]
			
			if not _bandit_group_leader:
				_chunk_key = alife.chunks.get_chunk_key_at(spawns.get_spawn_point_around(_military_group_leader['pos'], area=150, min_area=100))
				_bandit_group_leader = spawns.generate_group('bandit', amount=5, spawn_chunks=[_chunk_key])[0]
			
			_bandit_group_location = lfe.get_current_chunk_id(_bandit_group_leader)
			_military_group_location = lfe.get_current_chunk_id(_military_group_leader)
			order_group(_bandit_group_leader, _bandit_group_leader['group'], STAGE_RAIDING, 500, chunk_key=_military_group_location)
			alife.groups.discover_group(_bandit_group_leader, _military_group_leader['group'])
			alife.groups.declare_group_hostile(_bandit_group_leader, _bandit_group_leader['group'], _military_group_leader['group'])

			_real_direction = language.get_real_direction(numbers.direction_to((MAP_SIZE[0]/2, MAP_SIZE[1]/2), alife.chunks.get_chunk(_military_group_location)['pos']))
		
			_messages = [{'text': 'Attention all neutral and bandit squads.'},
		                 {'text': 'We finally got solid contact on military in the %s compound.' % _real_direction},
		                 {'text': 'We\'re located near coords %s and heading out soon.' % (', '.join(_bandit_group_location.split(',')))}]
			events.broadcast(_messages, 40)
			core.record_encounter(len(alife.groups.get_group(_military_group_leader, _military_group_leader['group'])['members']))
			
			_player_group_leader = LIFE[alife.groups.get_leader(_player, situation['group'])]
			
			for friendly_member in alife.groups.get_group(_player_group_leader, situation['group'])['members']:
				for hostile_member in alife.groups.get_group(_military_group_leader, _military_group_leader['group'])['members']:
					_target = alife.brain.meet_alife(LIFE[friendly_member], LIFE[hostile_member])
					_target['last_seen_time'] = 1
					_target['escaped'] = 1
					_target['last_seen_at'] = LIFE[hostile_member]['pos'][:]
					alife.stats.establish_hostile(LIFE[friendly_member], hostile_member)
			
			for hostile_member in alife.groups.get_group(_military_group_leader, _military_group_leader['group'])['members']:		
				for friendly_member in alife.groups.get_group(_player_group_leader, situation['group'])['members']:
					_target = alife.brain.meet_alife(LIFE[hostile_member], LIFE[friendly_member])
					_target['last_seen_time'] = 1
					_target['escaped'] = 1
					_target['last_seen_at'] = LIFE[friendly_member]['pos'][:]
					alife.stats.establish_hostile(LIFE[hostile_member], friendly_member)
			
			return True
	elif situation['armed']:
		_town_chunk_keys = []
		for ref in WORLD_INFO['refs']['towns']:
			_town_chunk_keys.extend(ref)
		
		_nearest_town_chunk_key = alife.chunks.get_nearest_chunk_in_list(_player['pos'], _town_chunk_keys)
		_town_chunk = alife.chunks.get_chunk(_nearest_town_chunk_key)
		_distance_to_nearst_town = numbers.distance(_player['pos'], _town_chunk['pos'])
		_spawn_distance = 15*WORLD_INFO['chunk_size']
		
		if len(situation['online_alife']) == len(situation['trusted_online_alife']):
			if _distance_to_nearst_town<=50:
				_group_spawn_velocity = numbers.velocity(numbers.direction_to(_player['pos'], _town_chunk['pos']), _spawn_distance+(50-numbers.clip(_distance_to_nearst_town, 0, 50)))
				_group_spawn_pos = [int(round(_player['pos'][0]+_group_spawn_velocity[0])), int(round(_player['pos'][1]+_group_spawn_velocity[1]))]
				_group_spawn_pos[0] = numbers.clip(_group_spawn_pos[0], 0, MAP_SIZE[0])
				_group_spawn_pos[1] = numbers.clip(_group_spawn_pos[1], 0, MAP_SIZE[1])
				_group_spawn_chunk_key = alife.chunks.get_chunk_key_at(spawns.get_spawn_point_around(_group_spawn_pos, area=30))
				
				_alife = spawns.generate_group('bandit', amount=2, spawn_chunks=[_group_spawn_chunk_key])
				
				for ai in _alife:
					alife.brain.meet_alife(ai, _player)
					alife.stats.establish_hostile(ai, _player['id'])
				
				core.record_encounter(2, life_ids=[i['id'] for i in _alife])
			
				if random.randint(0, 1) or 1:
					_spawn_chunk_key = spawns.get_spawn_point_around(_group_spawn_pos, area=90, min_area=60, chunk_key=True)
					_other_group = spawns.generate_group('loner', amount=1, spawn_chunks=[_spawn_chunk_key])
					
					for ai in _other_group:
						for ai2 in _alife:
							_target = alife.brain.meet_alife(ai, ai2)
							_target['last_seen_time'] = 1
							_target['escaped'] = 1
							_target['last_seen_at'] = ai2['pos'][:]
							
							alife.stats.establish_hostile(ai, ai2['id'])
					
					for ai2 in _alife:
						for ai in _other_group:
							_target = alife.brain.meet_alife(ai2, ai)
							_target['last_seen_time'] = 1
							_target['escaped'] = 1
							_target['last_seen_at'] = ai['pos'][:]
							
							alife.stats.establish_hostile(ai2, ai['id'])
					
					_messages = [{'text': 'I\'m pinned down in the village!'},
					             {'text': 'Anyone nearby?'}]
					events.broadcast(_messages, 0)
				
				return True
	elif 1==2:
		_spawn_chunk_key = spawns.get_spawn_point_around(_player['pos'], min_area=125, area=200, chunk_key=True)
		_group = spawns.generate_group('loner', amount=1, spawn_chunks=[_spawn_chunk_key])
		
		core.record_encounter(1, life_ids=[l['id'] for l in _group])
		
		for ai in _group:
			events.attract_tracked_alife_to(spawns.get_spawn_point_around(_player['pos'], min_area=10, area=100))
			
	return False