コード例 #1
0
ファイル: world_hire.py プロジェクト: penny64/r3-tdw
def roll():
    global HIRED_MEMBERS, FEATS

    HIRED_MEMBERS = []
    FEATS = []

    words.reset()

    _skill_cost = {_skill: 1 for _skill in SKILL_NAMES}
    _skill_cost['mobility'] = .3
    _skill_cost['smgs'] = .48
    _skill_cost['rifles'] = .75
    _skill_cost['pistols'] = .41
    _skill_cost['explosives'] = .65
    _max_skill_points = 0
    _mvp = {'name': '', 'stat': None, 'amount': 0}

    for i in range(5):
        _levels = {_skill: 1 for _skill in SKILL_NAMES}
        _total_cost = 0
        _skill_focus = {'stat': None, 'amount': 0}
        _levels['name'] = words.get_male_name()

        for skill_name in SKILL_NAMES:
            _levels[skill_name] = random.randint(20 + random.randint(-8, 8),
                                                 55 + random.randint(-20, 12))
            _total_cost += _levels[skill_name] * _skill_cost[skill_name]

            if skill_name in CLASS_SKILLS and (
                    not _skill_focus['stat']
                    or _levels[skill_name] > _skill_focus['amount']):
                _skill_focus['amount'] = _levels[skill_name]
                _skill_focus['stat'] = skill_name

                if not _mvp['name'] or _skill_focus['amount'] > _mvp['amount']:
                    _mvp['name'] = _levels['name']
                    _mvp['amount'] = _skill_focus['amount']
                    _mvp['stat'] = skill_name

        _levels['intelligence'] = random.randint(1, 5)
        _levels['skill_points'] = 80 + ((_levels['intelligence'] - 1) * 32)
        _levels['pay'] = _total_cost
        _levels['skill_focus'] = _skill_focus['stat']
        _max_skill_points += _levels['skill_points']

        HIRED_MEMBERS.append(_levels)

    if _max_skill_points > 750:
        FEATS.append([('Adaptable', (0, 180, 255)), 'Able to learn'])

    elif _max_skill_points < 650:
        FEATS.append([('Experienced', (0, 180, 255)), 'Unable to learn'])

    if _mvp['amount'] > 55:
        FEATS.append([('%s expert' % _mvp['stat'].title()[:-1], (255, 40, 40)),
                      _mvp['name']])
コード例 #2
0
ファイル: world_hire.py プロジェクト: witheld9/r3-tdw
def roll():
	global HIRED_MEMBERS, FEATS
	
	HIRED_MEMBERS = []
	FEATS = []
	
	words.reset()
	
	_skill_cost = {_skill: 1 for _skill in SKILL_NAMES}
	_skill_cost['mobility'] = .3
	_skill_cost['smgs'] = .48
	_skill_cost['rifles'] = .75
	_skill_cost['pistols'] = .41
	_skill_cost['explosives'] = .65
	_max_skill_points = 0
	_mvp = {'name': '', 'stat': None, 'amount': 0}
	
	for i in range(5):
		_levels = {_skill: 1 for _skill in SKILL_NAMES}
		_total_cost = 0
		_skill_focus = {'stat': None, 'amount': 0}
		_levels['name'] = words.get_male_name()
		
		for skill_name in SKILL_NAMES:
			_levels[skill_name] = random.randint(20 + random.randint(-8, 8), 55 + random.randint(-20, 12))
			_total_cost += _levels[skill_name] * _skill_cost[skill_name]
			
			if skill_name in CLASS_SKILLS and (not _skill_focus['stat'] or _levels[skill_name] > _skill_focus['amount']):
				_skill_focus['amount'] = _levels[skill_name]
				_skill_focus['stat'] = skill_name
				
				if not _mvp['name'] or _skill_focus['amount'] > _mvp['amount']:
					_mvp['name'] = _levels['name']
					_mvp['amount'] = _skill_focus['amount']
					_mvp['stat'] = skill_name
		
		_levels['intelligence'] = random.randint(1, 5)
		_levels['skill_points'] = 80 + ((_levels['intelligence'] - 1) * 32)
		_levels['pay'] = _total_cost
		_levels['skill_focus'] = _skill_focus['stat']
		_max_skill_points += _levels['skill_points']
		
		HIRED_MEMBERS.append(_levels)
	
	if _max_skill_points > 750:
		FEATS.append([('Adaptable', (0, 180, 255)), 'Able to learn'])
	
	elif _max_skill_points < 650:
		FEATS.append([('Experienced', (0, 180, 255)), 'Unable to learn'])
	
	if _mvp['amount'] > 55:
		FEATS.append([('%s expert' % _mvp['stat'].title()[:-1], (255, 40, 40)), _mvp['name']])
コード例 #3
0
ファイル: world_strategy.py プロジェクト: witheld9/r3-tdw
def create():
	global MAP, FADER
	
	worlds.create('strategy')
	words.reset()
	
	display.create_surface('background')
	display.create_surface('map', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT)
	display.create_surface('map_markers', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT)
	display.create_surface('map_squads', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT)
	display.create_surface('map_path', width=constants.STRAT_MAP_WIDTH, height=constants.STRAT_MAP_HEIGHT)
	display.create_surface('ui_bar', width=constants.WINDOW_WIDTH, height=constants.WINDOW_HEIGHT-constants.STRAT_MAP_HEIGHT)
	display.fill_surface('ui_bar', (30, 30, 30))
	display.blit_background('background')
	
	register_input()
	
	entities.create_entity_group('life', static=True)
	entities.create_entity_group('items', static=True)
	entities.create_entity_group('factions', static=True)
	entities.create_entity_group('squads', static=True)
	entities.create_entity_group('systems')
	
	FADER = entities.create_entity()
	timers.register(FADER)
	fade_in()
	
	_grid = {}
	_color_map = {}
	
	MAP = {'grid': _grid,
	       'color_map': _color_map,
	       'astar_map': None,
	       'astar_weight_map': numpy.ones((constants.STRAT_MAP_HEIGHT/constants.MAP_CELL_SPACE,
	                                       constants.STRAT_MAP_WIDTH/constants.MAP_CELL_SPACE))}
	
	for x in range(constants.STRAT_MAP_WIDTH/constants.MAP_CELL_SPACE):
		for y in range(constants.STRAT_MAP_HEIGHT/constants.MAP_CELL_SPACE):
			_grid[x, y] = {'owned_by': None,
			               'is_ownable': False,
			               'squads': [],
			               'income': .025}
	
	worldgen.generate()
	
	unregister_input()
	world_action._start_battle(attacking_squads=[entities.get_entity_group('squads')[0]], defending_squads=[entities.get_entity_group('squads')[1]])
コード例 #4
0
def create():
    global MAP, FADER

    worlds.create('strategy')
    words.reset()

    display.create_surface('background')
    display.create_surface('map',
                           width=constants.STRAT_MAP_WIDTH,
                           height=constants.STRAT_MAP_HEIGHT)
    display.create_surface('map_markers',
                           width=constants.STRAT_MAP_WIDTH,
                           height=constants.STRAT_MAP_HEIGHT)
    display.create_surface('map_squads',
                           width=constants.STRAT_MAP_WIDTH,
                           height=constants.STRAT_MAP_HEIGHT)
    display.create_surface('map_path',
                           width=constants.STRAT_MAP_WIDTH,
                           height=constants.STRAT_MAP_HEIGHT)
    display.create_surface('ui_bar',
                           width=constants.WINDOW_WIDTH,
                           height=constants.WINDOW_HEIGHT -
                           constants.STRAT_MAP_HEIGHT)
    display.fill_surface('ui_bar', (30, 30, 30))
    display.blit_background('background')

    register_input()

    entities.create_entity_group('life', static=True)
    entities.create_entity_group('items', static=True)
    entities.create_entity_group('factions', static=True)
    entities.create_entity_group('squads', static=True)
    entities.create_entity_group('systems')

    FADER = entities.create_entity()
    timers.register(FADER)
    fade_in()

    _grid = {}
    _color_map = {}

    MAP = {
        'grid':
        _grid,
        'color_map':
        _color_map,
        'astar_map':
        None,
        'astar_weight_map':
        numpy.ones((constants.STRAT_MAP_HEIGHT / constants.MAP_CELL_SPACE,
                    constants.STRAT_MAP_WIDTH / constants.MAP_CELL_SPACE))
    }

    for x in range(constants.STRAT_MAP_WIDTH / constants.MAP_CELL_SPACE):
        for y in range(constants.STRAT_MAP_HEIGHT / constants.MAP_CELL_SPACE):
            _grid[x, y] = {
                'owned_by': None,
                'is_ownable': False,
                'squads': [],
                'income': .025
            }

    worldgen.generate()

    unregister_input()
    world_action._start_battle(
        attacking_squads=[entities.get_entity_group('squads')[0]],
        defending_squads=[entities.get_entity_group('squads')[1]])