Page 1 of 1

Extend beams caused by Arcane Combat

Posted: Mon Jan 03, 2011 5:42 am
by yufra
Grey and I were talking about Arcane Blades and he suggested having the beam spells (Flame at lvl 5, Lightning at all levels) extend past the first target until they met a friendly target (don't want to kill those escorts!) or a wall. I have updated the arcane combat section in Combat.lua below and tested it. What do you think?

EDIT: I have been playing with this and it is a lot of fun to see a flame beam fly across the map. :D

Code: Select all

	-- Autospell cast
	if hitted and not target.dead and self:knowTalent(self.T_ARCANE_COMBAT) and self:isTalentActive(self.T_ARCANE_COMBAT) and rng.percent(20 + self:getTalentLevel(self.T_ARCANE_COMBAT) * (1 + self:getDex(9, true))) then
		local spells = {}
		if self:knowTalent(self.T_FLAME) then spells[#spells+1] = self.T_FLAME end
		if self:knowTalent(self.T_LIGHTNING) then spells[#spells+1] = self.T_LIGHTNING end
		local tid = rng.table(spells)
		if tid then
			-- Extending beam target, assumes a maximum range of 20
			local current_angle = math.atan2((target.y - self.y), (target.x - self.x)) + math.pi
			target_x = self.x - math.floor(0.5 + (20 * math.cos(current_angle)))
			target_y = self.y - math.floor(0.5 + (20 * math.sin(current_angle)))
			local l = line.new(self.x, self.y, target_x, target_y)
			local lx, ly = l()
			target_x, target_y = lx, ly
			-- Check for terrain and friendly actors
			while lx and ly do
				local actor = game.level.map(lx, ly, engine.Map.ACTOR)
				if actor and (self:reactionToward(actor) >= 0) then
					break
				elseif game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move") then
					target_x, target_y = lx, ly
					break
				end
				target_x, target_y = lx, ly
				lx, ly = l()
			end
			print("[ARCANE COMBAT] autocast ",self:getTalentFromId(tid).name)
			local old_cd = self:isTalentCoolingDown(self:getTalentFromId(tid))
			self:forceUseTalent(tid, {ignore_energy=true, force_target={x=target_x, y=target_y, __no_self=true}})
			-- Do not setup a cooldown
			if not old_cd then
				self.talents_cd[tid] = nil
			end
			self.changed = true
		end
	end

Re: Extend beams caused by Arcane Combat

Posted: Mon Jan 03, 2011 3:47 pm
by Final Master
Sounds good to me.

Re: Extend beams caused by Arcane Combat

Posted: Mon Jan 03, 2011 8:00 pm
by Grey
I hope this is implemented - looks like fun without being game-breaking.

Re: Extend beams caused by Arcane Combat

Posted: Mon Jan 03, 2011 9:01 pm
by edge2054
Grey wrote:I hope this is implemented - looks like fun without being game-breaking.
Arcane Blade's could probably stand for a power boost anyhow.

Re: Extend beams caused by Arcane Combat

Posted: Thu Jan 06, 2011 1:31 pm
by darkgod
done