From 0ec835c9fa8d842c14a2d3621fc64b2f9771313b Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Wed, 22 Feb 2012 10:43:13 +0000
Subject: [PATCH] Mana Clash cooldown reduced and damage altered Wearing an
 antimagic item also will incur a chance for spell sustain to be disrupted
 every turns

git-svn-id: http://svn.net-core.org/repos/t-engine4@4908 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Actor.lua             | 21 +++++++++++++---
 game/modules/tome/data/damage_types.lua       | 10 ++++----
 .../tome/data/general/objects/bows.lua        | 12 ++++-----
 .../tome/data/general/objects/slings.lua      | 12 ++++-----
 .../tome/data/maps/tutorial/tutorial1.lua     |  2 +-
 .../tome/data/talents/gifts/antimagic.lua     | 25 +++++++++++--------
 game/modules/tome/dialogs/UseTalents.lua      |  8 +++---
 7 files changed, 55 insertions(+), 35 deletions(-)

diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua
index a42f4f08d0..f2da6d4457 100644
--- a/game/modules/tome/class/Actor.lua
+++ b/game/modules/tome/class/Actor.lua
@@ -415,9 +415,21 @@ function _M:act()
 				self:forceUseTalent(tid, {ignore_energy=true})
 			end
 		end
-		-- clear grappling
-		if self:hasEffect(self.EFF_GRAPPLING) and not self:hasEffect(self.EFF_ADRENALINE_SURGE) then
-			self:removeEffect(self.EFF_GRAPPLING)
+	end
+	
+	-- clear grappling
+	if self:hasEffect(self.EFF_GRAPPLING) and self.stamina < 1 and not self:hasEffect(self.EFF_ADRENALINE_SURGE) then
+		self:removeEffect(self.EFF_GRAPPLING)
+	end
+	
+	-- disable spell sustains
+	if self:attr("spell_failure") then
+		for tid, _ in pairs(self.sustain_talents) do
+			local t = self:getTalentFromId(tid)
+			if t.is_spell and rng.percent(self:attr("spell_failure")/10)then
+				self:forceUseTalent(tid, {ignore_energy=true})
+				if not silent then game.logPlayer(self, "%s has been disrupted!", t.name) end
+			end
 		end
 	end
 
@@ -2919,6 +2931,9 @@ function _M:getTalentFullDescription(t, addlevel, config)
 			if t.no_energy and type(t.no_energy) == "boolean" and t.no_energy == true then uspeed = "instant" end
 			d:add({"color",0x6f,0xff,0x83}, "Usage Speed: ", {"color",0xFF,0xFF,0xFF}, uspeed, true)
 		end
+		if t.is_spell then 
+			d:add({"color",0x6f,0xff,0x83}, "Is Spell: ", {"color",0xFF,0xFF,0xFF}, "true", true)
+		end
 	end
 
 	d:add({"color",0x6f,0xff,0x83}, "Description: ", {"color",0xFF,0xFF,0xFF})
diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua
index 223c4afab4..136ad72a34 100644
--- a/game/modules/tome/data/damage_types.lua
+++ b/game/modules/tome/data/damage_types.lua
@@ -1969,10 +1969,10 @@ newDamageType{
 	projector = function(src, x, y, type, dam)
 		local target = game.level.map(x, y, Map.ACTOR)
 		if target then
-			local mana = dam * 2
-			local vim = dam
-			local positive = dam / 2
-			local negative = dam / 2
+			local mana = dam
+			local vim = dam / 2
+			local positive = dam / 4
+			local negative = dam / 4
 
 			mana = math.min(target:getMana(), mana)
 			vim = math.min(target:getVim(), vim)
@@ -1984,7 +1984,7 @@ newDamageType{
 			target:incPositive(-positive)
 			target:incNegative(-negative)
 
-			local dam = math.max(mana, vim * 2, positive * 4, negative * 4) * 1.3
+			local dam = math.max(mana, vim * 2, positive * 4, negative * 4)
 			return DamageType:get(DamageType.ARCANE).projector(src, x, y, DamageType.ARCANE, dam)
 		end
 		return 0
diff --git a/game/modules/tome/data/general/objects/bows.lua b/game/modules/tome/data/general/objects/bows.lua
index 9ba1eda324..43b95d1f7d 100644
--- a/game/modules/tome/data/general/objects/bows.lua
+++ b/game/modules/tome/data/general/objects/bows.lua
@@ -105,7 +105,7 @@ newEntity{
 	type = "ammo", subtype="arrow",
 	add_name = " (#COMBAT_AMMO#)",
 	display = "{", color=colors.UMBER, image = resolvers.image_material("arrow", "wood"),
-	encumber = 0.03,
+	encumber = 5,
 	rarity = 11,
 	combat = {
 		talented = "bow",
@@ -122,7 +122,7 @@ newEntity{ base = "BASE_ARROW",
 	name = "quiver of elm arrows", short_name = "elm",
 	level_range = {1, 10},
 	require = { stat = { dex=11 }, },
-	cost = 0.05,
+	cost = 2,
 	material_level = 1,
 	combat = {
 		capacity = resolvers.rngavg(5, 15),
@@ -137,7 +137,7 @@ newEntity{ base = "BASE_ARROW",
 	name = "quiver of ash arrows", short_name = "ash",
 	level_range = {10, 20},
 	require = { stat = { dex=16 }, },
-	cost = 0.1,
+	cost = 5,
 	material_level = 2,
 	combat = {
 		capacity = resolvers.rngavg(7, 15),
@@ -152,7 +152,7 @@ newEntity{ base = "BASE_ARROW",
 	name = "quiver of yew arrows", short_name = "yew",
 	level_range = {20, 30},
 	require = { stat = { dex=24 }, },
-	cost = 0.15,
+	cost = 10,
 	material_level = 3,
 	combat = {
 		capacity = resolvers.rngavg(9, 15),
@@ -167,7 +167,7 @@ newEntity{ base = "BASE_ARROW",
 	name = "quiver of elven-wood arrows", short_name = "e.wood",
 	level_range = {30, 40},
 	require = { stat = { dex=35 }, },
-	cost = 0.25,
+	cost = 15,
 	material_level = 4,
 	combat = {
 		capacity = resolvers.rngavg(11, 15),
@@ -182,7 +182,7 @@ newEntity{ base = "BASE_ARROW",
 	name = "quiver of dragonbone arrows", short_name = "dragonbone",
 	level_range = {40, 50},
 	require = { stat = { dex=48 }, },
-	cost = 0.35,
+	cost = 25,
 	material_level = 5,
 	combat = {
 		capacity = resolvers.rngavg(13, 15),
diff --git a/game/modules/tome/data/general/objects/slings.lua b/game/modules/tome/data/general/objects/slings.lua
index 10f6346123..8a2397cc86 100644
--- a/game/modules/tome/data/general/objects/slings.lua
+++ b/game/modules/tome/data/general/objects/slings.lua
@@ -104,7 +104,7 @@ newEntity{
 	type = "ammo", subtype="shot",
 	add_name = " (#COMBAT_AMMO#)",
 	display = "{", color=colors.UMBER, image = resolvers.image_material("shot", "metal"),
-	encumber = 0.03,
+	encumber = 5,
 	rarity = 11,
 	combat = { talented = "sling", damrange = 1.2},
 	proj_image = resolvers.image_material("shot_s", "metal"),
@@ -118,7 +118,7 @@ newEntity{ base = "BASE_SHOT",
 	name = "pouch of iron shots", short_name = "iron",
 	level_range = {1, 10},
 	require = { stat = { dex=11 }, },
-	cost = 0.05,
+	cost = 2,
 	material_level = 1,
 	combat = {
 		capacity = resolvers.rngavg(10, 25),
@@ -133,7 +133,7 @@ newEntity{ base = "BASE_SHOT",
 	name = "pouch of steel shots", short_name = "steel",
 	level_range = {10, 20},
 	require = { stat = { dex=16 }, },
-	cost = 0.10,
+	cost = 5,
 	material_level = 2,
 	combat = {
 		capacity = resolvers.rngavg(12, 25),
@@ -148,7 +148,7 @@ newEntity{ base = "BASE_SHOT",
 	name = "pouch of dwarven-steel shots", short_name = "d.steel",
 	level_range = {20, 30},
 	require = { stat = { dex=24 }, },
-	cost = 0.15,
+	cost = 10,
 	material_level = 3,
 	combat = {
 		capacity = resolvers.rngavg(14, 25),
@@ -163,7 +163,7 @@ newEntity{ base = "BASE_SHOT",
 	name = "pouch of stralite shots", short_name = "stralite",
 	level_range = {30, 40},
 	require = { stat = { dex=35 }, },
-	cost = 0.25,
+	cost = 15,
 	material_level = 4,
 	combat = {
 		capacity = resolvers.rngavg(16, 25),
@@ -178,7 +178,7 @@ newEntity{ base = "BASE_SHOT",
 	name = "pouch of voratun shots", short_name = "voratun",
 	level_range = {40, 50},
 	require = { stat = { dex=48 }, },
-	cost = 0.35,
+	cost = 25,
 	material_level = 5,
 	combat = {
 		capacity = resolvers.rngavg(18, 25),
diff --git a/game/modules/tome/data/maps/tutorial/tutorial1.lua b/game/modules/tome/data/maps/tutorial/tutorial1.lua
index b22a29e448..d63190d9c9 100644
--- a/game/modules/tome/data/maps/tutorial/tutorial1.lua
+++ b/game/modules/tome/data/maps/tutorial/tutorial1.lua
@@ -28,7 +28,7 @@ defineTile("S", "GRASS", nil, {random_filter={type="animal", subtype="snake", ma
 defineTile("T", "GRASS", nil, "TUTORIAL_NPC_TROLL", nil)
 defineTile("L", "GRASS", nil, "TUTORIAL_NPC_LONE_WOLF", nil)
 defineTile("1", "GRASS", nil, nil, "TUTORIAL_MELEE")
-defineTile("|", "GRASS", {random_filter={name="elm arrow"}}, nil, nil)
+defineTile("|", "GRASS", {random_filter={name="quiver of elm arrows"}}, nil, nil)
 defineTile("2", "GRASS", {random_filter={name="regeneration infusion"}}, nil, "TUTORIAL_OBJECTS")
 defineTile("3", "GRASS", nil, nil, "TUTORIAL_TALENTS")
 defineTile("4", "GRASS", nil, nil, "TUTORIAL_LEVELUP")
diff --git a/game/modules/tome/data/talents/gifts/antimagic.lua b/game/modules/tome/data/talents/gifts/antimagic.lua
index dd7d7635f4..4211ea7b77 100644
--- a/game/modules/tome/data/talents/gifts/antimagic.lua
+++ b/game/modules/tome/data/talents/gifts/antimagic.lua
@@ -124,32 +124,37 @@ newTalent{
 	require = gifts_req4,
 	points = 5,
 	equilibrium = 10,
-	cooldown = 10,
+	cooldown = 6,
 	range = 10,
 	tactical = { ATTACK = { ARCANE = 3 } },
+	direct_hit = true,
+	requires_target = true,
+	target = function(self, t)
+		return {type="hit", range=self:getTalentRange(t), talent=t}
+	end,
 	action = function(self, t)
-		local tg = {type="bolt", range=self:getTalentRange(t), talent=t}
-		local x, y = self:getTarget(tg)
+		local tg = self:getTalentTarget(t)
+		local x, y, target = self:getTarget(tg)
 		if not x or not y then return nil end
 		self:project(tg, x, y, function(px, py)
 			local target = game.level.map(px, py, Map.ACTOR)
 			if not target then return end
 
-			local base = self:combatTalentMindDamage(t, 20, 230)
+			local base = self:combatTalentMindDamage(t, 40, 460)
 			DamageType:get(DamageType.MANABURN).projector(self, px, py, DamageType.MANABURN, base)
 		end, nil, {type="slime"})
 		game:playSoundNear(self, "talents/heal")
 		return true
 	end,
 	info = function(self, t)
-		local base = self:combatTalentMindDamage(t, 20, 230)
-		local mana = base * 2
-		local vim = base
-		local positive = base / 2
-		local negative = base / 2
+		local base = self:combatTalentMindDamage(t, 40, 460)
+		local mana = base
+		local vim = base / 2
+		local positive = base / 4
+		local negative = base / 4
 
 		return ([[Drain %d mana, %d vim, %d positive and negative energies from your target, triggering a chain reaction that explodes in a burst of arcane damage.
-		The damage done is 130%% of the mana drained, 260%% of the vim drained, 520%% of the positive or negative energy drained, whichever is higher.
+		The damage done is equal to 100%% of the mana drained, 200%% of the vim drained, or 400%% of the positive or negative energy drained, whichever is higher.
 		The effect will increase with your Mindpower.]]):
 		format(mana, vim, positive, negative)
 	end,
diff --git a/game/modules/tome/dialogs/UseTalents.lua b/game/modules/tome/dialogs/UseTalents.lua
index d8c1657922..0a187f1710 100644
--- a/game/modules/tome/dialogs/UseTalents.lua
+++ b/game/modules/tome/dialogs/UseTalents.lua
@@ -237,9 +237,9 @@ function _M:generateList()
 
 	-- Find all talents of this school
 	for j, t in pairs(self.actor.talents_def) do
-		if self.actor:knowTalent(t.id) then
+		if self.actor:knowTalent(t.id) and not t.hide then
 			local typename = "talent"
-			local nodes = t.mode == "sustained" and sustains or actives
+			local nodes = (t.mode == "sustained" and sustains) or (t.mode =="passives" and passives) or actives
 			local status = tstring{{"color", "LIGHT_GREEN"}, "Active"}
 			if self.actor:isTalentCoolingDown(t) then
 				nodes = cooldowns
@@ -250,9 +250,9 @@ function _M:generateList()
 			elseif t.mode == "sustained" then
 				if self.actor:isTalentActive(t.id) then nodes = sustained end
 				status = self.actor:isTalentActive(t.id) and tstring{{"color", "YELLOW"}, "Sustaining"} or tstring{{"color", "LIGHT_GREEN"}, "Sustain"}
-			elseif t.mode == "passive" and not t.hide then
+			elseif t.mode == "passive" then
 				nodes = passives
-				status = tstring{{"color", "BLUE"}, "Passive"}
+				status = tstring{{"color", "LIGHT_BLUE"}, "Passive"}
 			end
 
 			-- Pregenenerate icon with the Tiles instance that allows images
-- 
GitLab