ToME: the Tales of Maj'Eyal
http://forums.te4.org/

how do i increase armour?
http://forums.te4.org/viewtopic.php?f=40&t=48455
Page 1 of 1

Author:  Jurriaan [ Sun Dec 10, 2017 8:54 pm ]
Post subject:  how do i increase armour?

I have this talent coded:

Code:
newTalent{
        shortname = 'MOUNTAINTROLLSKIN',
        name = "Mountain Troll Skin",
        type = {"race/mountaintroll", 3},
        require = racial_req3,
        mode = "passive",
        points = 5,
        no_energy = true,
        getArmour = function(self, t) return self:getTalentLevelRaw(t) * 12 end,
        tactical = { DEFEND = 2 },
        action = function(self, t)
                self:addTemporaryValue("combat_armour", t.getArmour(self, t))
                self:addTemporaryValue("combat_armour_hardiness", t.getArmour(self, t))
                return true
        end,

        on_learn = function(self, t)
                if self:getTalentLevelRaw(t) >= 5 then
                        self.size_category = self.size_category + 2
                else
                         if self:getTalentLevelRaw(t) >= 3 then
                                self.size_category = self.size_category + 1
                        end
                end
        end,
        on_unlearn = function(self, t)
                if self:getTalentLevelRaw(t) == 4 then
                        self.size_category = self.size_category - 1
                end
                if self:getTalentLevelRaw(t) == 2 then
                        self.size_category = self.size_category - 1
                end
        end,

        info = function(self, t)
                local armour = t.getArmour(self, t);
                return ([[Mountain Troll-skin is extremely hard and resistant to physical effects (+%d%% armour and %d%% armour hardiness). On talent level 3 and 5, your size will increase by 1.]]):format(armour, armour)
        end,
}


but, armour value does not increase on investing points. I experimented with 'passives =' instead of 'action =' and saw no difference. I experimented with 'self:talentTemporaryValue(p, "combat_armour", t.getArmour(self, t))' but also saw nothing happening.

It must be something simple? Any hints?

Thanks!

Author:  Jurriaan [ Mon Dec 11, 2017 9:35 pm ]
Post subject:  Re: how do i increase armour?

It turns out increasing armour has yet another mechanism:

on_learn
self.combat_armor = self.combat_armor + 12
self.combat_armor_hardiness = self.combat_armor_hardiness + 12

on_unlearn
self.combat_armor = self.combat_armor + 12
self.combat_armor_hardiness = self.combat_armor_hardiness + 12

seems to work.

Author:  HousePet [ Wed Dec 13, 2017 11:34 pm ]
Post subject:  Re: how do i increase armour?

A better way to do it is:
Code:
passives = function(self, t, p)
self:talentTemporaryValue(p, "combat_armor_hardiness", self:getTalentLevel(t) * 12)      
self:talentTemporaryValue(p, "combat_armor", self:getTalentLevel(t) * 12)
end,

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/