'Shot distance calc. for shootval-base
'*.refxpos *.refypos *.xpos *.ypos dist 2 logx -1 mult .shootval store
'find newaimangle
'*.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div *.refaim sin *.refvelscalar mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos div 3 pow 6 div add
'find newdist
'*.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos

'Shot velocity is 40 per cycle
'Base shot range is:
'*.body 2 logx 60 mult

'So, best shootval dist to predict future destination (not taking in account shot velocity)
'*.body 2 logx 60 mult *.refxpos *.refypos dist sqr *.refvelscalar sqr add 2 *.refxpos *.refypos dist mult *.refvelscalar mult sub *.refaim cos sub abs 2 logx -1 mult .shootval store
'TESTED: works like a dream!

'Now, to take into account shot velocity:
'All the previus formulas assume shot will reach destination in 1 cycle (calc. are for bot's movement in a cycle)

'This might get complicated. I will need to divide newdist by 40 to see how many cycles will it take
'for a shot to travel the distance, then see how far the prey will move in that many cycles, 
'then adjust

'However, this could also just be used as a system for pre-aiming, instead of a pre-emptive shot, however cool that is 
'The exact formula to do so just eludes me...

'Perhaps I should put up these formulas as bits of nfo for those who might have an idea of how to acheive the gloriously terrifying idea of the
'preemptive shot!

