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.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; } else { this.wallSlashing = false; if (attackDir == AttackDirection.normal) { if (!this.cState.altAttack) { this.slashComponent = this.normalSlash; this.slashFsm = this.normalSlashFsm; this.cState.altAttack = true; } else { this.slashComponent = this.alternateSlash; this.slashFsm = this.alternateSlashFsm; this.cState.altAttack = false; } if (this.playerData.equippedCharm_35) { if ((this.playerData.health == this.playerData.maxHealth && !this.playerData.equippedCharm_27) || (this.joniBeam && this.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.equippedCharm_13) { this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE); } else { this.grubberFlyBeam.transform.SetScaleY(1f); } } if (this.playerData.health == 1 && this.playerData.equippedCharm_6 && this.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.equippedCharm_13) { this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE); } else { this.grubberFlyBeam.transform.SetScaleY(1f); } } } } else if (attackDir == AttackDirection.upward) { this.slashComponent = this.upSlash; this.slashFsm = this.upSlashFsm; this.cState.upAttacking = true; if (this.playerData.equippedCharm_35) { if ((this.playerData.health == this.playerData.maxHealth && !this.playerData.equippedCharm_27) || (this.joniBeam && this.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.equippedCharm_13) { this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE); } } if (this.playerData.health == 1 && this.playerData.equippedCharm_6 && this.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.equippedCharm_13) { this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE); } } } } else if (attackDir == AttackDirection.downward) { this.slashComponent = this.downSlash; this.slashFsm = this.downSlashFsm; this.cState.downAttacking = true; if (this.playerData.equippedCharm_35) { if ((this.playerData.health == this.playerData.maxHealth && !this.playerData.equippedCharm_27) || (this.joniBeam && this.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.equippedCharm_13) { this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE); } } if (this.playerData.health == 1 && this.playerData.equippedCharm_6 && this.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.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 } this.slashComponent.StartSlash(); if (this.playerData.equippedCharm_38) { this.fsm_orbitShield.SendEvent("SLASH"); } }