mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-15 08:24:48 +00:00
🐛 fix health display
This commit is contained in:
parent
6a0e28e2e6
commit
223aab2527
5 changed files with 13 additions and 12 deletions
|
|
@ -15,7 +15,7 @@
|
|||
extends GutTest
|
||||
|
||||
var _subject : HealthComponent
|
||||
const TEST_MAX_HEALTH : float = 100.0
|
||||
const TEST_MAX_HEALTH : float = 1.
|
||||
const TEST_PLAYER_ID : int = 1
|
||||
const TEST_TEAM_ID : int = 1
|
||||
|
||||
|
|
@ -36,17 +36,17 @@ func test_that_it_has_max_health_when_ready() -> void:
|
|||
assert_eq(_subject.health, _subject.max_health)
|
||||
|
||||
func test_that_it_takes_damage_from_opponent_team() -> void:
|
||||
var damage_amount : float = 10.0
|
||||
var damage_amount : float = .1
|
||||
_subject.damage(damage_amount, -1, -1)
|
||||
assert_eq(_subject.health, TEST_MAX_HEALTH - damage_amount)
|
||||
|
||||
func test_that_it_takes_no_damage_from_same_team() -> void:
|
||||
var damage_amount : float = 10.0
|
||||
var damage_amount : float = .1
|
||||
_subject.damage(damage_amount, -1, TEST_TEAM_ID)
|
||||
assert_eq(_subject.health, TEST_MAX_HEALTH)
|
||||
|
||||
func test_that_it_can_self_damage() -> void:
|
||||
var damage_amount : float = 10.0
|
||||
var damage_amount : float = .1
|
||||
_subject.damage(damage_amount, TEST_PLAYER_ID, TEST_TEAM_ID)
|
||||
assert_eq(_subject.health, TEST_MAX_HEALTH - damage_amount)
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ func test_that_it_emits_health_zeroed() -> void:
|
|||
assert_signal_emitted_with_parameters(_subject, 'health_zeroed', [-1])
|
||||
|
||||
func test_that_it_heals_fully() -> void:
|
||||
_subject.health = 10
|
||||
_subject.health = .1
|
||||
_subject.heal_full()
|
||||
assert_eq(_subject.health, TEST_MAX_HEALTH)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue