Skip to content

Commit a5d1f0f

Browse files
Merge master and develop (PurpleBananass#86)
Co-authored-by: StableSub <enderbow36@gmail.com>
1 parent 8a4a565 commit a5d1f0f

10 files changed

Lines changed: 162 additions & 148 deletions

File tree

requirements/NOF.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,37 @@ The main purpose of our group is to develop “records and achievements”.
2020
- Changes
2121
- Rename the High Score menu to Achievement.
2222

23-
- Achievement Additions
24-
- Add cumulative score, cumulative playtime, cumulative number of games, highest score, and hit rate achievements.
25-
- Create tiered achievements for each category, ranging from the initial achievement to the final achievement.
26-
- Requirement: Create a file to store records for each category.
23+
24+
- ACHIEVEMENTS Additions
25+
- TOTAL SCORE, TOTAL PLAYTIME, ACHIEVEMENTS STATUS
26+
27+
28+
- ACHIEVEMENTS STATUS Additions
29+
- MAX COMBO
30+
- PERFECT CLEAR
31+
- FLAWLESS FAILURE
32+
- A TIME OF ETERNITY
33+
2734

2835
- Achievement Rewards
2936
- Provide tiered currency benefits for each category, from the initial achievement to the final achievement.
3037

3138

3239

40+
3341
- 변경사항
34-
- High Score메뉴를 Achievement로 변경.
42+
- 기존 High Score메뉴를 Achievement로 변경.
43+
44+
45+
- "ACHIEVEMENT" 창에 추가할 항목
46+
- TOTAL SCORE, TOTAL PLAYTIME, ACHIEVEMENTS STATUS
3547

3648

37-
- Achievement에 추가할 항목
38-
- 누적점수, 누적 플레이 시간, 누적 판수, 최고 점수, 명중률 달성
39-
- 각 항목 별 최초 업적부터 최종 업적까지 단계별 업적 생성
40-
- 필요 사항 : 각 항목 별 기록을 담을 파일 생성
49+
- "ACHIEVEMENTS STATUS"에 추가할 항목
50+
- MAX COMBO (최고 콤보)
51+
- PERFECT CLEAR (게임 클리어)
52+
- FLAWLESS FAILURE (명중률 0으로 게임 오버)
53+
- A TIME OF ETERNITY (누적 플레이 시간 10분 이상 달성)
4154

4255

4356
- 업적 달성 시 보상

src/engine/AchievementManager.java

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package engine;
22

33
import entity.Achievement;
4-
import entity.Wallet;
54

65
import java.io.IOException;
76
import java.util.logging.Logger;
@@ -20,36 +19,38 @@ public class AchievementManager {
2019
private final int MAX_PERFECT_STAGE = 7;
2120

2221
// Variables related to Accuracy Achievement
23-
private double highAccuracy; // List of accuracy achievements
22+
private int highMaxCombo; // List of accuracy achievements
2423

2524
// Variables related to Flawless Failure Achievement
2625
private boolean checkFlawlessFailure;
2726

28-
// Variables related to Best Friends Achievement
29-
private boolean checkBestFriends;
30-
3127
// Coin rewards update
3228
private int coinReward = 0;
3329

34-
private final int[] ACCURACY_COIN_REWARD = {500, 1500, 2000, 2500};
30+
private final int[] COMBO_COIN_REWARD = {500, 1500, 2000, 2500};
3531
private final int[] PERFECT_COIN_REWARD = {200, 400, 800, 2000, 3000, 4000, 5000};
3632
private final int FLAWLESS_FAILURE_COIN = 1000;
37-
private final int BEST_FRIENDS_COIN = 1000;
33+
private final int PLAY_TIME_COIN = 1000;
34+
35+
private boolean checkPlayTimeAch;
36+
3837

3938
// Variables needed for each achievement are loaded through a file.
4039
public AchievementManager() throws IOException {
4140
achievement = FileManager.getInstance().loadAchievement();
4241
this.currentPerfectLevel = achievement.getPerfectStage();
43-
this.highAccuracy = achievement.getHighAccuracy();
42+
this.highMaxCombo = achievement.getHighmaxCombo();
4443
this.checkFlawlessFailure = achievement.getFlawlessFailure();
45-
this.checkBestFriends = achievement.getBestFriends();
4644
}
4745

4846
public int getAchievementReward() {
4947
return coinReward;
5048
}
5149

5250
public void updateTotalPlayTime(int playTime) {
51+
if (achievement.getTotalPlayTime() < 600 && achievement.getTotalPlayTime() + playTime >= 600) {
52+
coinReward += PLAY_TIME_COIN;
53+
}
5354
achievement.setTotalPlayTime(playTime);
5455
}
5556

@@ -60,38 +61,44 @@ public void updateTotalScore(int score) {
6061
/**
6162
* Function to update the accuracy achievement.
6263
*/
63-
public void updateAccuracy(double accuracy) {
64-
if (highAccuracy >= accuracy) {
64+
public void updateMaxCombo(int maxCombo) {
65+
if (highMaxCombo >= maxCombo) {
6566
return;
6667
}
67-
int accuracyGoal = (int)(highAccuracy/10)*10+10;
68-
highAccuracy = accuracy;
69-
if (accuracyGoal < 70) {
70-
accuracyGoal = 70;
68+
int maxComboGoal = 10;
69+
if (highMaxCombo < 10) {
70+
maxComboGoal = 10;
71+
} else if (highMaxCombo < 15) {
72+
maxComboGoal = 15;
73+
} else if (highMaxCombo < 20) {
74+
maxComboGoal = 20;
75+
} else if (highMaxCombo < 25) {
76+
maxComboGoal = 25;
7177
}
72-
if (highAccuracy < accuracyGoal) {
73-
achievement.setHighAccuracy(highAccuracy);
78+
int rewardIndex = highMaxCombo / 5 - 1;
79+
highMaxCombo = maxCombo;
80+
if (highMaxCombo < maxComboGoal) {
81+
achievement.setHighMaxcombo(highMaxCombo);
7482
return;
7583
}
76-
int rewardIndex = accuracyGoal/10-7;
7784
// When an accuracy achievement is reached, all lower achievements are achieved together.
78-
if (highAccuracy >= 100) {
85+
if (highMaxCombo >= 25) {
7986
for (int i = rewardIndex; i < 4; i++) {
80-
coinReward += ACCURACY_COIN_REWARD[i];
87+
coinReward += COMBO_COIN_REWARD[i];
8188
}
82-
} else if (highAccuracy >= 90) {
89+
} else if (highMaxCombo >= 20) {
8390
for (int i = rewardIndex; i < 3; i++) {
84-
coinReward += ACCURACY_COIN_REWARD[i];
91+
coinReward += COMBO_COIN_REWARD[i];
8592
}
86-
} else if (highAccuracy >= 80) {
93+
} else if (highMaxCombo >= 15) {
8794
for (int i = rewardIndex; i < 2; i++) {
88-
coinReward += ACCURACY_COIN_REWARD[i];
95+
coinReward += COMBO_COIN_REWARD[i];
8996
}
90-
} else if (highAccuracy >= 70) {
91-
coinReward += ACCURACY_COIN_REWARD[0];
97+
} else if (highMaxCombo >= 10) {
98+
coinReward += COMBO_COIN_REWARD[0];
9299
}
93100
// Save the updated achievement.
94-
achievement.setHighAccuracy(highAccuracy);
101+
achievement.setHighMaxcombo(highMaxCombo);
95102
}
96103
/**
97104
* Check if the perfect achievement has been reached.
@@ -113,27 +120,18 @@ public void updateFlawlessFailure(double accuracy) {
113120
}
114121
}
115122

116-
public void updateBestFriends(boolean checkTwoPlayMode) {
117-
if (!checkBestFriends && checkTwoPlayMode) {
118-
checkBestFriends = true;
119-
coinReward += BEST_FRIENDS_COIN;
120-
achievement.setBestFriends(true);
121-
}
122-
}
123-
124123
public void updateAllAchievements() throws IOException {
125124
FileManager.getInstance().saveAchievement(achievement);
126125
}
127126

128-
public void updatePlaying(int playtime, int max_lives, int LivesRemaining, int level ) throws IOException{
127+
public void updatePlaying(int maxCombo ,int playtime, int max_lives, int LivesRemaining, int level ) throws IOException{
129128
updateTotalPlayTime(playtime);
130129
updatePerfect(max_lives,LivesRemaining,level);
130+
updateMaxCombo(maxCombo);
131131
}
132132

133-
public void updatePlayed(double accuracy, int score, boolean multiPlay) throws IOException{
134-
updateAccuracy(accuracy);
133+
public void updatePlayed(double accuracy, int score) throws IOException{
135134
updateTotalScore(score);
136135
updateFlawlessFailure(accuracy);
137-
updateBestFriends(multiPlay);
138136
}
139137
}

src/engine/Core.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static void main(final String[] args) throws IOException {
8989
int returnCode = 1;
9090
do {
9191
MAX_LIVES = wallet.getLives_lv()+2;
92-
gameState = new GameState(1, 0, BASE_SHIP, MAX_LIVES, 0, 0, 0, "", 0, 0, 0 ,0);
92+
gameState = new GameState(1, 0, BASE_SHIP, MAX_LIVES, 0, 0, 0, "", 0, 0, 0 ,0, 0);
9393
achievementManager = new AchievementManager();
9494

9595
GameSettings gameSetting = new GameSettings(4, 4, 60, 2500);
@@ -132,9 +132,9 @@ public static void main(final String[] args) throws IOException {
132132

133133
gameState = new GameState(gameState, gameState.getLevel() + 1);
134134
endTime = System.currentTimeMillis();
135-
achievementManager.updatePlaying((int) (endTime - startTime) / 1000, MAX_LIVES, gameState.getLivesRemaining(), gameState.getLevel()-1);
135+
achievementManager.updatePlaying(gameState.getMaxCombo(),(int) (endTime - startTime) / 1000, MAX_LIVES, gameState.getLivesRemaining(), gameState.getLevel()-1);
136136
} while (gameState.getLivesRemaining() > 0);
137-
achievementManager.updatePlayed(gameState.getAccuracy(), gameState.getScore(), GameSettingScreen.getMultiPlay());
137+
achievementManager.updatePlayed(gameState.getAccuracy(), gameState.getScore());
138138
achievementManager.updateAllAchievements();
139139
LOGGER.info("Starting " + WIDTH + "x" + HEIGHT
140140
+ " score screen at " + FPS + " fps, with a score of "

0 commit comments

Comments
 (0)