ArcherArcher
首页
快速开始
项目介绍
  • 简体中文
  • English
首页
快速开始
项目介绍
  • 简体中文
  • English
  • 首页
  • 基础配置

    • 项目介绍
    • 快速开始
    • 常见问题
    • 联系我们
  • 二次开发

    • 基础知识
    • 基础框架
    • 雀魂开发

      • 牌名

        • 基本
      • 管理器

        • 大厅管理器
      • 游戏接口

        • 基本
      • lq

        • 基本
      • 动作类型

        • 基本
      • 游戏状态

        • 基本
      • 登录事件

        • 登录事件
        • 进阶:麻将事件登录
      • 弃牌

        • 基础
        • 进阶
      • 吃
      • 碰
      • 杠
      • 取消、跳过
  • 插件系统

    • 基础使用
    • 资源类插件开发
  • 自动Review

    • 自动Review
  • 天凤个室对战

    • 在天凤个室与Mortal对局

调用接口

  • 使用 MajsoulActions 包中的 Pon 方法来弃牌。

示例代码

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() == E_PlayOperation_Pon {
    if len(result.GetResult()[0].GetCombination()) != 2 {
      fmt.Println("无法获取【碰】选项")
      return
    }

    actions.NewMajsoulActions().Pon(result.GetResult()[0].GetCombination()[0], result.GetResult()[0].GetCombination()[1])
  }
}
  • 在 onExecute 函数中,我们通过 result.GetResult()[0].GetType() 来判断当前操作是否为【碰】,如果是,我们通过 result.GetResult()[0].GetCombination() 来获取碰牌的组合,并调用 actions.NewMajsoulActions().Pon(result.GetResult()[0].GetCombination()[0], result.GetResult()[0].GetCombination()[1]) 来碰掉这两张牌。
  • 当然这里只是一个示例,实际使用时,你可能需要根据实际情况来修改代码。
  • lq.NotifyAIResult 参考 NotifyAIResult
  • GetType 参考 动作类型
Prev
吃
Next
杠