3DMGAME 3DM首页 新闻中心 前瞻 | 评测 游戏库 热门 | 最新 攻略中心 攻略 | 秘籍 下载中心 游戏 | 汉化 购买正版 论坛

注册 登录

QQ登录

只需一步,快速开始

查看: 3081|回复: 12
打印 上一主题 下一主题

[讨论] 如何修改诅咒光环系列里面的效果

  [复制链接]

31

主题

635

帖子

608

积分

超级玩家

Rank: 5Rank: 5

贡献度
40
金元
4480
积分
608
精华
0
注册时间
2009-8-30
跳转到指定楼层
主题
发表于 2012-4-28 10:53 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Talent{
        name = "Defiling Touch",
        type = {"cursed/cursed-aura", 1},
        require = cursed_lev_req1,
        points = 5,
        cooldown = 0,
        no_energy = true,
        no_npc_use = true,
        --no_unlearn_last = true,
        -- list of all curses
        getCurses = function(self, t)
                return { self.EFF_CURSE_OF_CORPSES, self.EFF_CURSE_OF_MADNESS, self.EFF_CURSE_OF_MISFORTUNE, self.EFF_CURSE_OF_NIGHTMARES, self.EFF_CURSE_OF_SHROUDS }
        end,
        -- tests whether or not an item can be cursed (takes into account current talent level unless ignoreLevel = true)
        canCurseItem = function(self, t, item, level)
                if not item:wornInven() then return false end

                -- possible slots:
                -- body, head, feet, hands, cloak, belt (armor)
                -- mainhand (weapon), offhand (weapon/armor;shield), psionic (weapon)
                -- finger (X2), neck (jewelry)
                -- lite (lite), tool (tool), quiver (ammo), gem (alchemist-gem)
                level = level or self:getTalentLevelRaw(t)
                if level >= 1 and item.type == "weapon" then return true end
                if level >= 2 and item.type == "armor" and (item.slot == "BODY" or item.slot == "CLOAK")  then return true end
                if level >= 3 and item.type == "armor" and (item.slot == "HEAD" or item.slot == "OFFHAND")  then return true end
                if level >= 4 and item.type == "armor" and (item.slot == "HANDS" or item.slot == "FEET" or item.slot == "BELT")  then return true end

                return false
        end,
        -- curses an item
        curseItem = function(self, t, item)
                if item.curse then return end
                if not t.canCurseItem(self, t, item) then return end

                -- apply the curse
                if item.define_as == "CLOAK_DECEPTION" then
                        -- cloak of deception is always Corpses..
                        item.curse = self.EFF_CURSE_OF_CORPSES
                else
                        local curses = t.getCurses(self, t)
                        item.curse = rng.table(curses)
                end

                local def = self.tempeffect_def[item.curse]
                item.add_name = (item.add_name or "").." ("..def.short_desc..")"
        end,
        -- curses all items on the floor
        curseFloor = function(self, t, x, y)
                local i = 1
                local item = game.level.map:getObject(x, y, i)
                while item do
                        t.curseItem(self, t, item)

                        i = i + 1
                        item = game.level.map:getObject(x, y, i)
                end
        end,
        -- curses all items in inventory
        curseInventory = function(self, t)
                for id, inven in pairs(self.inven) do
                        for i, item in ipairs(inven) do
                                t.curseItem(self, t, item)
                        end
                end
        end,
        -- sets a cursed aura (+2 curse bonus)
        setCursedAura = function(self, t, curse)
                self.cursed_aura = curse
                t.updateCurses(self, t)
        end,
        -- gets the name of the currently set cursed aura
        getCursedAuraName = function(self, t)
                if not self.cursed_aura then
                        return "None"
                else
                        return self.tempeffect_def[self.cursed_aura].desc
                end
        end,
        on_onWear = function(self, t, o)
                t.updateCurses(self, t)
        end,
        on_onTakeOff = function(self, t, o)
                t.updateCurses(self, t)
        end,

        -- chooses whether the player accepts the cursed aura tree when a cursable item is found..only offered once for Afflicted classes
        chooseCursedAuraTree = function(self, t)
                local choose = false
                local x, y, i = self.x, self.y, 1
                local item = game.level.map:getObject(x, y, i)
                while item and not choose do
                        if t.canCurseItem(self, t, item, 1) then
                                choose = true
                        else
                                i = i + 1
                                item = game.level.map:getObject(x, y, i)
                        end
                end

                if choose then
                        game.player:runStop()
                        game.player:restStop()

                        -- don't bother the player when there is an enemy near
                        local grids = core.fov.circle_grids(self.x, self.y, 10, true)
                        for x, yy in pairs(grids) do
                                for y, _ in pairs(grids[x]) do
                                        local actor = game.level.map(x, y, Map.ACTOR)
                                        if actor and self:reactionToward(actor) < 0 and self:hasLOS(actor.x, actor.y) then
                                                choose = false
                                        end
                                end
                        end

                        if choose then
                                self.chooseCursedAuraTree = nil
                                Dialog:yesnoLongPopup(
                                        "Cursed Fate",
                                        ("The %s lying nearby catches your attention. What draws you to it is not the thing itself, but something burning inside you. You feel contempt for it and all worldly things. This feeling is not new but the power of it overwhelms you. You reach out to touch the object, to curse it, to defile it. And you notice it begin to change. The colors of it begin to fade and are replaced with an insatiable hate. For a moment you hesistate. You know you must choose to resist this manifestation of your curse now and forever, or fall further into your madness."):format(item.name),
                                        300,
                                        function(ret)
                                                if ret then
                                                        Dialog:simpleLongPopup("Cursed Fate", (" The %s lies defiled at your feet. An aura of hatred surrounds you and you now feel truly cursed. You have gained the Cursed Aura talent tree and 1 point in Defiling Touch, but at the cost of 2 Willpower."):format(item.name), 300)
                                                        self:learnTalentType("cursed/cursed-aura", true)
                                                        self:learnTalent(self.T_DEFILING_TOUCH, true, 1, {no_unlearn=true})
                                                        self.inc_stats[self.STAT_WIL] = self.inc_stats[self.STAT_WIL] - 2
                                                        selfnStatChange(self.STAT_WIL, -2)
                                                        t.curseItem(self, t, item)
                                                        t.curseInventory(self, t)
                                                        t.curseFloor(self, t, self.x, self.y)
                                                        t.updateCurses(self, t, false)
                                                else
                                                        Dialog:simplePopup("Cursed Fate", ("The %s returns to normal and your hate subsides."):format(item.name))
                                                end
                                        end,
                                        "Release your hate upon the object",
                                        "Suppress your affliction")
                        end
                end
        end,
        -- updates the state of all curse effects
        updateCurses = function(self, t, forceUpdateEffects)
                local curses = t.getCurses(self, t)
                local itemCounts = {}
                local armorCount = 0

                -- count curses in worn items, but only if we can still curse that type of item
                for id, inven in pairs(self.inven) do
                        if self.inven_def[id].is_worn then
                                for i, item in ipairs(inven) do
                                        if item.curse and t.canCurseItem(self, t, item) then
                                                if item.type == "armor" then armorCount = armorCount + 1 end

                                                itemCounts[item.curse] = (itemCounts[item.curse] or 0) + 1
                                        end
                                end
                        end
                end

                -- add cursed aura
                if self.cursed_aura then
                        itemCounts[self.cursed_aura] = (itemCounts[self.cursed_aura] or 0) + 2
                end

                -- update cursed effect levels
                local tDarkGifts = self:getTalentFromId(self.T_DARK_GIFTS)
                for i, curse in ipairs(curses) do
                        local eff = self:hasEffect(curse)
                        local level = itemCounts[curse] or 0
                        local currentLevel = eff and eff.level or 0

                        --print("* curse:", self.tempeffect_def[curse].desc, currentLevel, "->", level, eff)
                        if currentLevel ~= level or forceUpdateEffects then
                                if eff then
                                        self:removeEffect(curse, false, true)
                                end

                                -- preserve the old eff values when re-starting the effect
                                if level > 0 then
                                        if not eff then
                                                eff = { def = self.tempeffect_def[curse] }
                                        end
                                        eff.level = math.min(5, level)
                                        eff.unlockLevel = math.min(5, tDarkGifts and self:getTalentLevelRaw(tDarkGifts) or 0)

                                        self:setEffect(curse, 1, eff)
                                end

                                self.changed = true
                        end
                end
        end,
        on_learn = function(self, t)
                t.curseInventory(self, t)
                t.curseFloor(self, t, self.x, self.y)
                t.updateCurses(self, t)
        end,
        on_unlearn = function(self, t)
                -- turn off cursed aura (which gets disabled, but does not turn off)
                t.setCursedAura(self, t, nil)
        end,
        on_pre_use = function(self, t, silent)
                return self:getTalentLevelRaw(t) >= 5
        end,
        -- selects a new cursed aura (+2 curse bonus)
        action = function(self, t)
                local cursedAuraSelect = require("mod.dialogs.CursedAuraSelect").new(self)
                game:registerDialog(cursedAuraSelect)
        end,
        info = function(self, t)
                return ([[Your defiling touch permeates everything around you, imparting a random curse on each item you find. When you equip a cursed item, you gain the effects of that curse. Multiple items with the same curse increase the power of those effects up to a maximum level of 5. Initially curses are harmful, but powerful benefits can be unlocked with multiple items and the Dark Gifts.
At level 1 you gain the ability to curse weapons.
At level 2 you gain the ability to curse body armor and cloaks.
At level 3 you gain the ability to curse shields and helmets.
At level 4 you gain the ability to curse gloves, boots and belts.
At level 5 you can activate this talent to surround yourself with an aura that adds 2 levels to a curse of your choosing. (Currently %s)]]):format(t.getCursedAuraName(self, t))
        end,
}

——————————————————————————————————————————————————————
以上是光环系中第一个技能的代码,我的思路是通过修改诅咒之触的5级后增加任何诅咒2个等级这个来解决,就是直接增加到所有诅咒等级满5,但是上面代码无论如何也找不到啊。。。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|3DMGAME ( 京ICP备14006952号-1  沪公网安备 31011202006753号

GMT+8, 2026-4-10 13:17 , Processed in 0.037816 second(s), 16 queries , Memcached On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表