alot of stuff i forgot to commit

This commit is contained in:
Sylvia 2026-06-24 22:09:38 -07:00
parent fc2329a873
commit b8d516e734
60 changed files with 7397 additions and 64 deletions

View file

@ -0,0 +1,56 @@
using System.Collections.Generic;
using System.Linq;
using Core.Extensions;
using UnityEngine;
public class LunaticRedEyes : Ability
{
private List<Entity> entitiesInRange = new();
[SerializeField] private StunEffect stunEffect;
[Header("Effect Chances")]
[SerializeField] private float effectChance;
[SerializeField] private float hypnotismChance;
protected override void Update()
{
base.Update();
transform.Lookat2D(thisEntity.attackOriginPoint.position);
}
protected override void AbilityEffects()
{
base.AbilityEffects();
foreach (Entity entity in entitiesInRange.ToList())
{
float rolledEffectChance = Random.Range(0, 100);
if (rolledEffectChance > 100 - effectChance) //so if i made it 80 percent, it would need to be higher than 20
{
float rolledHypnotismChance = Random.Range(0, 100);
if (rolledHypnotismChance > 100 - hypnotismChance)
{
entity.tag = thisEntity.tag;
entity.entitiesInRange.Clear();
}
else
{
stunEffect.ApplyEffect(entity.stats);
}
entitiesInRange.Remove(entity);
}
}
}
private void OnTriggerEnter2D(Collider2D other)
{
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Entity isEntity))
{
entitiesInRange.Add(isEntity);
}
}
private void OnTriggerExit2D(Collider2D other)
{
if (!other.CompareTag(thisEntity.tag) && other.TryGetComponent(out Entity isEntity) && entitiesInRange.Contains(isEntity))
{
entitiesInRange.Remove(isEntity);
}
}
}