world conquest: fix bezoar artifact being bugged (#6515)

This commit is contained in:
Tahsin Jahin Khalid 2022-06-28 10:33:55 +06:00 committed by GitHub
parent a7755749e3
commit b541b4cb23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -2,6 +2,8 @@
### Add-ons client
### Add-ons server
### Campaigns
* World Conquest
* Fixed Bezoar artifact being bugged and broken.
### Editor
### Multiplayer
### Lua API

View file

@ -114,6 +114,14 @@ function artifacts.give_item(unit, index, visualize)
unit:add_modification("object", object)
--rebuild unit, to reduce savefile size.
unit:transform(unit.type)
-- slot in traits if any artifacts grant any
for trait in wml.child_range(artifacts.list[index], "trait") do
if not unit:matches { wml.tag.filter_wml { wml.tag.modifications { wml.tag.trait { id = trait.id } } } } then
unit:add_modification("trait", trait)
end
end
-- restore unit hitpoints to before they picked up the artifact
unit.hitpoints = unit_initial_hp
-- the artifact might reduce the max xp.