Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function sync_weapons_to_items()
- for attack in helper.child_range(unit, 'attack') do
- if not invalid_attacks[attack.name] and not helper.get_child(var, "item", attack.name) then
- local descrip = string.format("%s - %s %s", attack.damage, attack.number, attack.type)
- local removal_id = "attack_" .. attack.name
- table.insert(var, {"item", {
- id = attack.name,
- name = first_to_upper(attack.description), -- [attack] doesn't have dedicated id keys, and the description is more like a name anyway
- image = attack.icon or string.format("attacks/%s.png", attack.name),
- description = descrip,
- effect_type = "equip",
- active = true,
- quantity = 1,
- T.command {
- T.object { silent = true, duration = "forever", no_write = true, removal_id = removal_id,
- { 'effect', lp8.copyTable(attack, { apply_to = 'new_attack' }) }
- },
- T.remove_object { skip_effects = true,
- T.filter_wml { removal_id = removal_id }
- }
- },
- T.removal_command {
- T.object { silent = true, duration = "forever", no_write = true, removal_id = removal_id,
- T.effect { apply_to = "remove_attacks", range = attack.range, name = attack.name }
- },
- T.remove_object { skip_effects = true,
- T.filter_wml { removal_id = removal_id }
- }
- }
- } })
- end
- end
- wesnoth.put_unit(unit)
- end
Advertisement
Add Comment
Please, Sign In to add comment