Comments (5)
@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.
askForDiscard调用这个
from qsanguosha-v2.
@Fsu0413 我问的是这个怎么定义的,想看看怎么筛选和排序的。
from qsanguosha-v2.
sgs.ai_skill_discard.xxxxx
后面的xxxxx是你自己定义的,也即是askForDiscard的第二个参数,他只会调用这一个函数,返回的内容就是他需要弃置的牌,和别的函数没有关系
from qsanguosha-v2.
@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)
- win7下编译运行没有声音 HOT 2
- 用最新的QT5.9.1编译,运行游戏存在阴影 HOT 7
- QT5.5编译出错 HOT 1
- 你们是如何提取到最新版三国杀的资源(武将原画,皮肤,配音等)的? HOT 3
- 用qt5.9.2编译后,debug模式会停止运行,release模式可以运行 HOT 15
- 最新的(2017年8月的)release是不是去掉了 选择所有 和 反向选择 手牌? HOT 1
- 求开启AI身份预知 HOT 5
- 求问一下Qt版本 HOT 3
- 你们用vs2013成功编译时,用的是哪个版本的Qt? HOT 4
- 编译之前是不是要安装FMOD? HOT 7
- 可不可以在windows下用g++编译成功? HOT 1
- 如果要使每次洛神都发音,应该对哪些文件中的代码进行修改? HOT 3
- 怎么切换界面语言? HOT 1
- sanguosha.qm这个文件是怎么生成的? HOT 1
- 有介绍录像文件中的语法的文档吗? HOT 2
- 两个lua同时引用第三个lua文件,游戏结束后闪退
- 太阳神三国杀没人维护了吗? HOT 5
- 请问有4k屏的解决方案吗 HOT 2
- Mac下的编译错误 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qsanguosha-v2.