Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tome
Tales of MajEyal
Commits
3e284592
Commit
3e284592
authored
8 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
New Actor:alterTalentCost method
parent
6bb271be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game/modules/tome/class/Actor.lua
+10
-0
10 additions, 0 deletions
game/modules/tome/class/Actor.lua
with
10 additions
and
0 deletions
game/modules/tome/class/Actor.lua
+
10
−
0
View file @
3e284592
...
...
@@ -4811,6 +4811,10 @@ function _M:getFeedbackDecay(mult)
end
end
function
_M
:
alterTalentCost
(
t
,
rname
,
cost
)
return
cost
end
--- Called before a talent is used
-- Check the actor can cast it
-- @param ab the talent (not the id, the table)
...
...
@@ -4879,6 +4883,7 @@ function _M:preUseTalent(ab, silent, fake)
cost
=
ab
[
res_def
.
sustain_prop
]
if
cost
then
cost
=
util
.
getval
(
cost
,
self
,
ab
)
or
0
cost
=
self
:
alterTalentCost
(
ab
,
res_def
.
sustain_prop
,
cost
)
rmin
,
rmax
=
self
[
res_def
.
getMinFunction
](
self
),
self
[
res_def
.
getMaxFunction
](
self
)
if
cost
~=
0
and
self
[
res_def
.
minname
]
and
self
[
res_def
.
maxname
]
and
self
[
res_def
.
minname
]
+
cost
>
self
[
res_def
.
maxname
]
then
if
not
silent
then
game
.
logPlayer
(
self
,
"You %s %s to activate %s."
,
res_def
.
invert_values
and
"have too much committed"
or
"do not have enough uncommitted"
,
res_def
.
name
,
ab
.
name
)
end
...
...
@@ -4908,6 +4913,7 @@ function _M:preUseTalent(ab, silent, fake)
cost
=
ab
[
rname
]
if
cost
then
cost
=
(
util
.
getval
(
cost
,
self
,
ab
)
or
0
)
*
(
util
.
getval
(
res_def
.
cost_factor
,
self
,
ab
,
true
)
or
1
)
cost
=
self
:
alterTalentCost
(
ab
,
rname
,
cost
)
if
cost
~=
0
then
rmin
,
rmax
=
self
[
res_def
.
getMinFunction
](
self
),
self
[
res_def
.
getMaxFunction
](
self
)
if
res_def
.
invert_values
then
...
...
@@ -5472,6 +5478,7 @@ function _M:postUseTalent(ab, ret, silent)
for
res
,
res_def
in
ipairs
(
_M
.
resources_def
)
do
rname
=
res_def
.
short_name
cost
=
ab
[
rname
]
and
util
.
getval
(
ab
[
rname
],
self
,
ab
)
or
0
cost
=
self
:
alterTalentCost
(
ab
,
rname
,
cost
)
if
cost
~=
0
then
trigger
=
true
cost
=
cost
*
(
util
.
getval
(
res_def
.
cost_factor
,
self
,
ab
)
or
1
)
...
...
@@ -5716,17 +5723,20 @@ function _M:getTalentFullDescription(t, addlevel, config, fake_mastery)
if
not
res_def
.
hidden_resource
then
-- list resource cost
local
cost
=
t
[
res_def
.
short_name
]
and
util
.
getval
(
t
[
res_def
.
short_name
],
self
,
t
)
or
0
cost
=
self
:
alterTalentCost
(
t
,
res_def
.
short_name
,
cost
)
if
cost
~=
0
then
cost
=
cost
*
(
util
.
getval
(
res_def
.
cost_factor
,
self
,
t
)
or
1
)
d
:
add
({
"color"
,
0x6f
,
0xff
,
0x83
},
(
"%s cost: "
):
format
(
res_def
.
name
:
capitalize
()),
res_def
.
color
or
{
"color"
,
0xff
,
0xa8
,
0xa8
},
""
..
math
.
round
(
cost
,
.
1
),
true
)
end
-- list sustain cost
cost
=
t
[
res_def
.
sustain_prop
]
and
util
.
getval
(
t
[
res_def
.
sustain_prop
],
self
,
t
)
or
0
cost
=
self
:
alterTalentCost
(
t
,
res_def
.
sustain_prop
,
cost
)
if
cost
~=
0
then
d
:
add
({
"color"
,
0x6f
,
0xff
,
0x83
},
(
"Sustain %s cost: "
):
format
(
res_def
.
name
:
lower
()),
res_def
.
color
or
{
"color"
,
0xff
,
0xa8
,
0xa8
},
""
..
math
.
round
(
cost
,
.
1
),
true
)
end
-- list drain cost
cost
=
t
[
res_def
.
drain_prop
]
and
util
.
getval
(
t
[
res_def
.
drain_prop
],
self
,
t
)
or
0
cost
=
self
:
alterTalentCost
(
t
,
res_def
.
drain_prop
,
cost
)
if
cost
~=
0
then
if
res_def
.
invert_values
then
d
:
add
({
"color"
,
0x6f
,
0xff
,
0x83
},
(
"%s %s: "
):
format
(
cost
>
0
and
"Generates"
or
"Removes"
,
res_def
.
name
:
lower
()),
res_def
.
color
or
{
"color"
,
0xff
,
0xa8
,
0xa8
},
""
..
math
.
round
(
math.abs
(
cost
),
.
1
),
true
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment