public override bool Activate()
{
var enemies = FindEnemiesInCamera();
int totalStacks = 0;
foreach (var enemy in enemies)
{
if (!enemy.TryGetComponent(out EnemyDebuffHandler debuffHandler)) continue;
int bleedStacks = debuffHandler.GetDebuffStack(DebuffType.Bleed);
if (bleedStacks <= 0) continue;
debuffHandler.RemoveDebuff(DebuffType.Bleed);
debuffHandler.ApplyDebuffStacks(_vampireAbsorbSO, bleedStacks);
for (int i = 0; i < bleedStacks; i++)
{
Vector3 offset = new Vector3(Random.Range(-0.4f, 0.4f), Random.Range(-0.4f, 0.4f), 0);
Vector3 spawnPos = enemy.transform.position + offset;
var orb = Instantiate(_bloodOrbPrefab, spawnPos, Quaternion.identity);
orb.GetComponent<BloodOrbEffect>().Initialize(_playerHealth, 1f);
}
totalStacks += bleedStacks;
}
if (_buffCoroutine != null)
{
StopCoroutine(_buffCoroutine);
_stat.RemoveModifier(_activeBuff);
}
if (totalStacks > 0)
{
totalStacks = Mathf.Min(totalStacks, _capacity);
_activeBuff = new StatModifier(
StatType.FinalDamageMultiplier,
1f + totalStacks,
StatModifier.ModifierMode.Multiplicative,
sourceTag: "VampireAbsorbSkill"
);
_stat.AddModifier(_activeBuff);
_buffCoroutine = StartCoroutine(RemoveBuffAfter(_buffDuration, _activeBuff));
}
return totalStacks > 0;
}
public void RemoveAllModifiersOfTypeWithTag(StatType type, string tag)
{
modifiers.RemoveAll(m => m.type == type && m.sourceTag == tag);
OnStatChanged?.Invoke(type);
}
private void StartChase()
{
if (_target == null) return;
transform.DOMove(_target.transform, _flyDuration)
.SetEase(_flyEase)
.OnUpdate(() =>
{
if (_target != null)
transform.DOMove(_target.transform.position, _flyDuration);
})
.OnComplete(() =>
{
if (_target != null)
_target.Heal(_healAmount);
Destroy(gameObject);
});
}
StatType의 버프가 여러 번 겹칠 수 있으므로, 반드시 sourceTag 기반으로 삭제 처리해야 함RemoveModifier() 외에 RemoveAllModifiersOfTypeWithTag() 로도 방어코드 작성_maxHealPercent * maxHP 등으로 제한 가능 (추후 확장 예정)이 시스템은 뱀파이어 방어구 스킬의 핵심인 출혈 → 흡혈 → 버프 → 회복 흐름을 매끄럽게 구현한 구조다.
DOTween과 StatModifier 시스템의 조합으로 애니메이션 + 스탯 버프 관리를 안정적으로 구현함.