-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspecial3v3-ai.lua
More file actions
62 lines (52 loc) · 2.03 KB
/
Copy pathspecial3v3-ai.lua
File metadata and controls
62 lines (52 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
sgs.ai_skill_cardask["@huanshi-card"] = function(self, data)
local judge = data:toJudge()
if self:needRetrial(judge) then
local cards = sgs.QList2Table(self.player:getCards("he"))
local card_id = self:getRetrialCardId(cards, judge)
local card = sgs.Sanguosha:getCard(card_id)
if card_id ~= -1 then
return "@HuanshiCard[" .. card:getSuitString() .. ":" .. card:getNumberString() .. "]=" .. card_id
end
end
return "."
end
sgs.ai_skill_invoke.huanshi = true
sgs.ai_skill_choice.huanshi = function(self, choices)
local zhugejin = self.room:findPlayerBySkillName("huanshi")
if self:objectiveLevel(zhugejin) > 3 then return "no" end
return "yes"
end
sgs.ai_skill_invoke.hongyuan = function(self, data)
return self.player:getHandcardNum() > 0
end
sgs.ai_skill_invoke.mingzhe = true
sgs.ai_skill_use["@@hongyuan"] = function(self, prompt)
self:sort(self.friends_noself, "handcard")
local first_index, second_index
for i=1, #self.friends_noself do
if self:needKongcheng(self.friends_noself[i]) and self.friends_noself[i]:getHandcardNum() == 0
or self.friends_noself[i]:hasSkill("manjuan") then
else
if not first_index then
first_index = i
else
second_index = i
end
end
if second_index then break end
end
if first_index and not second_index then
local others = self.room:getOtherPlayers(self.player)
for _, other in sgs.qlist(others) do
if (not self:isFriend(other) and (self:needKongcheng(other) and others:getHandcardNum() == 0 or other:hasSkill("manjuan"))) and
self.friends_noself[first_index]:objectName() ~= other:objectName() then
return ("@HongyuanCard=.->%s+%s"):format(self.friends_noself[first_index]:objectName(), other:objectName())
end
end
end
if not second_index then return "." end
self:log(self.friends_noself[first_index]:getGeneralName() .. "+" .. self.friends_noself[second_index]:getGeneralName())
local first = self.friends_noself[first_index]:objectName()
local second = self.friends_noself[second_index]:objectName()
return ("@HongyuanCard=.->%s+%s"):format(first, second)
end