2023-04-01 16:29:28 +03:00
|
|
|
using Demonics;
|
2023-06-12 10:40:01 +03:00
|
|
|
using UnityEngine;
|
2022-12-27 13:12:53 +02:00
|
|
|
|
2022-12-28 14:10:45 +02:00
|
|
|
public class HurtParentState : State
|
2022-12-27 13:12:53 +02:00
|
|
|
{
|
2023-01-06 23:10:53 +02:00
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
2023-04-04 21:43:30 +03:00
|
|
|
if (!player.hitstop)
|
2023-04-02 15:59:44 +03:00
|
|
|
{
|
2023-04-04 21:43:30 +03:00
|
|
|
AfterHitstop(player);
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2023-04-01 16:29:28 +03:00
|
|
|
if (SceneSettings.IsTrainingMode)
|
|
|
|
|
player.framedataEnum = FramedataTypesEnum.Hurt;
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
|
|
|
|
protected virtual void OnEnter(PlayerNetwork player)
|
|
|
|
|
{
|
2024-01-17 02:14:48 +02:00
|
|
|
player.soundGroup = "Hurt";
|
2023-05-28 14:10:29 +03:00
|
|
|
player.otherPlayer.ArcanaGain(ArcanaGainTypes.AttackOnHit);
|
|
|
|
|
player.ArcanaGain(ArcanaGainTypes.DefendOnHit);
|
2023-01-19 19:06:45 +02:00
|
|
|
CheckTrainingGauges(player);
|
2023-01-19 02:51:24 +02:00
|
|
|
player.shadow.isOnScreen = false;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = DemonVector2.Zero;
|
2023-01-06 23:10:53 +02:00
|
|
|
player.animationFrames = 0;
|
|
|
|
|
if (player.combo == 0)
|
|
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
player.comboTimerStarter = player.attackHurtNetwork.comboTimerStarter;
|
|
|
|
|
player.comboTimer = ComboTimerStarterTypes.GetComboTimerStarterValue(player.comboTimerStarter);
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2024-01-30 20:38:57 +02:00
|
|
|
if (player.attackHurtNetwork.moveMaterial == "Fire")
|
|
|
|
|
player.player.PlayerAnimator.FireMaterial();
|
2023-01-06 23:10:53 +02:00
|
|
|
player.player.OtherPlayerUI.SetComboTimerActive(true);
|
|
|
|
|
player.combo++;
|
2023-02-03 17:24:21 +02:00
|
|
|
player.health -= CalculateDamage(player, player.attackHurtNetwork.damage, player.playerStats.Defense);
|
2023-01-17 00:02:29 +02:00
|
|
|
player.healthRecoverable -= CalculateRecoverableDamage(player, player.attackHurtNetwork.damage, player.playerStats.Defense);
|
2023-01-06 23:10:53 +02:00
|
|
|
player.player.StartShakeContact();
|
|
|
|
|
player.player.PlayerUI.Damaged();
|
|
|
|
|
player.player.OtherPlayerUI.IncreaseCombo(player.combo);
|
|
|
|
|
player.enter = true;
|
|
|
|
|
player.otherPlayer.canChainAttack = true;
|
|
|
|
|
player.sound = player.attackHurtNetwork.impactSound;
|
2023-01-07 23:17:55 +02:00
|
|
|
if (!player.wasWallSplatted)
|
2023-06-26 17:00:26 +03:00
|
|
|
player.SetParticle(player.attackHurtNetwork.hurtEffect, player.hurtPosition);
|
2023-01-06 23:10:53 +02:00
|
|
|
if (player.attackHurtNetwork.cameraShakerNetwork.timer > 0)
|
|
|
|
|
CameraShake.Instance.Shake(player.attackHurtNetwork.cameraShakerNetwork);
|
|
|
|
|
player.stunFrames = player.attackHurtNetwork.hitStun;
|
|
|
|
|
player.knockback = 0;
|
2023-01-07 23:17:55 +02:00
|
|
|
player.pushbackStart = player.position;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.pushbackEnd = new DemonVector2(player.position.x + (player.attackHurtNetwork.knockbackForce * -player.flip), DemonicsPhysics.GROUND_POINT);
|
2023-01-23 18:31:58 +02:00
|
|
|
if (player.health <= 0)
|
|
|
|
|
{
|
2024-01-17 02:14:48 +02:00
|
|
|
player.soundGroup = "Death";
|
2023-10-24 22:05:09 +03:00
|
|
|
CameraShake.Instance.Zoom(30, 0.2f);
|
2023-01-28 17:42:01 +02:00
|
|
|
player.invincible = true;
|
2023-10-24 22:05:09 +03:00
|
|
|
CameraShake.Instance.Shake(new CameraShakerNetwork() { intensity = 30, timer = 0.5f });
|
2023-01-27 17:32:10 +02:00
|
|
|
if (!SceneSettings.IsTrainingMode)
|
|
|
|
|
{
|
2023-01-28 17:42:01 +02:00
|
|
|
GameSimulation.GlobalHitstop = 4;
|
2023-01-27 17:32:10 +02:00
|
|
|
GameSimulation.Run = false;
|
2023-03-11 15:57:01 +02:00
|
|
|
GameSimulation.Timer = GameSimulation._timerMax;
|
2023-01-27 17:32:10 +02:00
|
|
|
}
|
2023-01-23 18:31:58 +02:00
|
|
|
}
|
2023-04-04 21:43:30 +03:00
|
|
|
if (SceneSettings.IsTrainingMode)
|
|
|
|
|
player.framedataEnum = FramedataTypesEnum.Hurt;
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected virtual void AfterHitstop(PlayerNetwork player)
|
|
|
|
|
{
|
2024-02-16 03:45:37 +02:00
|
|
|
if (player.attackHurtNetwork.name.Contains("AR"))
|
2024-02-05 16:28:15 +02:00
|
|
|
{
|
|
|
|
|
player.otherPlayer.player.PlayerUI.SetDarkScreen(false);
|
|
|
|
|
GameSimulation.GlobalFreezeFrames = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-27 15:20:51 +02:00
|
|
|
GameSimulation.GlobalHitstop = 1;
|
2023-01-07 23:17:55 +02:00
|
|
|
if (player.attackHurtNetwork.knockbackDuration > 0 && player.knockback <= player.attackHurtNetwork.knockbackDuration)
|
2023-01-06 23:10:53 +02:00
|
|
|
{
|
2023-01-07 23:17:55 +02:00
|
|
|
Knockback(player);
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2023-02-14 14:31:19 +02:00
|
|
|
else
|
|
|
|
|
{
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
|
2023-02-14 14:31:19 +02:00
|
|
|
}
|
2023-01-16 13:26:54 +02:00
|
|
|
if (!player.comboLocked)
|
|
|
|
|
{
|
|
|
|
|
player.comboTimer--;
|
|
|
|
|
}
|
2023-01-06 23:10:53 +02:00
|
|
|
player.stunFrames--;
|
|
|
|
|
player.player.OtherPlayerUI.SetComboTimer
|
2023-07-02 23:17:37 +03:00
|
|
|
(DemonFloat.Lerp((DemonFloat)0, (DemonFloat)1,
|
|
|
|
|
(DemonFloat)player.comboTimer / (DemonFloat)ComboTimerStarterTypes.GetComboTimerStarterValue(player.comboTimerStarter)), ComboTimerStarterTypes.GetComboTimerStarterColor(player.comboTimerStarter));
|
2023-01-06 23:10:53 +02:00
|
|
|
}
|
2023-01-07 23:17:55 +02:00
|
|
|
|
|
|
|
|
protected virtual void Knockback(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
}
|
2022-12-27 13:12:53 +02:00
|
|
|
}
|