-
Notifications
You must be signed in to change notification settings - Fork 1
merge dev into main #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
merge dev into main #112
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,55 @@ | ||
| # 焚巢(SpellID=3752):从弃牌堆获得牌 | ||
|
|
||
| ## 协议样例 | ||
|
|
||
| ```json | ||
| { | ||
| "CardCount": 2, | ||
| "CardIDs": [], | ||
| "FromID": 255, | ||
| "FromPosition": 65282, | ||
| "FromZone": 2, | ||
| "FromZoneParam": 0, | ||
| "MoveType": 18, | ||
| "SpellID": 3752, | ||
| "ToID": 7, | ||
| "ToPosition": 65280, | ||
| "ToZone": 5, | ||
| "ToZoneParam": 0 | ||
| } | ||
| ``` | ||
|
|
||
| `FromZone=2` 表示弃牌堆,`FromID=255` 是公共区占位;`ToZone=5`、`ToID=7` 表示进入座位 7 | ||
| 的手牌。`MoveType=18` 为获得,`FromPosition=65282` 表示协议未给出精确来源位置。 | ||
|
|
||
| ## 当前推断规则 | ||
|
|
||
| 根据实测获得结果反推,焚巢从当前弃牌堆中优先获得**最早进入弃牌堆**的以下牌: | ||
|
|
||
| - 杀,包括火杀、雷杀、冰杀。 | ||
| - 决斗、南蛮入侵、万箭齐发、火攻。 | ||
|
|
||
| 所有符合条件的牌共用入堆顺序,不按牌名设优先级,也不限制每种牌只取一张。获得张数以 | ||
| `CardCount` 为准;牌离开弃牌堆后再次进入时,按重新入堆的顺序处理。 | ||
|
|
||
| 运行时按 `BaseCard.spellId` 识别目标牌:杀(含属性杀)为 `1`、决斗为 `8`、南蛮入侵为 `9`、 | ||
| 万箭齐发为 `10`、火攻为 `83`,不依赖牌名或简称。此字段与移动协议、标记区使用的 | ||
| `Card.spellID` 不同。 | ||
| 弃牌区数组按底到顶保存,因此正向筛选即可选择最早入堆的牌。 | ||
|
|
||
| ## 适配边界 | ||
|
|
||
| - 仅处理 `SpellID=3752`、`FromZone=2`、`ToZone=5`、`MoveType=18`、 | ||
| `FromPosition=65282`,且 `CardIDs` 没有正 ID 的事件。 | ||
| - 保留原始 `CardIDs`,通过 `sourceCards` 指定已有弃牌实体,交由通用移动同步手牌数、位置和明牌。 | ||
| - 协议已给出正 ID 时,以协议为准;无匹配牌时保持默认移动路径。 | ||
| - 本地可识别的目标牌不足时,复用通用来源补足规则,不重复消费选中实体。这不能保证缺失牌面或 | ||
| 缺失弃牌历史下的推断准确性。 | ||
| - 此规则来自当前样例及结果观察,后续有反例时应同步调整筛选规则与回归测试。 | ||
|
|
||
| ## 代码与验证 | ||
|
|
||
| - 技能装饰:`src/tracker/skill/FenChao.ts` 的 `decorateFenChao`。 | ||
| - 默认注册:`src/tracker/runtime/moveEventHandlers.ts` 的 `registerDefaultMoveEventHandlers`。 | ||
| - 回归:`tests/tracker/fenChao.test.ts`。 | ||
| - 协议索引:[README.md](README.md)。 |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,50 @@ | ||
| import { POSITION_RANDOM } from '../candidate/cardPositions' | ||
| import type { Card } from '../Card' | ||
| import { MOVE_TYPE } from '../MoveEventNormalizer' | ||
| import { PROTOCOL_ZONE } from '../protocolZones' | ||
| import type { Room } from '../Room' | ||
| import { | ||
| getCount, | ||
| getRaw, | ||
| hasPositiveID, | ||
| nextGroupID, | ||
| patchEvent, | ||
| type MoveEventDraft | ||
| } from './moveEventUtils' | ||
|
|
||
| const FEN_CHAO_SPELL_ID = 3752 | ||
| // 杀(含属性杀)、决斗、南蛮入侵、万箭齐发、火攻。 | ||
| const FEN_CHAO_CARD_SPELL_IDS = new Set([1, 8, 9, 10, 83]) | ||
|
|
||
| export default function decorateFenChao(event: MoveEventDraft, room: Room): MoveEventDraft { | ||
| const raw = getRaw(event) | ||
| if ( | ||
| hasPositiveID(event.cardIDs) || | ||
| Number(raw.FromZone) !== PROTOCOL_ZONE.DISCARD || | ||
| Number(raw.ToZone) !== PROTOCOL_ZONE.HAND || | ||
| Number(raw.MoveType) !== MOVE_TYPE.GAIN || | ||
| Number(raw.FromPosition) !== POSITION_RANDOM | ||
| ) { | ||
| return event | ||
| } | ||
|
|
||
| const cardCount = getCount(event) | ||
| if (cardCount === 0) return event | ||
|
|
||
| const sourceCards: Card[] = [] | ||
| // 按实测结果推断焚巢优先获得最早入堆的目标牌;弃牌数组按底 -> 顶保存。 | ||
| for (const card of room.zones.get('discard')?.cards ?? []) { | ||
| if (!FEN_CHAO_CARD_SPELL_IDS.has(card.spellId)) continue | ||
| sourceCards.push(card) | ||
| if (sourceCards.length === cardCount) break | ||
| } | ||
|
|
||
| if (sourceCards.length === 0) return event | ||
|
|
||
| return patchEvent(event, { | ||
| options: { | ||
| sourceCards, | ||
| combinationID: nextGroupID(room, FEN_CHAO_SPELL_ID, 'fenchao_discard_candidate') | ||
| } | ||
| }) | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.