Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function sync_weapons_to_items()
- for attack in wml.child_range(unit.__cfg, 'attack') do
- if not invalid_attacks[attack.name] and not wml.get_child(inv_list_data, "item", attack.name) then
- local descrip = string.format("%s - %s %s", attack.damage, attack.number, attack.type)
- table.insert(inv_list_data, {"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.modify_unit {
- T.filter { x = "$x1", y = "$y1" },
- { 'effect', lp8.copyTable(attack, { apply_to = 'new_attack' }) }
- }
- },
- T.removal_command {
- T.modify_unit {
- T.filter { x = "$x1", y = "$y1" },
- T.effect { apply_to = "remove_attacks", range = attack.range, name = attack.name }
- }
- }
- } })
- end
- end
- --wesnoth.put_unit(unit)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement