Skip to content
Snippets Groups Projects
Commit e1d2c6e4 authored by DarkGod's avatar DarkGod
Browse files

Fixed archery from exploding in a big ball of errors. Very sorry, much self whipping :/

parent 43fdc8a6
No related branches found
No related tags found
No related merge requests found
Showing
with 60 additions and 76 deletions
......@@ -213,65 +213,6 @@ tuneParadox = function(self, t, value)
end
end
wardenPreUse = function(self, t, silent, weapon_type)
local weapon, ammo, offweapon, pf_weapon = self:hasArcheryWeapon(weapon_type)
weapon = weapon or pf_weapon
if self:attr("warden_swap") and not weapon and weapon_type == nil or weapon_type == "bow" then
weapon, ammo = doWardenPreUse(self, "bow")
end
return archeryWeaponCheck(self, weapon, ammo, silent, weapon_type)
end
--- Warden weapon functions
-- Checks for weapons in main and quickslot
doWardenPreUse = function(self, weapon, silent)
if weapon == "bow" then
local bow, ammo, oh, pf_bow= self:hasArcheryWeapon("bow")
if not bow and not pf_bow then
bow, ammo, oh, pf_bow= self:hasArcheryWeaponQS("bow")
end
return bow or pf_bow, ammo
end
if weapon == "dual" then
local mh, oh = self:hasDualWeapon()
if not mh then
mh, oh = self:hasDualWeaponQS()
end
return mh, oh
end
end
-- Swaps weapons if needed
doWardenWeaponSwap = function(self, t, type, silent)
local swap = false
local mainhand, offhand, ammo, pf_weapon
if type == "blade" then
mainhand, offhand = self:hasDualWeapon()
if not mainhand and self:hasDualWeapon(nil, nil, true) then -- weird but this is lets ogers offhanding daggers still swap
swap = true
end
end
if type == "bow" then
mainhand, offhand, ammo, pf_weapon = self:hasArcheryWeapon("bow")
if not mainhand and not pf_weapon then
mainhand, offhand, ammo, pf_weapon = self:hasArcheryWeapon("bow", true)
if mainhand or pf_weapon then swap = true end
end
end
if swap == true then
local old_inv_access = self.no_inventory_access -- Make sure clones can swap
self.no_inventory_access = nil
self:attr("no_sound", 1)
self:quickSwitchWeapons(true, "warden", silent)
self:attr("no_sound", -1)
self.no_inventory_access = old_inv_access
end
return swap
end
-- Target helper function for focus fire
checkWardenFocus = function(self)
local target
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local archerPreUse = Talents.archerPreUse
newTalent{
name = "Phase Shot",
type = {"chronomancy/temporal-archery", 1},
......
......@@ -13,8 +13,6 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local archerPreUse = Talents.archerPreUse
-- calc_all is so the info can show all the effects.
local sniper_bonuses = function(self, calc_all)
local bonuses = {}
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local archerPreUse = Talents.archerPreUse
newTalent{
name = "Guided Shot",
type = {"psionic/psi-archery", 1},
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local archerPreUse = Talents.archerPreUse
newTalent{
name = "Bow Mastery",
type = {"technique/archery-bow", 1},
......
......@@ -13,8 +13,6 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local archerPreUse = Talents.archerPreUse
local preUse = function(self, t, silent)
if not self:hasShield() or not archerPreUse(self, t, true) then
if not silent then game.logPlayer("You require a ranged weapon and a shield to use this talent.") end
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local archerPreUse = Talents.archerPreUse
newTalent{
name = "Shoot Down", short_name = "SHOOT_DOWN_OLD",
type = {"technique/archery-excellence", 1},
......
......@@ -13,8 +13,6 @@
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
local archerPreUse = Talents.archerPreUse
-- Currently just a copy of Sling Mastery.
newTalent {
short_name = "SKIRMISHER_SLING_SUPREMACY",
......
......@@ -17,8 +17,6 @@
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
local archerPreUse = Talents.archerPreUse
newTalent{
name = "Sling Mastery",
type = {"technique/archery-sling", 1},
......
......@@ -351,6 +351,65 @@ archerPreUse = function(self, t, silent, weapon_type)
return archeryWeaponCheck(self, weapon, ammo, silent, weapon_type)
end
wardenPreUse = function(self, t, silent, weapon_type)
local weapon, ammo, offweapon, pf_weapon = self:hasArcheryWeapon(weapon_type)
weapon = weapon or pf_weapon
if self:attr("warden_swap") and not weapon and weapon_type == nil or weapon_type == "bow" then
weapon, ammo = doWardenPreUse(self, "bow")
end
return archeryWeaponCheck(self, weapon, ammo, silent, weapon_type)
end
--- Warden weapon functions
-- Checks for weapons in main and quickslot
doWardenPreUse = function(self, weapon, silent)
if weapon == "bow" then
local bow, ammo, oh, pf_bow= self:hasArcheryWeapon("bow")
if not bow and not pf_bow then
bow, ammo, oh, pf_bow= self:hasArcheryWeaponQS("bow")
end
return bow or pf_bow, ammo
end
if weapon == "dual" then
local mh, oh = self:hasDualWeapon()
if not mh then
mh, oh = self:hasDualWeaponQS()
end
return mh, oh
end
end
-- Swaps weapons if needed
doWardenWeaponSwap = function(self, t, type, silent)
local swap = false
local mainhand, offhand, ammo, pf_weapon
if type == "blade" then
mainhand, offhand = self:hasDualWeapon()
if not mainhand and self:hasDualWeapon(nil, nil, true) then -- weird but this is lets ogers offhanding daggers still swap
swap = true
end
end
if type == "bow" then
mainhand, offhand, ammo, pf_weapon = self:hasArcheryWeapon("bow")
if not mainhand and not pf_weapon then
mainhand, offhand, ammo, pf_weapon = self:hasArcheryWeapon("bow", true)
if mainhand or pf_weapon then swap = true end
end
end
if swap == true then
local old_inv_access = self.no_inventory_access -- Make sure clones can swap
self.no_inventory_access = nil
self:attr("no_sound", 1)
self:quickSwitchWeapons(true, "warden", silent)
self:attr("no_sound", -1)
self.no_inventory_access = old_inv_access
end
return swap
end
load("/data/talents/techniques/2hweapon.lua")
load("/data/talents/techniques/2h-assault.lua")
load("/data/talents/techniques/strength-of-the-berserker.lua")
......
......@@ -218,7 +218,7 @@ uberTalent{
require = { special={desc="Have dealt over 50000 damage with ranged weapons", fct=function(self) return self.damage_log and self.damage_log.weapon.archery and self.damage_log.weapon.archery >= 50000 end} },
tactical = { ATTACK = { weapon = 3 }, DISABLE = {2, stun = 2}},
requires_target = true,
on_pre_use = function(self, t, silent) return Talents.archerPreUse(self, t, silent) end,
on_pre_use = function(self, t, silent) return archerPreUse(self, t, silent) end,
archery_onhit = function(self, t, target, x, y)
if target:canBe("stun") then
target:setEffect(target.EFF_STUNNED, 5, {apply_power=self:combatAttack()})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment