This commit is contained in:
team3
2026-09-16 13:21:45 +02:00
parent 8a188c5d5c
commit 49e8f2d95e
27 changed files with 1772 additions and 265 deletions

View File

@@ -293,6 +293,12 @@ func _basic_attack(u: CUnit, t: CUnit) -> void:
func _apply_damage(src, tgt: CUnit, amount: float, is_true: bool) -> void:
if not tgt.alive or amount <= 0.0:
return
# Schere-Stein-Papier: Hauptelement und Rolle des Angreifers gegen das Ziel.
var counter := 1.0
if src != null and not is_true:
counter = Data.counter_multiplier(src.avatar.primary_element(), src.avatar.role,
tgt.avatar.primary_element(), tgt.avatar.role)
amount *= counter
var dmg := amount if is_true else amount * (1.0 - tgt.armor)
if tgt.shield > 0.0:
var absorbed: float = minf(tgt.shield, dmg)
@@ -304,7 +310,12 @@ func _apply_damage(src, tgt: CUnit, amount: float, is_true: bool) -> void:
if src != null:
src.dealt += dmg
if record_hits and src != null:
_record("crit" if amount > src.atk * 1.4 and not is_true else "dmg", tgt, dmg)
var kind := "dmg"
if counter > 1.0:
kind = "counter"
elif amount > src.atk * 1.4 and not is_true:
kind = "crit"
_record(kind, tgt, dmg)
tgt.mana += MANA_PER_HIT * tgt.mana_mult
if tgt.mana >= tgt.max_mana and tgt.alive and tgt.hp > 0.0:
_cast(tgt)
@@ -351,8 +362,6 @@ func _record(kind: String, u: CUnit, amount: float) -> void:
func _cast(u: CUnit) -> void:
u.mana = 0.0
u.cast_flash = 0.35
if record_hits:
_record("cast", u, 0.0)
var elems: Array = u.avatar.elements
var heal_bonus := 0.0
for i in elems.size():
@@ -361,6 +370,10 @@ func _cast(u: CUnit) -> void:
var hit_enemies: Array = []
var main_target = u.target if (u.target != null and u.target.alive) else _nearest_enemy(u)
if record_hits:
hits.append({"kind": "cast", "pos": u.pos, "team": u.team, "amount": 0, "t": time,
"role": u.avatar.role, "element": u.avatar.primary_element(),
"target": main_target.pos if main_target != null else u.pos})
match u.avatar.role:
Data.Role.TANK:
@@ -423,8 +436,10 @@ func _apply_element_effects(u: CUnit, main_target, hit_enemies: Array) -> void:
if combos.has("magnetsturm") and main_target != null and main_target.alive:
main_target.stun_timer = maxf(main_target.stun_timer, 0.6)
for i in elems.size():
var scale := 1.0 if i == 0 else 0.5
if not elems.is_empty():
_apply_form(u, elems[0], main_target, hit_enemies)
for i in range(1, elems.size()):
var scale := 0.5
match elems[i]:
Data.Element.FEUER:
for o in hit_enemies:
@@ -454,6 +469,58 @@ func _apply_element_effects(u: CUnit, main_target, hit_enemies: Array) -> void:
## Verbündete in Heilreichweite, schwächste zuerst. Mindestens der Heiler selbst.
## Die Form des Hauptelements wirkt für jede Rolle gleich: um das Ziel (Gegner)
## oder um den Zaubernden (Verbündete).
func _apply_form(u: CUnit, element: int, main_target, hit_enemies: Array) -> void:
match element:
Data.Element.FEUER:
if main_target == null:
return
for n in Hex.neighbors(main_target.pos):
var o = _occ.get(n)
if o != null and o.alive and o.team != u.team and not hit_enemies.has(o):
_apply_damage(u, o, u.atk * 0.6, false)
hit_enemies.append(o)
for o in hit_enemies:
if o.alive:
o.burn_dps = maxf(o.burn_dps, u.atk * 0.6)
o.burn_timer = maxf(o.burn_timer, 3.0)
Data.Element.WASSER:
for o in units:
if o.alive and o.team == u.team and o != u and Hex.distance(o.pos, u.pos) <= 2:
o.mana = minf(o.max_mana - 1.0, o.mana + 20.0)
u.mana += 10.0
Data.Element.WIND:
for o in units:
if o.alive and o.team == u.team and Hex.distance(o.pos, u.pos) <= 2:
o.haste = maxf(o.haste, 0.25)
o.haste_timer = maxf(o.haste_timer, 3.0)
Data.Element.BLITZ:
var chained := 0
for o in units:
if chained >= 2:
break
if o.alive and o.team != u.team and o != main_target:
_apply_damage(u, o, u.atk * 0.6, false)
hit_enemies.append(o)
chained += 1
Data.Element.ERDE:
if main_target == null:
return
main_target.stun_timer = maxf(main_target.stun_timer, 0.6)
for n in Hex.neighbors(main_target.pos):
var o = _occ.get(n)
if o != null and o.alive and o.team != u.team:
o.stun_timer = maxf(o.stun_timer, 0.6)
Data.Element.EIS:
if main_target == null:
return
for o in units:
if o.alive and o.team != u.team and Hex.distance(o.pos, main_target.pos) <= 1:
o.slow = maxf(o.slow, 0.30)
o.slow_timer = maxf(o.slow_timer, 3.0)
func _allies_by_missing_hp(team: int, healer: CUnit) -> Array:
var list := []
for o in units: