Skip to content

feat: 게임 애플리케이션 구현#129

Open
corock-dev wants to merge 3 commits intodevelopfrom
feature/corock-game
Open

feat: 게임 애플리케이션 구현#129
corock-dev wants to merge 3 commits intodevelopfrom
feature/corock-game

Conversation

@corock-dev
Copy link
Copy Markdown
Collaborator

  • 다음 주에 리팩터링 예정입니다.

@corock-dev corock-dev added the mission 미션 label Aug 3, 2024
@corock-dev corock-dev self-assigned this Aug 3, 2024
@corock corock linked an issue Aug 3, 2024 that may be closed by this pull request
@corock corock removed a link to an issue Aug 3, 2024
}

@Override
public String getMessage() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

추상메서드를 다음과 같이 구현하기보단,
컴포지션을 사용했으면 어떨까 싶네요


protected void takeHit(int power) {
this.damage = power;
int strength = this.hp - power;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strength면 통상 "힘"이라는 용어로 쓰이는데요,
체력(hp) - power가 왜 "힘"이 되는지 해당 메서드만으로는 단번에 이해가 어려워보여요

Comment on lines +82 to +101
interface Displayable {
int getValue();
}

/**
* A Stats class is an enum types that GameCharacter has.
*/
public enum Stats implements Displayable {
SOLDIER_INIT_LEVEL(1), SOLDIER_INIT_HP(100), SOLDIER_INIT_POWER(10),
SLIME_LEVEL(1), SLIME_HP(30), SLIME_POWER(4),
ORC_LEVEL(2), ORC_HP(40), ORC_POWER(6),
DRAGON_LEVEL(3), DRAGON_HP(100), DRAGON_POWER(10),
DRAGON_SPECIAL_MOVE(7), DRAGON_BREATH(15);

private final int value;

Stats(int value) {
this.value = value;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

클래스 안에 Inteface와 구현체가 동시에 있는 구조는 처음 보는데요,
이렇게 사용하는 이유가 뭘까요?

}

@Override
public String getMessage() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

역할이라는 관점을 봤을 때,
Output인 메시지를 Orc가 출력해주는게 맞을까요?


try {
soldierAttack.start();
Thread.sleep(500);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500은 상수로 뽑으면 어떨까요?

}

GameCharacter loser = getLoser(soldier, monster);
if (isLoserSoldierOrDragon(loser, soldier.getUserId())) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLoserSoldierOrDragon 메서드 명이 약간 모호한느낌이 들어요.

* The mode that displays configurations for the game.
*/
public enum Mode implements Displayable {
PRESS_ENTER(""), ENTER_DUNGEON("1"), ATTACK("1"), QUIT("2");
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

상수로 추출하는게 어떨까요?

corock pushed a commit that referenced this pull request Sep 15, 2024
corock pushed a commit that referenced this pull request Jan 26, 2025
error: getId() in Sender cannot override getId() in Thread
    private final String id;

  return type String is not compatible with long
@corock corock force-pushed the feature/corock-game branch from 614e370 to 5984ef9 Compare February 8, 2025 05:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mission 미션

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants