diff --git a/game/engines/default/engine/interface/ActorAI.lua b/game/engines/default/engine/interface/ActorAI.lua index 64c07674b0b0c3e9accb581324b92a01fd6700e7..a58421319f0f8657edb7e7bc56b40a751f4b2b06 100644 --- a/game/engines/default/engine/interface/ActorAI.lua +++ b/game/engines/default/engine/interface/ActorAI.lua @@ -138,7 +138,8 @@ end --- Returns the current target function _M:getTarget(typ) local tx, ty = self:aiSeeTargetPos(self.ai_target.actor) - return tx, ty, self.ai_target.actor + local target = game.level.map(tx, ty, Map.ACTOR) + return tx, ty, target end --- Sets the current target diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 714505e537d1fe8ff7eed829b77eba72df631650..8d61d7cee35a2add9ebfc1492dc89ed0c15bd2d3 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -833,7 +833,6 @@ function _M:magicMap(radius, x, y, checker) self:computeFOV(radius, "block_sense", function(x, y) if not checker or checker(x, y) then game.level.map.remembers(x, y, true) - game.level.map.has_seens(x, y, true) end end, true, true, true) @@ -1287,8 +1286,10 @@ function _M:onTakeHit(value, src) local eff = self:hasEffect(self.EFF_FROZEN) eff.hp = eff.hp - value * 0.4 value = value * 0.6 - if eff.hp < 0 and not eff.begone then game:onTickEnd(function() self:removeEffect(self.EFF_FROZEN) end) end - eff.begone = game.turn + if eff.hp < 0 and not eff.begone then + game:onTickEnd(function() self:removeEffect(self.EFF_FROZEN) end) + eff.begone = game.turn + end end -- Adds hate @@ -2033,7 +2034,7 @@ end function _M:onWear(o, bypass_set) o.wielded = {} - o:forAllStack(function(so) so.__transmo = false end) + if self.player then o:forAllStack(function(so) so.__transmo = false end) end if o.set_list and not bypass_set then local list = {} diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 9d3bff961c0f2821f7bbd3a54f2bc3ae497f963b..84b6fb1935015e651a58ef09c89e807821d162a7 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -543,7 +543,15 @@ end --- Tries to get a target from the user function _M:getTarget(typ) if self:attr("encased_in_ice") then - return self.x, self.y, self + local orig_range = typ.range + typ.range = 0 + local x, y, act = game:targetGetForPlayer(typ) + typ.range = orig_range + if x then + return self.x, self.y, self + else + return + end else return game:targetGetForPlayer(typ) end diff --git a/game/modules/tome/data/chats/sorcerer-end.lua b/game/modules/tome/data/chats/sorcerer-end.lua index e50f622bb469a3df9a6275683198e3752c9d67e5..f22ac929d570bfa23bb5ab2fb71ec7ad88ccc726 100644 --- a/game/modules/tome/data/chats/sorcerer-end.lua +++ b/game/modules/tome/data/chats/sorcerer-end.lua @@ -48,9 +48,9 @@ The Way will never forget you. Now go and make history! answers = { {"#LIGHT_GREEN#[sacrifice yourself to bring the Way to every sentient creature.]", action=function(npc, player) player.no_resurrect = true - player:die(player) player:setQuestStatus("high-peak", engine.Quest.COMPLETED, "yeek") player:hasQuest("high-peak"):win("yeek-sacrifice") + player:die(player) end}, {"But... I did so much, I could do so much more for the Way by staying alive!", jump="yeek-unsure"}, } @@ -63,9 +63,9 @@ You will do as asked, for the good of all Yeeks! The Way is always right. answers = { {"#LIGHT_GREEN#[sacrifice yourself to bring the Way to every sentient creature.]", action=function(npc, player) player.no_resurrect = true - player:die(player) player:setQuestStatus("high-peak", engine.Quest.COMPLETED, "yeek") player:hasQuest("high-peak"):win("yeek-sacrifice") + player:die(player) end}, } } @@ -88,8 +88,8 @@ After searching the remains of the Sorcerers you find a note explaining that the {"Aeryn, I am sorry but one of us needs to be sacrificed for the world to go on. #LIGHT_GREEN#[sacrifice Aeryn for the sake of the world]", jump="aeryn-sacrifice", cond=aeryn_alive}, {"I will close it. #LIGHT_GREEN#[sacrifice yourself for the sake of the world]", action=function(npc, player) player.no_resurrect = true - player:die(player) player:hasQuest("high-peak"):win("self-sacrifice") + player:die(player) end}, } } diff --git a/game/modules/tome/data/damage_types.lua b/game/modules/tome/data/damage_types.lua index ed6b3d4b594e2dff8af6331238c10b396b6950d6..1970dda2935109d4a7d36e560bb0f907f98d1938 100644 --- a/game/modules/tome/data/damage_types.lua +++ b/game/modules/tome/data/damage_types.lua @@ -962,11 +962,16 @@ newDamageType{ -- Poisoning damage newDamageType{ name = "poison", type = "POISON", - projector = function(src, x, y, type, dam) + projector = function(src, x, y, t, dam) + local power + if type(dam) == "table" then + power = dam.apply_power + dam = dam.dam + end local realdam = DamageType:get(DamageType.NATURE).projector(src, x, y, DamageType.NATURE, dam / 6) local target = game.level.map(x, y, Map.ACTOR) if target and target:canBe("poison") then - target:setEffect(target.EFF_POISONED, 5, {src=src, power=dam / 6, apply_power=src.combatAttack and src:combatAttack() or 0}) + target:setEffect(target.EFF_POISONED, 5, {src=src, power=dam / 6, apply_power=power or (src.combatAttack and src:combatAttack()) or 0}) end return realdam end, diff --git a/game/modules/tome/data/maps/wilderness/eyal.lua b/game/modules/tome/data/maps/wilderness/eyal.lua index 8797c3e0a99a59d0afaf61af4449d1df5a5f220b..2a34eae2fb24af6942069fb9054c836bd98802e1 100644 --- a/game/modules/tome/data/maps/wilderness/eyal.lua +++ b/game/modules/tome/data/maps/wilderness/eyal.lua @@ -80,7 +80,7 @@ if game.player:knowTalent(game.player.T_TELEPORT_ANGOLWEN) then defineTile('ango -- Zigur is only know from the start to non casters if not game.player:knowTalent(game.player.T_MANA_POOL) and not game.player:knowTalent(game.player.T_VIM_POOL) and not game.player:knowTalent(game.player.T_VIM_POOL) and not game.player:knowTalent(game.player.T_NEGATIVE_POOL) and not game.player:knowTalent(game.player.T_POSITIVE_POOL) and not game.player:knowTalent(game.player.T_PARADOX_POOL) and not game.player:attr("undead") then defineTile('zigur', "TOWN_ZIGUR") else quickEntity('zigur', ')') end -- Iron Council is only known to dwarves -if game.player:knowTalent(game.player.T_DWARF_RESILIENCE) then defineTile('iron-council', "TOWN_IRON_COUNCIL") else quickEntity('iron-council', '#') end +if game.player.descriptor.race == "Dwarf" then defineTile('iron-council', "TOWN_IRON_COUNCIL") else quickEntity('iron-council', '#') end -- Far East diff --git a/game/modules/tome/data/talents/corruptions/blight.lua b/game/modules/tome/data/talents/corruptions/blight.lua index 5a29347af66616e83356ff2e89b8cd7e9ab1565a..a70a041d941210f3ad30391cebc4499927c4e13f 100644 --- a/game/modules/tome/data/talents/corruptions/blight.lua +++ b/game/modules/tome/data/talents/corruptions/blight.lua @@ -157,10 +157,11 @@ newTalent{ local duration = 5 + self:getTalentLevel(t) local radius = self:getTalentRadius(t) local dam = self:combatTalentSpellDamage(t, 12, 130) + local actor = self -- Add a lasting map effect game.level.map:addEffect(self, self.x, self.y, duration, - DamageType.POISON, dam, + DamageType.POISON, {dam=dam, apply_power=actor:combatSpellpower()}, radius, 5, nil, engine.Entity.new{alpha=100, display='', color_br=20, color_bg=220, color_bb=70}, diff --git a/game/modules/tome/data/talents/cunning/dirty.lua b/game/modules/tome/data/talents/cunning/dirty.lua index 213b84aff3aee74db0938c36132c4a6d15b596a6..d7f0a0f50e51cbb447bc73ba09a4b5e4729629af 100644 --- a/game/modules/tome/data/talents/cunning/dirty.lua +++ b/game/modules/tome/data/talents/cunning/dirty.lua @@ -89,7 +89,7 @@ newTalent{ local tx, ty, sx, sy = target.x, target.y, self.x, self.y local hitted = self:attackTarget(target, nil, 0, true) - if hitted then + if hitted and not self.dead then self:setEffect(self.EFF_EVASION, t.getDuration(self, t), {chance=50}) -- Displace diff --git a/game/modules/tome/data/talents/cunning/traps.lua b/game/modules/tome/data/talents/cunning/traps.lua index f365ec18e3dcbb7c83f05f0f4e5b08e7dd899db0..1927f2cbe2dbd01ab0633c1b1da4a0b77eb177df 100644 --- a/game/modules/tome/data/talents/cunning/traps.lua +++ b/game/modules/tome/data/talents/cunning/traps.lua @@ -529,15 +529,17 @@ newTalent{ local dam = 20 + self:getCun() * 0.5 * self:getTalentLevel(self.T_TRAP_MASTERY) + -- Need to pass the actor in to the triggered function for the apply_power to work correctly local t = basetrap(self, t, x, y, 8 + self:getTalentLevel(self.T_TRAP_MASTERY), { type = "nature", name = "poison gas trap", color=colors.LIGHT_RED, image = "trap/blast_acid01.png", dam = dam, + check_hit = self:combatAttack(), lure_trigger = true, triggered = function(self, x, y, who) -- Add a lasting map effect - game.level.map:addEffect(self, + game.level.map:addEffect(actor, x, y, 4, - engine.DamageType.POISON, self.dam, + engine.DamageType.POISON, {dam=self.dam, apply_power=self.check_hit}, 3, 5, nil, {type="vapour"}, diff --git a/game/modules/tome/data/talents/gifts/summon-distance.lua b/game/modules/tome/data/talents/gifts/summon-distance.lua index aa43ca99151a423dc4054751659fc5d641abe2f9..8030af8c5edb8578baefaf89f6b50f1f1b43547a 100644 --- a/game/modules/tome/data/talents/gifts/summon-distance.lua +++ b/game/modules/tome/data/talents/gifts/summon-distance.lua @@ -327,7 +327,7 @@ newTalent{ self:project(tg, m.x, m.y, DamageType.TEMP_EFFECT, {foes=true, eff=self.EFF_LOWER_FIRE_RESIST, dur=4+self:getTalentLevelRaw(t), p={power=self:combatTalentMindDamage(t, 15, 70)}}, {type="flame"}) game.level.map:addEffect(self, m.x, m.y, 6, - DamageType.POISON, self:combatTalentMindDamage(t, 10, 40), + DamageType.POISON, {dam=self:combatTalentMindDamage(t, 10, 40), apply_power=self:combatMindpower()}, self:getTalentRadius(t), 5, nil, {type="vapour"}, diff --git a/game/modules/tome/data/talents/misc/inscriptions.lua b/game/modules/tome/data/talents/misc/inscriptions.lua index 75de8a06eb67e027ada44f6ee9681f8c9b6872b9..faec704dcf6c5350f02e3f74b66bc2638f6452e5 100644 --- a/game/modules/tome/data/talents/misc/inscriptions.lua +++ b/game/modules/tome/data/talents/misc/inscriptions.lua @@ -799,7 +799,8 @@ newInscription{ local damage = t.getDamage(self, t) local duration = t.getDuration(self, t) return ([[Inflicts %0.2f temporal damage. If your target survives it will be sent %d turns into the future. - It will also lower your paradox by 120 (if you have any).]]):format(damDesc(self, DamageType.TEMPORAL, damage), duration) + It will also lower your paradox by 120 (if you have any). + Note that messing with the spacetime continuum may have unforeseen consequences.]]):format(damDesc(self, DamageType.TEMPORAL, damage), duration) end, short_info = function(self, t) return ("%0.2f temporal damage, removed from time %d turns"):format(t.getDamage(self, t), t.getDuration(self, t)) diff --git a/game/modules/tome/data/talents/misc/misc.lua b/game/modules/tome/data/talents/misc/misc.lua index 66d5f173a5bdd6f5ce2372e9f1df5457ab7b20d4..67db623597dd5770990d5f44a7a7ecd8d18272b3 100644 --- a/game/modules/tome/data/talents/misc/misc.lua +++ b/game/modules/tome/data/talents/misc/misc.lua @@ -213,7 +213,7 @@ newTalent{ for eff_id, p in pairs(target.tmp) do local e = target.tempeffect_def[eff_id] if e.status == "detrimental" and save_for_effects[e.type] then - local save = self[save_for_effects[e.type]](self) + local save = self[save_for_effects[e.type]](self, true) local decrease = math.floor(save/5) print("About to reduce duration of... %s. Will use %s. Reducing duration by %d", e.desc, save_for_effects[e.type]) p.dur = p.dur - decrease @@ -227,9 +227,9 @@ newTalent{ return true end, info = function(self, t) - local physical_reduction = math.floor(self:combatPhysicalResist()/5) - local spell_reduction = math.floor(self:combatSpellResist()/5) - local mental_reduction = math.floor(self:combatMentalResist()/5) + local physical_reduction = math.floor(self:combatPhysicalResist(true)/5) + local spell_reduction = math.floor(self:combatSpellResist(true)/5) + local mental_reduction = math.floor(self:combatMentalResist(true)/5) return ([[Not the Master himself, nor all the orcs in fallen Reknor, nor even the terrifying unknown beyond Reknor's portal could slow your pursuit of the Staff of Absorption. Children will hear of your relentlessness in song for years to come. When activated, this ability reduces the duration of all active detrimental effects by the appropriate saving throw duration reduction. diff --git a/game/modules/tome/data/talents/spells/golemancy.lua b/game/modules/tome/data/talents/spells/golemancy.lua index 583c14d7c20ee7f74c14ec6b9ffee30461849640..cede45bc1d72f0b4f6101a30acfdacc60b856986 100644 --- a/game/modules/tome/data/talents/spells/golemancy.lua +++ b/game/modules/tome/data/talents/spells/golemancy.lua @@ -262,10 +262,11 @@ newTalent{ self.alchemy_golem.talents[Talents.T_WEAPON_COMBAT], self.alchemy_golem.talents[Talents.T_WEAPONS_MASTERY] = 2 + rawlev * 2, rawlev * 2 local ta, td = self:getTalentFromId(Talents.T_WEAPON_COMBAT), self:getTalentFromId(Talents.T_WEAPONS_MASTERY) local attack = ta.getAttack(self.alchemy_golem, ta) - local damage = td.getDamage(self.alchemy_golem, td) + local power = td.getDamage(self.alchemy_golem, td) + local damage = td.getPercentInc(self.alchemy_golem, td) self.alchemy_golem.talents[Talents.T_WEAPON_COMBAT], self.alchemy_golem.talents[Talents.T_WEAPONS_MASTERY] = olda, oldd - return ([[Improves your golem's proficiency with weapons, increasing its attack by %d and damage by %d%%.]]): - format(attack, 100 * damage) + return ([[Improves your golem's proficiency with weapons, increasing its attack by %d, physical power by %d and damage by %d%%.]]): + format(attack, power, 100 * damage) end, } @@ -299,7 +300,7 @@ newTalent{ local heavyarmor = ta.getArmor(self.alchemy_golem, ta) local hardiness = ta.getArmorHardiness(self.alchemy_golem, ta) local crit = ta.getCriticalChanceReduction(self.alchemy_golem, ta) - self.alchemy_golem.talents[Talents.T_THICK_SKIN], self.alchemy_golem.talents[Talents.T_ARMOUR_TRAINING] = olda, oldh + self.alchemy_golem.talents[Talents.T_THICK_SKIN], self.alchemy_golem.talents[Talents.T_ARMOUR_TRAINING] = oldh, olda return ([[Improves your golem's armour training and damage resistance. Increases all damage resistance by %d%%, increases armour value by %d, reduces chance to be critically hit by %d%% when wearing a heavy mail armour or a massive plate armour, increases armour hardiness by %d%% and increases healing factor by %d%%. diff --git a/game/modules/tome/data/zones/temporal-rift/zone.lua b/game/modules/tome/data/zones/temporal-rift/zone.lua index a2ad886c576d0823a600eb437ad1587ef8a18627..8ef72991fc067e8bb2fbf7553f54de252c9d5153 100644 --- a/game/modules/tome/data/zones/temporal-rift/zone.lua +++ b/game/modules/tome/data/zones/temporal-rift/zone.lua @@ -147,6 +147,11 @@ return { end, portal_next = function(npc) + -- Remove any special terrain already there, for example Volcano + local old = game.level.map(npc.x, npc.y, engine.Map.TERRAIN) + if game.level:hasEntity(old) then + game.level:removeEntity(old) + end local g = game.zone:makeEntityByName(game.level, "terrain", "RIFT") game.zone:addEntity(game.level, g, "terrain", npc.x, npc.y) end, diff --git a/game/modules/tome/dialogs/UseTalents.lua b/game/modules/tome/dialogs/UseTalents.lua index 9a150e445905ca62030a5e7048e145828b6cdbd5..d6fda8102a0e3cd9600d6ec42f9e7f9d190a42d9 100644 --- a/game/modules/tome/dialogs/UseTalents.lua +++ b/game/modules/tome/dialogs/UseTalents.lua @@ -242,7 +242,7 @@ function _M:generateList() if self.actor:isTalentCoolingDown(t) then nodes = cooldowns status = tstring{{"color", "LIGHT_RED"}, self.actor:isTalentCoolingDown(t).." turns"} - elseif not self.actor:preUseTalent(t) then + elseif not self.actor:preUseTalent(t, true, true) then nodes = unavailables status = tstring{{"color", "GREY"}, "Unavailable"} elseif t.mode == "sustained" then