0
0
Fork 0

Clear bad omen when raid complete

This commit is contained in:
cora 2022-11-08 03:57:11 +01:00
parent 6251c623dd
commit c3455de604
2 changed files with 9 additions and 2 deletions

View File

@ -106,8 +106,9 @@ function mcl_raids.promote_to_raidcaptain(c) -- object
l._banner = nil
mcl_raids.drop_obanner(pos)
if cmi_cause.type == "punch" and cmi_cause.puncher:is_player() then
local lv = mcl_potions.player_get_effect(cmi_cause.puncher, "bad_omen").factor
if not lv then lv = 0 end
local lv = mcl_potions.player_get_effect(cmi_cause.puncher, "bad_omen")
if not lv then lv = 0
else lv = lv.factor end
lv = math.max(5,lv + 1)
mcl_potions.bad_omen_func(cmi_cause.puncher,lv,6000)
end
@ -281,6 +282,7 @@ mcl_events.register_event("raid",{
on_complete = function(self)
--minetest.log("RAID complete")
awards.unlock(self.player,"mcl:hero_of_the_village")
mcl_potions.player_clear_effect(minetest.get_player_by_name(self.player),"bad_omen")
end,
})

View File

@ -524,6 +524,11 @@ function mcl_potions.player_get_effect(player, effect_name)
return EF[effect_name][player]
end
function mcl_potions.player_clear_effect(player,effect)
EF[effect][player] = nil
potions_set_icons(player)
end
minetest.register_on_leaveplayer( function(player)
mcl_potions._save_player_effects(player)
mcl_potions._clear_cached_player_data(player) -- clearout the buffer to prevent looking for a player not there