狗屎Minimax坏我代码

This commit is contained in:
SoulliesOfficial
2026-04-18 13:57:19 -04:00
parent 41140a2017
commit 7379583165
473 changed files with 34480 additions and 8069 deletions

View File

@@ -203,6 +203,15 @@ namespace Cielonos.MainGame
timer -= interval;
}
}
public void SetInterval(float interval)
{
this.interval = interval;
if (timer > interval)
{
timer = interval;
}
}
}
}

View File

@@ -1,74 +1,74 @@
using SLSUtilities.WwiseAssistance;
using UnityEngine;
namespace Cielonos.MainGame.Buffs.Character
{
public class Burn : CharacterBuffBase
{
private uint existID = AkUnitySoundEngine.AK_INVALID_PLAYING_ID;
public Burn(int stack = 1, float duration = 10f)
{
Initialize(BuffType.Negative, BuffDispelLevel.Basic);
this.contentSubmodule = new ContentSubmodule(this);
this.timeSubmodule = new TimeSubmodule(this, duration);
this.timeSubmodule.AddIntervalAction(IntervalAction, 1f);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
}
public override bool OnBuffApply(out CharacterBuffBase existingBuff)
{
MainGameManager.BaseCollection.InfoText().Spawn(attachedCharacter.centerPoint.position, "Burn");
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.timeSubmodule.PickHigherDuration(this.timeSubmodule);
existingBuff.unitedStackSubmodule.PickHigherStack(this.unitedStackSubmodule);
return false;
}
return true;
}
public override void OnAfterFirstApply()
{
base.OnAfterFirstApply();
attachedCharacter.renderSc.meshEffectUnits["Burn"].EffectOn(0.5f);
AudioManager.Post(AK.EVENTS.BUFF_BURN_APPLY, attachedCharacter.centerPosition);
existID = AudioManager.Post(AK.EVENTS.BUFF_BURN_EXIST, attachedCharacter.centerPosition).playingID;
}
public override void OnBuffUpdate()
{
timeSubmodule?.Update(Time.deltaTime);
}
private void IntervalAction()
{
AttackResult result = new AttackResult(sourceCharacter, attachedCharacter, nameof(Burn), attachedCharacter.centerPosition);
result.attackValue = new AttackValue(sourceCharacter, false, 10, Attack.AttackType.Magic);
attachedCharacter.TakeDamage(ref result);
}
public override void OnBuffRemove()
{
attachedCharacter.renderSc.meshEffectUnits["Burn"].EffectOff();
AudioManager.Post(AK.EVENTS.BUFF_BURN_REMOVE, attachedCharacter.centerPosition);
AudioManager.Stop(existID);
}
}
/// <summary>
/// Burn Buff 的工厂类,用于在行为树节点中以多态方式创建并配置 Burn 的实例。
/// </summary>
[System.Serializable]
public class BurnFactory : ICharacterBuffFactory
{
[UnityEngine.Tooltip("燃烧初始层数。")]
public int stack = 1;
[UnityEngine.Tooltip("燃烧持续时间(秒)。")]
public float duration = 10f;
public CharacterBuffBase Create() => new Burn(stack, duration);
}
}
using SLSUtilities.WwiseAssistance;
using UnityEngine;
namespace Cielonos.MainGame.Buffs.Character
{
public class Burn : CharacterBuffBase
{
private uint existID = AkUnitySoundEngine.AK_INVALID_PLAYING_ID;
public Burn(int stack = 1, float duration = 10f)
{
Initialize(BuffType.Negative, BuffDispelLevel.Basic);
this.contentSubmodule = new ContentSubmodule(this);
this.timeSubmodule = new TimeSubmodule(this, duration);
this.timeSubmodule.AddIntervalAction(IntervalAction, 1f);
this.unitedStackSubmodule = new UnitedStackSubmodule(this, stack);
}
public override bool OnBuffApply(out CharacterBuffBase existingBuff)
{
MainGameManager.BaseCollection.InfoText().Spawn(attachedCharacter.centerPoint.position, "Burn");
if (FindExistingSameBuff(out existingBuff))
{
existingBuff.timeSubmodule.PickHigherDuration(this.timeSubmodule);
existingBuff.unitedStackSubmodule.PickHigherStack(this.unitedStackSubmodule);
return false;
}
return true;
}
public override void OnAfterFirstApply()
{
base.OnAfterFirstApply();
attachedCharacter.renderSc.meshEffectUnits["Burn"].EffectOn(0.5f);
AudioManager.Post(AK.EVENTS.BUFF_BURN_APPLY, attachedCharacter.centerPosition);
existID = AudioManager.Post(AK.EVENTS.BUFF_BURN_EXIST, attachedCharacter.centerPosition).playingID;
}
public override void OnBuffUpdate()
{
timeSubmodule?.Update(Time.deltaTime);
}
private void IntervalAction()
{
AttackResult result = new AttackResult(sourceCharacter, attachedCharacter, nameof(Burn), attachedCharacter.centerPosition);
result.attackValue = new AttackValue(sourceCharacter, false, 10, Attack.AttackType.Magic);
attachedCharacter.TakeDamage(ref result);
}
public override void OnBuffRemove()
{
attachedCharacter.renderSc.meshEffectUnits["Burn"].EffectOff();
AudioManager.Post(AK.EVENTS.BUFF_BURN_REMOVE, attachedCharacter.centerPosition);
AudioManager.Stop(existID);
}
}
/// <summary>
/// Burn Buff 的工厂类,用于在行为树节点中以多态方式创建并配置 Burn 的实例。
/// </summary>
[System.Serializable]
public class BurnFactory : ICharacterBuffFactory
{
[Tooltip("燃烧初始层数。")]
public int stack = 1;
[Tooltip("燃烧持续时间(秒)。")]
public float duration = 10f;
public CharacterBuffBase Create() => new Burn(stack, duration);
}
}

View File

@@ -0,0 +1,75 @@
using UnityEngine;
namespace Cielonos.MainGame.Buffs.Character
{
public class Decay : CharacterBuffBase
{
public float accumulatedDamage;
public float damageInterval;
public float maximumDamagePerInterval;
public Decay(int damage, float damageInterval = 0.25f, float maximumDamagePerInterval = 10f)
{
Initialize(BuffType.Negative, BuffDispelLevel.Basic);
this.accumulatedDamage = damage;
this.damageInterval = damageInterval;
this.maximumDamagePerInterval = maximumDamagePerInterval;
this.contentSubmodule = new ContentSubmodule(this);
this.timeSubmodule = new TimeSubmodule(this, true);
this.timeSubmodule.AddIntervalAction(IntervalAction, damageInterval);
}
public override bool OnBuffApply(out CharacterBuffBase existingBuff)
{
if (FindExistingSameBuff(out existingBuff))
{
Decay existingDecay = existingBuff as Decay;
existingDecay.accumulatedDamage += this.accumulatedDamage;
if (existingDecay.damageInterval > this.damageInterval)
{
existingDecay.damageInterval = this.damageInterval;
existingDecay.timeSubmodule.intervalActions[0].SetInterval(existingDecay.damageInterval);
}
if (existingDecay.maximumDamagePerInterval < this.maximumDamagePerInterval)
{
existingDecay.maximumDamagePerInterval = this.maximumDamagePerInterval;
}
return false;
}
return true;
}
public override void OnBuffUpdate()
{
timeSubmodule?.Update(attachedCharacter.selfTimeSm.DeltaTime);
}
private void IntervalAction()
{
if (accumulatedDamage <= 0)
{
Remove();
return;
}
float damageValue = Mathf.Min(maximumDamagePerInterval, accumulatedDamage);
accumulatedDamage -= damageValue;
AttackResult result = new AttackResult(sourceCharacter, attachedCharacter, nameof(Decay), attachedCharacter.centerPosition)
{
attackValue = new AttackValue(sourceCharacter, false, damageValue, Attack.AttackType.Blank)
};
attachedCharacter.TakeDamage(ref result);
var dmgNumber = MainGameBaseCollection.Instance.DamageNumber(Attack.AttackType.Blank, false)
.Spawn(result.hitPosition, result.finalDamage, attachedCharacter.centerPoint);
dmgNumber.SetScale(0.5f);
dmgNumber.SetSpamGroup(result.spamGroupID);
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d0f6525ed44ff2640b867e65760c4bb0