an algorithm of aoe(area of effect) and its implementation