// pure pseudocode
local real ang = Atan2(GetUnitY(obj)-GetUnitY(inc), GetUnitX(obj)-GetUnitX(inc)) // obj is a static object, unable to move; inc is the incoming unit
local real sang = Atan2(inc.speed.y, inc.speed.x)
local real newang = bj_PI + (2*ang) - sang
set inc.speed.x=Cos(newang)*inc.speed.amount
set inc.speed.y=Sin(newang)*inc.speed.amount