Skip to content

Commit

Permalink
修改出牌逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
nocturne123 committed Aug 18, 2023
1 parent bf1f15a commit 9b18301
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 6 additions & 2 deletions game.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ def __init__(self, player):
# 回合结束时调用game类的end_stage,通知game类该阶段以结束

# 现阶段的轮次由turn类主持
# turn类被取消了
def start_stage(self, drawpile, player: Player):
player.draw_card(drawpile, num=player.draw_stage_card_number)

def end_stage(self, player, turn):
turn.end_stage(self, player)
def end_stage(self, player):
player.end_stage(self)


class UseStage(BaseStage):
Expand Down Expand Up @@ -148,6 +149,9 @@ def start_stage(self, stage, player):
def end_stage(self, stage, player):
pass

def start_turn(self, player):
pass

def game_start_dealing(self):
for player in self.player_list:
player.first_round_draw(self.draw_pile)
Expand Down
11 changes: 10 additions & 1 deletion player.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
from charaters import Charater
from ENUMS import CharaterAliveEnum, SpeciesEnum
from game import Game


class Player:
def __init__(self, cha: Charater):
def __init__(self, cha: Charater, game: Game):
self.health = cha.health
self.speed = cha.speed
self.skills = []
self.name = cha.name
self.species = cha.species
self.game = game

# 玩家的武器、护甲均为空列表形式,因为红龙能装多个装备,设计为列表也方便未来的扩展
self.armor = []
Expand Down Expand Up @@ -60,6 +62,9 @@ def __init__(self, cha: Charater):
self.move_chance = 1
self.attack_chance = 1

# 玩家是否为当前活动玩家
self.on_turn = False

@property
def living_status(self):
"""
Expand All @@ -72,6 +77,7 @@ def living_status(self):
else:
return CharaterAliveEnum.dead

# 角色攻击力
@property
def attack(self):
if self.weapon:
Expand Down Expand Up @@ -120,3 +126,6 @@ def discard(self, discard_pile, card):
# 游戏开始时的默认抽牌
def first_round_draw(self, pile):
self.draw_card(pile, num=self.start_game_draw)

def end_stage(self, game):
pass

0 comments on commit 9b18301

Please sign in to comment.