---
# System prepended metadata

title: 戰鬥架構

---

# 戰鬥架構

## Game Manager

### 初始化

### 遊戲迴圈

- 擲骰子 function
    - 計算 function
- 攻擊
- Player
            - 扣血 function
        - Monster
            - 扣血 function
- Player
- Monster

## Player

## Monster

Backpack/Button-Draw → DrawDice()
call 丟骰子 function
-> 把結果丟到攻擊方的計算傷害 function 裡
-> 把結果丟到受攻擊方的受到傷害 function 裡
看回合有沒有結束

遊戲迴圈
初始化
角色屬性
怪物屬性
# character
## attribute
- 天賦→幫她取英文名字
- 蛻變→幫他取英文名字
- hp
- state
- attack
## method
- 
# monster
## attribute
- hp
- state
- attack

# game manager

## 1. init()
1. PlayerRoomInitialize()
2. MonsterRoomInitialize()
## 2. while
1. RoundStart()
2. PlayerDrawDice()
3. PlayerSelectDice()
4. PlayerRollDice()
5. PlayerAttack()
    - Player Player.attack(const roll_dice_list, List monsters)
    - foreach(m in monsters) /*remove dead monster*/
    - JudgeGameEnd()
6. MonsterAttack()
    - foreach(m in monsters) m.attack(Player)
    - JudgeGameEnd()
7. RoundEnd()
    - Player.UpdateState()
    - foreach(m in monsters) m.UpdateState()
    - JudgeGameEnd()





