Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 30 additions & 59 deletions Assembly-CSharp/Patches/HeroController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,42 @@ public void Attack(AttackDirection attackDir)
{
ModHooks.OnAttack(attackDir); //MOD API ADDED
if (Time.timeSinceLevelLoad - this.altAttackTime > this.ALT_ATTACK_RESET)
{
this.cState.altAttack = false;
}

this.cState.attacking = true;
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_32)))
{
this.attackDuration = this.ATTACK_DURATION_CH;
}
else
{
this.attackDuration = this.ATTACK_DURATION;
}

if (this.cState.wallSliding)
{
this.wallSlashing = true;
this.slashComponent = this.wallSlash;
this.slashFsm = this.wallSlashFsm;
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
{
if ((this.playerData.GetInt(nameof(PlayerData.health)) == this.playerData.CurrentMaxHealth && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
{
if (this.transform.localScale.x > 0f)
this.grubberFlyBeam = this.grubberFlyBeamPrefabR.Spawn(this.transform.position);
else
this.grubberFlyBeam = this.grubberFlyBeamPrefabL.Spawn(this.transform.position);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
else
this.grubberFlyBeam.transform.SetScaleY(1f);
}
if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
{
if (this.transform.localScale.x > 0f)
this.grubberFlyBeam = this.grubberFlyBeamPrefabR_fury.Spawn(this.transform.position);
else
this.grubberFlyBeam = this.grubberFlyBeamPrefabL_fury.Spawn(this.transform.position);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
else
this.grubberFlyBeam.transform.SetScaleY(1f);
}
}
}
else
{
Expand All @@ -91,49 +108,29 @@ public void Attack(AttackDirection attackDir)
this.slashFsm = this.alternateSlashFsm;
this.cState.altAttack = false;
}

if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
{
if ((this.playerData.GetInt(nameof(PlayerData.health)) == this.playerData.GetInt(nameof(PlayerData.maxHealth)) && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
if ((this.playerData.GetInt(nameof(PlayerData.health)) >= this.playerData.CurrentMaxHealth && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
{
if (this.transform.localScale.x < 0f)
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabR.Spawn(this.transform.position);
}
else
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabL.Spawn(this.transform.position);
}

if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
}
else
{
this.grubberFlyBeam.transform.SetScaleY(1f);
}
}

if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
{
if (this.transform.localScale.x < 0f)
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabR_fury.Spawn(this.transform.position);
}
else
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabL_fury.Spawn(this.transform.position);
}

if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
}
else
{
this.grubberFlyBeam.transform.SetScaleY(1f);
}
}
}
}
Expand All @@ -144,26 +141,21 @@ public void Attack(AttackDirection attackDir)
this.cState.upAttacking = true;
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
{
if ((this.playerData.GetInt(nameof(PlayerData.health)) == this.playerData.GetInt(nameof(PlayerData.maxHealth)) && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
if ((this.playerData.GetInt(nameof(PlayerData.health)) >= this.playerData.CurrentMaxHealth && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabU.Spawn(this.transform.position);
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
}
}

if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabU_fury.Spawn(this.transform.position);
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
}
}
}
}
Expand All @@ -174,67 +166,46 @@ public void Attack(AttackDirection attackDir)
this.cState.downAttacking = true;
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
{
if ((this.playerData.GetInt(nameof(PlayerData.health)) == this.playerData.GetInt(nameof(PlayerData.maxHealth)) && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
if ((this.playerData.GetInt(nameof(PlayerData.health)) >= this.playerData.CurrentMaxHealth && !this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))) || (this.joniBeam && this.playerData.GetBool(nameof(PlayerData.equippedCharm_27))))
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabD.Spawn(this.transform.position);
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
}
}

if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
{
this.grubberFlyBeam = this.grubberFlyBeamPrefabD_fury.Spawn(this.transform.position);
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
{
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
}
}
}
}
}

if (this.cState.wallSliding)
{
if (this.cState.facingRight)
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
}
else
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
}
}
else if (attackDir == AttackDirection.normal && this.cState.facingRight)
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
}
else if (attackDir == AttackDirection.normal && !this.cState.facingRight)
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
}
else if (attackDir == AttackDirection.upward)
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 90f;
}
else if (attackDir == AttackDirection.downward)
{
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 270f;
}

this.altAttackTime = Time.timeSinceLevelLoad;
ModHooks.AfterAttack(attackDir); //MOD API - Added
if (!this.cState.attacking) return; //MOD API - Added
if (!this.cState.attacking) return; //MOD API - Added
this.slashComponent.StartSlash();
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_38)))
{
this.fsm_orbitShield.SendEvent("SLASH");
}
}

#endregion
Expand Down Expand Up @@ -936,4 +907,4 @@ public void DoAttack()
orig_DoAttack();
}
}
}
}