2019-07-07 07:35:21 UNSELECTED

Unknown type code

Copy Copied! Full
--駒をBOARD_NUMに従い配置 function Move_STROBJ() local OBJ = ASET.GetSubItem("Board") local OBJS = 0 local POS = OBJ.GetPosition() local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) local sho = 0 local ama = 0 local ANG2 = 0 local pow1 = 0 local pow2 = 0 if OBJ.GetForward().x < 0 then ANG = -1 * ANG end for i = 1, #BOARD_NUM do if BOARD_NUM[i] > 0 then OBJS = ASET.GetSubItem(CUBE_STR[BOARD_NUM[i]]) if OBJS.IsMine then sho = (-4 + math.floor((i - 1) / 9)) / 9 ama = (-4 + (i - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.08, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[BOARD_NUM[i]], URA_FLG[BOARD_NUM[i]])) end end end --補助駒 for i = 1, #CUBE_STR2 do OBJS = ASET.GetSubItem(CUBE_STR2[i]) OBJS.SetPosition(Vector3.__new(POS.x, 0, POS.z)) end local num1 = 1 local num2 = 1 for i = 1, #CUBE_STR do --盤に配置されて入ればfalse local flg = true for i2 = 1, #BOARD_NUM do if BOARD_NUM[i2] == i then flg = false break end end --盤外の駒を並べる if flg then if ANG_NUM[i] == 90 then OBJ = ASET.GetSubItem("Board") POS = OBJ.GetPosition() ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end OBJS = ASET.GetSubItem(CUBE_STR[i]) if OBJS.IsMine then sho = (-4 + math.floor((num1 - 18 - 1) / 9)) / 9 ama = (-4 + (num1 - 18 - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.06, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[i], URA_FLG[i])) end num1 = num1 + 1 else OBJ = ASET.GetSubItem("Board") POS = OBJ.GetPosition() ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end OBJS = ASET.GetSubItem(CUBE_STR[i]) if OBJS.IsMine then sho = (-4 + math.floor((num2 + #BOARD_NUM + 9 - 1) / 9)) / 9 ama = (-4 + (num2 + #BOARD_NUM + 9 - 1) % 9) / 9 ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end pow1 = sho * sho pow2 = ama * ama OBJS.SetPosition( Vector3.__new( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.08, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) ) OBJS.SetRotation(Quaternion.Euler(0, ANG + ANG_NUM[i], URA_FLG[i])) end num2 = num2 + 1 end end end end --補助駒計算 function Hozyo(i) local OBJ = ASET.GetSubItem("Board") local POS = OBJ.GetPosition() local ANG = Vector3.Angle(Vector3.__new(0, 0, 1), OBJ.GetForward()) if OBJ.GetForward().x < 0 then ANG = -1 * ANG end local sho = (-4 + math.floor((i - 1) / 9)) / 9 local ama = (-4 + (i - 1) % 9) / 9 OBJ = ASET.GetSubItem(CUBE_STR[TARG_NUM]) local ANG2 = Vector3.Angle(Vector3.__new(0, 0, 1), Vector3.__new(sho, 0, ama).normalized) if sho < 0 then ANG2 = -1 * ANG2 end local pow1 = sho * sho local pow2 = ama * ama local POS2 = POS POS2.Set( POS.x + math.sqrt(pow1 + pow2) * math.sin(math.pi * (ANG2 - ANG) / 180), POS.y + 0.06, POS.z - math.sqrt(pow1 + pow2) * math.cos(math.pi * (ANG2 - ANG) / 180) ) POS = OBJ.GetPosition() local loc = math.sqrt((POS.x - POS2.x) * (POS.x - POS2.x) + (POS.z - POS2.z) * (POS.z - POS2.z)) if min_loc > loc then min_loc = loc min = i end end --駒処理 function Koma() --盤に置いてある駒だったらtrue:とった駒の配置ならばfalse if flg then local hosei = 0 --歩 if TARG_NUM < 19 then --飛車 if URA_FLG[TARG_NUM] == 0 then if ANG_NUM[TARG_NUM] == 90 then hosei = 9 else hosei = -9 end if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end else if ANG_NUM[TARG_NUM] == 90 then for i = 1, 4 do if i == 1 then hosei = 7 for i2 = 1, 3 do if ((BORD_NUM + hosei + i2) <= #BOARD_NUM) and ((BORD_NUM + hosei + i2) > 0) and (math.floor(1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei + i2) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei + i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei + i2]] then BOARD_POSSIBLE[BORD_NUM + hosei + i2] = 0 end end end elseif i == 2 then hosei = -1 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end elseif i == 3 then hosei = 1 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end elseif i == 4 then hosei = -9 if ((BORD_NUM + hosei) <= #BOARD_NUM) and ((BORD_NUM + hosei) > 0) and (math.floor(-1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 + hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei]] then BOARD_POSSIBLE[BORD_NUM + hosei] = 0 end end end end else for i = 1, 4 do if i == 1 then hosei = 7 for i2 = 1, 3 do if ((BORD_NUM - hosei - i2) <= #BOARD_NUM) and ((BORD_NUM - hosei - i2) > 0) and (math.floor(-1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei - i2) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei - i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei - i2]] then BOARD_POSSIBLE[BORD_NUM - hosei - i2] = 0 end end end elseif i == 2 then hosei = -1 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end elseif i == 3 then hosei = 1 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor((BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end elseif i == 4 then hosei = -9 if ((BORD_NUM - hosei) <= #BOARD_NUM) and ((BORD_NUM - hosei) > 0) and (math.floor(1 + (BORD_NUM - 1) / 9) == math.floor((BORD_NUM - 1 - hosei) / 9)) then BOARD_POSSIBLE[BORD_NUM - hosei] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM - hosei]] then BOARD_POSSIBLE[BORD_NUM - hosei] = 0 end end end end end end BOARD_POSSIBLE[BORD_NUM] = 1 elseif TARG_NUM < 21 then --角 hosei = 1 for i = 1, 4 do if i == 1 then hosei = 9 elseif i == 2 then hosei = -9 elseif i == 3 then hosei = 1 elseif i == 4 then hosei = -1 end for i2 = 1, 9 do if ((BORD_NUM + hosei * i2) <= #BOARD_NUM) and ((BORD_NUM + hosei * i2) > 0) then if i < 3 then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end else if (math.floor((BORD_NUM - 1 + hosei * i2) / 9) == math.floor((BORD_NUM - 1) / 9)) then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end end end end end end if URA_FLG[TARG_NUM] == 180 then for i = 1, 4 do if i == 1 then hosei = 10 for i2 = 1, 1 do if ((BORD_NUM + hosei * i2) <= #BOARD_NUM) and ((BORD_NUM + hosei * i2) > 0) and (((BORD_NUM - 1) % 9 + i2) < 9) then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end end end elseif i == 2 then hosei = -10 for i2 = 1, 1 do if ((BORD_NUM + hosei * i2) <= #BOARD_NUM) and ((BORD_NUM + hosei * i2) > 0) and (((BORD_NUM - 1) % 9 - i2) >= 0) then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end end end elseif i == 3 then hosei = 8 for i2 = 1, 1 do if ((BORD_NUM + hosei * i2) <= #BOARD_NUM) and ((BORD_NUM + hosei * i2) > 0) and (((BORD_NUM - 1) % 9 - i2) >= 0) then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end end end elseif i == 4 then hosei = -8 for i2 = 1, 1 do if ((BORD_NUM + hosei * i2) <= #BOARD_NUM) and ((BORD_NUM + hosei * i2) > 0) and (((BORD_NUM - 1) % 9 + i2) < 9) then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 1 if ANG_NUM[BOARD_NUM[BORD_NUM]] == ANG_NUM[BOARD_NUM[BORD_NUM + hosei * i2]] then BOARD_POSSIBLE[BORD_NUM + hosei * i2] = 0 break elseif BOARD_NUM[BORD_NUM + hosei * i2] > 0 then break end end end end end end BOARD_POSSIBLE[BORD_NUM] = 1
RECOMMEND