Items integrados y mejoras

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-21 10:40:14 +02:00
1 parent 1fbfdf3f8a
commit 8fc8925151
41 files changed
+493 -74

No files matched your search

+67 -5
View File
@@ -200,6 +200,16 @@ var jumps_remaining: int = 2
var _speed_boost_timer: float = 0.0
var _speed_boost_multiplier: float = 0.0
# Only runtime state changes: CharacterData remains immutable during pickups.
var _damage_boost_timer: float = 0.0
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
var _jump_boost_timer: float = 0.0
var _jump_boost_multiplier: float = 0.0
var _shield_hits: int = 0
var _floating_texts: Array = []
@@ -369,12 +379,12 @@ func _handle_jump() -> void:
and not ground_pound_active
):
if is_on_floor() or coyote_timer > 0.0:
velocity.y = character_data.jump_velocity
velocity.y = character_data.jump_velocity * (1.0 + _jump_boost_multiplier)
jump_buffer_timer = 0.0
coyote_timer = 0.0
jumps_remaining = max(0, max_jumps - 1)
elif enable_double_jump and jumps_remaining > 0:
velocity.y = character_data.jump_velocity * double_jump_multiplier
velocity.y = character_data.jump_velocity * (1.0 + _jump_boost_multiplier) * double_jump_multiplier
jump_buffer_timer = 0.0
jumps_remaining -= 1
@@ -418,7 +428,7 @@ func _update_punch_damage() -> void:
return
for area in punch_hitbox.get_overlapping_areas():
_damage_target(area, character_data.basic_attack_damage, punch_hit_targets)
_damage_target(area, roundi(character_data.basic_attack_damage * (1.0 + _damage_boost_multiplier)), punch_hit_targets)
# ============================================================================
@@ -456,7 +466,7 @@ func _ground_pound_impact() -> void:
var hit_targets: Dictionary = {}
for area in ground_pound_hitbox.get_overlapping_areas():
_damage_target(area, damage, hit_targets)
_damage_target(area, roundi(damage * (1.0 + _damage_boost_multiplier + _air_damage_boost_multiplier)), hit_targets)
# ============================================================================
@@ -532,9 +542,39 @@ func collect_pickup(data: PickupData) -> bool:
"speed_boost":
if data.value <= 0.0 or data.duration <= 0.0:
return false
_speed_boost_multiplier = data.value
_speed_boost_multiplier = max(_speed_boost_multiplier, data.value) if _speed_boost_timer > 0.0 else data.value
_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":
if data.value <= 0.0 or data.duration <= 0.0:
return false
# Repeated pickup refreshes time and keeps the strongest bonus.
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
_spawn_floating_text(data.display_name, data.color)
"special_charge":
var new_charge: int = mini(special_max_charge, special_charge + int(data.value))
if new_charge <= special_charge:
return false
special_charge = new_charge
special_charge_changed.emit(special_charge, special_max_charge)
_spawn_floating_text("SPECIAL +" + str(int(data.value)), data.color)
"shield":
if data.value <= 0.0:
return false
_shield_hits = maxi(_shield_hits, int(data.value))
_spawn_floating_text("SHIELD", data.color)
_:
push_warning("Unknown pickup effect: %s" % data.effect_type)
return false
@@ -600,6 +640,15 @@ func take_damage(amount: int, source_position: Vector2) -> void:
if amount <= 0 or is_dead or invulnerability_timer > 0.0:
return
if _shield_hits > 0:
_shield_hits -= 1
invulnerability_timer = invulnerability_duration
_spawn_floating_text("BLOCK!", Color(0.7, 0.9, 1.0))
return
# At least one point of damage passes through an active reduction.
if _damage_reduction_timer > 0.0:
amount = maxi(1, roundi(amount * (1.0 - clampf(_damage_reduction_fraction, 0.0, 0.95))))
current_health = max(current_health - amount, 0)
invulnerability_timer = invulnerability_duration
@@ -644,6 +693,19 @@ func _update_timers(delta: float) -> void:
_speed_boost_timer = max(_speed_boost_timer - delta, 0.0)
else:
_speed_boost_multiplier = 0.0
# Each effect expires independently; no mutation of the character resource.
_damage_boost_timer = maxf(0.0, _damage_boost_timer - delta)
_air_damage_boost_timer = maxf(0.0, _air_damage_boost_timer - delta)
_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:
_jump_boost_multiplier = 0.0
func _update_animation() -> void: