minecraft-expanded-datapack/data/undeadm-m1/functions/entity/tick/magic_missile.mcfunction

48 lines
3.0 KiB
Mcfunction
Raw Normal View History

2021-02-20 11:10:44 +00:00
tellraw @a[scores={me-debugging=1..}] "undeadm-m1:tick/magic_missile"
## MagicMissile CUSTOM ENTITY (VIA ARMOR STAND)
#
# Travels 30 blocks -> 6 bps during 5 seconds
# Collision with collisionable blocks
# Deals 6 collision damage (potion effect instant damage)
# Can be redirected by the player using the staff
#
# Particles:
# @tick: end_rod: ~ ~ ~, 0 0 0, 0, 2
# @tick: end_rod: ~ ~ ~, 0.05 0.05 0.05, 0.025, 1
# @death: end_rod: ^ ^ ^-0.15, 0 0 0, 0.1, 5
#
# Sounds:
# @tick (every 5 ticks): entity.magic_missile.tick: neutral, @a
# @tick (every 5 ticks): entity.magic_missile.tick: neutral, @s (owner)
# @summon: entity.magic_missile.spawn: neutral, @a
## collision
# if no collison, move
execute if block ^ ^ ^0.3 #undeadm-core:no_collision run tp ^ ^ ^0.3
# if collision, dying
execute unless block ^ ^ ^0.3 #undeadm-core:no_collision run tag @s add Dying
# if it hits an entity, deals damage & dying
execute if entity @s[tag=Control1] as @e[tag=!MagicMissile,dx=0,dy=0,dz=0] run effect give @s minecraft:instant_damage 1 0
execute if entity @s[tag=Control1] if entity @e[tag=!MagicMissile,dx=0,dy=0,dz=0] unless entity @e[gamemode=!spectator,tag=!MagicMissile,dx=0,dy=0,dz=0] run tag @s add Dying
execute if score $current me-core_tickC matches 1 run playsound undeadm-m1:entity.magic_missile.spawn neutral @a ~ ~ ~
execute if score $current me-core_tickC matches 6 run playsound undeadm-m1:entity.magic_missile.spawn neutral @a ~ ~ ~
execute if score $current me-core_tickC matches 11 run playsound undeadm-m1:entity.magic_missile.spawn neutral @a ~ ~ ~
execute if score $current me-core_tickC matches 16 run playsound undeadm-m1:entity.magic_missile.spawn neutral @a ~ ~ ~
execute if score $current me-core_tickC matches 1 as @a if score @s me-core_uid = @e[limit=1,sort=nearest,tag=MagicMissile] me-core_uid at @s run playsound undeadm-m1:entity.magic_missile.spawn neutral @s ~ ~ ~
execute if score $current me-core_tickC matches 6 as @a if score @s me-core_uid = @e[limit=1,sort=nearest,tag=MagicMissile] me-core_uid at @s run playsound undeadm-m1:entity.magic_missile.spawn neutral @s ~ ~ ~
execute if score $current me-core_tickC matches 11 as @a if score @s me-core_uid = @e[limit=1,sort=nearest,tag=MagicMissile] me-core_uid at @s run playsound undeadm-m1:entity.magic_missile.spawn neutral @s ~ ~ ~
execute if score $current me-core_tickC matches 16 as @a if score @s me-core_uid = @e[limit=1,sort=nearest,tag=MagicMissile] me-core_uid at @s run playsound undeadm-m1:entity.magic_missile.spawn neutral @s ~ ~ ~
## some particles! (unless dying)
# first particle - white points at position: form a straight line
execute unless entity @s[tag=Dying] run particle minecraft:end_rod ~ ~ ~ 0 0 0 0 2
# second particle - white points dispersing a lot more openly than the straight line: creates magic leaking effect
execute unless entity @s[tag=Dying] run particle minecraft:end_rod ~ ~ ~ 0.05 0.05 0.05 0.025 1
## if dying
execute if entity @s[tag=Dying] run function undeadm-m1:entity/die/magic_missile