-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 배틀에 사용할 포켓몬, 타입 상성 데이터 세팅 * feat: 배틀 계산 api * refactor: 타입 enum으로 변경 * refactor: weather enum으로 변경 * feat: 배틀 계산에서 강풍 배수 적용 * refactor: 배틀 관련 데이터들 id 영어이름으로 변경 * fix: 날씨 비교 로직 오류 수정 * chore: 불필요한 데이터 삭제 * refactor: 불필요한 코드 제거 * refactor: api 명세에 따라 응답값 변경 * fix: 문법 오류 * style: 개행 추가 * refactor: BattleService 리팩토링 * refactor: MoveCategory 리팩토링
- Loading branch information
Showing
20 changed files
with
404 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
backend/pokerogue/src/main/java/com/pokerogue/helper/battle/BattlePokemon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.pokerogue.helper.battle; | ||
|
||
import java.util.List; | ||
|
||
public record BattlePokemon(String id, List<Type> pokemonTypes) { | ||
|
||
public boolean hasSameType(Type type) { | ||
return this.pokemonTypes.stream() | ||
.anyMatch(pokemonType -> pokemonType.equals(type)); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
backend/pokerogue/src/main/java/com/pokerogue/helper/battle/BattlePokemonRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.pokerogue.helper.battle; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public class BattlePokemonRepository { | ||
|
||
private final Map<String, BattlePokemon> battlePokemons = new HashMap<>(); | ||
|
||
public void save(BattlePokemon battlePokemon) { | ||
battlePokemons.put(battlePokemon.id(), battlePokemon); | ||
} | ||
|
||
public List<BattlePokemon> findAll() { | ||
return battlePokemons.values() | ||
.stream() | ||
.toList(); | ||
} | ||
|
||
public Optional<BattlePokemon> findById(String id) { | ||
return Optional.ofNullable(battlePokemons.get(id)); | ||
} | ||
} |
27 changes: 0 additions & 27 deletions
27
backend/pokerogue/src/main/java/com/pokerogue/helper/battle/BattlePokemonTypeRepository.java
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
backend/pokerogue/src/main/java/com/pokerogue/helper/battle/BattleResultResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.pokerogue.helper.battle; | ||
|
||
public record BattleResultResponse( | ||
int power, | ||
double multiplier, | ||
double accuracy, | ||
String moveName, | ||
String moveDescription, | ||
String moveType, | ||
String moveCategory | ||
) { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.