forked from Mogara/LuaSkillsForQSGS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChapterL.lua
1709 lines (1699 loc) · 57.6 KB
/
ChapterL.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
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
--[[
代码速查手册(L区)
技能索引:
狼顾、乐学、雷击、雷击、离魂、离间、离间、离迁、礼让、疠火、连环、连理、连破、连营、烈弓、烈弓、烈刃、裂围、流离、龙胆、龙魂、龙魂、龙吟、笼络、乱击、乱武、裸衣、裸衣、洛神、落雁、落英
]]--
--[[
技能名:狼顾
相关武将:贴纸·司马昭
描述:每当你受到1点伤害后,你可以进行一次判定,然后你可以打出一张手牌代替此判定牌:若如此做,你观看伤害来源的所有手牌,并弃置其中任意数量的与判定牌花色相同的牌。
引用:LuaXLanggu
状态:1217验证通过
]]--
LuaXLanggu = sgs.CreateTriggerSkill{
name = "LuaXLanggu",
frequency = sgs.Skill_Frequent,
events = {sgs.Damaged, sgs.AskForRetrial},
on_trigger = function(self, event, player, data)
if event == sgs.Damaged then
local damage = data:toDamage()
if not damage.from or damage.from:isKongcheng() then
return
end
local target = damage.from
local num = damage.damage
local n = 0
while n < num do
if player:askForSkillInvoke(self:objectName(), data) then
local room = player:getRoom()
local judge = sgs.JudgeStruct()
judge.reason = self:objectName()
judge.pattern = "."
judge.who = player
room:judge(judge)
local ids = target:handCards()
room:fillAG(ids, player)
local mark = judge.card:getSuitString()
room:setPlayerFlag(player, mark)
while not target:isKongcheng() do
local card_id = room:askForAG(player, ids, true, "LuaXLanggu")
if card_id == -1 then
room:clearAG(player)
break
end
local card = sgs.Sanguosha:getCard(card_id)
if judge.card:getSuit() == card:getSuit() then
room:throwCard(card_id, target)
end
end
room:setPlayerFlag(player, "-" .. mark)
else
break
end
n = n + 1
end
return
elseif event == sgs.AskForRetrial then
local room = player:getRoom()
local judge = data:toJudge()
if judge.reason == self:objectName() then
if judge.who:objectName() == player:objectName() then
local card = room:askForCard(player, ".", "@LuaXLanggu", data, sgs.AskForRetrial)
if card then
room:retrial(card, player, judge, self:objectName(), false)
end
end
end
return false
end
end,
}
--[[
技能名:乐学
相关武将:倚天·姜伯约
描述:出牌阶段,可令一名有手牌的其他角色展示一张手牌,若为基本牌或非延时锦囊,则你可将与该牌同花色的牌当作该牌使用或打出直到回合结束;若为其他牌,则立刻被你获得。每阶段限一次
引用:LuaXLexue
状态:1217验证通过
]]--
LuaXLexueCard = sgs.CreateSkillCard{
name = "LuaXLexueCard",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
if #targets == 0 then
if to_select:objectName() ~= sgs.Self:objectName() then
return not to_select:isKongcheng()
end
end
return false
end,
on_effect = function(self, effect)
local source = effect.from
local target = effect.to
local room = target:getRoom()
local card = room:askForCardShow(target, source, "LuaXLexue")
local card_id = card:getEffectiveId()
room:showCard(target, card_id)
local type_id = card:getTypeId()
if type_id == sgs.Card_Basic or card:isNDTrick() then
room:setPlayerMark(source, "lexue", card_id)
room:setPlayerFlag(source, "lexue")
else
source:obtainCard(card)
room:setPlayerFlag(source, "-lexue")
end
end
}
LuaXLexue = sgs.CreateViewAsSkill{
name = "LuaXLexue",
n = 1,
view_filter = function(self, selected, to_select)
if sgs.Self:hasUsed("#LuaXLexueCard") then
if #selected == 0 then
if sgs.Self:hasFlag("lexue") then
local card_id = sgs.Self:getMark("lexue")
local card = sgs.Sanguosha:getCard(card_id)
return to_select:getSuit() == card:getSuit()
end
end
end
return false
end,
view_as = function(self, cards)
if sgs.Self:hasUsed("#LuaXLexueCard") then
if sgs.Self:hasFlag("lexue") then
if #cards == 1 then
local card_id = sgs.Self:getMark("lexue")
local card = sgs.Sanguosha:getCard(card_id)
local first = cards[1]
local name = card:objectName()
local suit = first:getSuit()
local point = first:getNumber()
local new_card = sgs.Sanguosha:cloneCard(name, suit, point)
new_card:addSubcard(first)
new_card:setSkillName(self:objectName())
return new_card
end
end
else
return LuaXLexueCard:clone()
end
end,
enabled_at_play = function(self, player)
if player:hasUsed("#LuaXLexueCard") then
if player:hasFlag("lexue") then
local card_id = player:getMark("lexue")
local card = sgs.Sanguosha:getCard(card_id)
return card:isAvailable(player)
end
return false
end
return true
end,
enabled_at_response = function(self, player, pattern)
if player:getPhase() ~= sgs.Player_NotActive then
if player:hasFlag("lexue") then
if player:hasUsed("#LuaXLexueCard") then
local card_id = player:getMark("lexue")
local card = sgs.Sanguosha:getCard(card_id)
return string.find(pattern, card:objectName())
end
end
end
return false
end,
enabled_at_nullification = function(self, player)
if player:hasFlag("lexue") then
local card_id = player:getMark("lexue")
local card = sgs.Sanguosha:getCard(card_id)
if card:objectName() == "nullification" then
local cards = player:getHandcards()
for _,c in sgs.qlist(cards) do
if c:objectName() == "nullification" or c:getSuit() == card:getSuit() then
return true
end
end
cards = player:getEquips()
for _,c in sgs.qlist(cards) do
if c:objectName() == "nullification" or c:getSuit() == card:getSuit() then
return true
end
end
end
end
return false
end
}
--[[
技能名:雷击
相关武将:风·张角
描述:每当你使用【闪】选择目标后或打出【闪】,你可以令一名角色进行一次判定:若判定结果为黑色,你对该角色造成1点雷电伤害,然后你回复1点体力。
引用:LuaLeiji
状态:1217验证通过
]]--
LuaLeiji = sgs.CreateTriggerSkill{
name = "LuaLeiji",
events = {sgs.CardResponded},
on_trigger = function(self, event, player, data)
local card_star = data:toCardResponse().m_card
local room = player:getRoom()
if card_star:isKindOf("Jink") then
local target = room:askForPlayerChosen(player, room:getAlivePlayers(), self:objectName(), "LuaLeiji-invoke", true, true)
if not target then return false end
local judge = sgs.JudgeStruct()
judge.pattern = ".|black"
judge.good = false
judge.negative = true
judge.reason = self:objectName()
judge.who = target
room:judge(judge)
if judge:isBad() then
room:damage(sgs.DamageStruct(self:objectName(), player, target, 1, sgs.DamageStruct_Thunder))
if player:isAlive() then
local recover = sgs.RecoverStruct()
recover.who = player
room:recover(player, recover)
end
end
end
end
}
--[[
技能名:雷击
相关武将:怀旧·张角
描述:当你使用或打出一张【闪】(若为使用则在选择目标后),你可以令一名角色进行一次判定,若判定结果为黑桃,你对该角色造成2点雷电伤害。
引用:LuaLeiji
状态:1217验证通过
]]--
LuaLeiji = sgs.CreateTriggerSkill{
name = "LuaLeiji" ,
events = {sgs.CardResponded} ,
on_trigger = function(self, event, player, data)
local card_star = data:toCardResponse().m_card
local room = player:getRoom()
if card_star:isKindOf("Jink") then
local target = room:askForPlayerChosen(player, room:getAlivePlayers(), self:objectName(), "LuaLeiji-invoke", true, true)
if target then
local judge = sgs.JudgeStruct()
judge.pattern = ".|spade"
judge.good = false
judge.negative = true
judge.reason = self:objectName()
judge.who = target
room:judge(judge)
if judge:isBad() then
room:damage(sgs.DamageStruct(self:objectName(), player, target, 2, sgs.DamageStruct_Thunder))
end
end
end
return false
end
}
--[[
技能名:离魂
相关武将:☆SP·貂蝉
描述:出牌阶段限一次,你可以弃置一张牌将武将牌翻面,然后获得一名男性角色的所有手牌,且出牌阶段结束时,你交给该角色X张牌。(X为该角色的体力值)
引用:LuaLihun
状态:1217验证通过
]]--
LuaLihunCard = sgs.CreateSkillCard{
name = "LuaLihunCard" ,
filter = function(self, targets, to_select)
return (#targets == 0) and to_select:isMale() and (to_select:objectName() ~= sgs.Self:objectName())
end ,
on_effect = function(self, effect)
local room = effect.from:getRoom()
effect.from:turnOver()
local dummy_card = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
for _, cd in sgs.qlist(effect.to:getHandcards()) do
dummy_card:addSubcard(cd)
end
if not effect.to:isKongcheng() then
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_TRANSFER, effect.from:objectName(),effect.to:objectName(), "LuaLihun", nil)
room:moveCardTo(dummy_card, effect.to, effect.from, sgs.Player_PlaceHand, reason, false)
end
effect.to:setFlags("LuaLihunTarget")
end
}
LuaLihunVS = sgs.CreateViewAsSkill{
name = "LuaLihun" ,
n = 1,
view_filter = function(self, cards, to_select)
if #cards == 0 then
return not sgs.Self:isJilei(to_select)
else
return false
end
end ,
view_as = function(self, cards)
if #cards ~= 1 then return nil end
local card = LuaLihunCard:clone()
card:addSubcard(cards[1])
return card
end ,
enabled_at_play = function(self, player)
return player:canDiscard(player, "he") and (not player:hasUsed("#LuaLihunCard"))
end
}
LuaLihun = sgs.CreateTriggerSkill{
name = "LuaLihun" ,
events = {sgs.EventPhaseStart, sgs.EventPhaseEnd} ,
view_as_skill = LuaLihunVS ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if (event == sgs.EventPhaseEnd) and (player:getPhase() == sgs.Player_Play) then
local target
for _, other in sgs.qlist(room:getOtherPlayers(player)) do
if other:hasFlag("LuaLihunTarget") then
other:setFlags("-LuaLihunTarget")
target = other
break
end
end
if (not target) or (target:getHp() < 1) or player:isNude() then return false end
local to_back = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
if player:getCardCount(true) <= target:getHp() then
if not player:isKongcheng() then to_goback = player:wholeHandCards() end
for i = 0, 3, 1 do
if player:getEquip(i) then to_goback:addSubcard(player:getEquip(i):getEffectiveId()) end
end
else
to_goback = room:askForExchange(player, self:objectName(), target:getHp(), true, "LuaLihunGoBack")
end
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, player:objectName(), target:objectName(), self:objectName(), nil)
room:moveCardTo(to_goback, player, target, sgs.Player_PlaceHand, reason)
elseif (event == sgs.EventPhaseStart) and (player:getPhase() == sgs.Player_NotActive) then
for _, p in sgs.qlist(room:getAlivePlayers()) do
if p:hasFlag("LuaLihunTarget") then
p:setFlags("-LuaLihunTarget")
end
end
end
end ,
can_trigger = function(self, target)
return target and target:hasUsed("#LuaLihunCard")
end
}
--[[
技能名:离间
相关武将:标准·貂蝉
描述:出牌阶段限一次,你可以弃置一张牌并选择两名男性角色:若如此做,视为其中一名角色对另一名角色使用一张【决斗】。
引用:LuaLijian
状态:0405验证通过
]]--
LuaLijianCard = sgs.CreateSkillCard{
name = "LuaLijianCard" ,
filter = function(self, targets, to_select)
if not to_select:isMale() then
return false
end
local duel = sgs.Sanguosha:cloneCard("duel", sgs.Card_NoSuit, 0)
duel:deleteLater()
if #targets == 0 and to_select:isProhibited(to_select, duel) then
return false
elseif #targets == 1 and to_select:isCardLimited(duel, sgs.Card_MethodUse) then
return false
end
return #targets < 2 and to_select:objectName() ~= sgs.Self:objectName()
end ,
feasible = function(self, targets)
return #targets == 2
end ,
about_to_use = function(self, room, card_use)
local use = card_use
local data = sgs.QVariant()
data:setValue(card_use)
local thread = room:getThread()
thread:trigger(sgs.PreCardUsed, room, card_use.from, data)
use = data:toCardUse()
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_THROW, card_use.from:objectName(), "", "LuaLijian", "")
room:moveCardTo(self, card_use.from, nil, sgs.Player_DiscardPile, reason, true)
thread:trigger(sgs.CardUsed, room, card_use.from, data)
thread:trigger(sgs.CardFinished, room, card_use.from, data)
end ,
on_use = function(self, room, source, targets)
local to = targets[1]
local from = targets[2]
local duel = sgs.Sanguosha:cloneCard("duel", sgs.Card_NoSuit, 0)
duel:toTrick():setCancelable(true)-- 这里true改为false 就是旧版技能
duel:setSkillName(self:objectName())
if not from:isCardLimited(duel, sgs.Card_MethodUse) and not from:isProhibited(to, duel) then
room:useCard(sgs.CardUseStruct(duel, from, to))
else
duel:deleteLater()
end
end
}
LuaLijian = sgs.CreateOneCardViewAsSkill{
name = "LuaLijian" ,
filter_pattern = ".!" ,
view_as = function(self, card)
local lijian_card = LuaLijianCard:clone()
lijian_card:addSubcard(card:getId())
return lijian_card
end ,
enabled_at_play = function(self, player)
return player:canDiscard(player, "he") and not player:hasUsed("#LuaLijianCard") and player:getAliveSiblings():length() > 1
end
}
--[[
技能名:离间
相关武将:怀旧-标准·貂蝉-旧、SP·貂蝉、SP·台版貂蝉
描述:出牌阶段限一次,你可以弃置一张牌并选择两名男性角色:若如此做,视为其中一名角色对另一名角色使用一张【决斗】,此【决斗】不能被【无懈可击】响应。
引用:LuaLijian
状态:0405验证通过
注:仅需将新版离间的 "duel:toTrick():setCancelable(true)" 那一行改掉即可
]]--
--[[
技能名:离迁(锁定技)
相关武将:倚天·夏侯涓
描述:当你处于连理状态时,势力与连理对象的势力相同;当你处于未连理状态时,势力为魏
引用:LuaLiqian
状态:1217验证通过(技能的实现被耦合在本手册的技能“连理”中,这里只是空壳,做一个技能按钮而已)
]]--
LuaLiqian = sgs.CreateTriggerSkill{
name = "LuaLiqian",
frequency = sgs.Skill_Compulsory,
events = {},
on_trigger = function() end
}
--[[
技能名:礼让
相关武将:国战·孔融
描述:当你的牌因弃置而置入弃牌堆时,你可以将其中任意数量的牌以任意分配方式交给任意数量的其他角色。
引用:LuaXLirang
状态:1217验证通过
]]--
LuaXLirang = sgs.CreateTriggerSkill{
name = "LuaXLirang",
frequency = sgs.Skill_NotFrequent,
events = {sgs.BeforeCardsMove},
on_trigger = function(self, event, player, data)
local move = data:toMoveOneTime()
local source = move.from
if source and source:objectName() == player:objectName() then
if move.to_place == sgs.Player_DiscardPile then
local reason = move.reason
local basic = bit32.band(reason.m_reason, sgs.CardMoveReason_S_MASK_BASIC_REASON)
if basic == sgs.CardMoveReason_S_REASON_DISCARD then
local room = player:getRoom()
local i = 0
local lirang_card = sgs.IntList()
for _,card_id in sgs.qlist(move.card_ids) do
if room:getCardOwner(card_id):objectName() == move.from:objectName() then
local place = move.from_places:at(i)
if place == sgs.Player_PlaceHand or place == sgs.Player_PlaceEquip then
lirang_card:append(card_id)
end
end
i = i + 1
end
if not lirang_card:isEmpty() then
if player:askForSkillInvoke(self:objectName(), data) then
local original_lirang = lirang_card
while room:askForYiji(player, lirang_card, self:objectName(), false, true, true, -1, sgs.SPlayerList(), move.reason, "@lirang-distribute", true) do
if player:isDead() then return false end
end
local ids = move.card_ids
i = 0
for _,card_id in sgs.qlist(ids) do
if (original_lirang:contains(card_id) and not lirang_card:contains(card_id)) then
move.card_ids:removeOne(card_id)
move.from_places:removeAt(i)
end
i = i+1
end
data:setValue(move)
end
end
end
end
end
return false
end
}
--[[
技能名:疠火
相关武将:二将成名·程普
描述:你可以将一张普通【杀】当火【杀】使用,若以此法使用的【杀】造成了伤害,在此【杀】结算后你失去1点体力;你使用火【杀】时,可以额外选择一个目标。
引用:LuaLihuo、LuaLihuoTarget
状态:1217验证通过
]]--
LuaLihuoVS = sgs.CreateOneCardViewAsSkill{
name = "LuaLihuo" ,
filter_pattern = "%slash" ,
enabled_at_play = function(self, player)
return sgs.Slash_IsAvailable(player)
end ,
enabled_at_response = function(self, player, pattern)
return sgs.Sanguosha:getCurrentCardUseReason() == sgs.CardUseStruct_CARD_USE_REASON_RESPONSE_USE and pattern == "slash"
end ,
view_as = function(self, card)
local acard = sgs.Sanguosha:cloneCard("fire_slash", card:getSuit(), card:getNumber())
acard:addSubcard(card)
acard:setSkillName(self:objectName())
return acard
end ,
}
invokeLihuo = {}
LuaLihuo = sgs.CreateTriggerSkill{
name = "LuaLihuo" ,
events = {sgs.PreDamageDone, sgs.CardFinished} ,
view_as_skill = LuaLihuoVS ,
can_trigger = function(self, target)
return target
end ,
on_trigger = function(self, event, player, data)
if event == sgs.PreDamageDone then
local damage = data:toDamage()
if damage.card and damage.card:isKindOf("Slash") and (damage.card:getSkillName() == self:objectName()) then
table.insert(invokeLihuo, damage.card)
end
elseif (player and player:isAlive() and player:hasSkill(self:objectName())) and (not player:hasFlag("Global_ProcessBroken")) then
local use = data:toCardUse()
if not use.card:isKindOf("Slash") then return false end
local can_invoke = false
for _, c in ipairs(invokeLihuo) do
if c:getEffectiveId() == use.card:getEffectiveId() then
can_invoke = true
table.removeOne(invokeLihuo,c)
break
end
end
if not can_invoke then return false end
player:getRoom():loseHp(player)
end
return false
end
}
LuaLihuoTargetMod = sgs.CreateTargetModSkill{
name = "#LuaLihuo-target" ,
extra_target_func = function(self, from, card)
if from:hasSkill("LuaLihuo") and card:isKindOf("FireSlash") then
return 1
end
return 0
end ,
}
--[[
技能名:连环
相关武将:火·庞统
描述:你可以将一张梅花手牌当【铁索连环】使用或重铸。
引用:LuaLianhuan
状态:1217验证通过
]]--
LuaLianhuan = sgs.CreateViewAsSkill{
name = "LuaLianhuan",
n = 1,
view_filter = function(self, selected, to_select)
return (not to_select:isEquipped()) and (to_select:getSuit() == sgs.Card_Club)
end,
view_as = function(self, cards)
if #cards == 1 then
local chain = sgs.Sanguosha:cloneCard("iron_chain", cards[1]:getSuit(), cards[1]:getNumber())
chain:addSubcard(cards[1])
chain:setSkillName(self:objectName())
return chain
end
end
}
--[[
技能名:连理
相关武将:倚天·夏侯涓
描述:回合开始阶段开始时,你可以选择一名男性角色,你和其进入连理状态直到你的下回合开始:该角色可以帮你出闪,你可以帮其出杀
引用:LuaLianStart,LuaLianliSlash,LuaLianliJink,LuaLianliClear,LuaLianli,LuaLianlivs(技能暗将,或加入技能库)
状态:1217验证通过
]]--
LuaLianliStart = sgs.CreateTriggerSkill{
name = "#LuaLianliStart",
events = {sgs.GameStart},
on_trigger = function(self,event,player,data)
local room = player:getRoom()
local players = room:getOtherPlayers(player)
for _,p in sgs.qlist(players) do
if p:isMale() then
room:attachSkillToPlayer(p,"LuaLianliSlash")
end
end
return false
end
}
LuaLianliSlashCard = sgs.CreateSkillCard{
name = "LuaLianliSlashCard",
filter = function(self,targets,to_select)
local slash = sgs.Sanguosha:cloneCard("slash",sgs.Card_NoSuit,0)
slash:deleteLater()
local qtargets = sgs.PlayerList()
for _,p in ipairs(targets) do
qtargets:append(p)
end
return slash:targetFilter(qtargets,to_select,sgs.Self)
end,
on_validate = function(self,carduse)
carduse.m_isOwnerUse = false
local zhangfei = carduse.from
local room = zhangfei:getRoom()
local xiahoujuan = room:findPlayerBySkillName("LuaLianli")
if xiahoujuan then
local slash = room:askForCard(xiahoujuan,"slash","@lianli-slash",sgs.QVariant(),sgs.Card_MethodResponse,nil,false,"",true)
if slash then
return slash
end
end
room:setPlayerFlag(zhangfei,"Global_LianliFailed")
return nil
end
}
LuaLianliSlashvs = sgs.CreateViewAsSkill{
name = "LuaLianliSlash",
n = 0,
attached_lord_skill = true,
enabled_at_play = function(self,player)
return player:getMark("@tied") > 0 and sgs.Slash_IsAvailable(player) and not player:hasFlag("Global_LianliFailed")
end,
enabled_at_response = function(self,player,pattern)
return pattern == "slash" and sgs.Sanguosha:getCurrentCardUseReason() == sgs.CardUseStruct_CARD_USE_REASON_RESPONSE_USE
and not player:hasFlag("Global_LianliFailed")
end,
view_as = function(self,cards)
return LuaLianliSlashCard:clone()
end
}
LuaLianliSlash = sgs.CreateTriggerSkill{
name = "#LuaLianliSlash",
events = {sgs.CardAsked},
can_trigger = function(self,target)
return target ~= nil and target:getMark("@tied") > 0 and not target:hasSkill("LuaLianli")
end,
on_trigger = function(self,event,player,data)
local pattern = data:toStringList()[1]
if pattern ~= "slash" then return false end
if not player:askForSkillInvoke("LuaLianli",data) then return false end
local room = player:getRoom()
local xiahoujuan = room:findPlayerBySkillName("LuaLianli")
if xiahoujuan then
local slash = room:askForCard(xiahoujuan,"slash","@lianli-slash",data,sgs.Card_MethodResponse,nil,false,"",true)
if slash then
room:provide(slash)
return true
end
end
return false
end
}
LuaLianliJink = sgs.CreateTriggerSkill{
name = "#LuaLianliJink",
events = {sgs.CardAsked},
can_trigger = function(self,target)
return target ~= nil and target:getMark("@tied") > 0 and target:isAlive() and target:hasSkill(self:objectName())
end,
on_trigger = function(self,event,xiahoujuan,data)
local pattern = data:toStringList()[1]
if pattern ~= "jink" then return false end
if not xiahoujuan:askForSkillInvoke("LuaLianli",data) then return false end
local room = xiahoujuan:getRoom()
local players = room:getOtherPlayers(xiahoujuan)
for _ ,player in sgs.qlist(players) do
if player:getMark("@tied") > 0 then
local zhangfei = player
local jink = room:askForCard(zhangfei,"jink","@lianli-jink",data,sgs.Card_MethodResponse,nil,false,"",true)
if jink then
room:provide(jink)
return true
end
break
end
end
return false
end
}
LuaLianli = sgs.CreateTriggerSkill{
name = "LuaLianli",
events = {sgs.EventPhaseStart},
on_trigger = function(self,event,target,data)
if target:getPhase() == sgs.Player_Start then
local room = target:getRoom()
local males = sgs.SPlayerList()
for _,p in sgs.qlist(room:getAlivePlayers()) do
if p:isMale() then
males:append(p)
end
end
local zhangfei = room:askForPlayerChosen(target,males,self:objectName(),"@lianli-card",true,true)
if males:isEmpty() or zhangfei == nil then
if target:hasSkill("LuaLiqian") and target:getKingdom() ~= "wei" then
room:setPlayerProperty(target,"kingdom",sgs.QVariant("wei"))
end
local players = room:getAllPlayers()
for _,p in sgs.qlist(players) do
if p:getMark("@tied") > 0 then
p:loseMark("@tied")
end
end
return false
end
local log = sgs.LogMessage()
log.type = "#LianliConnection"
log.from = target
log.to:append(zhangfei)
room:sendLog(log)
if target:getMark("@tied") == 0 then
target:gainMark("@tied")
end
if zhangfei:getMark("@tied") == 0 then
for _,p in sgs.qlist(room:getOtherPlayers(target)) do
if p:getMark("@tied") > 0 then
p:loseMark("@tied")
break
end
end
zhangfei:gainMark("@tied")
end
if target:hasSkill("LuaLiqian") and target:getKingdom() ~= zhangfei:getKingdom() then
room:setPlayerProperty(target,"kingdom",sgs.QVariant(zhangfei:getKingdom()))
end
end
return false
end
}
LuaLianliClear = sgs.CreateTriggerSkill{
name = "#LuaLianliClear",
events = {sgs.Death},
can_trigger = function(self,target)
return target ~= nil and target:hasSkill(self:objectName())
end,
on_trigger = function(self,event,player,data)
local room = player:getRoom()
local death = data:toDeath()
if death.who:objectName() ~= player:objectName() then return false end
for _,p in sgs.qlist(room:getAlivePlayers()) do
if player:getMark("@tied") > 0 then
player:loseMark("@tied")
end
end
return false
end
}
--[[
技能名:连破
相关武将:神·司马懿
描述:每当一名角色的回合结束后,若你于本回合杀死至少一名角色,你可以进行一个额外的回合。
引用:LuaLianpoCount、LuaLianpo
状态:0405验证通过
]]--
LuaLianpoCount = sgs.CreateTriggerSkill{
name = "#LuaLianpo-count" ,
events = {sgs.Death, sgs.TurnStart} ,
global = true ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.Death then
local death = data:toDeath()
if death.who:objectName() ~= player:objectName() then return false end
local killer
if death.damage then
killer = death.damage.from
else
killer = nil
end
local current = room:getCurrent()
if killer and current and (current:isAlive() or current:objectName() == death.who:objectName()) and current:getPhase() ~= sgs.Playr_NotActive then
killer:addMark("LuaLianpo")
end
else
for _, p in sgs.qlist(room:getAlivePlayers()) do
p:setMark("LuaLianpo", 0)
end
end
return false
end
}
LuaLianpo = sgs.CreatePhaseChangeSkill{
name = "LuaLianpo" ,
frequency = sgs.Skill_Frequent ,
priority = 1 ,
on_phasechange = function(self, player)
local room = player:getRoom()
if player:getPhase() == sgs.Player_NotActive then
local shensimayi = player:getRoom():findPlayerBySkillName(self:objectName())
if not shensimayi or shensimayi:getMark("LuaLianpo") <= 0 or not shensimayi:askForSkillInvoke(self:objectName()) then return false end
shensimayi:gainAnExtraTurn()
end
return false
end ,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:连营
相关武将:界限突破·陆逊
描述:每当你失去最后的手牌后,你可以令至多X名角色各摸一张牌。(X为你失去的手牌数)
引用:LuaLianying
状态:0405验证通过
]]--
LuaLianyingCard = sgs.CreateSkillCard{
name = "LuaLianyingCard",
filter = function(self, targets, to_select, erzhang)
return #targets < sgs.Self:getMark("lianying")
end,
on_effect = function(self, effect)
effect.to:drawCards(1, "lianying")
end
}
LuaLianyingVS = sgs.CreateZeroCardViewAsSkill{
name = "LuaLianying",
response_pattern = "@@LuaLianying",
view_as = function()
return LuaLianyingCard:clone()
end
}
LuaLianying = sgs.CreateTriggerSkill{
name = "LuaLianying",
events = {sgs.CardsMoveOneTime},
view_as_skill = LuaLianyingVS ,
on_trigger = function(self, event, luxun, data)
local room = luxun:getRoom()
local move = data:toMoveOneTime()
if move.from and move.from:objectName() == luxun:objectName() and move.from_places:contains(sgs.Player_PlaceHand) and move.is_last_handcard then
luxun:setTag("LianyingMoveData", data)
local count = 0
for i = 0, move.from_places:length() - 1, 1 do
if move.from_places:at(i) == sgs.Player_PlaceHand then
count = count + 1
end
end
room:setPlayerMark(luxun, "lianying", count)
room:askForUseCard(luxun, "@@LuaLianying", "@lianying-card:::" .. tostring(count))
end
return false
end
}
--[[
技能名:连营
相关武将:标准·陆逊、SP·台版陆逊、倚天·陆抗
描述:每当你失去最后的手牌后,你可以摸一张牌。
引用:LuaNosLianying
状态:0405验证通过
]]--
LuaNosLianying = sgs.CreateTriggerSkill{
name = "LuaNosLianying" ,
frequency = sgs.Skill_Frequent ,
events = {sgs.CardsMoveOneTime} ,
on_trigger = function(self, event, luxun, data)
local room = luxun:getRoom()
local move = data:toMoveOneTime()
if move.from and move.from:objectName() == luxun:objectName() and move.from_places:contains(sgs.Player_PlaceHand) and move.is_last_handcard then
if room:askForSkillInvoke(luxun, self:objectName(), data) then
luxun:drawCards(1, self:objectName())
end
end
return false
end
}
--[[
技能名:烈弓
相关武将:风·黄忠
描述:当你于出牌阶段内使用【杀】指定一个目标后,若其手牌数不小于你的体力值或不大于你的攻击范围,你可以令其不能使用【闪】响应此【杀】。
引用:LuaLiegong
状态:0405验证通过
]]--
Table2IntList = function(theTable)
local result = sgs.IntList()
for i = 1, #theTable, 1 do
result:append(theTable[i])
end
return result
end
LuaLiegong = sgs.CreateTriggerSkill{
name = "LuaLiegong" ,
events = {sgs.TargetSpecified} ,
on_trigger = function(self, event, player, data)
local use = data:toCardUse()
if player:getPhase() ~= sgs.Player_Play or not use.card:isKindOf("Slash") then return false end
local jink_table = sgs.QList2Table(player:getTag("Jink_" .. use.card:toString()):toIntList())
local index = 1
for _, p in sgs.qlist(use.to) do
if player:getHp() <= p:getHandcardNum() or player:getAttackRange() >= p:getHandcardNum() then
local _data = sgs.QVariant()
_data:setValue(p)
if player:askForSkillInvoke(self:objectName(), _data) then
jink_table[index] = 0
end
end
index = index + 1
end
local jink_data = sgs.QVariant()
jink_data:setValue(Table2IntList(jink_table))
player:setTag("Jink_" .. use.card:toString(), jink_data)
return false
end
}
zy:addSkill(LuaLiegong)
--[[
技能名:烈弓
相关武将:1v1·黄忠1v1
描述:当你于出牌阶段内使用【杀】指定一个目标后,若其手牌数不小于你的体力值,你可以令其不能使用【闪】响应此【杀】。
引用:LuaKOFLiegong
状态:0405验证通过
]]--
Table2IntList = function(theTable)
local result = sgs.IntList()
for i = 1, #theTable, 1 do
result:append(theTable[i])
end
return result
end
LuaKOFLiegong = sgs.CreateTriggerSkill{
name = "LuaKOFLiegong" ,
events = {sgs.TargetSpecified} ,
on_trigger = function(self, event, player, data)
local use = data:toCardUse()
if player:getPhase() ~= sgs.Player_Play or not use.card:isKindOf("Slash") then return false end
local jink_table = sgs.QList2Table(player:getTag("Jink_" .. use.card:toString()):toIntList())
local index = 1
for _, p in sgs.qlist(use.to) do
local _data = sgs.QVariant()
_data:setValue(p)
if player:getHp() <= p:getHandcardNum() and player:askForSkillInvoke(self:objectName(), _data) then
jink_table[index] = 0
end
index = index + 1
end
local jink_data = sgs.QVariant()
jink_data:setValue(Table2IntList(jink_table))
player:setTag("Jink_" .. use.card:toString(), jink_data)
return false
end
}
--[[
技能名:烈刃
相关武将:火·祝融、1v1·祝融1v1
描述:每当你使用【杀】对目标角色造成伤害后,你可以与该角色拼点:若你赢,你获得其一张牌。
引用:LuaLieren
状态:0405验证通过
]]--
LuaLieren = sgs.CreateTriggerSkill{
name = "LuaLieren",
events = {sgs.Damage},
on_trigger = function(self, event, zhurong, data)
local room = zhurong:getRoom()
local damage = data:toDamage()
local target = damage.to
if damage.card and damage.card:isKindOf("Slash") and (not zhurong:isKongcheng()) and (not target:isKongcheng()) and (not target:hasFlag("Global_DebutFlag")) and (not damage.chain) and (not damage.transfer) then
if room:askForSkillInvoke(zhurong, self:objectName(), data) then
local success = zhurong:pindian(target, "LuaLieren", nil)
if not success then return false end
if not target:isNude() then
local card_id = room:askForCardChosen(zhurong, target, "he", self:objectName())
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_EXTRACTION, zhurong:objectName())
room:obtainCard(zhurong, sgs.Sanguosha:getCard(card_id), reason, room:getCardPlace(card_id) ~= Player_PlaceHand)
end
end
end
return false
end
}
--[[
技能名:裂围
相关武将:1v1·牛金
描述:每当你杀死对手后,你可以摸三张牌。
引用:LuaLiewei
状态:1217验证通过
]]--
LuaLiewei = sgs.CreateTriggerSkill{
name = "LuaLiewei",
events = {sgs.BuryVictim},
frequency = sgs.Skill_Frequent,
priority = -2,
can_trigger = function(target)
return target ~= nil
end,
on_trigger = function(self, event, player, data)
local death = data:toDeath()
local room = player:getRoom()
if death.damage and death.damage.from and death.damage.from:hasSkill(self:objectName()) then
if room:askForSkillInvoke(death.damage.from, self:objectName(), data) then
death.damage.from:drawCards(3, self:objectName())
end
end
return false
end,
}
--[[
技能名:流离
相关武将:标准·大乔、SP·台版大乔、SP·王战大乔
描述:当你成为【杀】的目标时,你可以弃置一张牌,将此【杀】转移给你攻击范围内的一名其他角色(此【杀】的使用者除外)。
引用:LuaLiuli
状态:1217验证通过
]]--
LuaLiuliCard = sgs.CreateSkillCard{
name = "LuaLiuliCard" ,
filter = function(self, targets, to_select)
if #targets > 0 then return false end
if to_select:hasFlag("LuaLiuliSlashSource") or (to_select:objectName() == sgs.Self:objectName()) then return false end
local from
for _, p in sgs.qlist(sgs.Self:getSiblings()) do