[b43] Armour training glitch gives permanent stats.

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
Tyren
Halfling
Posts: 112
Joined: Sun Mar 04, 2012 2:04 am

[b43] Armour training glitch gives permanent stats.

#1 Post by Tyren »

Step 1: Level Armour Training up to 4 so you can unlearn it. Have some unassigned points left. Accept changes.
Step 2: Wear heavy armor.
Step 3: Unlearn Armour Training, the armor piece falls off. Close the level-up screen. Don't accept changes. (Click No).
Unequip the armor. You now have permanent armor stats.

Looks like it's the same bug here http://forums.te4.org/viewtopic.php?f=4 ... e#p137963.

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [b43] Armour training glitch gives permanent stats.

#2 Post by aardvark »

It's because the temporary value ID is stored in the item's object rather than the actor's. When equipping items, the Object's wielder field's bonuses are applied to the Player using the addTemporaryValue() function and the temporary value info is stored in the Object's object.

Later, when entering the levelup dialog, a recursive copy of the Player object's table is made excepting the subtables that are also T-Engine classes. Changes on the levelup dialog are applied to the live Player as they're made. When declining the changes, the live Player is discarded and the copy is substituted.

So, the problem: when removing points from Armour Training, it removes the armor from the player. That removes the temporary values from the Player object and the values stored in the uncopied armor. When we cancel the levelup, the Player copy that still has the temporary values applied is substituted but the uncopied, de-temporaried armor is still what it has in its inventory slot. Subsequent removal of the armor doesn't remove the temporary values from Player because it already has, in another life.

It's the Golemancy bug all over again. The only real fix is to change the levelup dialog to defer the changes to Player until the player finalizes them. It shouldn't be that hard to mock up the changes and apply them wholesale when they're confirmed. It would have the extra benefit of removing a bunch of memory copying and should make the dialog more responsive.

darkgod
Master of Eyal
Posts: 10751
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: [b43] Armour training glitch gives permanent stats.

#3 Post by darkgod »

fixed
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

Re: [b43] Armour training glitch gives permanent stats.

#4 Post by aardvark »

Here's a patch that fixes the temporary values bug while allowing players to unlearn Armour Training:

Code: Select all

Index: game/modules/tome/dialogs/LevelupDialog.lua
===================================================================
--- game/modules/tome/dialogs/LevelupDialog.lua	(revision 6027)
+++ game/modules/tome/dialogs/LevelupDialog.lua	(working copy)
@@ -34,6 +34,15 @@
 local function backup(original)
 	local bak = original:clone()
 	bak.uid = original.uid -- Yes ...
+	-- Copy worn items as well
+	for id, inven in pairs(bak.inven) do
+		if inven.worn then
+			for i, item in ipairs(inven) do
+				inven[i] = item:clone()
+				inven[i].uid = item.uid
+			end
+		end
+	end
 	return bak
 end
 
Index: game/modules/tome/data/talents/techniques/combat-training.lua
===================================================================
--- game/modules/tome/data/talents/techniques/combat-training.lua	(revision 6027)
+++ game/modules/tome/data/talents/techniques/combat-training.lua	(working copy)
@@ -41,7 +41,6 @@
 	name = "Armour Training",
 	type = {"technique/combat-training", 1},
 	mode = "passive",
-	no_unlearn_last = true,
 	points = 5,
 	require = {stat = {str = function(level) return 16 + (level + 2) * (level - 1) end}},
 	on_unlearn = function(self, t)
Since it's the Golemancy bug, the Golemancy fix does the trick!
Attachments
at-unlearn-fix-no-really-this-time.txt
Armour Training unlearn bug patch
(1.14 KiB) Downloaded 103 times

Post Reply