force_choke: type: task definitions: target script: - if <[target]> != null && (<[target].is_player> || <[target].is_mob> || <[target].is_npc>): - flag player.force.statistics.cast_choke:++ - cast slow <[target]> duration: amplifier:3 hide_particles:true no_icon:true no_clear - cast slow duration: amplifier:1 hide_particles:true no_icon:true no_clear - wait 0.25s # Prevent other force powers from being used when healing - foreach as:power: - define expiration - define old_cooldown ].second||0> - if <[old_cooldown]> > <[expiration]>: - foreach next - flag player.force.cooldown.<[power]> expire:<[expiration]> - itemcooldown ].material> duration:<[expiration]> - define previous_target <[target]> - repeat : - define target ;range=;raysize=]||null> - if ( <[target]> != null && <[previous_target]> != null ) && ( <[target].is_player> || <[target].is_mob> || <[target].is_npc> ): - if <[target]> != <[previous_target]>: - cast slow remove <[previous_target]> - cast slow <[target]> duration: amplifier:3 hide_particles:true no_icon:true no_clear - if <[target].health.sub[]> <= 0: - hurt <[target]> cause:Magic - define target null - define previous_target null - repeat next - hurt <[target]> cause:Magic - define previous_target <[target]> - else if <[target]> == null && <[previous_target]> != null: - define previous_target <[target]> - wait - repeat next - else if <[target]> != null && <[previous_target]> == null: - cast slow <[target]> duration: amplifier:3 hide_particles:true no_icon:true no_clear - hurt <[target]> cause:Magic - define previous_target <[target]> - else if <[target]> == null && <[previous_target]> == null: - cast slow remove - foreach as:power: - narrate "maybe nothing happens" - if !]>: - foreach next # if the old cooldown > new expiration, dont change anything. If it's less or equal, set it to 0 - if <[old_cooldown]> <= <[expiration]>: - flag player.force.cooldown.<[power]>:! - itemcooldown ].material> duration:0 - stop - wait