I want to make a beam struggle code so when two beams clloide they will determine whos beam is stronger and then after that the stronger persons beam will break through the other person that shot his beam and do dmg to him
something like this

After the beams clloide they struggle back and forth to determain which one is stronger and when the it does the stronger one wins and does the damage

I hope that is enoufe imformation to help me with my problem and my post isnt too big that you wont help me
heres my beam system i am working with
obj
SBC
icon = 'SBC.dmi'
density = 1
Head
icon_state = "head"
New()
spawn(1)
Start()
Check()
..()
proc
Start()
walk(src,usr.dir,1)
Check()
while(src)
var/turf/T = get_step(src,src.dir)
if(!T)
owner.firing = 0
owner.icon_state = ""
owner.move1 = 1
if(src)
for(var/obj/O in src.Beam)
del(O)
del(src)
sleep(1)
Bump(atom/M)
if(isturf(M))
owner.firing = 0
owner.icon_state = ""
owner.move1 = 1
for(var/obj/O in src.Beam)
del(O)
del(src)
else if(ismob(M))
var/mob/Target = M
view(src.owner) << "[src.owner]'s beam hits [M] for [owner.damage]!"
Target.HitPoints -= owner.damage
Target.PowerlevelCheck()
owner << "Target's HitPoints are [Target.HitPoints]."
owner.firing = 0
src.owner.icon_state = ""
owner.move1 = 1
for(var/obj/O in src.Beam)
del(O)
del(src)
else
if(!ismob(M) && !isturf(M) && !isobj(M) && !isarea(M))
owner.firing = 0
owner.icon_state = ""
owner.move1 = 1
for(var/obj/O in src.Beam)
del(O)
del(src)
Body
icon_state = "body"
density = 1
Move()
if(istype(src,/obj/SBC/Head))
var/obj/Body = new/obj/SBC/Body(src.loc)
Body.owner = src
src.Beam.Add(Body)
Body.dir = src.dir
moved++
if(moved == total)
owner.firing = 0
owner.icon_state = ""
owner.move1 = 1
if(src)
for(var/obj/O in src.Beam)
del(O)
del(src)
..()
mob
proc
SBeamC()
var/obj/Head = new/obj/SBC/Head()
if(usr.dir == NORTH)
Head.loc = locate(usr.x,usr.y+1,usr.z)
if(usr.dir == SOUTH)
Head.loc = locate(usr.x,usr.y-1,usr.z)
if(usr.dir == WEST)
Head.loc = locate(usr.x-1,usr.y,usr.z)
if(usr.dir == EAST)
Head.loc = locate(usr.x+1,usr.y,usr.z)
Head.total = 6
Head.dir = usr.dir
Head.owner = usr
Dave^^