Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions effects/projectiles/arcane_bolt.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@ func setup(owner_actor: Node, travel_direction: Vector2, hit_damage: float, hit_
timer.timeout.connect(queue_free)

func _physics_process(delta: float) -> void:
var previous_position := global_position
global_position += direction * speed * delta
if _expire_if_blocked_between(previous_position, global_position):
return
pulse_time += delta
bolt.scale = Vector2.ONE * (1.06 if int(pulse_time * 16.0) % 2 == 0 else 0.94)
trail_timer -= delta
Expand Down Expand Up @@ -80,6 +83,19 @@ func _expire_on_blocker() -> void:
_spawn_hit_flash()
_consume_bolt()

func _expire_if_blocked_between(from_position: Vector2, to_position: Vector2) -> bool:
if expired or from_position == to_position:
return false
var query := PhysicsRayQueryParameters2D.create(from_position, to_position)
query.collision_mask = 1
query.exclude = [self]
var hit := get_world_2d().direct_space_state.intersect_ray(query)
var collider = hit.get("collider", null)
if collider is Node and (collider as Node).is_in_group("projectile_blocker"):
_expire_on_blocker()
return true
return false

func _try_hit_overlapping_targets() -> void:
if expired:
return
Expand Down
16 changes: 16 additions & 0 deletions effects/projectiles/enemy_bolt.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func setup(owner_actor: Node, travel_direction: Vector2, hit_damage: float, colo
timer.timeout.connect(queue_free)

func _physics_process(delta: float) -> void:
var previous_position := global_position
global_position += direction * speed * delta
if _expire_if_blocked_between(previous_position, global_position):
return
pulse_time += delta
var pixel_pulse := 1.08 if int(pulse_time * 18.0) % 2 == 0 else 0.96
bolt.scale = Vector2.ONE * pixel_pulse
Expand Down Expand Up @@ -92,6 +95,19 @@ func _expire_on_blocker() -> void:
_spawn_hit_flash()
queue_free()

func _expire_if_blocked_between(from_position: Vector2, to_position: Vector2) -> bool:
if expired or from_position == to_position:
return false
var query := PhysicsRayQueryParameters2D.create(from_position, to_position)
query.collision_mask = 1
query.exclude = [self]
var hit := get_world_2d().direct_space_state.intersect_ray(query)
var collider = hit.get("collider", null)
if collider is Node and (collider as Node).is_in_group("projectile_blocker"):
_expire_on_blocker()
return true
return false

func _resolve_damage_target(target: Variant) -> Node:
if target == null or not (target is Node):
return null
Expand Down
16 changes: 16 additions & 0 deletions effects/projectiles/piercing_arrow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func setup(owner_actor: Node, travel_direction: Vector2, hit_damage: float, hit_
timer.timeout.connect(queue_free)

func _physics_process(delta: float) -> void:
var previous_position := global_position
global_position += direction * speed * delta
if _expire_if_blocked_between(previous_position, global_position):
return
pulse_time += delta
trail.scale = Vector2(1.08 if int(pulse_time * 20.0) % 2 == 0 else 0.98, 1.0)
trail.color = Color(1.0, 0.96, 0.72, 1.0)
Expand Down Expand Up @@ -74,6 +77,19 @@ func _expire_on_blocker() -> void:
_spawn_hit_flash()
queue_free()

func _expire_if_blocked_between(from_position: Vector2, to_position: Vector2) -> bool:
if expired or from_position == to_position:
return false
var query := PhysicsRayQueryParameters2D.create(from_position, to_position)
query.collision_mask = 1
query.exclude = [self]
var hit := get_world_2d().direct_space_state.intersect_ray(query)
var collider = hit.get("collider", null)
if collider is Node and (collider as Node).is_in_group("projectile_blocker"):
_expire_on_blocker()
return true
return false

func _resolve_damage_target(target: Variant) -> Node:
if target == null or not (target is Node):
return null
Expand Down
16 changes: 16 additions & 0 deletions effects/projectiles/royal_bolt.gd
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ func setup(owner_actor: Node, travel_direction: Vector2, hit_damage: float, payl
timer.timeout.connect(queue_free)

func _physics_process(delta: float) -> void:
var previous_position := global_position
global_position += direction * speed * delta
if _expire_if_blocked_between(previous_position, global_position):
return
pulse_time += delta
bolt.scale = Vector2.ONE * (1.08 if int(pulse_time * 18.0) % 2 == 0 else 0.96)
trail_timer -= delta
Expand Down Expand Up @@ -74,6 +77,19 @@ func _expire_on_blocker() -> void:
_spawn_hit_flash()
queue_free()

func _expire_if_blocked_between(from_position: Vector2, to_position: Vector2) -> bool:
if expired or from_position == to_position:
return false
var query := PhysicsRayQueryParameters2D.create(from_position, to_position)
query.collision_mask = 1
query.exclude = [self]
var hit := get_world_2d().direct_space_state.intersect_ray(query)
var collider = hit.get("collider", null)
if collider is Node and (collider as Node).is_in_group("projectile_blocker"):
_expire_on_blocker()
return true
return false

func _resolve_damage_target(target: Variant) -> Node:
if target == null or not (target is Node):
return null
Expand Down
5 changes: 3 additions & 2 deletions systems/map/map_runtime.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ func build() -> void:
world_root.add_child(map_camera)


func activate_room(room_index: int, player_character: Node) -> void:
func activate_room(room_index: int, player_character: Node, move_player: bool = true) -> void:
if map_walkable_rects.is_empty():
return
var clamped_index := clampi(room_index, 0, map_walkable_rects.size() - 1)
if spawn_marker != null:
spawn_marker.position = player_spawn_for_room(clamped_index)
if encounter_marker != null:
encounter_marker.position = encounter_spawn_for_room(clamped_index)
if player_character is Node2D and spawn_marker != null and is_instance_valid(player_character):
if move_player and player_character is Node2D and spawn_marker != null and is_instance_valid(player_character):
(player_character as Node2D).position = spawn_marker.position
update_camera(clamped_index, player_character, true)

Expand Down Expand Up @@ -263,6 +263,7 @@ func _try_add_generated_room_prop(room_index: int, candidate: Dictionary, placed
var source_width := maxf(1.0, float(source_size[0]))
var source_height := maxf(1.0, float(source_size[1]))
var texture_to_room_scale := Vector2(room_rect.size.x / source_width, room_rect.size.y / source_height)
texture_to_room_scale *= MapBrowserDemo.RANDOM_PROP_WORLD_SCALE
var prop_size := Vector2(float(texture.get_width()) * texture_to_room_scale.x, float(texture.get_height()) * texture_to_room_scale.y)
if not MapBrowserDemo.is_generated_prop_size_usable(prop_size, room_rect.size):
return false
Expand Down
10 changes: 6 additions & 4 deletions systems/run/audio_route.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ extends RefCounted
static func play_for_encounter(music: Node, next_encounter_index: int) -> void:
if music == null:
return
if next_encounter_index <= 4:
if next_encounter_index <= 3 or next_encounter_index == 7:
music.call("play_profile", &"town_battle")
elif next_encounter_index == 5:
elif next_encounter_index >= 4 and next_encounter_index <= 6:
music.call("play_profile", &"church_intermission")
elif next_encounter_index == 8:
music.call("play_profile", &"gate_guard")
elif next_encounter_index == 6:
elif next_encounter_index >= 9 and next_encounter_index <= 11:
music.call("play_profile", &"palace_explore")
elif next_encounter_index == 7:
elif next_encounter_index == 12:
music.call("play_profile", &"twin_princes")
else:
music.call("play_profile", &"emperor")
Expand Down
6 changes: 6 additions & 0 deletions systems/run/run_director.gd
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ func reset_run() -> void:
town_service_consumed = false
_emit_state()

func mark_town_services_consumed() -> void:
if town_service_consumed:
return
town_service_consumed = true
_emit_state()

func reward_encounter(encounter_index: int, actor: Node = null) -> int:
cleared_encounters += 1
var base_reward: int = 12 + maxi(encounter_index, 0) * 6
Expand Down
2 changes: 1 addition & 1 deletion tests/smoke_run_flow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func _run() -> void:
world.current_encounter = first_room_stub
world.player_character.global_position = world._room_exit_target(0)
world._on_encounter_defeated()
await create_timer(0.9).timeout
await create_timer(2.8).timeout
await process_frame
if world.stage_reward_panel == null or not world.stage_reward_panel.visible:
push_error("Stage reward panel did not open after the first map encounter")
Expand Down
2 changes: 2 additions & 0 deletions tools/map_browser_demo.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ const GENERATED_PROP_MANIFEST_PATH := "res://assets/maps/stitched_demo/generated
const RANDOM_PROP_MIN_PER_ROOM := 2
const RANDOM_PROP_MAX_PER_ROOM := 4
const RANDOM_PROP_PLACEMENT_ATTEMPTS := 56
const RANDOM_PROP_WORLD_SCALE := 0.70
const RANDOM_PROP_MIN_WIDTH_RATIO := 0.045
const RANDOM_PROP_MIN_HEIGHT_RATIO := 0.050
const RANDOM_PROP_MIN_AREA_RATIO := 0.0040
Expand Down Expand Up @@ -667,6 +668,7 @@ func _try_add_random_cover_prop(parent: Node, room_index: int, candidate: Dictio
var source_width := maxf(1.0, float(source_size[0]))
var source_height := maxf(1.0, float(source_size[1]))
var texture_to_room_scale := Vector2(room_rect.size.x / source_width, room_rect.size.y / source_height)
texture_to_room_scale *= RANDOM_PROP_WORLD_SCALE
var prop_size := Vector2(float(texture.get_width()) * texture_to_room_scale.x, float(texture.get_height()) * texture_to_room_scale.y)
if not is_generated_prop_size_usable(prop_size, room_rect.size):
return false
Expand Down
Loading
Loading