Setting throw bomb to deal damage to AAD

All development conversation and discussion takes place here

Moderator: Moderator

Post Reply
Message
Author
Nevuk
Thalore
Posts: 189
Joined: Thu Jul 27, 2006 2:50 am

Setting throw bomb to deal damage to AAD

#1 Post by Nevuk »

It's been mentioned a few times recently that alchemists really can't use arcane amplification drone once they've leveled alchemist protection, as it prevents you from dealing damage to friendly targets - of which the Arcane Amplification Drone is one, due to being a summon.

There were a few ways I thought about doing this. Changing the AAD to be unfriendly seemed like a possibility, until I realized that would probably make it damage you - and I couldn't quite figure out how to do it anyways (I think I could work it out, but not sure how to give proper credit and xp to the player).

The other possibility was to add a check in throw bomb's action function to check for if a target is an AAD, and set it to always deal damage. This would be inverse behavior of how it deals with golems or friendly npcs.

This is the golem behavior code :

Code: Select all

if self.alchemy_golem then
			golem = game.level:hasEntity(self.alchemy_golem) and self.alchemy_golem or nil
		end
[...]
local grids = self:project(tg, x, y, function(tx, ty)
			local d = dam
			local target = game.level.map(tx, ty, Map.ACTOR)
			-- Protect yourself
			if tx == self.x and ty == self.y then
				d = dam * (1 - prot)
			-- Protect the golem
			elseif golem and tx == golem.x and ty == golem.y then
				d = dam * (1 - prot)
				if self:isTalentActive(self.T_FROST_INFUSION) and self:knowTalent(self.T_ICE_ARMOUR) then
					self:callTalent(self.T_ICE_ARMOUR, "applyEffect", golem)
				elseif self:isTalentActive(self.T_ACID_INFUSION) and self:knowTalent(self.T_CAUSTIC_GOLEM) then
					self:callTalent(self.T_CAUSTIC_GOLEM, "applyEffect", golem)
				elseif self:isTalentActive(self.T_LIGHTNING_INFUSION) and self:knowTalent(self.T_DYNAMIC_RECHARGE) then
					self:callTalent(self.T_DYNAMIC_RECHARGE, "applyEffect", golem)
				end
			else -- reduced damage to friendly npcs (could make random chance like friendlyfire instead)
				if target and self:reactionToward(target) >= 0 then d = dam * (1 - prot) end
			end
      if d <= 0 then return end
I'm not certain at all how to translate the AAD into similar behavior as the golem, but this is my initial attempt (it loads but doesn't change any behavior as far as I can tell). I'm well aware that it's almost certainly not "self.arcane_amplification_drone", but am unsure what to actually use or where to look for an example.

Code: Select all

if self.arcane_amplification_drone then
		drone = gamel.level:hasEntity(self.arcane_amplification_drone) and self.arcane_amplification_drone or nil
		end
[....]
		local grids = self:project(tg, x, y, function(tx, ty)
			local d = dam
			local target = game.level.map(tx, ty, Map.ACTOR)
			-- Protect yourself
			if tx == self.x and ty == self.y then
				d = dam * (1 - prot)
			-- Protect the golem
			elseif golem and tx == golem.x and ty == golem.y then
				d = dam * (1 - prot)
				if self:isTalentActive(self.T_FROST_INFUSION) and self:knowTalent(self.T_ICE_ARMOUR) then
					self:callTalent(self.T_ICE_ARMOUR, "applyEffect", golem)
				elseif self:isTalentActive(self.T_ACID_INFUSION) and self:knowTalent(self.T_CAUSTIC_GOLEM) then
					self:callTalent(self.T_CAUSTIC_GOLEM, "applyEffect", golem)
				elseif self:isTalentActive(self.T_LIGHTNING_INFUSION) and self:knowTalent(self.T_DYNAMIC_RECHARGE) then
					self:callTalent(self.T_DYNAMIC_RECHARGE, "applyEffect", golem)
				end
			else -- reduced damage to friendly npcs (could make random chance like friendlyfire instead)
				if target and self:reactionToward(target) >= 0 then d = dam * (1 - prot) end
			end
			if drone and tx == drone.x and ty == drone.y then d = dam end

			if d <= 0 then return end

Erenion
Archmage
Posts: 319
Joined: Mon Feb 13, 2017 4:43 pm

Re: Setting throw bomb to deal damage to AAD

#2 Post by Erenion »

Try this:

Code: Select all

else -- reduced damage to friendly npcs (could make random chance like friendlyfire instead)
    if target and self:reactionToward(target) >= 0 and not target:knowTalent(target.T_ARCANE_AMPLIFICATION_DRONE_EFFECT) then d = dam * (1 - prot) end
end
Basically, we just check if a friendly target knows the talent the drone is born with (the one that does the stuff that the drone does) and if it knows it, we don't protect it.
Breaking Projection since 1.5

Nevuk
Thalore
Posts: 189
Joined: Thu Jul 27, 2006 2:50 am

Re: Setting throw bomb to deal damage to AAD

#3 Post by Nevuk »

Erenion wrote:Try this:

Code: Select all

else -- reduced damage to friendly npcs (could make random chance like friendlyfire instead)
    if target and self:reactionToward(target) >= 0 and not target:knowTalent(target.T_ARCANE_AMPLIFICATION_DRONE_EFFECT) then d = dam * (1 - prot) end
end
Basically, we just check if a friendly target knows the talent the drone is born with (the one that does the stuff that the drone does) and if it knows it, we don't protect it.
Thanks, that does it perfectly. Unfortunately the AAD hits the golem, but I think that's alright for now. I think I can fix it, but not sure if it should be fixed (I'm assuming it hits other minions so for consistencies sake I'll probably keep it).

Post Reply