Setting throw bomb to deal damage to AAD
Posted: Wed Mar 14, 2018 10:45 pm
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 :
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.
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
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