Code Monkey home page Code Monkey logo

Comments (5)

DGAH avatar DGAH commented on September 28, 2024 1

@bioxun
在 smart-ai.lua 最开始的部分,大概47行左右的位置,有一句 sgs.ai_skill_discard = {} ,这就是定义了。
具体的用法或者说工作过程,正如 @Fsu0413 所说的那样,是写在 SmartAI:askForDiscard 函数里的。
以下是其中的三行比较关键的代码:
local callback = sgs.ai_skill_discard[reason]
if type(callback) == "function" then
local cb = callback(self, discard_num, min_num, optional, include_equip)
至于说 sgs.ai_skill_discard["dummy"],找不到定义那应该就是没有定义,
此时 type(callback) == "function" 的判断不成立,不会进入其调用过程,
而是转入后续的 SmartAI:askForDiscard 自身提供的默认处理的部分。
建议楼主仔细研读一下 SmartAI:askForDiscard 这个函数的具体内容,应该就可以明白了。

from qsanguosha-v2.

Fsu0413 avatar Fsu0413 commented on September 28, 2024

askForDiscard调用这个

from qsanguosha-v2.

bioxun avatar bioxun commented on September 28, 2024

@Fsu0413 我问的是这个怎么定义的,想看看怎么筛选和排序的。

from qsanguosha-v2.

Fsu0413 avatar Fsu0413 commented on September 28, 2024

sgs.ai_skill_discard.xxxxx
后面的xxxxx是你自己定义的,也即是askForDiscard的第二个参数,他只会调用这一个函数,返回的内容就是他需要弃置的牌,和别的函数没有关系

from qsanguosha-v2.

bioxun avatar bioxun commented on September 28, 2024

@Fsu0413 我想问的是sgs.ai_skill_discard怎么定义,不是askForDiscard怎么定义。
我就是发现askForDiscard里面有个sgs.ai_skill_discard[reason]函数,不知道sgs.ai_skill_discard在哪定义的。
sgs.ai_skill_discard["dummy"]显然不是我定义的,我应该在哪找这个定义呢?

from qsanguosha-v2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.