Menu de inicio, nuevo nivel y ajustes en objetos
This commit is contained in:
1 parent
cd9f31c8c1
commit
827e16cf50
61 files changed
+2685
-3553
No files matched your search
+32
-29
@@ -8,7 +8,7 @@ extends CharacterBody2D
|
||||
signal health_changed(current_health: int, max_health: int)
|
||||
signal died
|
||||
signal special_charge_changed(current_charge: int, max_charge: int)
|
||||
## Solo se emite cuando el objeto ha aplicado su efecto. El laboratorio cuenta recogidas reales, no simples contactos.
|
||||
## Solo se emite cuando el objeto aplica su efecto, nunca por un simple contacto.
|
||||
signal pickup_collected(data: PickupData)
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ const COMBAT_FX = preload("res://effects/combat_fx.gd")
|
||||
@export_range(0, 100, 1) var special_max_damage: int = 30
|
||||
|
||||
## Radio adicional al filtro de pantalla. Un valor grande conserva el alcance visible original.
|
||||
## El laboratorio usa un radio reducido para aislar sus estaciones.
|
||||
## Los niveles 00 y 01 fijan 290 px para comparar el combate con el mismo alcance.
|
||||
@export var special_radius: float = 100000.0
|
||||
|
||||
## Duracion del solo: preparacion, pulsos y recuperacion. El dano total se reparte entre los pulsos.
|
||||
@@ -224,10 +224,9 @@ var jumps_remaining: int = 2
|
||||
|
||||
var _speed_boost_timer: float = 0.0
|
||||
var _speed_boost_multiplier: float = 0.0
|
||||
# Las mejoras solo alteran estado temporal; nunca se modifica el recurso CharacterData compartido.
|
||||
var _damage_boost_timer: float = 0.0
|
||||
# Las mejoras solo alteran estado de la partida; nunca se modifica CharacterData.
|
||||
# Las dos mejoras de dano no caducan por tiempo: se pierden al recibir un golpe valido.
|
||||
var _damage_boost_multiplier: float = 0.0
|
||||
var _air_damage_boost_timer: float = 0.0
|
||||
var _air_damage_boost_multiplier: float = 0.0
|
||||
var _damage_reduction_timer: float = 0.0
|
||||
var _damage_reduction_fraction: float = 0.0
|
||||
@@ -653,25 +652,30 @@ func collect_pickup(data: PickupData) -> bool:
|
||||
if data.value <= 0.0 or data.duration <= 0.0:
|
||||
return false
|
||||
_speed_boost_multiplier = max(_speed_boost_multiplier, data.value) if _speed_boost_timer > 0.0 else data.value
|
||||
_speed_boost_timer = data.duration
|
||||
_speed_boost_timer = maxf(_speed_boost_timer, data.duration)
|
||||
_spawn_floating_text("SPEED UP", Color(1.0, 0.8, 0.2))
|
||||
"damage_boost", "air_damage_boost", "damage_reduction", "jump_boost":
|
||||
"damage_boost":
|
||||
# No se suman objetos: solo sustituye la potencia una mejora estrictamente superior.
|
||||
if data.value <= _damage_boost_multiplier or data.value <= 0.0:
|
||||
return false
|
||||
_damage_boost_multiplier = data.value
|
||||
_spawn_floating_text(data.display_name, data.color)
|
||||
"air_damage_boost":
|
||||
# Es un canal distinto del dano general; ambos siguen respetando el limite del pound.
|
||||
if data.value <= _air_damage_boost_multiplier or data.value <= 0.0:
|
||||
return false
|
||||
_air_damage_boost_multiplier = data.value
|
||||
_spawn_floating_text(data.display_name, data.color)
|
||||
"damage_reduction", "jump_boost":
|
||||
if data.value <= 0.0 or data.duration <= 0.0:
|
||||
return false
|
||||
# Recoger la misma mejora renueva el tiempo y conserva la potencia mas alta.
|
||||
match data.effect_type:
|
||||
"damage_boost":
|
||||
_damage_boost_multiplier = max(_damage_boost_multiplier, data.value) if _damage_boost_timer > 0.0 else data.value
|
||||
_damage_boost_timer = data.duration
|
||||
"air_damage_boost":
|
||||
_air_damage_boost_multiplier = max(_air_damage_boost_multiplier, data.value) if _air_damage_boost_timer > 0.0 else data.value
|
||||
_air_damage_boost_timer = data.duration
|
||||
"damage_reduction":
|
||||
_damage_reduction_fraction = max(_damage_reduction_fraction, data.value) if _damage_reduction_timer > 0.0 else data.value
|
||||
_damage_reduction_timer = data.duration
|
||||
"jump_boost":
|
||||
_jump_boost_multiplier = max(_jump_boost_multiplier, data.value) if _jump_boost_timer > 0.0 else data.value
|
||||
_jump_boost_timer = data.duration
|
||||
# No acorta una mejora activa al recoger otro objeto con menos duracion.
|
||||
if data.effect_type == "damage_reduction":
|
||||
_damage_reduction_fraction = maxf(_damage_reduction_fraction, data.value) if _damage_reduction_timer > 0.0 else data.value
|
||||
_damage_reduction_timer = maxf(_damage_reduction_timer, data.duration)
|
||||
else:
|
||||
_jump_boost_multiplier = maxf(_jump_boost_multiplier, data.value) if _jump_boost_timer > 0.0 else data.value
|
||||
_jump_boost_timer = maxf(_jump_boost_timer, data.duration)
|
||||
_spawn_floating_text(data.display_name, data.color)
|
||||
"special_charge":
|
||||
var new_charge: int = mini(special_max_charge, special_charge + int(data.value))
|
||||
@@ -753,11 +757,16 @@ func _damage_target(collider: Node, damage: int, hit_targets: Dictionary) -> voi
|
||||
target.take_damage(damage, global_position)
|
||||
|
||||
|
||||
## Valida invulnerabilidad y escudo antes de reducir vida, aplicar empuje y comprobar muerte.
|
||||
## Ignora contactos no validos, retira mejoras ofensivas y resuelve escudo, vida y empuje.
|
||||
func take_damage(amount: int, source_position: Vector2, knockback_multiplier: float = 1.0) -> void:
|
||||
if amount <= 0 or is_dead or invulnerability_timer > 0.0:
|
||||
return
|
||||
|
||||
# Un golpe aceptado rompe las mejoras ofensivas incluso si el escudo protege la vida.
|
||||
# Los intentos sin dano, en invulnerabilidad o tras morir ya retornaron antes.
|
||||
_damage_boost_multiplier = 0.0
|
||||
_air_damage_boost_multiplier = 0.0
|
||||
|
||||
if _shield_hits > 0:
|
||||
_shield_hits -= 1
|
||||
invulnerability_timer = invulnerability_duration
|
||||
@@ -823,15 +832,9 @@ func _update_timers(delta: float) -> void:
|
||||
_speed_boost_timer = max(_speed_boost_timer - delta, 0.0)
|
||||
else:
|
||||
_speed_boost_multiplier = 0.0
|
||||
# Cada mejora caduca por separado; nunca se muta el recurso de personaje.
|
||||
_damage_boost_timer = maxf(0.0, _damage_boost_timer - delta)
|
||||
_air_damage_boost_timer = maxf(0.0, _air_damage_boost_timer - delta)
|
||||
# Cada mejora temporizada caduca por separado; nunca se muta el recurso de personaje.
|
||||
_damage_reduction_timer = maxf(0.0, _damage_reduction_timer - delta)
|
||||
_jump_boost_timer = maxf(0.0, _jump_boost_timer - delta)
|
||||
if _damage_boost_timer == 0.0:
|
||||
_damage_boost_multiplier = 0.0
|
||||
if _air_damage_boost_timer == 0.0:
|
||||
_air_damage_boost_multiplier = 0.0
|
||||
if _damage_reduction_timer == 0.0:
|
||||
_damage_reduction_fraction = 0.0
|
||||
if _jump_boost_timer == 0.0:
|
||||
|
||||
Reference in new issue
Block a user