Exemplo n.º 1
0


@pydwarf.urist(
    name = 'stal.armoury.items',
    version = '1.0.1',
    author = ('Stalhansch', 'Sophie Kirschner'),
    description = 'Attempts to improve the balance and realism of combat.',
    arguments = {
        'remove_entity_items': '''Determines whether items that would be made unavailable to
            entities should be removed from those entities or not. If you're also using other
            mods that make changes to weapons and armour and such it may be desireable to set
            this flag to False. Otherwise, for best results, the flag should be set to True.
            Defaults to True'''
    },
    compatibility = pydwarf.df_revision_range('0.40.14', '0.40.24')
)
def armoury(df, remove_entity_items=True):
    try:
        pydwarf.log.debug('Loading armoury raws from %s.' % armoury_dir)
        armouryraws = raws.dir(root=armoury_dir, log=pydwarf.log)
    except:
        return pydwarf.failure('Unable to load armoury raws.')
        
    # Persist a list of armoury item tokens because we're going to be needing them for a few things
    armouryitemtokens = armouryraws.allobj(type_in=armoury_item_objects)
    
    # Rename items in the armoury raws in accordance with a manually compiled list of naming oddities
    for item in armouryitemtokens.all(arg_in=(0, weird_armoury_names)):
        item.args[0] = weird_armoury_names[item.args[0]]
        
Exemplo n.º 2
0
    arguments={
        'remove_entity_items':
        '''Determines whether items that would be made unavailable to
            entities should be removed from those entities or not. If you're also using other
            mods that make changes to weapons and armour and such it may be desireable to set
            this flag to False. Otherwise, for best results, the flag should be set to True.
            Defaults to True''',
        'remove_attacks':
        '''Removes these attacks from species listed in remove_attacks_from.
            Defaults to scratch and bite.''',
        'remove_attacks_from':
        '''If set to True, specified remove_attacks are removed
            from the species in the list to improve combat balancing. If set to None those
            attacks will not be touched. Defaults to dwarves, humans, and elves.'''
    },
    compatibility=pydwarf.df_revision_range('0.40.14', '0.40.24'))
def armourypack(dfraws,
                remove_entity_items=True,
                remove_attacks=('SCRATCH', 'BITE'),
                remove_attacks_from=('DWARF', 'HUMAN', 'ELF')):
    try:
        armouryraws = raws.dir(path=armourydir, log=pydwarf.log)
    except:
        return pydwarf.failure('Unable to load armoury raws.')

    additemstoraws(dfraws, armouryraws)
    additemstoents(dfraws, armouryraws, remove_entity_items)
    addreactions(dfraws, armouryraws)
    removeattacks(dfraws, remove_attacks, remove_attacks_from)

    return pydwarf.success()
Exemplo n.º 3
0
    name = 'pineapple.skillrust',
    version = '1.0.0',
    author = 'Sophie Kirschner',
    description = '''Modifies skill rust for given creatures. Disables it entirely by
        default.''',
    arguments = {
        'creatures': 'An iterable containing creatures for which to disable skill rust.',
        'rates': '''What the skill rust rates are to be changed to. It must be a tuple
            or list containing three values. The default is ('NONE', 'NONE', 'NONE'),
            which disables skill rust entirely. Dwarf Fortress's default rates are
            ('8', '16', '16'). Lower numbers indicate faster skill rust.'''
    },
    
    # Though the skill tokens were introduced earlier, a bug persisting until 0.31.18 prevented rust from actually being disabled.
    # http://www.bay12games.com/dwarves/mantisbt/print_bug_page.php?bug_id=2877
    compatibility = (pydwarf.df_revision_range('0.31.18', '0.31.25'), pydwarf.df_0_34, pydwarf.df_0_40)
)
def skillrust(df, creatures=default_creatures, rates=default_rates):
    failures = []
    
    # Handle each creature
    creaturetokens = df.allobj(type='CREATURE', id_in=creatures)
    for creaturetoken in creaturetokens:
        pydwarf.log.debug('Handling skill rust for %s.' % creaturetoken)

        # First see about editing existing skill tokens
        needsnew = True
        editedtotal = 0
        existingtokens = creaturetoken.allprop(value_in=('SKILL_RATE', 'SKILL_RUST_RATE', 'SKILL_RATES', 'SKILL_RUST_RATES'))
        for existingtoken in existingtokens:
            pydwarf.log.debug('Modifying arguments for existing token %s.' % existingtoken)