Resolve pending gameplay tickets
This commit is contained in:
parent
ec20778215
commit
c2ebbfaa2d
28 changed files with 618 additions and 188 deletions
|
|
@ -2,19 +2,18 @@ extends SceneTree
|
|||
|
||||
# Headless gameplay test: run with
|
||||
# godot --headless -s res://tests/test_building_collateral.gd
|
||||
# Forgejo #165: a gas bomb and a vessel flying fast enough both damage a
|
||||
# structure. The blast used to stop politely at anything the player owned,
|
||||
# which made a bomb dropped on a besieged mothership a free way to sweep the
|
||||
# attackers off it.
|
||||
# Forgejo #176: the player's own ships and their weapons do not damage the
|
||||
# player's buildings. Friendly fire on structures made defending them with a
|
||||
# gas bomb or crossing them at speed punish ordinary play.
|
||||
#
|
||||
# Covers:
|
||||
# A. a bomb landing on a structure damages it
|
||||
# A. a bomb landing on a structure leaves it unharmed
|
||||
# B. a bomb landing clear of it does not - the radius is the radius, and
|
||||
# this is a weapon that has to be aimed
|
||||
# C. a vessel resting against a structure does NOT damage it. The fleet
|
||||
# sits on its own mothership constantly to bank ore; if that hurt, the
|
||||
# game's own economy loop would grind its buildings down
|
||||
# D. a vessel arriving fast does
|
||||
# D. a vessel arriving fast still does not damage it or itself
|
||||
|
||||
var game_state: Node
|
||||
var main: Node
|
||||
|
|
@ -23,6 +22,7 @@ var building_id: int = 0
|
|||
var stage: int = 0
|
||||
var elapsed: float = 0.0
|
||||
var hp_before: int = 0
|
||||
var ships_before: int = 0
|
||||
const BUILDING_AT := Vector2(1200.0, 0.0)
|
||||
|
||||
|
||||
|
|
@ -78,11 +78,11 @@ func _process(delta: float) -> bool:
|
|||
return _fail("a bomb 900 away still damaged the structure")
|
||||
print("a bomb clear of the structure leaves it alone")
|
||||
|
||||
# --- A. a bomb on top of it does --------------------------------
|
||||
# --- A. a friendly bomb on top of it is safe ----------------------
|
||||
_detonate_at(BUILDING_AT)
|
||||
if _hp() >= hp_before:
|
||||
return _fail("a bomb landing on the structure did not damage it (hp %d)" % _hp())
|
||||
print("a bomb on the structure took it from %d to %d" % [hp_before, _hp()])
|
||||
if _hp() != hp_before:
|
||||
return _fail("a friendly bomb damaged the structure (%d -> %d)" % [hp_before, _hp()])
|
||||
print("a friendly bomb on the structure leaves it at %d hp" % _hp())
|
||||
|
||||
# --- C. resting against it is free ------------------------------
|
||||
hp_before = _hp()
|
||||
|
|
@ -104,8 +104,9 @@ func _process(delta: float) -> bool:
|
|||
% [hp_before, _hp()])
|
||||
print("a vessel parked on the structure for %.1fs did nothing to it" % elapsed)
|
||||
|
||||
# --- D. arriving fast does --------------------------------------
|
||||
# --- D. arriving fast is still friendly -------------------------
|
||||
hp_before = _hp()
|
||||
ships_before = fleet.ships.size()
|
||||
for ship in fleet.ships:
|
||||
# Placed clear and sent IN, because the impact is detected on
|
||||
# entry - a ship spawned already overlapping never enters.
|
||||
|
|
@ -118,9 +119,11 @@ func _process(delta: float) -> bool:
|
|||
3:
|
||||
if elapsed < 1.2:
|
||||
return false
|
||||
if _hp() >= hp_before:
|
||||
return _fail("a vessel arriving at 900 did not damage the structure")
|
||||
print("a vessel arriving fast took it from %d to %d" % [hp_before, _hp()])
|
||||
if _hp() != hp_before:
|
||||
return _fail("a fast friendly vessel damaged the structure (%d -> %d)" % [hp_before, _hp()])
|
||||
if fleet.ships.size() != ships_before:
|
||||
return _fail("a friendly building destroyed a vessel crossing it")
|
||||
print("a vessel crossing the structure at speed leaves both unharmed")
|
||||
|
||||
print("TEST_BUILDING_COLLATERAL: PASS")
|
||||
quit(0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue