scoreboard players add @s generic_timer 1

execute if score @s generic_timer matches 18 run attribute @s minecraft:gravity base set 0
execute if score @s generic_timer matches 18 run data merge entity @s {Motion:[0.0,0.0,0.0]}
execute if score @s generic_timer matches 20 run playsound minecraft:entity.villager.ambient neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 20 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"You did not pay your taxes last year...","color":"white"}]

execute if score @s generic_timer matches 50 run playsound minecraft:entity.villager.ambient neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 50 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"And now, you suffer the consequences...","color":"white"}]

execute if score @s generic_timer matches 100 run playsound minecraft:entity.villager.no neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 100 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"Lets see exactly how much you owe!","color":"white"}]

execute if score @s generic_timer matches 140 store result score @s temp run random value 40..120
execute if score @s generic_timer matches 140 run playsound minecraft:entity.villager.celebrate neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 140 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"Ah yes, it appears you owe exactly ","color":"white"},{"score":{"name":"@s","objective":"temp"},"color":"gold"},{"text":" coins!","color":"white"}]

execute if score @s generic_timer matches 200 run playsound minecraft:entity.villager.yes neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 200 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"Alright chump, time to pay up!","color":"white"}]

execute if score @s generic_timer matches 210 store result storage pctf:tax input.x int 1 run scoreboard players get @s temp
execute if score @s generic_timer matches 210 run function pctf:logic/items/lucky_block/outcomes/negative/solo/tax_collector/collect with storage pctf:tax input

execute if score @s generic_timer matches 240 run playsound minecraft:entity.villager.no neutral @a ~ ~ ~ 1 1
execute if score @s generic_timer matches 240 run tellraw @a[distance=..64] ["",{"text":"[Tax Collector] ","color":"yellow"},{"text":"Thanks, see ya!","color":"white"}]
execute if score @s generic_timer matches 260 run tp @s ~ ~-1000 ~
execute if score @s generic_timer matches 260.. run kill @s