feat: 赛马游戏调整 - 允许自马下注 & 取消非冠军参赛奖励

- 移除下注时不能给自己马匹下注的限制
- 非冠军马主不再获得参赛奖励积分(PARTICIPANT_REWARD=0)
- 同步更新帮助文本、README文档和config默认值
This commit is contained in:
2026-04-05 21:25:10 +08:00
parent ff8cf611af
commit e773a7a1ef
3 changed files with 8 additions and 22 deletions

View File

@@ -153,10 +153,6 @@ def _build_point_changes(room: Room, odds: dict[str, float]) -> tuple[dict[str,
if champion:
point_changes[champion.owner_id] = point_changes.get(champion.owner_id, 0) + config.CHAMPION_REWARD
for horse in room.horses.values():
if champion and horse.owner_id != champion.owner_id:
point_changes[horse.owner_id] = point_changes.get(horse.owner_id, 0) + config.PARTICIPANT_REWARD
for bet in room.bets:
if bet.horse_name == room.champion_name:
payout = int(bet.amount * odds.get(bet.horse_name, config.MIN_ODDS))
@@ -209,11 +205,6 @@ async def settle_race(room: Room) -> RaceResult | None:
# Reward champion owner
await points_service.reward_champion(champion.owner_id)
# Reward all participants
for horse in room.horses.values():
if horse.owner_id != champion.owner_id:
await points_service.reward_participant(horse.owner_id)
# Settle bets
odds = calculate_odds(room)
for bet in room.bets:
@@ -453,10 +444,6 @@ async def handle_bet(bot: Bot, event: Event):
await bet_cmd.finish(f"马匹序号/名称 \"{horse_selector}\" 不存在")
return
if horse.owner_id == user_id:
await bet_cmd.finish("不能给自己的马下注")
return
success, balance = await points_service.spend_bet_points(user_id, amount, f"下注 {_format_horse_label(horse)}")
if not success:
await bet_cmd.finish(f"积分不足(当前余额:{balance}")
@@ -550,7 +537,7 @@ async def handle_help(bot: Bot, event: Event):
/赛马报名 <马匹名> - 报名参赛最多8匹马
/赛马报名 - 复用上一次绑定的马名报名
/赛马取消报名 - 取消报名并退还下注
/赛马下注 <序号|马匹名> <金额> - 下注(不能给自己的马下注)
/赛马下注 <序号|马匹名> <金额> - 下注
/赛马赔率 - 查看当前赔率和下注池
/赛马开赛 - 开始比赛至少2匹马
/赛马帮助 - 显示此帮助
@@ -559,11 +546,9 @@ async def handle_help(bot: Bot, event: Event):
• 最低下注金额:{config.MIN_BET} 积分
• 参赛马匹上限8匹
• 开赛要求至少2匹马报名
• 不能给自己的马下注
💰 奖励机制:
• 冠军马主:获得 {config.CHAMPION_REWARD} 积分
• 参赛马主:获得 {config.PARTICIPANT_REWARD} 积分
• 下注中奖:下注金额 × 赔率
📊 赔率说明:
@@ -573,7 +558,7 @@ async def handle_help(bot: Bot, event: Event):
🎮 游戏流程:
1⃣ 玩家报名并绑定马匹名
2⃣ 玩家可以给其他玩家的马下注
2⃣ 玩家可以给任意马匹下注
3⃣ 满足开赛条件后,任意玩家可开赛
4⃣ 比赛实时进行,定期播报进度
5⃣ 比赛结束后结算积分和奖金"""