Alchemist getting experience for killing his own golem

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Alchemist getting experience for killing his own golem

#1 Post by yufra »

I stumbled across this on accident, I promise. Then I tested it and the patch below by throwing bombs at my poor unsuspecting golem. :D

Code: Select all

--- modules/tome/data/talents/spells/golemancy.lua.old	2010-07-15 18:29:22.000000000 -0700
+++ modules/tome/data/talents/spells/golemancy.lua	2010-07-15 18:29:27.000000000 -0700
@@ -65,6 +65,7 @@
 		disease_immune = 1,
 		see_invisible = 2,
 		no_breath = 1,
+		exp_worth = 0,
 	}
 end
This does have the side-effect that nobody gets experience for killing the golem, but that strikes me as harmless.
<DarkGod> lets say it's intended

Shoob
Reaper
Posts: 1535
Joined: Mon Jan 22, 2007 6:31 pm
Location: East of the sun, west of the moon

Re: Alchemist getting experience for killing his own golem

#2 Post by Shoob »

well, harmless for now, however, there may be situations where monsters do level up (take mt doom for example).

what really should be done is negate xp gain from killing friendly slaves. (just friendly units should turn on you and lower your relation with their faction iff you target them directly, slaves would be unable to turn on you though)
Oliphant am I, and I never lie.

yufra
Perspiring Physicist
Posts: 1332
Joined: Tue Jul 13, 2010 2:53 pm

Re: Alchemist getting experience for killing his own golem

#3 Post by yufra »

Good point Shoob, and after thinking about it and looking at the code a bit more there is a better solution. Here is the new patch:

Code: Select all

--- tome/data/talents/spells/golemancy.lua.old	2010-07-15 18:29:22.000000000 -0700
+++ tome/data/talents/spells/golemancy.lua	2010-07-15 21:10:52.000000000 -0700
@@ -27,7 +27,7 @@
 end
 
 local function makeGolem()
-	return require("mod.class.NPC").new{
+	golem = require("mod.class.NPC").new{
 		type = "construct", subtype = "golem",
 		display = 'g', color=colors.WHITE,
 		level_range = {1, 50},
@@ -66,6 +66,19 @@
 		see_invisible = 2,
 		no_breath = 1,
 	}
+	---[[
+	--Overwrite the worthExp function to check if the target is the summoner
+	golem.summoner = self
+	golem._worthExp = golem.worthExp
+	golem.worthExp = function(self, target)
+			if target ~= self.summoner then
+				return self:_worthExp(target)
+			else
+				return 0
+			end
+		end
+	--]]
+	return golem
 end
 
 newTalent{
<DarkGod> lets say it's intended

Antagonist
Higher
Posts: 71
Joined: Sun May 23, 2010 9:55 am

Re: Alchemist getting experience for killing his own golem

#4 Post by Antagonist »

Heheheh... you can still level up a second pet if you have it kill the golem?

I'm wondering though what kind of effect it will have if we make 0 xp gained global for all members of your own faction. Maybe even for friendly factions, but thats abit more common. The golem I assume is in the players faction, as would any summons or so, so this would be a more general case solution.

Shoob
Reaper
Posts: 1535
Joined: Mon Jan 22, 2007 6:31 pm
Location: East of the sun, west of the moon

Re: Alchemist getting experience for killing his own golem

#5 Post by Shoob »

well, not really, right now pets and slaves and summons do not gain exp, they funnel it all to you. I would expect this would eventually change as I would rather see pets and slaves share xp gain with you.
Oliphant am I, and I never lie.

Post Reply