Files
combat_automation.sk
Code
1 40
combat_automation.sk
options:
mace-range: 3.5
mace-damage: 6
blast-range: 5
blast-damage: 8
on right click:
if "%type of player's tool%" contains "spear":
push player in direction of player at speed 1.5
on right click on block:
if event-block is obsidian or event-block is bedrock or event-block is respawn anchor:
if {combat::blast::%uuid of player%} is set:
if difference between now and {combat::blast::%uuid of player%} is less than 1 second:
stop
set {combat::blast::%uuid of player%} to now
set {_center} to location of event-block
loop all players:
if loop-player is not player:
if world of loop-player is world of player:
if distance between loop-player and {_center} is less than or equal to {@blast-range}:
damage loop-player by {@blast-damage} hearts
every 5 ticks:
loop all players:
set {_attacker} to loop-player
if "%type of {_attacker}'s tool%" contains "mace":
set {_ready} to false
if {combat::mace::%uuid of {_attacker}%} is not set:
set {_ready} to true
else if difference between now and {combat::mace::%uuid of {_attacker}%} is greater than or equal to 10 ticks:
set {_ready} to true
if {_ready} is true:
set {combat::mace::%uuid of {_attacker}%} to now
loop all players:
set {_target} to loop-player
if {_target} is not {_attacker}:
if world of {_target} is world of {_attacker}:
if distance between {_attacker} and {_target} is less than or equal to {@mace-range}:
damage {_target} by {@mace-damage} hearts