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
12ad699a
Commit
12ad699a
authored
10 years ago
by
Alex Ksandra
Browse files
Options
Downloads
Patches
Plain Diff
Added the same for sustains.
parent
b9083762
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!63
removeEffectsFilter tweaks
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
game/modules/tome/class/Actor.lua
+68
-0
68 additions, 0 deletions
game/modules/tome/class/Actor.lua
with
68 additions
and
0 deletions
game/modules/tome/class/Actor.lua
+
68
−
0
View file @
12ad699a
...
...
@@ -5563,6 +5563,74 @@ function _M:removeEffectsFilter(t, nb, silent, force)
return
#
eff_ids
end
-- Mix in sustains
local
function
getSustainType
(
talent_def
)
if
talent_def
.
is_mind
then
return
"mental"
elseif
talent_def
.
is_spell
then
return
"spell"
else
return
"sustain_generic"
end
end
function
_M
:
sustainsFilter
(
t
,
nb
)
local
ids
=
{}
for
tid
,
active
in
pairs
(
self
.
sustain_talents
)
do
if
active
then
local
talent
=
self
:
getTalentFromId
(
tid
)
local
ttype
=
getSustainType
(
talent
)
local
test
if
type
(
t
)
==
"function"
then
test
=
t
(
talent
)
else
test
=
(
not
t
.
type
or
t
.
type
==
ttype
)
and
(
not
t
.
types
or
t
.
types
[
ttype
])
end
if
test
then
ids
[
#
ids
+
1
]
=
tid
end
end
end
if
nb
then
local
found
=
{}
while
#
ids
>
0
and
nb
>
0
do
local
tid
=
rng
.
tableRemove
(
ids
)
found
[
#
found
+
1
]
=
tid
nb
=
nb
-
1
end
return
found
else
return
ids
end
end
function
_M
:
removeSustainsFilter
(
t
,
nb
)
local
found
=
self
:
sustainsFilter
(
t
,
nb
)
for
_
,
tid
in
ipairs
(
found
)
do
self
:
forceUseTalent
(
tid
,
{
ignore_energy
=
true
})
end
return
#
found
end
function
_M
:
removeEffectsSustainsFilter
(
t
,
nb
,
allow_other
)
local
objects
=
{}
for
_
,
eff_id
in
ipairs
(
self
:
effectsFilter
(
t
))
do
objects
[
#
objects
+
1
]
=
{
"effect"
,
eff_id
}
end
for
_
,
tid
in
ipairs
(
self
:
sustainsFilter
(
t
))
do
objects
[
#
objects
+
1
]
=
{
"talent"
,
tid
}
end
local
found
if
nb
then
while
#
objects
>
0
and
nb
>
0
do
found
[
#
found
+
1
]
=
rng
.
tableRemove
(
objects
)
nb
=
nb
-
1
end
else
found
=
objects
end
for
_
,
obj
in
ipairs
(
found
)
do
if
obj
[
1
]
==
"effect"
then
self
:
removeEffect
(
obj
[
2
])
else
self
:
forceUseTalent
(
obj
[
2
],
{
ignore_energy
=
true
})
end
end
end
--- Randomly reduce talent cooldowns based on a filter
-- @param t the function to use as a filter on the talent definition or nil to apply to all talents on cooldown
-- @param change the amount to change the cooldown by
...
...
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