Skip to content

Commit 662f8e9

Browse files
authored
Merge pull request #56 from FortuneMon/fix/#55-ball-open
fix: #55 포켓몬 뽑기 시 볼 오픈 true로 변경
2 parents a3f796a + f6211f9 commit 662f8e9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/FortuneMonBackEnd/fortuneMon/service/UserMonsterBallServiceImpl.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public UserPokemonDTO openMonsterBall(Long ballId){
4747
double rand = Math.random();
4848
double cumulative = 0.0;
4949
PokemonBallRate pokemonRate = null;
50-
List<PokemonBallRate> rates = pokemonBallRateRepository.findAllByBallId(ballId);
50+
UserBall openBall = userMonsterBallRepository.findById(ballId).orElse(null);
51+
List<PokemonBallRate> rates = pokemonBallRateRepository.findAllByBallId(openBall.getMonsterBall().getId());
5152

5253
for(PokemonBallRate rate : rates){
5354
cumulative += rate.getProbability();
@@ -60,6 +61,7 @@ public UserPokemonDTO openMonsterBall(Long ballId){
6061
return null;
6162
}
6263
Pokemon pokemon = pokemonRepository.findById(pokemonRate.getPokemonId()).orElse(null);
64+
openBall.setOpen(true); // 볼 사용 표시
6365

6466
Long userId = SecurityUtil.getCurrentUserId();
6567
User user = userRepository.findById(userId).orElse(null);

0 commit comments

Comments
 (0)