Skip to content

Commit

Permalink
add more augments
Browse files Browse the repository at this point in the history
  • Loading branch information
TheThanathor committed Sep 30, 2024
1 parent 7f01851 commit a7fb11e
Show file tree
Hide file tree
Showing 34 changed files with 729 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ execute store result score $augment gm4_aa_data run data get storage gm4_augment

# run based on augment id
execute if score $augment gm4_aa_data matches 8 run function gm4_augmented_armor:armor/augment/type/sparking/damage_dealt
execute if score $augment gm4_aa_data matches 22 run function gm4_augmented_armor:armor/augment/type/charging/damage_dealt
execute if score $augment gm4_aa_data matches 23 run function gm4_augmented_armor:armor/augment/type/giantsbane/damage_dealt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ execute summon wolf run function gm4_augmented_armor:armor/augment/type/canine/w
# playsound with cooldown
execute unless score @s gm4_aa_augment.canine.timer matches 1.. run playsound minecraft:entity.wolf.whine neutral @s ~ ~ ~ 0.6 0.8
scoreboard players set @s gm4_aa_augment.canine.timer 1

# cleanup
data remove storage gm4_augmented_armor:temp uuid
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# grant ramping move speed and hunger to sprinting player
# @s = player wearing husk armour above 50% health and sprinting
# at unspecified
# run from armor/augment/damage_dealt

scoreboard players set $change gm4_aa_data 1

# if player was above 4 attack speed add full charge unless it was already here
execute if score $attribute.attack_speed gm4_aa_data matches 41.. unless score $active gm4_aa_data matches 1 run return run function gm4_augmented_armor:armor/augment/type/charging/full_charge

# remove charge if this piece was charged and charge was used
execute if score $active gm4_aa_data matches 1 run return run function gm4_augmented_armor:armor/augment/type/charging/remove_charge

# otherwise increase the level
execute store result score $level gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.levels[0] 10

execute if score $slot gm4_aa_data matches 0 store result score $curr_bonus gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:head.dynamic"}].amount 1000
execute if score $slot gm4_aa_data matches 1 store result score $curr_bonus gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:chest.dynamic"}].amount 1000
execute if score $slot gm4_aa_data matches 2 store result score $curr_bonus gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:legs.dynamic"}].amount 1000
execute if score $slot gm4_aa_data matches 3 store result score $curr_bonus gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:feet.dynamic"}].amount 1000

scoreboard players operation $curr_bonus gm4_aa_data += $level gm4_aa_data

execute if score $slot gm4_aa_data matches 0 store result storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:head.dynamic"}].amount float 0.001 run scoreboard players get $curr_bonus gm4_aa_data
execute if score $slot gm4_aa_data matches 1 store result storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:chest.dynamic"}].amount float 0.001 run scoreboard players get $curr_bonus gm4_aa_data
execute if score $slot gm4_aa_data matches 2 store result storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:legs.dynamic"}].amount float 0.001 run scoreboard players get $curr_bonus gm4_aa_data
execute if score $slot gm4_aa_data matches 3 store result storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:feet.dynamic"}].amount float 0.001 run scoreboard players get $curr_bonus gm4_aa_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

data modify storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.augment.active set value 1

# activate attribute
execute if score $slot gm4_aa_data matches 0 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:head.dynamic_2"}].amount set value 1
execute if score $slot gm4_aa_data matches 1 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:chest.dynamic_2"}].amount set value 1
execute if score $slot gm4_aa_data matches 2 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:legs.dynamic_2"}].amount set value 1
execute if score $slot gm4_aa_data matches 3 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:feet.dynamic_2"}].amount set value 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

data modify storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.augment.active set value 0

# disable attributes
execute if score $slot gm4_aa_data matches 0 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:head.dynamic"}].amount set value 0
execute if score $slot gm4_aa_data matches 1 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:chest.dynamic"}].amount set value 0
execute if score $slot gm4_aa_data matches 2 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:legs.dynamic"}].amount set value 0
execute if score $slot gm4_aa_data matches 3 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:feet.dynamic"}].amount set value 0

execute if score $slot gm4_aa_data matches 0 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:head.dynamic_2"}].amount set value 0
execute if score $slot gm4_aa_data matches 1 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:chest.dynamic_2"}].amount set value 0
execute if score $slot gm4_aa_data matches 2 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:legs.dynamic_2"}].amount set value 0
execute if score $slot gm4_aa_data matches 3 run data modify storage gm4_augmented_armor:temp components."minecraft:attribute_modifiers".modifiers[{id:"gm4_augmented_armor:feet.dynamic_2"}].amount set value 0

# sound and particles
execute at @n[distance=..12,nbt={HurtTime:10s}] run particle electric_spark ~ ~1.2 ~ 0.3 0.3 0.3 1 4
playsound minecraft:entity.lightning_bolt.thunder player @a ~ ~ ~ 0.5 2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

execute store result score $damage_dealt gm4_aa_data run attribute @s generic.attack_damage get 100

tag @s add gm4_aa_augment_damager
execute as @n[type=!#gm4_augmented_armor:augment_immune,distance=..12,tag=!gm4_aa_augment_damager,tag=!smithed.strict,nbt={HurtTime:10s}] run function gm4_augmented_armor:armor/augment/type/giantsbane/damage
tag @s remove gm4_aa_augment_damager

scoreboard players reset $augment.giantsbane_damage gm4_aa_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

execute store result score $giantsbane_damage gm4_aa_data run attribute @s generic.max_health get 100
scoreboard players operation $giantsbane_damage gm4_aa_data *= $augment.giantsbane_damage gm4_aa_data
scoreboard players operation $giantsbane_damage gm4_aa_data /= #100 gm4_aa_data

# sound and particles
execute at @s run particle block{block_state:"chest"} ~ ~1 ~ 0.3 0.3 0.3 0.5 12
playsound minecraft:entity.zombie.attack_wooden_door player @a ~ ~ ~ 1 0

# use custom system for player
execute if entity @s[type=player] run function gm4_augmented_armor:armor/augment/type/giantsbane/player_target/damage

# calcualte new health for non-player
execute store result score $health gm4_aa_data run data get entity @s Health 100
scoreboard players operation $health gm4_aa_data -= $giantsbane_damage gm4_aa_data
# if health is reduced to 0 kill this entity
execute unless score $health gm4_aa_data matches 1.. run damage @s 9999 mob_attack by @p[tag=gm4_aa_augment_damager]
# otherwise reduce health to new total
execute store result entity @s[type=!player] Health float 0.01 run scoreboard players get $health gm4_aa_data
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# grant ramping move speed and hunger to sprinting player
# @s = player wearing husk armour above 50% health and sprinting
# at unspecified
# run from armor/augment/damage_dealt

# check the UUID of target entity
data modify storage gm4_augmented_armor:temp giantsbane.target_UUID set from entity @n[type=!#gm4_augmented_armor:augment_immune,distance=..12,tag=!gm4_aa_augment_damager,tag=!smithed.strict,nbt={HurtTime:10s}] UUID
data modify storage gm4_augmented_armor:temp giantsbane.armor_UUID set from storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.last_target
execute store result score $new_target gm4_aa_data run data modify storage gm4_augmented_armor:temp giantsbane.armor_UUID set from storage gm4_augmented_armor:temp giantsbane.target_UUID
execute if score $new_target gm4_aa_data matches 0 run return 0

# set new UUID
scoreboard players set $change gm4_aa_data 1
data modify storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.last_target set from storage gm4_augmented_armor:temp giantsbane.target_UUID

# store level in $augment.giantsbane_damage to use later
execute store result score $level gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.levels[0]
scoreboard players operation $augment.giantsbane_damage gm4_aa_data += $level gm4_aa_data

# cleanup
data remove storage gm4_augmented_armor:temp giantsbane
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

scoreboard players operation $giantsbane_damage gm4_aa_data += $damage_dealt gm4_aa_data
execute store result storage gm4_augmented_armor:temp giantsbane.damage float 0.01 run scoreboard players get $giantsbane_damage gm4_aa_data
function gm4_augmented_armor:armor/augment/type/giantsbane/player_target/eval_damage with storage gm4_augmented_armor:temp giantsbane
data remove storage gm4_augmented_armor:temp giantsbane
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

$damage @s $(damage) player_attack by @p[tag=gm4_aa_augment_damager]
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

# if the augment clock was not running first clear any old stacks
execute if score $keep_tick.sparking gm4_aa_keep_tick matches 0 as @e[scores={gm4_aa_augment.sparking.static_stacks=1..}] run function gm4_augmented_armor:armor/augment/type/sparking/remove_static

scoreboard players operation @s gm4_aa_augment.sparking.static_stacks += $level gm4_aa_data
scoreboard players set @s gm4_aa_augment.sparking.timer 160

execute unless score $keep_tick.sparking gm4_aa_keep_tick matches 1 run schedule function gm4_augmented_armor:clocks/temp/sparking 1t
scoreboard players set $keep_tick.sparking gm4_aa_keep_tick 1
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
execute store result score $level gm4_aa_data run data get storage gm4_augmented_armor:temp components."minecraft:custom_data".gm4_augmented_armor.levels[0]

# apply stacks
execute anchored eyes positioned ^ ^ ^3 as @e[type=!#gm4_augmented_armor:effect_immune,distance=..12,tag=!gm4_aa_self,tag=!smithed.strict,nbt={HurtTime:10s}] run function gm4_augmented_armor:armor/augment/type/sparking/add_static
execute anchored eyes positioned ^ ^ ^3 as @e[type=!#gm4_augmented_armor:augment_immune,distance=..12,tag=!gm4_aa_self,tag=!smithed.strict,nbt={HurtTime:10s}] run function gm4_augmented_armor:armor/augment/type/sparking/add_static
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

execute unless entity @s[type=player] run damage @s 42 lightning_bolt at ~ ~ ~
execute if entity @s[type=player] run damage @s 16 lightning_bolt at ~ ~ ~
execute as @e[distance=0.01..2.5,type=!player,type=!#gm4_augmented_armor:effect_immune,tag=!smithed.strict] run damage @s 21 lightning_bolt at ~ ~ ~
execute as @e[distance=0.01..2.5,type=!player,type=!#gm4_augmented_armor:augment_resist,tag=!smithed.strict] run damage @s 21 lightning_bolt at ~ ~ ~
summon lightning_bolt

scoreboard players set @s gm4_aa_augment.sparking.timer 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
advancement revoke @s only gm4_augmented_armor:damage_dealt
# run from player/in_pvp

# | Prep for augments
# store attack speed
execute store result score $attribute.attack_speed gm4_aa_data run attribute @s generic.attack_speed get 10

# store armor items to storage
item replace block 29999998 1 7134 container.0 from entity @s armor.head
item replace block 29999998 1 7134 container.1 from entity @s armor.chest
Expand All @@ -20,5 +24,8 @@ execute if data storage gm4_augmented_armor:temp Items[{Slot:2b}].components."mi
execute if data storage gm4_augmented_armor:temp Items[{Slot:3b}].components."minecraft:custom_data".gm4_augmented_armor.augment.triggers{damage_dealt:1} run function gm4_augmented_armor:armor/slot/feet
scoreboard players set $trigger.damage_dealt gm4_aa_data 0

# Giantsbane
execute if score $augment.giantsbane_damage gm4_aa_data matches 1.. run function gm4_augmented_armor:armor/augment/type/giantsbane/activate

# cleanup
data remove storage gm4_augmented_armor:temp Items
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
# @s = unspecified
# at unspecified
# schedule from armor/augment/type/spark/activate
# schedule from weapon/augment/lightning/add_score
# schedule from here

# if the clock just started we remove any static stacks
execute if score $keep_tick.sparking gm4_aa_keep_tick matches 0 as @e[scores={gm4_aa_augment.sparking.static_stacks=1..}] run function gm4_augmented_armor:armor/augment/type/sparking/remove_static

scoreboard players set $keep_tick.sparking gm4_aa_keep_tick 0
execute as @e[scores={gm4_aa_augment.sparking.static_stacks=1..}] at @s run function gm4_augmented_armor:armor/augment/type/sparking/tick
execute if score $keep_tick.sparking gm4_aa_keep_tick matches 1 run schedule function gm4_augmented_armor:clocks/temp/sparking 1t
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ scoreboard objectives add gm4_aa_augment.berserkers.timer dummy
scoreboard objectives add gm4_aa_augment.hawkeye.max_damage dummy
scoreboard objectives add gm4_aa_augment.hawkeye.count dummy

scoreboard objectives add gm4_aa_training_dummy.dps dummy
scoreboard objectives add gm4_aa_training_dummy.total_damage dummy
scoreboard objectives add gm4_aa_training_dummy.timer dummy

# constants
scoreboard players set #-1 gm4_aa_data -1
scoreboard players set #0 gm4_aa_data 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ schedule function gm4_augmented_armor:tick 1t
execute as @e[type=item,tag=!gm4_aa_item_checked] run function gm4_augmented_armor:check_item

execute as @e[type=marker,tag=gm4_aa_process_marker.tick] run function gm4_augmented_armor:clocks/process_markers_tick

# training dummy
execute as @e[type=zombie,tag=gm4_aa_training_dummy] run function gm4_augmented_armor:training_dummy/process
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# add new entry to dps_array
data modify storage gm4_augmented_armor:temp dps.new set value {gametime:0,damage:0}
execute store result storage gm4_augmented_armor:temp dps.new.gametime int 1 run scoreboard players get $gametime gm4_aa_data
execute store result storage gm4_augmented_armor:temp dps.new.damage int 1 run scoreboard players get $damage_dealt gm4_aa_data
data modify storage gm4_augmented_armor:temp dps.array append from storage gm4_augmented_armor:temp dps.new

# update recent hit
execute on passengers if entity @s[tag=gm4_aa_training_dummy.recent_hit] run function gm4_augmented_armor:training_dummy/update/recent_hit

# update total damage (resets after 10 seconds of not taking damage)
execute unless score @s gm4_aa_training_dummy.timer matches 1.. run scoreboard players set @s gm4_aa_training_dummy.total_damage 0
scoreboard players set @s gm4_aa_training_dummy.timer 100
scoreboard players operation @s gm4_aa_training_dummy.total_damage += $damage_dealt gm4_aa_data
scoreboard players operation $total_damage gm4_aa_data = @s gm4_aa_training_dummy.total_damage
execute on passengers if entity @s[tag=gm4_aa_training_dummy.total_damage] run function gm4_augmented_armor:training_dummy/update/total_damage
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

# remove old damage
execute store result score $reduce_dps gm4_aa_data run data get storage gm4_augmented_armor:temp dps.array[0].damage
scoreboard players operation @s gm4_aa_training_dummy.dps -= $reduce_dps gm4_aa_data
data remove storage gm4_augmented_armor:temp dps.array[0]
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

# total damage timer
scoreboard players remove @s[scores={gm4_aa_training_dummy.timer=1..}] gm4_aa_training_dummy.timer 1

# check if the dummy lost health
execute store result score $health gm4_aa_data run data get entity @s Health 10
execute if score $health gm4_aa_data matches 10000.. unless score @s gm4_aa_training_dummy.dps matches 1.. run return 0

# calculate the damage dealt (x10)
scoreboard players set $damage_dealt gm4_aa_data 10000
scoreboard players operation $damage_dealt gm4_aa_data -= $health gm4_aa_data

# grab the array of recent damages
data modify storage gm4_augmented_armor:temp dps.array set from entity @s ArmorItems[0].components."minecraft:custom_data".gm4_augmented_armor.dps_array
# check if the oldest entry is more than 10 seconds old, if so remove it and reduce total damage by it
execute store result score $keep_entry gm4_aa_data run data get storage gm4_augmented_armor:temp dps.array[0].gametime
scoreboard players add $keep_entry gm4_aa_data 100
execute store result score $gametime gm4_aa_data run time query gametime
scoreboard players operation $keep_entry gm4_aa_data -= $gametime gm4_aa_data
execute unless score $keep_entry gm4_aa_data matches 1.. run function gm4_augmented_armor:training_dummy/dps_remove

# update the damage displays if needed
execute if score $damage_dealt gm4_aa_data matches 1.. run function gm4_augmented_armor:training_dummy/damage_dealt

# update dps display
scoreboard players operation @s gm4_aa_training_dummy.dps += $damage_dealt gm4_aa_data
scoreboard players operation $dps gm4_aa_data = @s gm4_aa_training_dummy.dps
execute on passengers if entity @s[tag=gm4_aa_training_dummy.dps] run function gm4_augmented_armor:training_dummy/update/dps

# store the array of recent damages
data modify entity @s ArmorItems[0].components."minecraft:custom_data".gm4_augmented_armor.dps_array set from storage gm4_augmented_armor:temp dps.array

# cleanup
data remove storage gm4_augmented_armor:temp dps
data modify entity @s Health set value 1000
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

summon zombie ~ ~ ~ {Silent:1b,DeathLootTable:"empty",attributes:[{id:"minecraft:generic.max_health",base:1000}],PersistenceRequired:1b,NoAI:1b,Health:1000f,Tags:["gm4_aa_training_dummy"],ArmorItems:[{id:"minecraft:stone_button",count:1,components:{"minecraft:custom_data":{gm4_augmented_armor:{dps_array:[]}}}},{},{},{}],Passengers:[\
\
{id:"minecraft:text_display",billboard:"vertical",Tags:["gm4_aa_training_dummy","gm4_aa_training_dummy.recent_hit"],text:'[{"translate":"entity.gm4.augmented_armor.training_dummy.recent_hit","fallback":"Last Hit: ","color":"gray"},{"text":"0.0","color":"white"}]'},\
\
{id:"minecraft:text_display",billboard:"vertical",Tags:["gm4_aa_training_dummy","gm4_aa_training_dummy.dps"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0.3f,0f],scale:[1f,1f,1f]},text:'[{"translate":"entity.gm4.augmented_armor.training_dummy.dps","fallback":"Damage / Second: ","color":"gray"},{"text":"0.0","color":"white"}]'},\
\
{id:"minecraft:text_display",billboard:"vertical",Tags:["gm4_aa_training_dummy","gm4_aa_training_dummy.total_damage"],transformation:{left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f],translation:[0f,0.6f,0f],scale:[1f,1f,1f]},text:'[{"translate":"entity.gm4.augmented_armor.training_dummy.total_damage","fallback":"Total Damage: ","color":"gray"},{"text":"0.0","color":"white"}]'}]}
Loading

0 comments on commit a7fb11e

Please sign in to comment.