From 9ccbac6c1aa5da2de8e1f8a894d548e787936294 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Mon, 30 Apr 2012 20:57:55 +0000
Subject: [PATCH] torque powers

git-svn-id: http://svn.net-core.org/repos/t-engine4@5065 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua             |  5 ++
 .../general/objects/egos/torques-powers.lua   | 54 +++++++++++++++-
 .../tome/data/timed_effects/mental.lua        | 64 ++++++++++++++++---
 3 files changed, 112 insertions(+), 11 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index 2a61a13145..a222ddb327 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -3603,6 +3603,11 @@ function _M:on_set_temporary_effect(eff_id, e, p)
 	if e.status == "detrimental" and self:attr("negative_status_effect_immune") then
 		p.dur = 0
 	end
+	if e.status == "detrimental" and e.type == "mental" and self:attr("mental_negative_status_effect_immune") then
+		p.dur = 0
+		self:attr("mental_negative_status_effect_immune", -1)
+		if not self:attr("mental_negative_status_effect_immune") then self:removeEffect(self.EFF_CLEAR_MIND) end
+	end
 	if self:attr("status_effect_immune") then
 		p.dur = 0
 	end
diff --git a/game/modules/tome/data/general/objects/egos/torques-powers.lua b/game/modules/tome/data/general/objects/egos/torques-powers.lua
index 273c0a19bb..8b94ff5f64 100644
--- a/game/modules/tome/data/general/objects/egos/torques-powers.lua
+++ b/game/modules/tome/data/general/objects/egos/torques-powers.lua
@@ -19,7 +19,7 @@
 
 --[[
 Torques
-psionic shield
+*psionic shield
 psychoportation
 clear mind
 adrenaline rush
@@ -40,3 +40,55 @@ newEntity{
 		return {id=true, used=true}
 	end),
 }
+
+newEntity{
+	name = " of kinetic psionic shield", addon=true, instant_resolve=true,
+	level_range = {1, 50},
+	rarity = 7,
+
+	charm_power_def = {add=3, max=100, floor=true},
+	resolvers.charm("setup a psionic shield, reducing all physical and acid damage by %d for 6 turns.", 20, function(self, who)
+		who:setEffect(who.EFF_PSIONIC_SHIELD, 6, {kind="kinetic", power=self:getCharmPower()})
+		game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
+		return {id=true, used=true}
+	end),
+}
+
+newEntity{
+	name = " of thermal psionic shield", addon=true, instant_resolve=true,
+	level_range = {1, 50},
+	rarity = 7,
+
+	charm_power_def = {add=3, max=100, floor=true},
+	resolvers.charm("setup a psionic shield, reducing all fire and cold damage by %d for 6 turns.", 20, function(self, who)
+		who:setEffect(who.EFF_PSIONIC_SHIELD, 6, {kind="thermal", power=self:getCharmPower()})
+		game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
+		return {id=true, used=true}
+	end),
+}
+
+newEntity{
+	name = " of charged psionic shield", addon=true, instant_resolve=true,
+	level_range = {10, 50},
+	rarity = 8,
+
+	charm_power_def = {add=3, max=100, floor=true},
+	resolvers.charm("setup a psionic shield, reducing all lightning and blight damage by %d for 6 turns.", 20, function(self, who)
+		who:setEffect(who.EFF_PSIONIC_SHIELD, 6, {kind="charged", power=self:getCharmPower()})
+		game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
+		return {id=true, used=true}
+	end),
+}
+
+newEntity{
+	name = " of clear mind", addon=true, instant_resolve=true,
+	level_range = {15, 50},
+	rarity = 12,
+
+	charm_power_def = {add=0, max=5, floor=true},
+	resolvers.charm("absorbs and nullifies at most %d detrimental mental status effects in the next 6 turns.", 20, function(self, who)
+		who:setEffect(who.EFF_CLEAR_MIND, 6, {power=self:getCharmPower()})
+		game.logSeen(who, "%s uses %s!", who.name:capitalize(), self:getName{no_count=true})
+		return {id=true, used=true}
+	end),
+}
diff --git a/game/modules/tome/data/timed_effects/mental.lua b/game/modules/tome/data/timed_effects/mental.lua
index 1ce46a7b27..91c6c835dc 100644
--- a/game/modules/tome/data/timed_effects/mental.lua
+++ b/game/modules/tome/data/timed_effects/mental.lua
@@ -764,7 +764,7 @@ newEffect{
 			eff.source:incHate(eff.hateGain)
 		end
 		DamageType:get(DamageType.MIND).projector(eff.source, self.x, self.y, DamageType.MIND, { dam=eff.damage, crossTierChance=25 })
-		
+
 		if self.dead then
 			-- only spread on activate if the target is dead
 			if eff.jumpCount > 0 then
@@ -776,7 +776,7 @@ newEffect{
 		end
 
 		game:playSoundNear(self, "talents/fire")
-		
+
 		eff.firstTurn = true
 	end,
 	deactivate = function(self, eff)
@@ -791,7 +791,7 @@ newEffect{
 		elseif eff.jumpDuration > 0 then
 			-- limit the total duration of all spawned effects
 			eff.jumpDuration = eff.jumpDuration - 1
-			
+
 			if eff.jumpCount > 0 then
 				-- guaranteed jump
 				eff.jumpCount = eff.jumpCount - 1
@@ -974,7 +974,7 @@ newEffect{
 	end,
 	deactivate = function(self, eff)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1036,7 +1036,7 @@ newEffect{
 	deactivate = function(self, eff)
 		self:removeTemporaryValue("resists", eff.damageId)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1059,7 +1059,7 @@ newEffect{
 	deactivate = function(self, eff)
 		eff.terrifiedId = self:removeTemporaryValue("terrified", eff.terrifiedId)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1086,7 +1086,7 @@ newEffect{
 		self:removeTemporaryValue("combat_mentalresist", eff.mentalId)
 		self:removeTemporaryValue("combat_spellresist", eff.spellId)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1116,7 +1116,7 @@ newEffect{
 	end,
 	deactivate = function(self, eff)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1142,7 +1142,7 @@ newEffect{
 	end,
 	deactivate = function(self, eff)
 		updateFearParticles(self)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -1230,7 +1230,7 @@ newEffect{
 	end,
 	deactivate = function(self, eff)
 		self:removeParticles(eff.particlesId)
-		
+
 		local tInstillFear = self:getTalentFromId(self.T_INSTILL_FEAR)
 		tInstillFear.endEffect(self, tInstillFear)
 	end,
@@ -2251,3 +2251,47 @@ newEffect{
 		if self.ai then self.ai=eff.ai end
 	end,
 }
+
+newEffect{
+	name = "PSIONIC_SHIELD", image = "talents/kinetic_shield.png",
+	desc = "Psionic Shield",
+	display_desc = function(self, eff) return eff.kind:capitalize().." Psionic Shield" end,
+	long_desc = function(self, eff) return ("Reduces all incoming %s damage by %d."):format(eff.what, eff.power) end,
+	type = "mental",
+	subtype = { psionic=true, shield=true },
+	status = "beneficial",
+	parameters = { power=10, kind="kinetic" },
+	activate = function(self, eff)
+		if eff.kind == "kinetic" then
+			eff.sid = self:addTemporaryValue("flat_damage_armor", {[DamageType.PHYSICAL] = eff.power, [DamageType.ACID] = eff.power})
+			eff.what = "physical and acid"
+		elseif eff.kind == "thermal" then
+			eff.sid = self:addTemporaryValue("flat_damage_armor", {[DamageType.FIRE] = eff.power, [DamageType.COLD] = eff.power})
+			eff.what = "fire and cold"
+		elseif eff.kind == "charged" then
+			eff.sid = self:addTemporaryValue("flat_damage_armor", {[DamageType.LIGHTNING] = eff.power, [DamageType.BLIGHT] = eff.power})
+			eff.what = "lightning and blight"
+		end
+	end,
+	deactivate = function(self, eff)
+		if eff.sid then
+			self:removeTemporaryValue("flat_damage_armor", eff.sid)
+		end
+	end,
+}
+
+newEffect{
+	name = "CLEAR_MIND", image = "talents/aura_discipline.png",
+	desc = "Clear Mind",
+	long_desc = function(self, eff) return ("Nullifies the next %d detrimental mental effects."):format(self.mental_negative_status_effect_immune) end,
+	type = "mental",
+	subtype = { psionic=true, },
+	status = "beneficial",
+	parameters = { power=2 },
+	activate = function(self, eff)
+		self.mental_negative_status_effect_immune = eff.power
+	end,
+	deactivate = function(self, eff)
+		self.mental_negative_status_effect_immune = nil
+	end,
+}
-- 
GitLab