Skip to content

Commit

Permalink
Fix: Use tile fridge in Chankan calculation.
Browse files Browse the repository at this point in the history
  • Loading branch information
KCFindstr committed Jun 5, 2023
1 parent 9330d22 commit abd9872
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions Events/InGame/Listener/AddKanListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
namespace RabiRiichi.Events.InGame.Listener {
public static class AddKanListener {
private static Task ExecuteAddKan(AddKanEvent ev) {
// Remove fake discard info
ev.incoming.discardInfo = null;
if (ev.kanSource == TileSource.Ankan || ev.kanSource == TileSource.Daiminkan) {
ev.player.hand.AddKan(ev.kan);
} else if (ev.kanSource == TileSource.Kakan) {
Expand Down
3 changes: 2 additions & 1 deletion Events/InGame/Listener/KanListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ namespace RabiRiichi.Events.InGame.Listener {
public static class KanListener {
public static Task ExecuteKan(KanEvent ev) {
// Pretend that kan tile is discarded to resolve chankan, and recover state later
using var _ = ev.incoming.Freeze();
ev.player.hand.Play(ev.incoming, DiscardReason.Chankan);

// Resolve chankan
Expand All @@ -24,7 +25,7 @@ public static Task ExecuteKan(KanEvent ev) {
// 若有人抢杠,杠在荣和后成立
var addKanEvent = new AddKanEvent(ev);
ev.Q.Queue(addKanEvent);
// 若游戏进入下一局,不要执行抢杠事件
// 若游戏进入下一局,不要执行添加杠事件
ev.bus.Subscribe<NextGameEvent>((e) => {
addKanEvent.Cancel();
return Task.CompletedTask;
Expand Down

0 comments on commit abd9872

Please sign in to comment.