📄 human.java
字号:
{
Map.SetItemId(newItem, leftPosX, posY1);
}
SetAction(10);
if(Room.IsCloseTreasureId(rData) && canSaveItem)
{
Room.SetRoomData(rData + 1, leftPosX, posY1);
}
String newItemMsg[] = {
Map.GetItemName(newItem), Map.GetItemInfo(newItem)
};
SetMessage(newItemMsg, 30);
if(newItem == 0)
{
GameManager.ShowEvent(3);
} else
if(newItem == 7)
{
Map.SetEventId(7, 11, 4, 7);
} else
if(newItem == 8)
{
Map.SetEventId(8, 12, 8, 2);
} else
if(newItem == 9)
{
Map.SetEventId(10, 14, 5, 6);
} else
if((newItem == 14 || newItem == 16 || newItem == 15) && HasItemId(14) && HasItemId(16) && HasItemId(15))
{
Map.UnlockDoorId(3, 7, 0);
GameManager.ShowEvent(98);
}
} else
if(Room.IsExaminableId(rData))
{
SetAction(9);
}
}
}
if(rightRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(rightRoomData, 3);
int lWidth = 30 - Room.GetObstructionDistance(rightRoomData, 2);
int rWidth = objPosX;
int width = lWidth - rWidth;
if(width > 0)
{
objPosX += rightPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
return curPosY < rightDisY || moveTo > rightDisY ? moveOffset : curPosY - rightDisY;
}
}
}
if(leftPosX != rightPosX && leftRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(leftRoomData, 3);
int lWidth = Room.GetObstructionDistance(leftRoomData, 2);
int rWidth = 30 - objPosX;
int width = rWidth - lWidth;
if(width > 0)
{
objPosX += leftPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
return curPosY < leftDisY || moveTo > leftDisY ? moveOffset : curPosY - leftDisY;
}
}
}
if(Room.IsCornerWallId(leftRoomData))
{
return leftDisY < moveTo ? moveOffset : curPosY - leftDisY;
}
if(Room.IsCornerWallId(rightRoomData))
{
return rightDisY < moveTo ? moveOffset : curPosY - rightDisY;
}
}
}
break;
}
case 1: // '\001'
{
int minX = curPosX - widthOffset;
int maxX = curPosX + widthOffset;
int leftPosX = minX / 30;
int rightPosX = maxX / 30;
int posY1 = curPosY / 30;
int leftRoomData = Room.GetObjectId(leftPosX, posY1);
int rightRoomData = Room.GetObjectId(rightPosX, posY1);
int objPosY = posY1 * 30;
int leftDisY = objPosY + Room.GetObstructionDistance(leftRoomData, direct);
int rightDisY = objPosY + Room.GetObstructionDistance(rightRoomData, direct);
int moveTo = curPosY + moveOffset;
if(Room.IsCornerWallId(leftRoomData))
{
return leftDisY > moveTo ? moveOffset : leftDisY - curPosY - 1;
}
if(Room.IsCornerWallId(rightRoomData))
{
return rightDisY > moveTo ? moveOffset : rightDisY - curPosY - 1;
}
if(rightRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(rightRoomData, 3);
int lWidth = 30 - Room.GetObstructionDistance(rightRoomData, 2);
int rWidth = objPosX;
int width = lWidth - rWidth;
if(width > 0)
{
objPosX += rightPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
if(moveTo >= rightDisY)
{
if(changeRoomData && (GetType() == 20 || GetType() == 21) && leftPosX == rightPosX && Room.IsCloseDoorYId(rightRoomData))
{
OpenTheDoor(rightRoomData + 1, leftPosX, posY1);
}
return rightDisY - curPosY - 1;
} else
{
return moveOffset;
}
}
}
}
if(leftPosX != rightPosX && leftRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(leftRoomData, 3);
int lWidth = Room.GetObstructionDistance(leftRoomData, 2);
int rWidth = 30 - objPosX;
int width = rWidth - lWidth;
if(width > 0)
{
objPosX += leftPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
if(moveTo >= leftDisY)
{
return leftDisY - curPosY - 1;
} else
{
return moveOffset;
}
}
}
}
int posY2 = moveTo / 30;
if(posY1 == posY2)
{
break;
}
while(++posY1 <= posY2)
{
leftRoomData = Room.GetObjectId(leftPosX, posY1);
rightRoomData = Room.GetObjectId(rightPosX, posY1);
leftDisY = (objPosY += 30) + Room.GetObstructionDistance(leftRoomData, direct);
rightDisY = objPosY + Room.GetObstructionDistance(rightRoomData, direct);
if(rightRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(rightRoomData, 3);
int lWidth = 30 - Room.GetObstructionDistance(rightRoomData, 2);
int rWidth = objPosX;
int width = lWidth - rWidth;
if(width > 0)
{
objPosX += rightPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
return moveTo < rightDisY ? moveOffset : rightDisY - curPosY - 1;
}
}
}
if(leftPosX != rightPosX && leftRoomData != -1)
{
int objPosX = Room.GetObstructionDistance(leftRoomData, 3);
int lWidth = Room.GetObstructionDistance(leftRoomData, 2);
int rWidth = 30 - objPosX;
int width = rWidth - lWidth;
if(width > 0)
{
objPosX += leftPosX * 30;
int leftBound = objPosX;
int rightBound = objPosX + width;
if(minX < rightBound && maxX > leftBound || minX > leftBound && maxX < rightBound || minX < leftBound && maxX > leftBound || minX < rightBound && maxX > rightBound)
{
return moveTo < leftDisY ? moveOffset : leftDisY - curPosY - 1;
}
}
}
}
break;
}
case 2: // '\002'
{
int minX = curPosX - widthOffset;
int leftPosX1 = minX / 30;
int posY = curPosY / 30;
int leftRoomData = Room.GetObjectId(leftPosX1, posY);
int objPosX = (leftPosX1 + 1) * 30;
int leftDisX = objPosX - Room.GetObstructionDistance(leftRoomData, direct);
int moveTo = minX - moveOffset;
if(leftRoomData != -1 && leftDisX <= minX)
{
int objPosY;
int upDisY;
int downDisY;
if(leftDisX >= moveTo)
{
if(!Room.IsCornerWallId(leftRoomData))
{
objPosY = posY * 30;
int objDis = Room.GetObstructionDistance(leftRoomData, 0);
if(objDis < 30)
{
upDisY = (objPosY + 30) - objDis;
if(curPosY > upDisY)
{
return moveOffset;
}
}
objDis = Room.GetObstructionDistance(leftRoomData, 1);
if(objDis < 30)
{
downDisY = objPosY + Room.GetObstructionDistance(leftRoomData, 1);
if(curPosY < downDisY)
{
return moveOffset;
}
}
}
if(changeRoomData && (GetType() == 20 || GetType() == 21) && Room.IsCloseDoorXId(leftRoomData))
{
OpenTheDoor(-1, leftPosX1, posY);
}
return minX - leftDisX;
}
objPosY = posY * 30;
upDisY = (objPosY + 30) - Room.GetObstructionDistance(leftRoomData, 0);
downDisY = objPosY + Room.GetObstructionDistance(leftRoomData, 1);
if(curPosY < upDisY && curPosY > downDisY)
{
return minX - leftDisX <= moveOffset ? minX - leftDisX : moveOffset;
}
}
int leftPosX2 = moveTo / 30;
if(leftPosX1 == leftPosX2)
{
break;
}
while(--leftPosX1 >= leftPosX2)
{
leftRoomData = Room.GetObjectId(leftPosX1, posY);
leftDisX = (objPosX -= 30) - Room.GetObstructionDistance(leftRoomData, direct);
if(leftRoomData != -1 && leftDisX <= minX)
{
int objPosY;
int upDisY;
int downDisY;
if(leftDisX >= moveTo)
{
if(!Room.IsCornerWallId(leftRoomData))
{
objPosY = posY * 30;
int objDis = Room.GetObstructionDistance(leftRoomData, 0);
if(objDis < 30)
{
upDisY = (objPosY + 30) - objDis;
if(curPosY > upDisY)
{
return moveOffset;
}
}
objDis = Room.GetObstructionDistance(leftRoomData, 1);
if(objDis < 30)
{
downDisY = objPosY + Room.GetObstructionDistance(leftRoomData, 1);
if(curPosY < downDisY)
{
return moveOffset;
}
}
}
if(changeRoomData && (GetType() == 20 || GetType() == 21) && Room.IsCloseDoorXId(leftRoomData))
{
OpenTheDoor(-1, leftPosX1, posY);
}
return minX - leftDisX;
}
objPosY = posY * 30;
upDisY = (objPosY + 30) - Room.GetObstructionDistance(leftRoomData, 0);
downDisY = objPosY + Room.GetObstructionDistance(leftRoomData, 1);
if(curPosY < upDisY && curPosY > downDisY)
{
return minX - leftDisX <= moveOffset ? minX - leftDisX : moveOffset;
}
}
}
break;
}
case 3: // '\003'
{
int maxX = curPosX + widthOffset;
int rightPosX1 = maxX / 30;
int posY = curPosY / 30;
int rightRoomData = Room.GetObjectId(rightPosX1, posY);
int objPosX = rightPosX1 * 30;
int rightDisX = objPosX + Room.GetObstructionDistance(rightRoomData, direct);
int moveTo = maxX + moveOffset;
if(rightRoomData != -1 && rightDisX >= maxX)
{
int objPosY;
int upDisY;
int downDisY;
if(rightDisX <= moveTo)
{
if(!Room.IsCornerWallId(rightRoomData))
{
objPosY = posY * 30;
int objDis = Room.GetObstructionDistance(rightRoomData, 0);
if(objDis < 30)
{
upDisY = (objPosY + 30) - objDis;
if(curPosY > upDisY)
{
return moveOffset;
}
}
objDis = Room.GetObstructionDistance(rightRoomData, 1);
if(objDis < 30)
{
downDisY = objPosY + Room.GetObstructionDistance(rightRoomData, 1);
if(curPosY < downDisY)
{
return moveOffset;
}
}
}
if(changeRoomData && (GetType() == 20 || GetType() == 21) && Room.IsCloseDoorXId(rightRoomData))
{
OpenTheDoor(-1, rightPosX1, posY);
}
return rightDisX - maxX - 1;
}
objPosY = posY * 30;
upDisY = (objPosY + 30) - Room.GetObstructionDistance(rightRoomData, 0);
downDisY = objPosY + Room.GetObstructionDistance(rightRoomData, 1);
if(curPosY < upDisY && curPosY > downDisY)
{
return rightDisX - maxX - 1 <= moveOffset ? rightDisX - maxX - 1 : moveOffset;
}
}
int rightPosX2 = moveTo / 30;
if(rightPosX1 == rightPosX2)
{
break;
}
while(++rightPosX1 <= rightPosX2)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -