diff --git a/ChangeLog b/ChangeLog index 53cb73589..938d705bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2021-04-07 Nicolas Weeger + * python/events/gkill/sword_of_souls.py: Fix type error by converting explicitely to int. + * python/items/curse_on_apply.py, + * python/items/lose_buffs_on_drop.py: Display message only if the wielder is a player. + 2021-03-17 Nicolas Weeger * quests/peterm/DragonQuest/ElectricHatchery, * quests/peterm/DragonQuest/FireHatchery, diff --git a/python/events/gkill/sword_of_souls.py b/python/events/gkill/sword_of_souls.py index 37fdd7e17..c94894c2b 100644 --- a/python/events/gkill/sword_of_souls.py +++ b/python/events/gkill/sword_of_souls.py @@ -24,7 +24,7 @@ if killer.Owner is None and killer.Type == Crossfire.Type.PLAYER: # Add experience to the weapon (though we only care about the total_exp field) # As the weapon gets stronger, it takes a larger share of the exp, # with a baseline of half at level 0, and taking all of it at level 115. - weap.AddExp((victim.Exp * (1.0 + weap.ItemPower / 115.0)) // 2) + weap.AddExp(int(victim.Exp * (1.0 + weap.ItemPower / 115.0)) // 2) # Determine the change in XP delta_exp = weap.TotalExp - old_xp diff --git a/python/items/curse_on_apply.py b/python/items/curse_on_apply.py index 14b674bb6..1bc07accb 100644 --- a/python/items/curse_on_apply.py +++ b/python/items/curse_on_apply.py @@ -4,7 +4,7 @@ me = Crossfire.WhoAmI() ac = Crossfire.WhoIsActivator() # Since this checks before equipping actually occurs, Applied will be 0 when we apply -if me.Applied == 0: +if me.Applied == 0 and ac.Type == Crossfire.Type.PLAYER: ac.Write("You feel the "+me.Name+" bind to you.") me.Cursed = 1 me.KnownCursed = 1 diff --git a/python/items/lose_buffs_on_drop.py b/python/items/lose_buffs_on_drop.py index fcdade809..61cb84442 100644 --- a/python/items/lose_buffs_on_drop.py +++ b/python/items/lose_buffs_on_drop.py @@ -4,7 +4,7 @@ me = Crossfire.WhoAmI() ac = Crossfire.WhoIsActivator() # It is assumed that this buffed weapon uses PermExp to denote how much it has been used. -if me.PermExp > 0: +if me.PermExp() > 0: me.Str = me.Archetype.Clone.Str me.Dex = me.Archetype.Clone.Dex me.Con = me.Archetype.Clone.Con @@ -25,4 +25,5 @@ if me.PermExp > 0: # Experience should be affected before Item Power, since it affects that field me.AddExp(-me.TotalExp) me.ItemPower = me.Archetype.Clone.ItemPower - ac.Write("The "+me.Name+" shudders and looks almost like a normal weapon again.") + if ac.Type == Crossfire.Type.PLAYER: + ac.Write("The "+me.Name+" shudders and looks almost like a normal weapon again.")