Beispiel #1
0
def mission_outcome(status):
    """Call this when mission is over
    
    Right now, only calling mission_outcome('success') has effect.
    """
    if status == 'success':
        active_mission().receive_payment(HiredGunsWorld.instance().pc)
    else:
        pass
Beispiel #2
0
def random_merc(req_traits=()):
    """Get random merc from the team
    
    Optionally, filter only those having all req_traits
    """
    pc = HiredGunsWorld.instance().pc
    mercs = [merc for merc in [pc]+pc.team if merc.has_all_traits(req_traits)]
    if mercs:
        return random.choice(mercs)
    else:
        print('WARNING: no random_merc selected')
        return None
Beispiel #3
0
def random_encounter(level=(0, float('inf')), with_tags=set(), without_tags=set()):
    try:
        level[0]
    except TypeError:
        level = (level, level)
    encounters = [
        encounter for encounter in HiredGunsWorld.instance().encounter_pool
            if  level[0] <= encounter.level <= level[1] and
                set(with_tags).issubset(encounter.tags) and
                set(without_tags).isdisjoint(encounter.tags)
    ]
    if encounters:
        return random.choice(encounters)()
    else:
        return None
Beispiel #4
0
def world():
    pc_name = 'You'
    pc = Merc('pc')
    pc.name = pc_name
    world = HiredGunsWorld(pc)
    return world
Beispiel #5
0
def new_battle(*args, **kwargs):
    return HGBattle(Turnman, HiredGunsWorld.instance(), *args, **kwargs)
Beispiel #6
0
def active_mission():
    return HiredGunsWorld.instance().active_mission