Skip to content

Commit ba5d809

Browse files
committed
feeffefe
1 parent 0b2d22b commit ba5d809

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

src/main/kotlin/dev/sterner/common/components/VoidBoundPlayerItemAbilityComponent.kt

+52-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ import team.lodestar.lodestone.registry.common.LodestoneAttributeRegistry
2323
class VoidBoundPlayerItemAbilityComponent(private val player: Player) : AutoSyncedComponent, CommonTickingComponent {
2424

2525
private var vampirismCooldown: Int = 0
26+
private var wrathCooldown: Int = 0
27+
private val wrathCooldownMax = 20 * 60
28+
private var finalStrike = false
29+
private val finalStrikeCooldownMax = 20 * 20
30+
private var finalStrikeDuration = 0
31+
private var wrathCounter = 0
2632

2733
fun tryUseVampirism(target: LivingEntity){
2834
if (vampirismCooldown <= 0) {
@@ -55,19 +61,63 @@ class VoidBoundPlayerItemAbilityComponent(private val player: Player) : AutoSync
5561
return healing
5662
}
5763

64+
fun increaseWrath() {
65+
if (!finalStrike) {
66+
wrathCounter++
67+
wrathCooldown = wrathCooldownMax
68+
}
69+
sync()
70+
}
71+
5872
override fun readFromNbt(tag: CompoundTag) {
59-
vampirismCooldown = tag.getInt("vampirm")
73+
vampirismCooldown = tag.getInt("vampirismCooldown")
74+
wrathCooldown = tag.getInt("wrathCooldown")
75+
wrathCounter = tag.getInt("wrathCounter")
76+
finalStrike = tag.getBoolean("finalStrike")
6077
}
6178

6279
override fun writeToNbt(tag: CompoundTag) {
63-
tag.putInt("vampirm", vampirismCooldown)
80+
tag.putInt("vampirismCooldown", vampirismCooldown)
81+
tag.putInt("wrathCooldown", wrathCooldown)
82+
tag.putInt("wrathCounter", wrathCounter)
83+
tag.putBoolean("finalStrike", finalStrike)
6484
}
6585

6686
override fun tick() {
6787
if (vampirismCooldown > 0 && VoidBoundItemUtils.getActiveAbility(player.mainHandItem) == ItemAbility.VAMPIRISM) {
6888
vampirismCooldown--
6989
sync()
7090
}
91+
92+
if (!finalStrike) {
93+
// Wrath logic
94+
if (wrathCounter in 1..9) {
95+
if (wrathCooldown > 0) {
96+
wrathCooldown--
97+
} else {
98+
// If cooldown hits 0, reset the wrath counter
99+
wrathCounter = 0
100+
}
101+
sync()
102+
}
103+
104+
// FinalStrike logic when wrathCounter reaches 10
105+
if (wrathCounter == 10) {
106+
finalStrike = true
107+
wrathCounter = 0
108+
wrathCooldown = 0
109+
finalStrikeDuration = finalStrikeCooldownMax
110+
sync()
111+
}
112+
} else {
113+
// Handle ticking down the finalStrike duration
114+
if (finalStrikeDuration > 0) {
115+
finalStrikeDuration--
116+
} else {
117+
finalStrike = false
118+
}
119+
sync()
120+
}
71121
}
72122

73123
private fun sync(){

0 commit comments

Comments
 (0)