Eliminate pointless `or`-ing with nil.

The problematic expression in question was `helper.get_child(…) or nil`.
If `helper.get_child()` does not find a matching child, it returns nil,
so `or`-ing its result with nil is pointless.
Avoid a table construction when opening inventory.

The `valid_attacks` list, which is static, was defined in
`wesnoth.wml_actions.inventory_controller()`, and was thus pointlessly
re-constructed each time the inventory was opened. I moved its
definition out of the function, to file scope.