From 5c94e38f44c64953b2140c85529a315b76c79dfd Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 1 Sep 2010 19:30:37 +0000
Subject: [PATCH] Added potions of free action, they are not cheap but they are
 useful :)

git-svn-id: http://svn.net-core.org/repos/t-engine4@1126 51575b47-30f0-44d4-a5cc-537603b46e54
---
 .../tome/data/general/objects/potions.lua     | 13 ++++++++++++
 game/modules/tome/data/timed_effects.lua      | 20 +++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git a/game/modules/tome/data/general/objects/potions.lua b/game/modules/tome/data/general/objects/potions.lua
index c88df101f3..6815536f58 100644
--- a/game/modules/tome/data/general/objects/potions.lua
+++ b/game/modules/tome/data/general/objects/potions.lua
@@ -284,3 +284,16 @@ newEntity{ base = "BASE_POTION",
 		return "destroy", true
 	end}
 }
+
+newEntity{ base = "BASE_POTION",
+	name = "potion of free action",
+	color = colors.YELLOW,
+	level_range = {15, 50},
+	rarity = 6,
+	cost = 7,
+
+	use_simple = { name="resist stuns, dazes and pinning", use = function(self, who)
+		who:setEffect(who.EFF_FREE_ACTION, 4 + math.floor(who:getMag(3)), {power=1})
+		return "destroy", true
+	end}
+}
diff --git a/game/modules/tome/data/timed_effects.lua b/game/modules/tome/data/timed_effects.lua
index de6224f1f4..74d57d711a 100644
--- a/game/modules/tome/data/timed_effects.lua
+++ b/game/modules/tome/data/timed_effects.lua
@@ -1041,3 +1041,23 @@ newEffect{
 		self:removeTemporaryValue("continuum_destabilization", eff.effid)
 	end,
 }
+
+newEffect{
+	name = "FREE_ACTION",
+	desc = "Free Action",
+	type = "magical",
+	status = "beneficial",
+	parameters = { power=1 },
+	on_gain = function(self, err) return "#Target# is moving freely .", "+Free Action" end,
+	on_lose = function(self, err) return "#Target# is moving less freely.", "-Free Action" end,
+	activate = function(self, eff)
+		eff.stun = self:addTemporaryValue("stun_immune", eff.power)
+		eff.daze = self:addTemporaryValue("daze_immune", eff.power)
+		eff.pin = self:addTemporaryValue("pin_immune", eff.power)
+	end,
+	deactivate = function(self, eff)
+		self:removeTemporaryValue("stun_immune", eff.stun)
+		self:removeTemporaryValue("daze_immune", eff.daze)
+		self:removeTemporaryValue("pin_immune", eff.pin)
+	end,
+}
-- 
GitLab