forked from Mogara/LuaSkillsForQSGS
-
Notifications
You must be signed in to change notification settings - Fork 6
/
ChapterR.lua
473 lines (467 loc) · 14.9 KB
/
ChapterR.lua
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
--[[
代码速查手册(R区)
技能索引:
仁德、仁德、仁德、仁望、仁心、忍戒、肉林、若愚
]]--
--[[
技能名:仁德
相关武将:标准·刘备
描述:出牌阶段限一次,你可以将至少一张手牌交给其他角色,若你以此法交给其他角色的手牌数量不少于2,你回复1点体力。
状态:1217验证通过
引用:LuaRende
注备:为什么table.contains不好使……
]]--
LuaRendeCard = sgs.CreateSkillCard{
name = "LuaRendeCard" ,
will_throw = false ,
handling_method = sgs.Card_MethodNone ,
filter = function(self, selected, to_select)
return (#selected == 0) and (to_select:objectName() ~= sgs.Self:objectName())
end ,
on_use = function(self, room, source, targets)
local target = targets[1];
source:speak("a")
local old_value = source:getMark("LuaRende");
local rende_list = {}
if old_value > 0 then
rende_list = source:property("LuaRende"):toString():split("+")
else
rende_list = sgs.QList2Table(source:handCards())
end
for _,id in sgs.qlist(self:getSubcards())do
table.removeOne(rende_list,id)
end
room:setPlayerProperty(source, "LuaRende", sgs.QVariant(table.concat(rende_list,"+")));
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, source:objectName(), target:objectName(), "LuaRende","")
room:moveCardTo(self,target,sgs.Player_PlaceHand,reason)
local new_value = old_value + self:getSubcards():length()
room:setPlayerMark(source, "LuaRende", new_value);
if (old_value < 2 and new_value >= 2) then
local recover = sgs.RecoverStruct()
recover.card = self
recover.who = source;
room:recover(source, recover);
end
if room:getMode() == "04_1v3" and source:getMark("LuaRende") >= 2 then return end
if source:isKongcheng() or source:isDead() or #rende_list == 0 then return end
room:addPlayerHistory(source, "#LuaRendeCard", -1);
if not room:askForUseCard(source, "@@LuaRende", "@rende-give", -1, sgs.Card_MethodNone) then
room:addPlayerHistory(source,"#LuaRendeCard")
end
end,
}
LuaRendeVs = sgs.CreateViewAsSkill{
name = "LuaRende",
n = 10086,
response_pattern = "@@LuaRende",
view_filter = function(self, selected, to_select)
if sgs.Self:property("GameMode"):toString() == "04_1v3" and #selected + sgs.Self:getMark("LuaRende") >= 2 then
return false
else
if to_select:isEquipped() then return false end
if sgs.Sanguosha:getCurrentCardUsePattern() == "@@LuaRende" then
local rende_list = sgs.Self:property("LuaRende"):toString():split("+")
return function()
for _,id in pairs(rende_list)do
if id == to_select:getEffectiveId() then
return true
end
end
return false
end
else
return true
end
return true
end
end,
view_as = function(self, cards)
if #cards > 0 then
local rende = LuaRendeCard:clone()
for _,c in ipairs(cards)do
rende:addSubcard(c)
end
return rende
end
end,
enabled_at_play = function(self, player)
if player:property("GameMode"):toString() == "04_1v3" and player:getMark("LuaRende") >= 2 then
return false
end
return (not player:hasUsed("#LuaRendeCard")) and not player:isKongcheng()
end,
}
LuaRende = sgs.CreateTriggerSkill{
name = "LuaRende" ,
events = {sgs.EventPhaseChanging,sgs.TurnStart} ,
view_as_skill = LuaRendeVs ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.EventPhaseChanging and player:getMark("LuaRende") > 0 then
local change = data:toPhaseChange()
if change.to ~= sgs.Player_NotActive then return false end
room:setPlayerMark(player,"LuaRende", 0)
return false
elseif event == sgs.TurnStart and player:property("GameMode"):toString() == "" then
room:setPlayerProperty(player,"GameMode",sgs.QVariant(room:getMode()))
end
end ,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:仁德
相关武将:怀旧-标准·刘备-旧
描述:出牌阶段,你可以将至少一张手牌任意分配给其他角色。你于本阶段内以此法给出的手牌首次达到两张或更多后,你回复1点体力。
引用:LuaNosRende
状态:0405验证通过
备注:虎牢关部分没有lua
]]--
LuaNosRendeCard = sgs.CreateSkillCard{
name = "LuaNosRendeCard" ,
will_throw = false ,
handling_method = sgs.Card_MethodNone ,
filter = function(self, selected, to_select)
return (#selected == 0) and (to_select:objectName() ~= sgs.Self:objectName())
end ,
on_use = function(self, room, source, targets)
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, source:objectName(), targets[1]:objectName(), "LuaNosRende", "")
room:obtainCard(targets[1], self, reason, false)
local old_value = source:getMark("LuaNosRende")
local new_value = old_value + self:getSubcards():length()
room:setPlayerMark(source, "LuaNosRende", new_value)
if old_value < 2 and new_value >= 2 then
room:recover(source, sgs.RecoverStruct(source))
end
end
}
LuaNosRendeVS = sgs.CreateViewAsSkill{
name = "LuaNosRende" ,
n = 999 ,
view_filter = function(self, selected, to_select)
return not to_select:isEquipped()
end ,
view_as = function(self, cards)
if #cards == 0 then return nil end
local rende_card = LuaNosRendeCard:clone()
for _, c in ipairs(cards) do
rende_card:addSubcard(c)
end
return rende_card
end ,
enabled_at_play = function(self, player)
return not player:isKongcheng()
end
}
LuaNosRende = sgs.CreateTriggerSkill{
name = "LuaNosRende" ,
events = {sgs.EventPhaseChanging} ,
view_as_skill = LuaNosRendeVS ,
on_trigger = function(self, event, player, data)
local change = data:toPhaseChange()
if change.to ~= sgs.Player_NotActive then return false end
player:getRoom():setPlayerMark(player, self:objectName(), 0)
return false
end ,
can_trigger = function(self, target)
return target and target:getMark(self:objectName()) > 0
end
}
--[[
技能名:仁德
相关武将:虎牢关·刘备
描述:出牌阶段,你可以将最多两张手牌交给其他角色,若此阶段你给出的牌张数达到两张时,你回复1点体力。
引用:LuaRende
状态:验证通过
]]--
LuaRendeCard = sgs.CreateSkillCard{
name = "LuaRendeCard",
target_fixed = false,
will_throw = false,
on_use = function(self, room, source, targets)
local target
if #targets == 0 then
local list = room:getAlivePlayers()
for _,player in sgs.qlist(list) do
if player:objectName() ~= source:objectName() then
target = player
break
end
end
else
target = targets[1]
end
room:obtainCard(target, self, false)
local subcards = self:getSubcards()
local old_value = source:getMark("rende")
local new_value = old_value + subcards:length()
room:setPlayerMark(source, "rende", new_value)
if old_value < 2 then
if new_value >= 2 then
local recover = sgs.RecoverStruct()
recover.card = self
recover.who = source
room:recover(source, recover)
end
end
end
}
LuaRendeVS = sgs.CreateViewAsSkill{
name = "LuaRende",
n = 2,
view_filter = function(self, selected, to_select)
if not to_select:isEquipped() then
local markCount = sgs.Self:getMark("rende")
return #selected + markCount < 2
end
end,
view_as = function(self, cards)
if #cards > 0 then
local rende_card = LuaRendeCard:clone()
for i=1, #cards, 1 do
local id = cards[i]:getId()
rende_card:addSubcard(id)
end
return rende_card
end
end
}
LuaRende = sgs.CreateTriggerSkill{
name = "LuaRende",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseStart},
view_as_skill = LuaRendeVS,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
room:setPlayerMark(player, "rende", 0)
return false
end,
can_trigger = function(self, target)
if target then
if target:isAlive() then
if target:hasSkill(self:objectName()) then
if target:getPhase() == sgs.Player_NotActive then
return target:hasUsed("#LuaRendeCard")
end
end
end
end
return false
end
}
--[[
技能名:仁望
相关武将:1v1·刘备
描述:对手于其出牌阶段内对包括你的角色使用第二张及以上【杀】或非延时锦囊牌时,你可以弃置其一张牌。
引用:LuaRenwang
状态:1217验证通过
]]--
LuaRenwang = sgs.CreateTriggerSkill{
name = "LuaRenwang" ,
events = {sgs.CardUsed, sgs.EventPhaseChanging} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.CardUsed and player:getPhase() == sgs.Player_Play then
local use = data:toCardUse()
if not use.card:isKindOf("Slash") and not use.card:isNDTrick() then return false end
local first = sgs.SPlayerList()
for _,to in sgs.qlist(use.to) do
if to:objectName() ~= player:objectName() and not to:hasFlag("LuaRenwangEffect") then
first:append(to)
to:setFlags("LuaRenwangEffect")
end
end
for _,p in sgs.qlist(room:getOtherPlayers(use.from)) do
if use.to:contains(p) and not first:contains(p) and p:canDiscard(use.from, "he") and p:hasFlag("LuaRenwangEffect") and p:isAlive() and p:hasSkill(self:objectName()) then
if not room:askForSkillInvoke(p, self:objectName(), data) then return false end
room:throwCard(room:askForCardChosen(p, use.from, "he", self:objectName(), false, sgs.Card_MethodDiscard), use.from, p);
end
end
elseif event == sgs.EventPhaseChanging then
local change = data:toPhaseChange()
if change.to == sgs.Player_NotActive then
for _,to in sgs.qlist(room:getAlivePlayers()) do
if to:hasFlag("LuaRenwangEffect") then
to:setFlags("-LuaRenwangEffect")
end
end
end
end
end,
can_trigger = function(self, target)
return target ~= nil
end
}
--[[
技能名:仁心
相关武将:一将成名2013·曹冲
描述:一名其他角色处于濒死状态时,你可以将武将牌翻面并将所有手牌交给该角色,令该角色回复1点体力。
引用:LuaRenxin
状态:1217验证通过
]]--
LuaRenxinCard = sgs.CreateSkillCard{
name = "LuaRenxinCard",
target_fixed = true,
on_use = function(self, room, source, targets)
local who = room:getCurrentDyingPlayer()
if who then
source:turnOver()
room:obtainCard(who,source:wholeHandCards(),false)
local recover = sgs.RecoverStruct()
recover.who = source
room:recover(who,recover)
end
end
}
LuaRenxin = sgs.CreateZeroCardViewAsSkill{
name = "LuaRenxin",
view_as = function(self)
return LuaRenxinCard:clone()
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "peach" and not player:isKongcheng()
end
}
--[[
技能名:忍戒(锁定技)
相关武将:神·司马懿
描述:每当你受到1点伤害后或于弃牌阶段因你的弃置而失去一张牌后,你获得一枚“忍”。
引用:LuaRenjie
状态:0405验证通过
]]--
LuaRenjie = sgs.CreateTriggerSkill{
name = "LuaRenjie" ,
events = {sgs.Damaged, sgs.CardsMoveOneTime} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.CardsMoveOneTime then
if player:getPhase() == sgs.Player_Discard then
local move = data:toMoveOneTime()
if move.from:objectName() == player:objectName() and bit32.band(move.reason.m_reason, sgs.CardMoveReason_S_MASK_BASIC_REASON) == sgs.CardMoveReason_S_REASON_DISCARD then
local n = move.card_ids:length()
if n > 0 then
room:notifySkillInvoked(player, self:objectName())
player:gainMark("@bear", n)
end
end
end
elseif event == sgs.Damaged then
room:notifySkillInvoked(player, self:objectName())
local damage = data:toDamage()
player:gainMark("@bear",damage.damage)
end
return false
end
}
--[[
技能名:肉林(锁定技)
相关武将:林·董卓
当你使用【杀】指定一名女性角色为目标后,该角色需连续使用两张【闪】才能抵消;当你成为女性角色使用【杀】的目标后,你需连续使用两张【闪】才能抵消。
引用:LuaRoulin
状态:1217验证通过
]]--
Table2IntList = function(theTable)
local result = sgs.IntList()
for i = 1, #theTable, 1 do
result:append(theTable[i])
end
return result
end
LuaRoulin = sgs.CreateTriggerSkill{
name = "LuaRoulin",
frequency = sgs.Skill_Compulsory,
events = {sgs.TargetConfirmed},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local use = data:toCardUse()
if use.card:isKindOf("Slash") and player:objectName() == use.from:objectName() then
local jink_table = sgs.QList2Table(use.from:getTag("Jink_" .. use.card:toString()):toIntList())
local index = 1
local play_effect = false
if use.from and use.from:isAlive() and use.from:hasSkill(self:objectName()) then
for _,p in sgs.qlist(use.to) do
if p:isFemale() then
play_effect = true
if jink_table[index] == 1 then
jink_table[index] = 2
end
end
index = index + 1
end
local jink_data = sgs.QVariant()
jink_data:setValue(Table2IntList(jink_table))
use.from:setTag("Jink_" .. use.card:toString(), jink_data)
if play_effect then
room:notifySkillInvoked(use.from, self:objectName())
end
elseif use.from:isFemale() then
for _,p in sgs.qlist(use.to) do
if p:hasSkill(self:objectName()) then
play_effect = true
if jink_table[index] == 1 then
jink_table[index] = 2
end
end
index = index + 1
end
local jink_data = sgs.QVariant()
jink_data:setValue(Table2IntList(jink_table))
use.from:setTag("Jink_" .. use.card:toString(), jink_data)
if play_effect then
for _,p in sgs.qlist(use.to) do
if p:hasSkill(self:objectName()) then
room:notifySkillInvoked(p, self:objectName())
end
end
end
end
end
end,
can_trigger = function(self, target)
return target ~= nil and (target:hasSkill(self:objectName()) or target:isFemale())
end
}
--[[
技能名:若愚(主公技、觉醒技)
相关武将:山·刘禅
描述:回合开始阶段开始时,若你的体力是全场最少的(或之一),你须加1点体力上限,回复1点体力,并获得技能“激将”。
引用:LuaRuoyu
状态:1217验证通过
]]--
LuaRuoyu = sgs.CreateTriggerSkill{
name = "LuaRuoyu$",
events = {sgs.EventPhaseStart},
frequency = sgs.Skill_Wake,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local can_invoke = true
for _, p in sgs.qlist(room:getAllPlayers()) do
if player:getHp() > p:getHp() then
can_invoke = false
break
end
end
if can_invoke then
room:addPlayerMark(player, "LuaRuoyu")
if room:changeMaxHpForAwakenSkill(player, 1) then
local recover = sgs.RecoverStruct()
recover.who = player
room:recover(player, recover)
if player:isLord() then
room:acquireSkill(player, "jijiang")
end
end
end
end,
can_trigger = function(self, target)
return target and (target:getPhase() == sgs.Player_Start)
and target:hasLordSkill("LuaRuoyu")
and target:isAlive()
and (target:getMark("LuaRuoyu") == 0)
end
}