#Standard
execute unless items entity @s armor.head *[custom_data~{clear:1b}] run function otif:forms/hupdate
execute unless predicate otif:invis_check run function otif:forms/dna

execute if entity @s[tag=otif.S2_Controls] if items entity @s weapon.mainhand warped_fungus_on_a_stick[custom_data~{clear:1b}] run function otif:util/f_key
execute if entity @s[tag=otif.S1_Controls] if items entity @s weapon.mainhand warped_fungus_on_a_stick[custom_data~{clear:1b}] run clear @s warped_fungus_on_a_stick[custom_data~{clear:1b}]
execute if entity @s[tag=otif.S1_Controls] if items entity @s weapon.offhand *[custom_data~{clear:1b}] unless score @s otif.SIS matches 6..8 run clear @s warped_fungus_on_a_stick[custom_data~{clear:1b}]
execute if entity @s[tag=otif.S2_Controls] unless items entity @s weapon.offhand *[custom_data~{clear:1b}] run item replace entity @s[scores={otif.CD=0}] weapon.offhand with warped_fungus_on_a_stick[item_name='{"text":""}',unbreakable={},custom_model_data={strings:['otif_air']},custom_data={clear:1b}]
execute unless predicate otif:sneaking run tag @s[tag=otif.Stream] remove otif.Stream
#

#S2 control / s1 control
execute if entity @s[tag=otif.S2_Controls,tag=!otif.SCha] if score @s otif.click matches 1.. run function otif:util/scroll_s2

execute if entity @s[tag=otif.S1_Controls,tag=!otif.SCha] if score @s otif.SIS matches 8 run function otif:sis/up_8
execute if entity @s[tag=otif.S1_Controls,tag=!otif.SCha] if score @s otif.SIS matches 7 run function otif:sis/up_7
execute if entity @s[tag=otif.S1_Controls,tag=!otif.SCha] if score @s otif.SIS matches 6 run function otif:sis/up_6
execute if entity @s[tag=otif.S1_Controls,tag=!otif.SCha] if score @s otif.SIS matches 5 run function otif:sis/up_5

execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=4},tag=!otif.SCha] run function otif:sis/up_8
execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=3},tag=!otif.SCha] run function otif:sis/up_7
execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=2},tag=!otif.SCha] run function otif:sis/up_6
execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=1},tag=!otif.SCha] run function otif:sis/up_5

#Timeout
execute if entity @s[scores={otif.alien=1..240},tag=otif.Master_Control,x_rotation=80..90,predicate=otif:sneaking,tag=otif.S1_Controls] if score @s otif.click matches 1.. run function otif:debug/omnitrix_reset
execute if entity @s[scores={otif.alien=1..240},tag=otif.Master_Control,x_rotation=80..90,predicate=otif:sneaking,tag=otif.S2_Controls] if score @s otif.FTrack matches 1.. run function otif:debug/omnitrix_reset
#


execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=5..},tag=!otif.SCha] if score @s otif.click matches 1.. run scoreboard players set @s otif.Control_Select 1
execute if entity @s[tag=otif.S2_Controls,scores={otif.Control_Select=..0},tag=!otif.SCha] if score @s otif.click matches 1.. run scoreboard players set @s otif.Control_Select 4
execute if entity @s[tag=otif.S2_Controls] if score @s otif.click matches 1.. run scoreboard players set @s otif.click 0
#



execute if entity @s[tag=otif.SCha] run function otif:forms/ex/up_puddle
execute if entity @s[tag=otif.SCha] unless score @s otif.Control_Select matches 1 run scoreboard players set @s otif.Control_Select 1

execute if score @s otif.score1 matches 1 run function otif:forms/ex/up_sb
execute if score @s otif.score1 matches 1 if predicate otif:random/3.5 if entity @e[type=arrow,distance=..50] run kill @e[type=arrow,distance=..50]
execute if score @s otif.score1 matches 2 run function otif:forms/ex/up_dp
execute if score @s otif.score1 matches 3 run function otif:forms/ex/up_fu
execute if score @s otif.score1 matches 4 run function otif:forms/ex/up_rl
execute if score @s otif.score1 matches 5 run function otif:forms/ex/up_mc
execute if score @s otif.score1 matches 5 if block ~ ~ ~ powered_rail[powered=true] run effect give @s speed 1 5 true
execute if score @s otif.score1 matches 5 if entity @e[distance=..3,tag=!otif.Kate,type=#otif:living] run function otif:abilities_/speed_slam
execute if score @s otif.score1 matches 6 run function otif:forms/ex/up_lr

execute if entity @s[advancements={otif:player_hit_entity=true}] run function otif:abilities/h/default
