158 lines
5.9 KiB
C#
158 lines
5.9 KiB
C#
using System.Collections.Generic;
|
|
using Cielonos.MainGame.Characters;
|
|
using Cielonos.MainGame.Effects.Feedback;
|
|
using Cielonos.MainGame.FunctionalAnimation;
|
|
using SLSUtilities.Feedback;
|
|
using SLSUtilities.FunctionalAnimation;
|
|
using UnityEngine;
|
|
|
|
namespace Cielonos.MainGame.Inventory.Collections
|
|
{
|
|
public partial class Polychrome
|
|
{
|
|
private bool PlayAirAttackL(string nodeName)
|
|
{
|
|
bool played = PlayTargetedAnimation("AirAttack" + nodeName);
|
|
if (played)
|
|
{
|
|
if (_hasPhotonAccelerator) ApplyPhotonAccelerator();
|
|
functionSm["LightAttack"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private bool PlayRunAttack(CharacterBase target)
|
|
{
|
|
bool played = PlayTargetedAnimation("RunAttack", target);
|
|
if (played)
|
|
{
|
|
if (_hasPhotonAccelerator) ApplyPhotonAccelerator();
|
|
functionSm["LightAttack"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private bool PlayNormalAttackL(CharacterBase target, string nextNodeName)
|
|
{
|
|
bool keepAdsorption = nextNodeName is "L4" or "L5";
|
|
bool played = PlayTargetedAnimation("Attack" + nextNodeName, target, 1f, keepAdsorption);
|
|
if (played)
|
|
{
|
|
if (_hasPhotonAccelerator) ApplyPhotonAccelerator();
|
|
functionSm["LightAttack"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private bool PlayFarSlashes(CharacterBase target)
|
|
{
|
|
bool played = PlayTargetedAnimation("FarSlashes", target);
|
|
if (played)
|
|
{
|
|
if (_hasPhotonAccelerator) ApplyPhotonAccelerator();
|
|
functionSm["FarSlashes"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private bool PlayAirAttackR()
|
|
{
|
|
bool played = PlayTargetedAnimation("AirAttackRStart");
|
|
if (played)
|
|
{
|
|
player.landMovementSc.ExtraJump(10f);
|
|
functionSm["HeavyAttack"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private bool PlayNormalAttackR(Enemy target, string suffix)
|
|
{
|
|
bool keepAdsorption = suffix is "RC";
|
|
bool played = PlayTargetedAnimation("Attack" + suffix, target, 1f, keepAdsorption);
|
|
if (played)
|
|
{
|
|
functionSm["HeavyAttack"].Execute();
|
|
}
|
|
return played;
|
|
}
|
|
|
|
private void WarpToTarget(Enemy target, FuncAnimInterval interval, float cutout = 0f, float multiplier = 1f)
|
|
{
|
|
float warpDuration = interval.Duration / multiplier;
|
|
if (interval.intervalType == IntervalType.Startup)
|
|
{
|
|
warpDuration = (interval.Duration - cutout) / multiplier;
|
|
}
|
|
fullBodyFuncAnimSm.currentRuntimeFuncAnim.AddAnimEvent(interval.StartTime, new SetFuncAnimSpeed(multiplier));
|
|
fullBodyFuncAnimSm.currentRuntimeFuncAnim.AddAnimEvent(interval.EndTime, new SetFuncAnimSpeed(1));
|
|
player.movementSc.Teleport(target, warpDuration);
|
|
}
|
|
|
|
private void PlayDisruptionAttack(Enemy target, string suffix, bool playStartupFeedback = false)
|
|
{
|
|
string animName = "DisruptionAttack" + suffix;
|
|
bool played = PlayTargetedAnimation(animName, target);
|
|
if (played)
|
|
{
|
|
float duration = fullBodyFuncAnimSm.collection[animName].Interval(IntervalType.Startup).Duration * 2;
|
|
if (playStartupFeedback)
|
|
{
|
|
player.feedbackSc.PlayFeedback("DisruptionStartup", runtimeFeedback =>
|
|
{
|
|
FeedbackClip timeScaleModifierClip = runtimeFeedback.Clip<TimeScaleModifierAction>("Time");
|
|
if (timeScaleModifierClip != null)
|
|
{
|
|
timeScaleModifierClip.duration = duration;
|
|
}
|
|
});
|
|
}
|
|
if(suffix == "B") CombatManager.PassionSystem.DecreasePassion(100, false);
|
|
functionSm["DisruptionAttack"].Execute();
|
|
}
|
|
}
|
|
|
|
private bool PlayParryAttack(List<Enemy> availableEnemies)
|
|
{
|
|
var blockSm = player.reactionSc.blockSm;
|
|
if (!blockSm.afterPerfectBlockTimer.isCompleted)
|
|
{
|
|
Enemy blockedTarget = blockSm.perfectBlockedTarget as Enemy;
|
|
if (TryPlayParryAttack(blockedTarget, availableEnemies))
|
|
{
|
|
blockSm.afterPerfectBlockTimer.Complete();
|
|
RemoveBlock();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
var dodgeSm = player.reactionSc.dodgeSm;
|
|
if (!dodgeSm.afterPerfectDodgeTimer.isCompleted)
|
|
{
|
|
Enemy dodgedTarget = dodgeSm.perfectDodgedTarget as Enemy;
|
|
if (TryPlayParryAttack(dodgedTarget, availableEnemies))
|
|
{
|
|
dodgeSm.afterPerfectDodgeTimer.Complete();
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
|
|
bool TryPlayParryAttack(Enemy parryTarget, List<Enemy> enemiesInRadius)
|
|
{
|
|
bool shouldTeleport = parryTarget != null && !enemiesInRadius.Contains(parryTarget);
|
|
bool played = PlayTargetedAnimation("BlockParryAttack", parryTarget);
|
|
if (played && shouldTeleport)
|
|
{
|
|
FuncAnimData data = fullBodyFuncAnimSm.currentData;
|
|
FuncAnimInterval interval = data.Interval(IntervalType.Startup);
|
|
WarpToTarget(parryTarget, interval, data.animInfo.overrideStartFrame * data.animationClip.frameRate, 1f);
|
|
}
|
|
return played;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|