- Use the
Cancel method from the MajsoulActions package to discard or skip an action.
package main
import (
"github.com/moxcomic/Archer/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()
}
}
- In the
onExecute function, we check if the current action is Cancel by calling result.GetResult()[0].GetType(). If it is, we call actions.NewMajsoulActions().Cancel() to skip the action. - This is just an example, and you may need to modify the code according to your specific use case.
- For more information, refer to
lq.NotifyAIResult in NotifyAIResult. - The
Type for canceling is always 321.