2022-12-26 03:47:56 +02:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ArcanaState : State
|
|
|
|
|
{
|
|
|
|
|
public override void UpdateLogic(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (!player.enter)
|
|
|
|
|
{
|
2023-04-04 21:43:30 +03:00
|
|
|
if (player.CurrentState != this)
|
|
|
|
|
return;
|
2023-02-15 12:31:21 +02:00
|
|
|
SetTopPriority(player);
|
2023-01-12 19:12:56 +02:00
|
|
|
player.dashFrames = 0;
|
2024-02-16 03:45:37 +02:00
|
|
|
if (player.attackNetwork.name.Contains("AR"))
|
2023-11-30 20:43:04 +02:00
|
|
|
{
|
2023-11-14 15:31:56 +02:00
|
|
|
player.arcanaGauge -= PlayerStatsSO.ARCANA_MULTIPLIER;
|
2023-11-30 20:43:04 +02:00
|
|
|
DemonVector2 effectPosition = new(player.position.x, player.position.y + 20);
|
|
|
|
|
player.SetParticle("Arcana", effectPosition);
|
2024-02-16 03:45:37 +02:00
|
|
|
player.player.PlayerUI.SetDarkScreen(true);
|
|
|
|
|
GameSimulation.GlobalFreezeFrames = 8;
|
2023-11-30 20:43:04 +02:00
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
player.enter = true;
|
2022-12-27 13:12:53 +02:00
|
|
|
player.canChainAttack = false;
|
2023-01-07 23:17:55 +02:00
|
|
|
player.animation = player.attackNetwork.name;
|
|
|
|
|
player.sound = player.attackNetwork.attackSound;
|
2024-01-17 02:14:48 +02:00
|
|
|
player.soundGroup = player.attackNetwork.name[1..];
|
2022-12-26 03:47:56 +02:00
|
|
|
player.animationFrames = 0;
|
2023-01-14 19:39:35 +02:00
|
|
|
player.hitbox.enter = false;
|
2024-01-09 17:55:16 +02:00
|
|
|
if (player.attackNetwork.teleport)
|
|
|
|
|
player.position = new DemonVector2(player.otherPlayer.position.x + player.attackNetwork.teleportPosition.x, player.otherPlayer.position.y + player.attackNetwork.teleportPosition.y);
|
2022-12-26 03:47:56 +02:00
|
|
|
player.attackFrames = DemonicsAnimator.GetMaxAnimationFrames(player.playerStats._animation, player.animation);
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(player.attackNetwork.travelDistance.x * (DemonFloat)player.flip, (DemonFloat)player.attackNetwork.travelDistance.y);
|
2023-01-15 13:05:14 +02:00
|
|
|
player.InitializeProjectile(player.attackNetwork.moveName, player.attackNetwork, player.attackNetwork.projectileSpeed, player.attackNetwork.projectilePriority, player.attackNetwork.projectileDestroyOnHit);
|
2023-05-05 13:51:37 +03:00
|
|
|
player.invincible = player.player.PlayerAnimator.GetInvincible(player.animation, player.animationFrames);
|
|
|
|
|
if (player.invincible)
|
|
|
|
|
player.player.PlayerUI.DisplayNotification(NotificationTypeEnum.Reversal);
|
2023-10-01 17:21:54 +03:00
|
|
|
if (player.attackNetwork.superArmor > 0)
|
|
|
|
|
player.player.PlayerAnimator.ArmorMaterial();
|
2023-04-04 21:43:30 +03:00
|
|
|
UpdateFramedata(player);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!player.hitstop)
|
|
|
|
|
{
|
|
|
|
|
if (player.attackNetwork.travelDistance.y > 0)
|
|
|
|
|
{
|
2023-12-04 02:06:05 +02:00
|
|
|
player.canChainAttack = false;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.velocity = new DemonVector2(player.velocity.x, player.velocity.y - DemonicsPhysics.GRAVITY);
|
2023-04-04 21:43:30 +03:00
|
|
|
ToIdleFallState(player);
|
|
|
|
|
}
|
|
|
|
|
player.animationFrames++;
|
|
|
|
|
player.attackFrames--;
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
2024-02-05 16:28:15 +02:00
|
|
|
if (player.animationFrames % 3 == 0)
|
|
|
|
|
{
|
|
|
|
|
if (player.flip > 0)
|
|
|
|
|
{
|
|
|
|
|
DemonVector2 effectPosition = new DemonVector2(player.position.x - 1, player.position.y);
|
|
|
|
|
player.SetEffect("GhostArcana", player.position, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DemonVector2 effectPosition = new DemonVector2(player.position.x + 1, player.position.y);
|
|
|
|
|
player.SetEffect("GhostArcana", player.position, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-19 19:06:45 +02:00
|
|
|
player.invincible = player.player.PlayerAnimator.GetInvincible(player.animation, player.animationFrames);
|
2023-11-14 16:34:15 +02:00
|
|
|
player.invincible = player.player.PlayerAnimator.GetInvincible(player.animation, player.animationFrames);
|
2023-11-30 20:43:04 +02:00
|
|
|
if (player.invincible)
|
|
|
|
|
player.player.PlayerAnimator.InvincibleMaterial();
|
|
|
|
|
else if (player.attackNetwork.superArmor > 0)
|
|
|
|
|
player.player.PlayerAnimator.ArmorMaterial();
|
2023-10-01 17:21:54 +03:00
|
|
|
else
|
2023-11-30 20:43:04 +02:00
|
|
|
player.player.PlayerAnimator.NormalMaterial();
|
2023-04-01 16:29:28 +03:00
|
|
|
UpdateFramedata(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
ToIdleState(player);
|
2023-01-12 19:12:56 +02:00
|
|
|
Projectile(player);
|
2023-01-09 00:34:18 +02:00
|
|
|
ToHurtState(player);
|
2023-12-04 02:06:05 +02:00
|
|
|
// if (!player.hitstop)
|
|
|
|
|
// AttackCancel(player);
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
2023-01-12 19:12:56 +02:00
|
|
|
private void Projectile(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.dashFrames == 0)
|
|
|
|
|
{
|
|
|
|
|
bool isProjectile = player.player.PlayerAnimator.GetProjectile(player.animation, player.animationFrames);
|
|
|
|
|
if (isProjectile)
|
|
|
|
|
{
|
|
|
|
|
player.dashFrames = 1;
|
|
|
|
|
if (player.flip == 1)
|
|
|
|
|
{
|
|
|
|
|
player.SetProjectile(player.attackNetwork.moveName,
|
2023-07-02 23:17:37 +03:00
|
|
|
new DemonVector2(player.position.x + (player.attackNetwork.projectilePosition.x * player.flip), player.position.y + player.attackNetwork.projectilePosition.y), false);
|
2023-01-12 19:12:56 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
player.SetProjectile(player.attackNetwork.moveName,
|
2023-07-02 23:17:37 +03:00
|
|
|
new DemonVector2(player.position.x + (player.attackNetwork.projectilePosition.x * player.flip), player.position.y + player.attackNetwork.projectilePosition.y), true);
|
2023-01-12 19:12:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
private void ToIdleFallState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-07-02 23:17:37 +03:00
|
|
|
if (player.isAir && player.position.y <= DemonicsPhysics.GROUND_POINT && (DemonFloat)player.velocity.y <= (DemonFloat)0)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2024-02-05 16:28:15 +02:00
|
|
|
player.player.PlayerUI.SetDarkScreen(false);
|
|
|
|
|
GameSimulation.GlobalFreezeFrames = 0;
|
2023-12-04 02:06:05 +02:00
|
|
|
player.canChainAttack = false;
|
2023-06-27 17:23:24 +03:00
|
|
|
player.SetParticle("Fall", player.position);
|
|
|
|
|
player.sound = "Landed";
|
2023-06-18 17:04:55 +03:00
|
|
|
CheckTrainingGauges(player);
|
2023-01-19 19:06:45 +02:00
|
|
|
player.invincible = false;
|
2023-01-12 19:12:56 +02:00
|
|
|
player.dashFrames = 0;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Idle");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
2023-11-14 15:31:56 +02:00
|
|
|
|
2022-12-26 03:47:56 +02:00
|
|
|
private void ToIdleState(PlayerNetwork player)
|
|
|
|
|
{
|
|
|
|
|
if (player.attackFrames <= 0)
|
|
|
|
|
{
|
2024-02-05 16:28:15 +02:00
|
|
|
player.player.PlayerUI.SetDarkScreen(false);
|
|
|
|
|
GameSimulation.GlobalFreezeFrames = 0;
|
2023-12-04 02:06:05 +02:00
|
|
|
player.canChainAttack = false;
|
2023-01-19 19:06:45 +02:00
|
|
|
CheckTrainingGauges(player);
|
2023-01-12 19:12:56 +02:00
|
|
|
player.dashFrames = 0;
|
2023-01-08 23:39:08 +02:00
|
|
|
if (player.isAir || player.position.y > DemonicsPhysics.GROUND_POINT)
|
2022-12-26 03:47:56 +02:00
|
|
|
{
|
2023-06-27 17:23:24 +03:00
|
|
|
player.invincible = false;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Fall");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-06-27 17:23:24 +03:00
|
|
|
if (player.invincible)
|
|
|
|
|
{
|
|
|
|
|
player.SetParticle("Fall", player.position);
|
|
|
|
|
player.sound = "Landed";
|
|
|
|
|
}
|
|
|
|
|
player.invincible = false;
|
2022-12-26 03:47:56 +02:00
|
|
|
player.isCrouch = false;
|
|
|
|
|
player.isAir = false;
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Idle");
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-01-09 00:34:18 +02:00
|
|
|
private void ToHurtState(PlayerNetwork player)
|
|
|
|
|
{
|
2023-06-10 02:49:56 +03:00
|
|
|
if (IsColliding(player))
|
2023-01-09 00:34:18 +02:00
|
|
|
{
|
2024-02-05 16:28:15 +02:00
|
|
|
player.player.PlayerUI.SetDarkScreen(false);
|
|
|
|
|
GameSimulation.GlobalFreezeFrames = 0;
|
2023-12-04 02:06:05 +02:00
|
|
|
player.canChainAttack = false;
|
2023-06-10 02:49:56 +03:00
|
|
|
if (player.attackNetwork.superArmor > 0 && !player.player.PlayerAnimator.InRecovery(player.animation, player.animationFrames))
|
|
|
|
|
{
|
2023-06-19 13:55:25 +03:00
|
|
|
SuperArmorHurt(player);
|
2023-06-10 02:49:56 +03:00
|
|
|
return;
|
|
|
|
|
}
|
2023-01-12 19:12:56 +02:00
|
|
|
player.dashFrames = 0;
|
2023-01-09 00:34:18 +02:00
|
|
|
player.enter = false;
|
|
|
|
|
if (DemonicsPhysics.IsInCorner(player))
|
|
|
|
|
{
|
|
|
|
|
player.otherPlayer.knockback = 0;
|
|
|
|
|
player.otherPlayer.pushbackStart = player.otherPlayer.position;
|
2023-07-02 23:17:37 +03:00
|
|
|
player.otherPlayer.pushbackEnd = new DemonVector2(player.otherPlayer.position.x + (player.attackHurtNetwork.knockbackForce * -player.otherPlayer.flip), DemonicsPhysics.GROUND_POINT);
|
2023-01-09 00:34:18 +02:00
|
|
|
player.otherPlayer.pushbackDuration = player.attackHurtNetwork.knockbackDuration;
|
|
|
|
|
}
|
2023-01-18 21:41:03 +02:00
|
|
|
if (player.attackHurtNetwork.attackType == AttackTypeEnum.Throw)
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Grabbed");
|
2023-01-14 19:39:35 +02:00
|
|
|
if (player.attackHurtNetwork.moveName == "Shadowbreak")
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Knockback");
|
2023-01-09 00:34:18 +02:00
|
|
|
if (IsBlocking(player))
|
|
|
|
|
{
|
|
|
|
|
if (player.direction.y < 0)
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "BlockLow");
|
2023-01-09 00:34:18 +02:00
|
|
|
else
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Block");
|
2023-01-09 00:34:18 +02:00
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-05-05 13:51:37 +03:00
|
|
|
player.player.PlayerUI.DisplayNotification(NotificationTypeEnum.Punish);
|
2023-01-09 00:34:18 +02:00
|
|
|
if (player.attackHurtNetwork.hardKnockdown)
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "Airborne");
|
2023-01-09 00:34:18 +02:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (player.attackHurtNetwork.knockbackArc == 0 || player.attackHurtNetwork.softKnockdown)
|
2023-04-04 21:43:30 +03:00
|
|
|
if (player.position.y <= DemonicsPhysics.GROUND_POINT)
|
|
|
|
|
EnterState(player, "Hurt");
|
|
|
|
|
else
|
|
|
|
|
EnterState(player, "HurtAir");
|
2023-01-09 00:34:18 +02:00
|
|
|
else
|
2023-01-23 18:31:58 +02:00
|
|
|
EnterState(player, "HurtAir");
|
2023-01-09 00:34:18 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-26 03:47:56 +02:00
|
|
|
}
|