Пример #1
0
def is_target_group_hostile(life, life_id):
    if not brain.knows_alife_by_id(life,
                                   life_id) or not brain.knows_alife_by_id(
                                       life, life_id)['group']:
        return False

    return factions.is_enemy(life,
                             get_group(life, LIFE[life_id]['group'])['leader'])
Пример #2
0
def meet_alife(life, target):
    if life['id'] == target['id']:
        raise Exception('Life \'%s\' learned about itself. Stopping.' %
                        ' '.join(life['name']))

    if target['id'] in life['know']:
        return life['know'][target['id']]

    life['know'][target['id']] = {
        'life': target,
        'danger': 0,
        'trust': 0,
        'alignment': 'neutral',
        'last_seen_time': -1,
        'time_visible': 0,
        'met_at_time': WORLD_INFO['ticks'],
        'last_seen_at': target['pos'],
        'last_encounter_time': 0,
        'items': [],
        'escaped': False,
        'asleep': False,
        'state': None,
        'state_tier': None,
        'group': None,
        'dead': False,
        'snapshot': {},
        'sent': {},
        'questions': [],
        'orders': {},
        'orderid': 1,
        'flags': {}
    }

    if factions.is_enemy(life, target['id']):
        stats.establish_hostile(life, target['id'])
    else:
        stats.establish_trust(life, target['id'])

    #logging.debug('%s met %s.' % (' '.join(life['name']), ' '.join(target['name'])) )
    return life['know'][target['id']]
Пример #3
0
def meet_alife(life, target):
	if life['id'] == target['id']:
		raise Exception('Life \'%s\' learned about itself. Stopping.' % ' '.join(life['name']))
	
	if target['id'] in life['know']:
		return life['know'][target['id']]
	
	life['know'][target['id']] = {'life': target,
		'danger': 0,
		'trust': 0,
		'alignment': 'neutral',
		'last_seen_time': -1,
		'time_visible': 0,
		'met_at_time': WORLD_INFO['ticks'],
		'last_seen_at': target['pos'],
		'last_encounter_time': 0,
		'items': [],
		'escaped': False,
		'asleep': False,
		'state': None,
		'state_tier': None,
		'group': None,
		'dead': False,
		'snapshot': {},
		'sent': {},
		'questions': [],
		'orders': {},
		'orderid': 1,
		'flags': {}}
	
	if factions.is_enemy(life, target['id']):
		stats.establish_hostile(life, target['id'])
	else:
		stats.establish_trust(life, target['id'])
	
	#logging.debug('%s met %s.' % (' '.join(life['name']), ' '.join(target['name'])) )
	return life['know'][target['id']]
Пример #4
0
def is_target_group_hostile(life, life_id):
	if not brain.knows_alife_by_id(life, life_id) or not brain.knows_alife_by_id(life, life_id)['group']:
		return False
	
	return factions.is_enemy(life, get_group(life, LIFE[life_id]['group'])['leader'])
Пример #5
0
def is_group_hostile(life, group_id):
	return factions.is_enemy(life, get_group(life, group_id)['leader'])
Пример #6
0
def is_group_hostile(life, group_id):
    return factions.is_enemy(life, get_group(life, group_id)['leader'])