From 43bf6d416817a149a168481203f43596e6f6af5d Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Sun, 12 Feb 2012 22:16:31 +0000 Subject: [PATCH] minds git-svn-id: http://svn.net-core.org/repos/t-engine4@4847 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/modules/tome/class/Object.lua | 10 +++++----- game/modules/tome/class/interface/Combat.lua | 20 +++++++++++++++---- .../data/general/objects/world-artifacts.lua | 2 +- game/modules/tome/dialogs/CharacterSheet.lua | 6 +++--- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua index e0e107de03..6ca7487ab4 100644 --- a/game/modules/tome/class/Object.lua +++ b/game/modules/tome/class/Object.lua @@ -334,7 +334,7 @@ function _M:getTextualDesc(compare_with) -- Stop here if unided if not self:isIdentified() then return desc end - local compare_fields = function(item1, items, infield, field, outformat, text, mod, isinversed, isdiffinversed, add_table, change_order, affects_spells) + local compare_fields = function(item1, items, infield, field, outformat, text, mod, isinversed, isdiffinversed, add_table, change_order, combat) add_table = add_table or {} mod = mod or 1 change_order = change_order or true @@ -350,7 +350,6 @@ function _M:getTextualDesc(compare_with) ret:add(((item1[field] or 0) + (add_table[field] or 0)) < 0 and {"color","RED"} or {"color","LIGHT_GREEN"}, outformat:format(((item1[field] or 0) + (add_table[field] or 0)) * mod), {"color", "LAST"}) end --if change_order then ret:add(text) end - --if affects_spells then ret:add(" (affects spells)") end if item1[field] then add = true end @@ -380,7 +379,8 @@ function _M:getTextualDesc(compare_with) ret:add(")") end if change_order then ret:add(text) end - if affects_spells then ret:add(" (affects spells)") end + if combat and combat.affects_spells then ret:add(" (affects spells)") end + if combat and combat.affects_minds then ret:add(" (affects minds)") end if add then desc:merge(ret) desc:add(true) @@ -534,8 +534,8 @@ function _M:getTextualDesc(compare_with) end - compare_fields(combat, compare_with, field, "critical_power", "%.1f", " crit multiplier", 1, false, false, add_table, true, combat.affects_spells) - compare_fields(combat, compare_with, field, "max_acc", "%d%%", " max hit chance", 1, false, false, add_table, true, combat.affects_spells) + compare_fields(combat, compare_with, field, "critical_power", "%.1f", " crit multiplier", 1, false, false, add_table, true, combat) + compare_fields(combat, compare_with, field, "max_acc", "%d%%", " max hit chance", 1, false, false, add_table, true, combat) compare_fields(combat, compare_with, field, "capacity", "%d", " capacity", 1, false, false, add_table) compare_fields(combat, compare_with, field, "shots_reloaded_per_turn", "%+d", " reload speed", 1, false, false, add_table) compare_fields(combat, compare_with, field, "ammo_every", "%d", " turns elapse between self-loadings", 1, false, false, add_table) diff --git a/game/modules/tome/class/interface/Combat.lua b/game/modules/tome/class/interface/Combat.lua index 185b73242d..5bc099885a 100644 --- a/game/modules/tome/class/interface/Combat.lua +++ b/game/modules/tome/class/interface/Combat.lua @@ -274,6 +274,13 @@ function _M:getMaxAccuracy(hit_type, combat) (oh.combat and oh.combat.affects_spells and oh.combat.max_acc) or (oh.special_combat and oh.special_combat.affects_spells and oh.special_combat.max_acc) or 75, (pf.combat and pf.combat.max_acc) or 75 ) + elseif hit_type == "mind" then + --if combat and combat.max_acc then return combat.max_acc end + return (combat and combat.affects_minds and combat.max_acc) or math.max( + (mh.combat and mh.combat.affects_minds and mh.combat.max_acc) or 75, + (oh.combat and oh.combat.affects_minds and oh.combat.max_acc) or (oh.special_combat and oh.special_combat.affects_minds and oh.special_combat.max_acc) or 75, + (pf.combat and pf.combat.max_acc) or 75 + ) end return 75 @@ -900,11 +907,16 @@ end --- Gets crit magnitude function _M:combatCritPower(crit_type, weapon) local combat = weapon or self.combat or {} - if crit_type == "spell" and not combat.affects_spells then - return 1.1 - else + if crit_type == "physical" then return (combat.critical_power or 1.1) + (self.combat_critical_power or 0) - end + elseif crit_type == "spell" then + if combat.affects_spells then return (combat.critical_power or 1.1) + (self.combat_critical_power or 0) + else return 1.1 end + elseif crit_type == "mind" then + if combat.affects_minds then return (combat.critical_power or 1.1) + (self.combat_critical_power or 0) + else return 1.1 end + end + return 1.1 end --- Gets the damage range diff --git a/game/modules/tome/data/general/objects/world-artifacts.lua b/game/modules/tome/data/general/objects/world-artifacts.lua index db90df60a5..76f71d0d39 100644 --- a/game/modules/tome/data/general/objects/world-artifacts.lua +++ b/game/modules/tome/data/general/objects/world-artifacts.lua @@ -2148,7 +2148,7 @@ newEntity{ base = "BASE_LONGSWORD", cost = 650, material_level = 5, combat = { - affects_spells = true, + affects_minds = true, dam = 65, max_acc = 95, critical_power = 1.8, diff --git a/game/modules/tome/dialogs/CharacterSheet.lua b/game/modules/tome/dialogs/CharacterSheet.lua index 59a0ac9ff5..53acc197f1 100644 --- a/game/modules/tome/dialogs/CharacterSheet.lua +++ b/game/modules/tome/dialogs/CharacterSheet.lua @@ -585,7 +585,7 @@ function _M:drawDialog(kind, actor_to_compare) if mean and dam then local max_acc = o.combat.max_acc if o.archery and player:hasAmmo(o.archery) then max_acc = player:hasAmmo(o.archery).combat.max_acc end - sp_text = (o.combat.affects_spells and " (affects spells)") or "" + sp_text = (o.combat.affects_spells and " (affects spells)") or (o.combat.affects_minds and " (affects mindpowers)") or "" local attack_speed_bonus = (1 / player:combatSpeed(o.combat))*100 - 100 s:drawColorStringBlended(self.font, WeaponTxt, w, h, 255, 255, 255, true) h = h + self.font_h @@ -614,7 +614,7 @@ function _M:drawDialog(kind, actor_to_compare) s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Unarmed:", w, h, 255, 255, 255, true) h = h + self.font_h local mean, dam = player.combat, player.combat if mean and dam then - sp_text = (player.combat.affects_spells and " (affects spells)") or "" + sp_text = (player.combat.affects_spells and " (affects spells)") or (player.combat.affects_minds and " (affects mindpowers)") or "" local attack_speed_bonus = (1 / player:combatSpeed(player.combat))*100 - 100 local gloves = player:hasGloves() local total_dam = player:combatDamage(player.combat) + (gloves and gloves:getMeleeProjectDam() or 0) @@ -649,7 +649,7 @@ function _M:drawDialog(kind, actor_to_compare) if mean and dam then local max_acc = o.combat.max_acc if o.archery and player:hasAmmo(o.archery) then max_acc = player:hasAmmo(o.archery).combat.max_acc end - sp_text = (o.combat.affects_spells and " (affects spells)") or "" + sp_text = (o.combat.affects_spells and " (affects spells)") or (o.combat.affects_minds and " (affects mindpowers)") or "" local attack_speed_bonus = (1 / player:combatSpeed(o.combat))*100 - 100 s:drawColorStringBlended(self.font, "#LIGHT_BLUE#Off Hand:", w, h, 255, 255, 255, true) h = h + self.font_h -- GitLab