[svn] Hornet Stingers artifact and poison damage

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
aardvark
Wyrmic
Posts: 200
Joined: Wed Aug 22, 2012 12:16 am

[svn] Hornet Stingers artifact and poison damage

#1 Post by aardvark »

When an elite grave wight attacked me using Hornet Stingers artifact arrows, errors popped up every time an arrow hit. A little investigating revealed that it's the Crippling Poison damage type that it adds to its victims. Unlike Insidious Poison, neither Crippling nor Spydric Poisons apply default values when they're used as damage types. This patch changes that:

Code: Select all

--- data/damage_types.lua.old	2012-09-16 02:05:15.578125000 -0700
+++ data/damage_types.lua	2012-09-16 02:30:25.109375000 -0700
@@ -1168,6 +1168,7 @@
 newDamageType{
 	name = "spydric poison", type = "SPYDRIC_POISON",
 	projector = function(src, x, y, type, dam)
+		if _G.type(dam) == "number" then dam = {dam=dam, dur=3} end
 		DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam / dam.dur)
 		local target = game.level.map(x, y, Map.ACTOR)
 		if target and target:canBe("poison") then
@@ -1180,6 +1181,7 @@
 newDamageType{
 	name = "crippling poison", type = "CRIPPLING_POISON", text_color = "#LIGHT_GREEN#",
 	projector = function(src, x, y, type, dam)
+		if _G.type(dam) == "number" then dam = {dam=dam, dur=4} end
 		DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam.dam / dam.dur)
 		local target = game.level.map(x, y, Map.ACTOR)
 		if target and target:canBe("poison") then
I just copied the check from Insidious Poison and changed the default durations. Spydric Poison gets 3 since that's what the Mandible of Ungolmor (the only place it's used?) has. Crippling Poison gets 4 since that seems reasonable for a poison that interferes with talent use.
Attachments
poison-fix.txt
Poison defaults patch
(958 Bytes) Downloaded 65 times

Frumple
Sher'Tul Godslayer
Posts: 1517
Joined: Sat May 15, 2010 9:17 pm

Re: [svn] Hornet Stingers artifact and poison damage

#2 Post by Frumple »

Not sure if it'd help any or change anything, but the other place you can find spydric poison is on the rod of spydric poison. It's in the object file for ardhungol and has a duration of six. Three would probably be fine so long as the rod code overwrites it, yeah.

Saving yeh some time:

Code: Select all

newEntity{ base = "BASE_ROD",
	power_source = {nature=true},
	define_as = "ROD_SPYDRIC_POISON",
	unided_name = "poison dripping wand", image = "object/artifact/rod_of_spydric_poison.png",
	name = "Rod of Spydric Poison", color=colors.LIGHT_GREEN, unique=true,
	desc = [[This rod carved out of a giant spider fang continuously drips venom.]],
	cost = 50,
	elec_proof = true,

	max_power = 75, power_regen = 1,
	use_power = { name = "shoot a bolt of spydric poison", power = 25,
		use = function(self, who)
			local tg = {type="bolt", range=12, talent=t}
			local x, y = who:getTarget(tg)
			if not x or not y then return nil end
			who:project(tg, x, y, engine.DamageType.SPYDRIC_POISON, {dam=200 + who:getMag() * 4, dur=6}, {type="slime"})
			return {id=true, used=true}
		end
	},
}

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

Re: [svn] Hornet Stingers artifact and poison damage

#3 Post by aardvark »

That one's already fine since it explicitly calls project() as shown in your code snippet:
Frumple wrote:

Code: Select all

use_power = {
...snip...
			who:project(tg, x, y, engine.DamageType.SPYDRIC_POISON, {dam=200 + who:getMag() * 4, dur=6}, {type="slime"})
The Mandible of Ungolmor also uses who:project() from a special_on_crit property.

Hornet Stingers adds the damage without any special function, like so:

Code: Select all

ranged_project={
	[DamageType.CRIPPLING_POISON] = 10,
},
The error would be fixed either by changing the way Stingers applies the damage or altering the Crippling Poison damage type to account for the simplified usage. I chose the latter since Insidious Poison already had the check (with default duration 7) and fixing it this way solves potential future bugs as well. I threw in the default for Spydric Poison since the code fragments were together and I noticed it was also missing the check.

I tentatively chose 3 and 4 as default durations since they seemed reasonable to me. I wouldn't be at all offended if they were changed (the svn log shows they've both been set to 3). I would like to note that the project() method overrides the defaults by providing an explicit duration, so this fix shouldn't clobber any currently working artifacts, items, or skills.

Post Reply