Skip to content

Commit

Permalink
✨ [Feat] 제한 조건 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
rimi3226 committed Jan 26, 2025
1 parent 3e9ca64 commit 3c2b9db
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ public int calculateFreePriority(Position myMainP, Position mySubP, Position myW
/**
* 칼바람 모드 우선순위 계산
*/
public int calculateAramPriority(Position myWantPosition, Position otherMainPosition, Position otherSubPosition,
Mike myMike, Mike otherMike, Integer myManner, Integer otherManner,
Tier myTier, Integer myRank, Tier otherTier, Integer otherRank) {
public int calculateAramPriority(Mike myMike, Mike otherMike, Integer myManner, Integer otherManner) {
int priority = 0;

// 매너 우선순위
Expand All @@ -125,19 +123,39 @@ public int calculateAramPriority(Position myWantPosition, Position otherMainPosi
return priority;
}

public boolean validateMatching(Position myMainP, Position mySubP, Position myWantP, Position otherMainP,
Position otherSubP, Position otherWantP) {
// 1. <A의 주가 B의 부이거나 B의 주가 A의 부일 때>
// 1.1 A의 찾는 포지션(myWantP)이 B의 부 포지션(otherSubP)일 경우
if ((myMainP == otherSubP || otherMainP == mySubP) && myWantP == otherSubP) {
return true;
}

// 1.2 B의 찾는 포지션(otherWantP)이 A의 부 포지션(mySubP)일 경우
if ((otherMainP == mySubP || myMainP == otherSubP) && otherWantP == mySubP) {
return true;
}

// 2. 주/부 포지션이 순서 상관없이 겹칠 경우 false 반환
if ((myMainP == otherMainP || myMainP == otherSubP) && (mySubP == otherMainP || mySubP == otherSubP)) {
return false;
}

return true;
}

/**
* 정밀 매칭 검증 메서드
*/
public boolean validatePreciseMatching(Mike myMike, Mike otherMike, Position myWantPosition,
Position otherMainPosition, Position otherSubPosition,
Tier myTier, Tier otherTier) {
public boolean validatePreciseMatching(Mike myMike, Mike otherMike, Position myWantP, Position otherMainP,
Position otherSubP, Tier myTier, Tier otherTier) {
// 마이크가 다를 경우 매칭 실패
if (!myMike.equals(otherMike)) {
return false;
}

// 내가 원하는 포지션이 상대 포지션이 아닐 경우 매칭 실패
if (!otherMainPosition.equals(myWantPosition) && !otherSubPosition.equals(myWantPosition)) {
if (!otherMainP.equals(myWantP) && !otherSubP.equals(myWantP)) {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,25 @@ public PriorityListResponse calculatePriorityList(MatchingRecord myMatchingRecor


public int calculatePriority(GameMode gameMode, MatchingRecord myRecord, MatchingRecord otherRecord) {
// 공통 조건
if (!matchingPriorityCalculateService.validateMatching(myRecord.getMainPosition(), myRecord.getSubPosition(),
myRecord.getWantPosition(), otherRecord.getMainPosition(), otherRecord.getSubPosition(),
otherRecord.getWantPosition())) {
return 0;
}

// 정밀 매칭
if (myRecord.getMatchingType() == MatchingType.PRECISE) {
if (matchingPriorityCalculateService.validatePreciseMatching(myRecord.getMike(), otherRecord.getMike(),
myRecord.getWantPosition(), otherRecord.getMainPosition(), otherRecord.getSubPosition(),
myRecord.getSoloTier(), otherRecord.getSoloTier())) {
return matchingPriorityCalculateService.calculatePrecisePriority(myRecord.getMannerLevel(),
otherRecord.getMannerLevel());
}
return 0;
}

// 겜구 매칭
return switch (gameMode) {
case SOLO ->
// 개인 랭크 모드 우선순위 계산
Expand Down Expand Up @@ -93,18 +112,10 @@ public int calculatePriority(GameMode gameMode, MatchingRecord myRecord, Matchin
case ARAM ->
// 칼바람 모드 우선순위 계산
matchingPriorityCalculateService.calculateAramPriority(
myRecord.getWantPosition(),
otherRecord.getMainPosition(),
otherRecord.getSubPosition(),
myRecord.getMike(),
otherRecord.getMike(),
myRecord.getMannerLevel(),
otherRecord.getMannerLevel(),
myRecord.getSoloTier(),
myRecord.getSoloRank(),
otherRecord.getSoloTier(),
otherRecord.getSoloRank()
);
otherRecord.getMannerLevel());
case FAST ->
// 빠른대전 우선순위 계산
matchingPriorityCalculateService.calculateFastPriority(
Expand Down

0 comments on commit 3c2b9db

Please sign in to comment.