Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Otowa Kotori
Tales of MajEyal
Commits
ebe69f9d
Commit
ebe69f9d
authored
15 years ago
by
dg
Browse files
Options
Downloads
Patches
Plain Diff
resting
git-svn-id:
http://svn.net-core.org/repos/t-engine4@221
51575b47-30f0-44d4-a5cc-537603b46e54
parent
f98c055d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
game/engine/interface/PlayerRest.lua
+9
-4
9 additions, 4 deletions
game/engine/interface/PlayerRest.lua
game/modules/tome/class/Player.lua
+10
-9
10 additions, 9 deletions
game/modules/tome/class/Player.lua
with
19 additions
and
13 deletions
game/engine/interface/PlayerRest.lua
+
9
−
4
View file @
ebe69f9d
...
...
@@ -25,8 +25,9 @@ end
function
_M
:
restStep
()
if
not
self
.
resting
then
return
false
end
if
not
self
:
restCheck
()
then
self
:
restStop
()
local
ret
,
msg
=
self
:
restCheck
()
if
not
ret
then
self
:
restStop
(
msg
)
return
false
else
self
:
useEnergy
()
...
...
@@ -43,12 +44,16 @@ function _M:restCheck()
end
--- Stops resting
function
_M
:
restStop
()
function
_M
:
restStop
(
msg
)
if
not
self
.
resting
then
return
false
end
game
:
unregisterDialog
(
self
.
resting
.
dialog
)
game
.
log
(
"Rested for %d turns."
,
self
.
resting
.
cnt
)
if
msg
then
game
.
log
(
"Rested for %d turns (stop reason: %s)."
,
self
.
resting
.
cnt
,
msg
)
else
game
.
log
(
"Rested for %d turns."
,
self
.
resting
.
cnt
)
end
self
.
resting
=
nil
return
true
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/class/Player.lua
+
10
−
9
View file @
ebe69f9d
...
...
@@ -151,17 +151,18 @@ end
--- Can we continue resting ?
-- We can rest if no hostiles are in sight, and if we need life/mana/stamina (and their regen rates allows them to fully regen)
function
_M
:
restCheck
()
local
seen
=
false
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent resting
core
.
fov
.
calc_circle
(
self
.
x
,
self
.
y
,
20
,
game
.
level
.
map
.
opaque
,
function
(
map
,
x
,
y
)
local
actor
=
map
(
x
,
y
,
map
.
ACTOR
)
if
actor
and
self
:
reactionToward
(
actor
)
<
0
and
self
:
canSee
(
actor
)
then
seen
=
true
end
end
,
game
.
level
.
map
)
if
seen
then
return
false
,
"hostile spotted"
end
-- Check ressources, make sure they CAN go up, otherwise we will never stop
if
self
:
getMana
()
<
self
:
getMaxMana
()
and
self
.
mana_regen
>
0
then
return
true
end
if
self
:
getStamina
()
<
self
:
getMaxStamina
()
and
self
.
stamina_regen
>
0
then
return
true
end
if
self
.
life
<
self
.
max_life
and
self
.
life_regen
>
0
then
return
true
end
--[[
core.fov.calc_circle(x, y, radius, function(self, lx, ly)
if not grids[lx] then grids[lx] = {} end
grids[lx][ly] = true
if block and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move") then return true end
end, function()end, self)
]]
return
false
,
"all resources and life at maximun"
end
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