115 lines
4.4 KiB
C#
115 lines
4.4 KiB
C#
using Cielonos.MainGame.Characters;
|
|
using Cielonos.MainGame.FunctionalAnimation;
|
|
using SLSUtilities.FunctionalAnimation;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Inventory.Collections
|
|
{
|
|
public partial class Polychrome
|
|
{
|
|
private bool _hasPhotonAccelerator;
|
|
private bool _hasPhotonWarper;
|
|
private bool _hasPhotonDissociator;
|
|
private bool _hasPhotonPolarizer;
|
|
private bool _hasDisorderedPhotonCollector;
|
|
|
|
protected override void OnExtendersChanged()
|
|
{
|
|
CacheExtenderFlags();
|
|
}
|
|
|
|
private void CacheExtenderFlags()
|
|
{
|
|
_hasPhotonAccelerator = HasExtender<PhotonAccelerator>();
|
|
_hasPhotonWarper = HasExtender<PhotonWarper>();
|
|
_hasPhotonDissociator = HasExtender<PhotonDissociator>();
|
|
_hasPhotonPolarizer = HasExtender<PhotonPolarizer>();
|
|
_hasDisorderedPhotonCollector = HasExtender<DisorderedPhotonCollector>();
|
|
}
|
|
|
|
private void ApplyPhotonAccelerator()
|
|
{
|
|
FuncAnimInterval interval = fullBodyFuncAnimSm.currentData.Interval(IntervalType.Startup);
|
|
if (interval != null)
|
|
{
|
|
fullBodyFuncAnimSm.currentRuntimeFuncAnim.AddAnimEvent(
|
|
interval.StartTime, new SetFuncAnimSpeed(1.5f, SetFuncAnimSpeed.SpeedApplyMode.Multiply));
|
|
fullBodyFuncAnimSm.currentRuntimeFuncAnim.AddAnimEvent(
|
|
interval.EndTime, new SetFuncAnimSpeed(1f / 1.5f, SetFuncAnimSpeed.SpeedApplyMode.Multiply));
|
|
}
|
|
}
|
|
|
|
private Enemy GetPhotonWarperAdjustedHeavyAttackTarget(string suffix, out bool shouldWarp)
|
|
{
|
|
shouldWarp = false;
|
|
Enemy target = CombatManager.EnemySm.Query(15f, TargetingScorePreset.MeleeAttack).Best();
|
|
if (target != null && suffix == "RA")
|
|
{
|
|
float distance = Vector3.Distance(player.transform.position, target.transform.position);
|
|
if (distance > 2.5f)
|
|
{
|
|
shouldWarp = true;
|
|
player.movementSc.SmartTurnToTarget(target, 360, true);
|
|
}
|
|
}
|
|
|
|
return target;
|
|
}
|
|
|
|
private void ApplyPhotonWarperAfterHeavyAttack(Enemy target)
|
|
{
|
|
FuncAnimInterval interval = fullBodyFuncAnimSm.currentData.Interval(IntervalType.Startup);
|
|
WarpToTarget(target, interval, 0f, 1f);
|
|
}
|
|
|
|
private NormalArea CreatePhotonDissociatorHeavySlash(string vfxName, AttackUnit attackUnit)
|
|
{
|
|
AttackUnit modifiedUnit = attackUnit.Clone();
|
|
modifiedUnit.startDamage *= 0.5f;
|
|
|
|
NormalArea slash = vfxData.SpawnVFX(vfxName, player).GetComponentInChildren<NormalArea>();
|
|
slash.Initialize<NormalArea>(player, this, Fraction.Enemy)
|
|
.SetAttackSubmodule<NormalArea>(modifiedUnit)
|
|
.SetTimeSubmodule<NormalArea>(1f, 0.04f, 0.4f)
|
|
.SetHitSubmodule<NormalArea>(0.1f, 3);
|
|
|
|
slash.SetImpulseSubmodule(1f).WithRepulsion(2.5f);
|
|
return slash;
|
|
}
|
|
|
|
private void ApplyPhotonPolarizerPerfectBlock(AttackAreaBase attackArea)
|
|
{
|
|
if (attackArea is not NormalArea) return;
|
|
|
|
attackArea.creator.GetHit(Breakthrough.Type.Forced, out _);
|
|
attackArea.creator.movementSc.impulseSm.ApplyKnockback(-attackArea.creator.transform.forward, 20f);
|
|
}
|
|
|
|
private void ApplyUltimatePassionBoost()
|
|
{
|
|
var passionSystem = CombatManager.PassionSystem;
|
|
if (passionSystem != null)
|
|
{
|
|
int currentLevel = passionSystem.LevelIndex;
|
|
float currentPercent = passionSystem.Percent;
|
|
|
|
float targetIncrease = 100f;
|
|
if (currentLevel == 0)
|
|
{
|
|
targetIncrease = 200f - currentPercent;
|
|
}
|
|
|
|
float amplifier = player.attributeSm[CharacterAttribute.PassionIncreaseAmplifier];
|
|
float multiplier = passionSystem.passionLevels[currentLevel].increaseMultiplier;
|
|
|
|
float divisor = multiplier * (1f + amplifier);
|
|
if (divisor > 0.001f)
|
|
{
|
|
float baseAmount = targetIncrease / divisor;
|
|
passionSystem.IncreasePassion(baseAmount, true);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|