#include_function "lib\Ikareimu\Common\Math.dnh"
#include_function "lib\Ikareimu\System\Polarity.dnh"
/******************************************
* Variables                               *
******************************************/

/******************************************
* Public Functions                        *
******************************************/

/******************************************
* Private Functions                       *
******************************************/

function PlayerShot_detectCollision(objID, polarity) {
  let CollisionAreas = GetCommonDataDefault("SetCollisionA", []);
  let len = length(CollisionAreas);
  ascent(i in 0..len){
    if(GetDistance(Obj_GetX(objID), Obj_GetY(objID), CollisionAreas[i][0], CollisionAreas[i][1]) <= CollisionAreas[i][2]){
      let damage = 5;
      Obj_Delete(objID);
      if((polarity==RED && CollisionAreas[i][3]==BLUE) || (polarity==BLUE && CollisionAreas[i][3]==RED)){
        damage = 10;
      }
      let obj = Obj_Create(OBJ_SHOT);
      Obj_SetPosition(obj, CollisionAreas[i][0], CollisionAreas[i][1]);
      Obj_SetSpeed(obj, 0);
      Obj_SetAngle(obj, 0);
      Obj_SetAlpha(obj, 0);
      ObjShot_SetGraphic(obj, WHITE05);
      ObjShot_SetDamage(obj, damage);
      ObjShot_SetPenetration(obj, 1);
      yield;
      yield;
      Obj_Delete(obj);
      return ;
    }
  }
}