@@ -23,6 +23,12 @@ import team.lodestar.lodestone.registry.common.LodestoneAttributeRegistry
23
23
class VoidBoundPlayerItemAbilityComponent (private val player : Player ) : AutoSyncedComponent, CommonTickingComponent {
24
24
25
25
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
26
32
27
33
fun tryUseVampirism (target : LivingEntity ){
28
34
if (vampirismCooldown <= 0 ) {
@@ -55,19 +61,63 @@ class VoidBoundPlayerItemAbilityComponent(private val player: Player) : AutoSync
55
61
return healing
56
62
}
57
63
64
+ fun increaseWrath () {
65
+ if (! finalStrike) {
66
+ wrathCounter++
67
+ wrathCooldown = wrathCooldownMax
68
+ }
69
+ sync()
70
+ }
71
+
58
72
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" )
60
77
}
61
78
62
79
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)
64
84
}
65
85
66
86
override fun tick () {
67
87
if (vampirismCooldown > 0 && VoidBoundItemUtils .getActiveAbility(player.mainHandItem) == ItemAbility .VAMPIRISM ) {
68
88
vampirismCooldown--
69
89
sync()
70
90
}
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
+ }
71
121
}
72
122
73
123
private fun sync (){
0 commit comments