Archer

取消、跳过

调用接口

示例代码

go
package main

import (
  "github.com/moxcomic/Archer/internal/platform/actions"
  "github.com/moxcomic/lq"
)

const (
  E_PlayOperation_None           = iota
  E_PlayOperation_Discard
  E_PlayOperation_Chi
  E_PlayOperation_Pon
  E_PlayOperation_Ankan
  E_PlayOperation_Minkan
  E_PlayOperation_Kakan
  E_PlayOperation_RiiChi
  E_PlayOperation_Tsumo
  E_PlayOperation_Ron
  E_PlayOperation_JiuZhongJiuPai
  E_PlayOperation_Babei
  E_PlayOperation_HuanSanZhang
  E_PlayOperation_DingQue
  E_PlayOperation_Reveal
  E_PlayOperation_Unveil
  E_PlayOperation_LockTile
  E_PlayOperation_Revealliqi
)

func onExecute(result *lq.NotifyAIResult, risk []float64, r, m, f, t float64) {
  if result.GetResult()[0].GetType() == 321 {
    actions.NewMajsoulActions().Cancel()
  }
}
  • onExecute 函数中,我们通过 result.GetResult()[0].GetType() 来判断当前操作是否为【吃】,如果是,我们通过 result.GetResult()[0].GetCombination() 来获取吃牌的组合,并调用 actions.NewMajsoulActions().Chii(result.GetResult()[0].GetCombination()[0], result.GetResult()[0].GetCombination()[1]) 来吃掉这两张牌。
  • 当然这里只是一个示例,实际使用时,你可能需要根据实际情况来修改代码。
  • lq.NotifyAIResult 参考 NotifyAIResult
  • GetType 参考 动作类型
注意
取消的 Type 固定为 321