Skip to content

Commit ecdc0fe

Browse files
FrogBishopfifty-six
authored andcommitted
1 parent 3c47ab5 commit ecdc0fe

File tree

1 file changed

+30
-59
lines changed

1 file changed

+30
-59
lines changed

Assembly-CSharp/Patches/HeroController.cs

Lines changed: 30 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,42 @@ public void Attack(AttackDirection attackDir)
5454
{
5555
ModHooks.OnAttack(attackDir); //MOD API ADDED
5656
if (Time.timeSinceLevelLoad - this.altAttackTime > this.ALT_ATTACK_RESET)
57-
{
5857
this.cState.altAttack = false;
59-
}
60-
6158
this.cState.attacking = true;
6259
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_32)))
63-
{
6460
this.attackDuration = this.ATTACK_DURATION_CH;
65-
}
6661
else
67-
{
6862
this.attackDuration = this.ATTACK_DURATION;
69-
}
70-
7163
if (this.cState.wallSliding)
7264
{
7365
this.wallSlashing = true;
7466
this.slashComponent = this.wallSlash;
7567
this.slashFsm = this.wallSlashFsm;
68+
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
69+
{
70+
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))))
71+
{
72+
if (this.transform.localScale.x > 0f)
73+
this.grubberFlyBeam = this.grubberFlyBeamPrefabR.Spawn(this.transform.position);
74+
else
75+
this.grubberFlyBeam = this.grubberFlyBeamPrefabL.Spawn(this.transform.position);
76+
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
77+
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
78+
else
79+
this.grubberFlyBeam.transform.SetScaleY(1f);
80+
}
81+
if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
82+
{
83+
if (this.transform.localScale.x > 0f)
84+
this.grubberFlyBeam = this.grubberFlyBeamPrefabR_fury.Spawn(this.transform.position);
85+
else
86+
this.grubberFlyBeam = this.grubberFlyBeamPrefabL_fury.Spawn(this.transform.position);
87+
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
88+
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
89+
else
90+
this.grubberFlyBeam.transform.SetScaleY(1f);
91+
}
92+
}
7693
}
7794
else
7895
{
@@ -91,49 +108,29 @@ public void Attack(AttackDirection attackDir)
91108
this.slashFsm = this.alternateSlashFsm;
92109
this.cState.altAttack = false;
93110
}
94-
95111
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
96112
{
97-
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))))
113+
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))))
98114
{
99115
if (this.transform.localScale.x < 0f)
100-
{
101116
this.grubberFlyBeam = this.grubberFlyBeamPrefabR.Spawn(this.transform.position);
102-
}
103117
else
104-
{
105118
this.grubberFlyBeam = this.grubberFlyBeamPrefabL.Spawn(this.transform.position);
106-
}
107-
108119
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
109-
{
110120
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
111-
}
112121
else
113-
{
114122
this.grubberFlyBeam.transform.SetScaleY(1f);
115-
}
116123
}
117-
118124
if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
119125
{
120126
if (this.transform.localScale.x < 0f)
121-
{
122127
this.grubberFlyBeam = this.grubberFlyBeamPrefabR_fury.Spawn(this.transform.position);
123-
}
124128
else
125-
{
126129
this.grubberFlyBeam = this.grubberFlyBeamPrefabL_fury.Spawn(this.transform.position);
127-
}
128-
129130
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
130-
{
131131
this.grubberFlyBeam.transform.SetScaleY(this.MANTIS_CHARM_SCALE);
132-
}
133132
else
134-
{
135133
this.grubberFlyBeam.transform.SetScaleY(1f);
136-
}
137134
}
138135
}
139136
}
@@ -144,26 +141,21 @@ public void Attack(AttackDirection attackDir)
144141
this.cState.upAttacking = true;
145142
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
146143
{
147-
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))))
144+
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))))
148145
{
149146
this.grubberFlyBeam = this.grubberFlyBeamPrefabU.Spawn(this.transform.position);
150147
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
151148
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
152149
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
153-
{
154150
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
155-
}
156151
}
157-
158152
if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
159153
{
160154
this.grubberFlyBeam = this.grubberFlyBeamPrefabU_fury.Spawn(this.transform.position);
161155
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
162156
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 270f);
163157
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
164-
{
165158
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
166-
}
167159
}
168160
}
169161
}
@@ -174,67 +166,46 @@ public void Attack(AttackDirection attackDir)
174166
this.cState.downAttacking = true;
175167
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_35)))
176168
{
177-
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))))
169+
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))))
178170
{
179171
this.grubberFlyBeam = this.grubberFlyBeamPrefabD.Spawn(this.transform.position);
180172
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
181173
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
182174
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
183-
{
184175
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
185-
}
186176
}
187-
188177
if (this.playerData.GetInt(nameof(PlayerData.health)) == 1 && this.playerData.GetBool(nameof(PlayerData.equippedCharm_6)) && this.playerData.GetInt(nameof(PlayerData.healthBlue)) < 1)
189178
{
190179
this.grubberFlyBeam = this.grubberFlyBeamPrefabD_fury.Spawn(this.transform.position);
191180
this.grubberFlyBeam.transform.SetScaleY(this.transform.localScale.x);
192181
this.grubberFlyBeam.transform.localEulerAngles = new Vector3(0f, 0f, 90f);
193182
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_13)))
194-
{
195183
this.grubberFlyBeam.transform.SetScaleY(this.grubberFlyBeam.transform.localScale.y * this.MANTIS_CHARM_SCALE);
196-
}
197184
}
198185
}
199186
}
200187
}
201-
202188
if (this.cState.wallSliding)
203189
{
204190
if (this.cState.facingRight)
205-
{
206191
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
207-
}
208192
else
209-
{
210193
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
211-
}
212194
}
213195
else if (attackDir == AttackDirection.normal && this.cState.facingRight)
214-
{
215196
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 0f;
216-
}
217197
else if (attackDir == AttackDirection.normal && !this.cState.facingRight)
218-
{
219198
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 180f;
220-
}
221199
else if (attackDir == AttackDirection.upward)
222-
{
223200
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 90f;
224-
}
225201
else if (attackDir == AttackDirection.downward)
226-
{
227202
this.slashFsm.FsmVariables.GetFsmFloat("direction").Value = 270f;
228-
}
229-
230203
this.altAttackTime = Time.timeSinceLevelLoad;
231204
ModHooks.AfterAttack(attackDir); //MOD API - Added
232-
if (!this.cState.attacking) return; //MOD API - Added
205+
if (!this.cState.attacking) return; //MOD API - Added
233206
this.slashComponent.StartSlash();
234207
if (this.playerData.GetBool(nameof(PlayerData.equippedCharm_38)))
235-
{
236208
this.fsm_orbitShield.SendEvent("SLASH");
237-
}
238209
}
239210

240211
#endregion
@@ -936,4 +907,4 @@ public void DoAttack()
936907
orig_DoAttack();
937908
}
938909
}
939-
}
910+
}

0 commit comments

Comments
 (0)