This repository has been archived by the owner on Jun 7, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix hero:set_invincible() not working without duration
Closes #805.
- Loading branch information
1 parent
7a704de
commit c2b3ff7
Showing
6 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/testing_quest/data/maps/bugs/805_hero_set_invincible.dat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
properties{ | ||
x = 0, | ||
y = 0, | ||
width = 320, | ||
height = 240, | ||
min_layer = 0, | ||
max_layer = 2, | ||
tileset = "castle", | ||
} | ||
|
||
tile{ | ||
layer = 0, | ||
x = 0, | ||
y = 0, | ||
width = 320, | ||
height = 240, | ||
pattern = "3", | ||
} | ||
|
||
destination{ | ||
layer = 0, | ||
x = 24, | ||
y = 29, | ||
direction = 1, | ||
} | ||
|
25 changes: 25 additions & 0 deletions
25
tests/testing_quest/data/maps/bugs/805_hero_set_invincible.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
local map = ... | ||
|
||
function map:on_started() | ||
|
||
-- Set invincible with no limit. | ||
hero:set_invincible(true) | ||
assert(hero:is_invincible()) | ||
|
||
sol.timer.start(10, function() | ||
assert(hero:is_invincible()) | ||
|
||
-- Stop invincibility. | ||
hero:set_invincible(false) | ||
assert(not hero:is_invincible()) | ||
|
||
-- Set invincible again, this time with a limit. | ||
hero:set_invincible(true, 10) | ||
assert(hero:is_invincible()) | ||
|
||
sol.timer.start(20, function() | ||
assert(not hero:is_invincible()) | ||
sol.main.exit() | ||
end) | ||
end) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters