forked from Mogara/LuaSkillsForQSGS
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ChapterJ.lua
1918 lines (1907 loc) · 62.6 KB
/
ChapterJ.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
--[[
代码速查手册(J区)
代码索引:
鸡肋、激昂、激将、极略、急救、急速、急袭、集智、集智、嫉恶、奸雄、奸雄、坚守、将驰、节命、结姻、竭缘、解烦、解烦、解惑、解围、尽瘁、禁酒、精策、精锐、酒池、酒诗、救援、救主、举荐、举荐、巨象、倨傲、据守、据守、据守、聚武、绝策、绝汲、绝境、绝境、绝情、军威、峻刑
]]--
--[[
技能名:鸡肋
相关武将:SP·杨修
描述:每当你受到伤害后,你可以选择一种牌的类别,伤害来源不能使用、打出或弃置其该类别的手牌,直到回合结束。
引用:LuaJilei、LuaJileiClear
状态:0405验证通过
]]--
LuaJilei = sgs.CreateTriggerSkill{
name = "LuaJilei",
events = {sgs.Damaged},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local damage = data:toDamage()
local current = room:getCurrent()
if not current or current:getPhase()==sgs.Player_NotActive or current:isDead() or not damage.from then
return false
end
if room:askForSkillInvoke(player, self:objectName(), data) then
local choice = room:askForChoice(player, self:objectName(), "BasicCard+EquipCard+TrickCard")
local jileis = damage.from:getTag(self:objectName()):toString():split("+")
if table.contains(jileis, choice) then return false end
table.insert(jileis,choice)
damage.from:setTag(self:objectName(), sgs.QVariant(table.concat(jileis, "+")))
local _type = choice.."|.|.|hand" --只是手牌
room:setPlayerCardLimitation(damage.from, "use,response,discard", _type, true)
local typename = string.lower(string.gsub(choice,"Card",""))
if damage.from:getMark("@jilei_"..typename) == 0 then
room:addPlayerMark(damage.from, "@jilei_"..typename)
end
end
end
}
LuaJileiClear = sgs.CreateTriggerSkill{
name = "#LuaJilei-clear",
events = {sgs.EventPhaseChanging,sgs.Death},
priority = 5,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.EventPhaseChanging then
local change = data:toPhaseChange()
if change.to ~= sgs.Player_NotActive then
return false
end
elseif event == sgs.Death then
local death = data:toDeath()
if death.who:objectName() ~= player:objectName() or player:objectName() ~= room:getCurrent():objectName() then
return false
end
end
local players = room:getAllPlayers()
for _,p in sgs.qlist(players) do
local jilei_list = p:getTag("LuaJilei"):toString():split("+")
if #jilei_list > 0 then
for _,jileity in ipairs(jilei_list) do
room:removePlayerCardLimitation(p, "use,response,discard", jileity.."|.|.|hand$1")
local typename = string.lower(string.gsub(jileity,"Card",""))
room:setPlayerMark(p, "@jilei_"..typename, 0)
end
p:removeTag("LuaJilei")
end
end
return false
end,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:激昂
相关武将:山·孙策,☆SP·吕蒙
描述:每当你指定或成为红色【杀】或【决斗】的目标后,你可以摸一张牌。
引用:LuaJiang
状态:0405验证通过
]]--
luaJiang = sgs.CreateTriggerSkill{
name = "LuaJiang" ,
events = {sgs.TargetConfirmed, sgs.TargetSpecified},
frequency = sgs.Skill_Frequent,
on_trigger = function(self, event, sunce, data)
local use = data:toCardUse()
if event == sgs.TargetSpecified or (event == sgs.TargetConfirmed and use.to:contains(sunce)) then
if use.card:isKindOf("Duel") or (use.card:isKindOf("Slash") and use.card:isRed()) then
if sunce:askForSkillInvoke(self:objectName(), data) then
sunce:drawCards(1, self:objectName())
end
end
end
return false
end
}
--[[
技能名:激将(主公技)
相关武将:标准·刘备、山·刘禅、怀旧-标准·刘备-旧
描述:当你需要使用或打出一张【杀】时,你可以令其他蜀势力角色打出一张【杀】(视为由你使用或打出)。
引用:LuaJijiang
状态:1217验证通过
]]--
LuaJijiangCard = sgs.CreateSkillCard{
name = "LuaJijiangCard" ,
filter = function(self, targets, to_select)
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
local plist = sgs.PlayerList()
for i = 1, #targets, 1 do
plist:append(targets[i])
end
return slash:targetFilter(plist, to_select, sgs.Self)
end ,
on_validate = function(self, cardUse) --这是0610新加的哦~~~~
cardUse.m_isOwnerUse = false
local liubei = cardUse.from
local targets = cardUse.to
room = liubei:getRoom()
local slash = nil
local lieges = room:getLieges("shu", liubei)
for _, target in sgs.qlist(targets) do
target:setFlags("LuaJijiangTarget")
end
for _, liege in sgs.qlist(lieges) do
slash = room:askForCard(liege, "slash", "@jijiang-slash:" .. liubei:objectName(), sgs.QVariant(), sgs.Card_MethodResponse, liubei) --未处理胆守
if slash then
for _, target in sgs.qlist(targets) do
target:setFlags("-LuaJijiangTarget")
end
return slash
end
end
for _, target in sgs.qlist(targets) do
target:setFlags("-LuaJijiangTarget")
end
room:setPlayerFlag(liubei, "Global_LuaJijiangFailed")
return nil
end
}
hasShuGenerals = function(player)
for _, p in sgs.qlist(player:getSiblings()) do
if p:isAlive() and (p:getKingdom() == "shu") then
return true
end
end
return false
end
LuaJijiangVS = sgs.CreateViewAsSkill{
name = "LuaJijiang$" ,
n = 0 ,
view_as = function()
return LuaJijiangCard:clone()
end ,
enabled_at_play = function(self, player)
return hasShuGenerals(player)
and player:hasLordSkill("LuaJijiang")
and (not player:hasFlag("Global_LuaJijiangFailed"))
and sgs.Slash_IsAvailable(player)
end ,
enabled_at_response = function(self, player, pattern)
return hasShuGenerals(player)
and player:hasLordSkill("LuaJijiang")
and ((pattern == "slash") or (pattern == "@jijiang"))
and (sgs.Sanguosha:getCurrentCardUseReason() == sgs.CardUseStruct_CARD_USE_REASON_RESPONSE_USE)
and (not player:hasFlag("Global_LuaJijiangFailed"))
end
}
LuaJijiang = sgs.CreateTriggerSkill{
name = "LuaJijiang$" ,
events = {sgs.CardAsked} ,
view_as_skill = LuaJijiangVS ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local pattern = data:toStringList()[1]
local prompt = data:toStringList()[2]
if (pattern ~= "slash") or string.find(prompt, "@jijiang-slash") then return false end
local lieges = room:getLieges("shu", player)
if lieges:isEmpty() then return false end
if not room:askForSkillInvoke(player, self:objectName(), data) then return false end
for _, liege in sgs.qlist(lieges) do
local slash = room:askForCard(liege, "slash", "@jijiang-slash:" .. player:objectName(), sgs.QVariant(), sgs.Card_MethodResponse, player)
if slash then
room:provide(slash)
return true
end
end
return false
end ,
can_trigger = function(self, target)
return target and target:hasLordSkill("LuaJijiang")
end
}
--[[
技能名:极略
相关武将:神·司马懿
描述:你可以弃一枚“忍”并发动以下技能之一:“鬼才”、“放逐”、“集智”、“制衡”、“完杀”。
引用:LuaJilve、LuaJilveClear
状态:0405验证通过
]]--
LuaJilveCard = sgs.CreateSkillCard{
name = "LuaJilveCard",
target_fixed = true,
about_to_use = function(self, room, use)
local shensimayi = use.from
local choices = {}
if not shensimayi:hasFlag("LuaJilveZhiheng") and shensimayi:canDiscard(shensimayi, "he") then
table.insert(choices,"zhiheng")
end
if not shensimayi:hasFlag("LuaJilveWansha") then
table.insert(choices,"wansha")
end
table.insert(choices,"cancel")
if #choices == 1 then return end
local choice = room:askForChoice(shensimayi, "LuaJilve", table.concat(choices,"+"))
if choice == "cancel" then
room:addPlayerHistory(shensimayi, "#LuaJilveCard", -1)
return
end
shensimayi:loseMark("@bear")
room:notifySkillInvoked(shensimayi, "LuaJilve")
if choice == "wansha" then
room:setPlayerFlag(shensimayi, "LuaJilveWansha")
room:acquireSkill(shensimayi, "wansha")
else
room:setPlayerFlag(shensimayi, "LuaJilveZhiheng")
room:askForUseCard(shensimayi, "@zhiheng", "@jilve-zhiheng", -1, sgs.Card_MethodDiscard)
end
end
}
LuaJilveVS = sgs.CreateZeroCardViewAsSkill{--完杀和制衡
name = "LuaJilve",
enabled_at_play = function(self,player)
return player:usedTimes("#LuaJilveCard") < 2 and player:getMark("@bear") > 0
end,
view_as = function()
return LuaJilveCard:clone()
end
}
LuaJilve = sgs.CreateTriggerSkill{
name = "LuaJilve",
events = {sgs.CardUsed, sgs.AskForRetrial, sgs.Damaged},--分别为集智、鬼才、放逐
view_as_skill = LuaJilveVS,
can_trigger = function(self, target)
return target and target:isAlive() and target:hasSkill(self:objectName()) and target:getMark("@bear") > 0
end,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
player:setMark("JilveEvent",tonumber(event))
if event == sgs.CardUsed then
local jizhi = sgs.Sanguosha:getTriggerSkill("jizhi")
local use = data:toCardUse()
if jizhi and use.card and use.card:getTypeId() == sgs.Card_TypeTrick and player:askForSkillInvoke(self:objectName(), data) then
room:notifySkillInvoked(player, self:objectName())
player:loseMark("@bear")
jizhi:trigger(event, room, player, data)
end
elseif event == sgs.AskForRetrial then
local guicai = sgs.Sanguosha:getTriggerSkill("guicai")
if guicai and not player:isKongcheng() and player:askForSkillInvoke(self:objectName(), data) then
room:notifySkillInvoked(player, self:objectName())
player:loseMark("@bear")
guicai:trigger(event, room, player, data)
end
elseif event == sgs.Damaged then
local fangzhu = sgs.Sanguosha:getTriggerSkill("fangzhu")
if fangzhu and player:askForSkillInvoke(self:objectName(), data) then
room:notifySkillInvoked(player, self:objectName())
player:loseMark("@bear")
fangzhu:trigger(event, room, player, data)
end
end
player:setMark("JilveEvent", 0)
return false
end
}
LuaJilveClear = sgs.CreateTriggerSkill{
name = "#LuaJilve-clear",
events = {sgs.EventPhaseChanging},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local change = data:toPhaseChange()
if change.to ~= sgs.Player_NotActive then return false end
room:detachSkillFromPlayer(player, "wansha", false, true)
return false
end,
can_trigger = function(self, target)
return target and target:hasFlag("LuaJilveWansha")
end
}
--[[
技能名:急救
相关武将:标准·华佗
描述:你的回合外,你可以将一张红色牌当【桃】使用。
引用:LuaJijiu
状态:1217验证通过
]]--
LuaJijiu = sgs.CreateViewAsSkill{
name = "LuaJijiu",
n = 1,
view_filter = function(self, selected, to_select)
if #selected == 0 then
return to_select:isRed()
end
return false
end,
view_as = function(self, cards)
if #cards == 1 then
local card = cards[1]
local suit = card:getSuit()
local point = card:getNumber()
local id = card:getId()
local peach = sgs.Sanguosha:cloneCard("peach", suit, point)
peach:setSkillName(self:objectName())
peach:addSubcard(id)
return peach
end
return nil
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player, pattern)
local phase = player:getPhase()
if phase == sgs.Player_NotActive then
return string.find(pattern, "peach")
end
return false
end
}
--[[
技能名:急速
相关武将:奥运·叶诗文
描述:你可以跳过你此回合的判定阶段和摸牌阶段。若如此做,视为对一名其他角色使用一张【杀】。
引用:LuaXJisu
状态:1217验证通过
]]--
LuaXJisuCard = sgs.CreateSkillCard{
name = "LuaXJisuCard",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
if #targets == 0 then
return sgs.Self:canSlash(to_select, nil, false)
end
return false
end,
on_use = function(self, room, source, targets)
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
slash:setSkillName(self:objectName())
local use = sgs.CardUseStruct()
use.card = slash
use.from = source
for _,p in pairs(targets) do
use.to:append(p)
end
room:useCard(use)
end
}
LuaXJisuVS = sgs.CreateViewAsSkill{
name = "LuaXJisu",
n = 0,
view_as = function(self, cards)
return LuaXJisuCard:clone()
end,
enabled_at_play = function(self, player)
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "@@LuaXJisu"
end
}
LuaXJisu = sgs.CreateTriggerSkill{
name = "LuaXJisu",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseChanging},
view_as_skill = LuaXJisuVS,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local change = data:toPhaseChange()
local nextphase = change.to
if nextphase == sgs.Player_Judge then
if not player:isSkipped(sgs.Player_Judge) then
if not player:isSkipped(sgs.Player_Draw) then
if room:askForUseCard(player, "@@LuaXJisu", "@LuaXJisu") then
player:skip(sgs.Player_Judge)
player:skip(sgs.Player_Draw)
end
end
end
end
return false
end
}
--[[
技能名:急袭
相关武将:山·邓艾
描述:你可以将一张“田”当【顺手牵羊】使用。
引用:LuaJixi
状态:0405验证通过(需与技能“屯田”配合使用)
]]--
LuaJixi = sgs.CreateOneCardViewAsSkill{
name = "LuaJixi",
filter_pattern = ".|.|.|field",
expand_pile = "field",
view_as = function(self, originalCard)
local snatch = sgs.Sanguosha:cloneCard("snatch", originalCard:getSuit(), originalCard:getNumber())
snatch:addSubcard(originalCard:getId())
snatch:setSkillName(self:objectName())
return snatch
end,
enabled_at_play = function(self, player)
return not player:getPile("field"):isEmpty()
end
}
--[[
技能名:集智
相关武将:标准·黄月英
描述:每当你使用锦囊牌选择目标后,你可以展示牌堆顶的一张牌。若此牌为基本牌,你选择一项:1.将之置入弃牌堆;2.用一张手牌替换之。若此牌不为基本牌,你获得之。
引用:LuaJizhi
状态:1217验证通过
]]--
LuaJizhi = sgs.CreateTriggerSkill{
name = "LuaJizhi" ,
frequency = sgs.Skill_Frequent ,
events = {sgs.CardUsed} ,
on_trigger = function(self, event, player, data)
local use = data:toCardUse()
local room = player:getRoom()
if (use.card:getTypeId() == sgs.Card_TypeTrick) then
if not (player:getMark("JilveEvent") > 0) then
if not room:askForSkillInvoke(player, self:objectName()) then return false end
end
local ids = room:getNCards(1, false)
local move = sgs.CardsMoveStruct()
move.card_ids = ids
move.to = player
move.to_place = sgs.Player_PlaceTable
move.reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_TURNOVER, player:objectName(), self:objectName(), nil)
room:moveCardsAtomic(move, true)
local id = ids:first()
local card = sgs.Sanguosha:getCard(id)
if not card:isKindOf("BasicCard") then
player:obtainCard(card)
else
local card_ex
if not player:isKongcheng() then
local card_data = sgs.QVariant()
card_data:setValue(card)
card_ex = room:askForCard(player, ".", "@jizhi-exchange:::" .. card:objectName(), card_data, sgs.Card_MethodNone)
end
if card_ex then
local reason1 = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_PUT, player:objectName(), self:objectName(), nil)
local reason2 = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_OVERRIDE, player:objectName(), self:objectName(), nil)
local move1 = sgs.CardsMoveStruct()
move1.card_ids:append(card_ex:getEffectiveId())
move1.from = player
move1.to = nil
move1.to_place = sgs.Player_DrawPile
move1.reason = reason1
local move2 = sgs.CardsMoveStruct()
move2.card_ids = ids
move2.from = player
move2.to = player
move2.to_place = sgs.Player_PlaceHand
move2.reason = reason2
local moves = sgs.CardsMoveList()
moves:append(move1)
moves:append(move2)
room:moveCardsAtomic(moves, false)
else
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_NAUTRAL_ENTER, player:objectName(), self:objectName(), nil)
room:throwCard(card, reason, nil)
end
end
end
return false
end
}
--[[
技能名:集智
相关武将:怀旧-标准·黄月英-旧、1v1·黄月英1v1、SP·台版黄月英
描述:每当你使用非延时类锦囊牌选择目标后,你可以摸一张牌。
引用:LuaNosJizhi
状态:0405验证通过
]]--
LuaNosJizhi = sgs.CreateTriggerSkill{
name = "LuaNosJizhi" ,
frequency = sgs.Skill_Frequent ,
events = {sgs.CardUsed} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local use = data:toCardUse()
if use.card:isNDTrick() and room:askForSkillInvoke(player, self:objectName()) then
player:drawCards(1, self:objectName())
end
return false
end
}
--[[
技能名:嫉恶(锁定技)
相关武将:☆SP·张飞
描述:你使用的红色【杀】造成的伤害+1。
引用:LuaJie
状态:1217验证通过
]]--
LuaJie = sgs.CreateTriggerSkill{
name = "LuaJie",
frequency = sgs.Skill_Compulsory,
events = {sgs.ConfirmDamage},
on_trigger = function(self, event, player, data)
local damage = data:toDamage()
local card = damage.card
if card then
if card:isKindOf("Slash") and card:isRed() then
local hurt = damage.damage
damage.damage = hurt + 1
data:setValue(damage)
end
end
return false
end
}
--[[
技能名:奸雄
相关武将:界限突破·曹操
描述:每当你受到伤害后,你可以选择一项:获得对你造成伤害的牌,或摸一张牌。
引用:LuaJianxiong
状态:0405验证通过
]]--
LuaJianxiong = sgs.CreateMasochismSkill{
name = "LuaJianxiong" ,
on_damaged = function(self, player, damage)
local room = player:getRoom()
local data = sgs.QVariant()
data:setValue(damage)
local choices = {"draw+cancel"}
local card = damage.card
if card then
local ids = sgs.IntList()
if card:isVirtualCard() then
ids = card:getSubcards()
else
ids:append(card:getEffectiveId())
end
if ids:length() > 0 then
local all_place_table = true
for _, id in sgs.qlist(ids) do
if room:getCardPlace(id) ~= sgs.Player_PlaceTable then
all_place_table = false
break
end
end
if all_place_table then
table.insert(choices, "obtain")
end
end
end
local choice = room:askForChoice(player, self:objectName(), table.concat(choices, "+"), data)
if choice ~= "cancel" then
room:notifySkillInvoked(player, self:objectName())
if choice == "obtain" then
player:obtainCard(card)
else
player:drawCards(1, self:objectName())
end
end
end
}
--[[
技能名:奸雄
相关武将:标准·曹操、铜雀台·曹操
描述:每当你受到伤害后,你可以获得对你造成伤害的牌。
引用:LuaNosJianxiong
状态:0405验证通过
]]--
LuaNosJianxiong = sgs.CreateMasochismSkill{
name = "LuaNosJianxiong" ,
on_damaged = function(self, player, damage)
local room = player:getRoom()
local card = damage.card
if not card then return end
local ids = sgs.IntList()
if card:isVirtualCard() then
ids = card:getSubcards()
else
ids:append(card:getEffectiveId())
end
if ids:isEmpty() then return end
for _, id in sgs.qlist(ids) do
if room:getCardPlace(id) ~= sgs.Player_PlaceTable then return end
end
local data = sgs.QVariant()
data:setValue(damage)
if room:askForSkillInvoke(player, self:objectName(), data) then
player:obtainCard(card)
end
end
}
--[[
技能名:坚守
相关武将:测试·蹲坑曹仁
描述:回合结束阶段开始时,你可以摸五张牌,然后将你的武将牌翻面
引用:LuaXJianshou
状态:1217验证通过
]]--
LuaXJianshou = sgs.CreateTriggerSkill{
name = "LuaXJianshou",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseStart},
on_trigger = function(self, event, player, data)
if player:getPhase() == sgs.Player_Finish then
if player:askForSkillInvoke(self:objectName(), data) then
player:drawCards(5, true, self:objectName())
player:turnOver()
end
end
end
}
--[[
技能名:将驰
相关武将:二将成名·曹彰
描述:摸牌阶段,你可以选择一项:1、额外摸一张牌,若如此做,你不能使用或打出【杀】,直到回合结束。2、少摸一张牌,若如此做,出牌阶段你使用【杀】时无距离限制且你可以额外使用一张【杀】,直到回合结束。
引用:LuaJiangchi、LuaJiangchiTargetMod
状态:1217验证通过
]]--
LuaJiangchi = sgs.CreateTriggerSkill{
name = "LuaJiangchi" ,
events = {sgs.DrawNCards} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local choice = room:askForChoice(player, self:objectName(), "jiang+chi+cancel")
if choice == "cancel" then return false end
if choice == "jiang" then
room:setPlayerCardLimitation(player, "use,response", "Slash", true)
data:setValue(data:toInt() + 1)
return false
else
room:setPlayerFlag(player, "LuaJiangchiInvoke")
data:setValue(data:toInt() - 1)
return false
end
end
}
LuaJiangchiTargetMod = sgs.CreateTargetModSkill{
name = "#LuaJiangchi-target" ,
residue_func = function(self, from)
if from:hasSkill("LuaJiangchi") and from:hasFlag("LuaJiangchiInvoke") then
return 1
else
return 0
end
end ,
distance_limit_func = function(self, from)
if from:hasSkill("LuaJiangchi") and from:hasFlag("LuaJiangchiInvoke") then
return 1000
else
return 0
end
end
}
--[[
技能名:节命
相关武将:火·荀彧
描述:每当你受到1点伤害后,你可以令一名角色将手牌补至X张(X为该角色的体力上限且至多为5)。
引用:LuaJieming
状态:1217验证通过
]]--
LuaJieming = sgs.CreateTriggerSkill{
name = "LuaJieming" ,
events = {sgs.Damaged} ,
on_trigger = function(self, event, player, data)
local damage = data:toDamage()
local room = player:getRoom()
for i = 0, damage.damage - 1, 1 do
local to = room:askForPlayerChosen(player, room:getAlivePlayers(), self:objectName(), "jieming-invoke", true, true)
if not to then break end
local upper = math.min(5, to:getMaxHp())
local x = upper - to:getHandcardNum()
if x <= 0 then
else
to:drawCards(x)
end
end
end
}
--[[
技能名:结姻
相关武将:界限突破·孙尚香、标准·孙尚香、SP·孙尚香
描述:出牌阶段限一次,你可以弃置两张手牌并选择一名已受伤的男性角色,你和该角色各回复1点体力。
引用:LuaJieyin
状态:0405验证通过
]]--
LuaJieyinCard = sgs.CreateSkillCard{
name = "LuaJieyinCard" ,
filter = function(self, targets, to_select)
if #targets ~= 0 then return false end
return to_select:isMale() and to_select:isWounded() and to_select:objectName() ~= sgs.Self:objectName()
end ,
on_effect = function(self, effect)
local room = effect.from:getRoom()
local recover = sgs.RecoverStruct()
recover.card = self
recover.who = effect.from
room:recover(effect.from, recover, true)
room:recover(effect.to, recover, true)
end
}
LuaJieyin = sgs.CreateViewAsSkill{
name = "LuaJieyin" ,
n = 2 ,
view_filter = function(self, selected, to_select)
if #selected > 1 or sgs.Self:isJilei(to_select) then return false end
return not to_select:isEquipped()
end ,
view_as = function(self, cards)
if #cards ~= 2 then return nil end
local jieyin_card = LuaJieyinCard:clone()
for _,card in pairs(cards) do
jieyin_card:addSubcard(card)
end
return jieyin_card
end ,
enabled_at_play = function(self, target)
return target:getHandcardNum() >= 2 and not target:hasUsed("#LuaJieyinCard")
end
}
--[[
技能名:竭缘
相关武将:铜雀台·灵雎、SP·灵雎
描述:每当你对一名其他角色造成伤害时,若其体力值大于或等于你的体力值,你可以弃置一张黑色手牌:若如此做,此伤害+1。每当你受到一名其他角色造成的伤害时,若其体力值大于或等于你的体力值,你可以弃置一张红色手牌:若如此做,此伤害-1。
引用:LuaJieyuan
状态:0405验证通过
]]--
LuaJieyuan = sgs.CreateTriggerSkill{
name = "LuaJieyuan" ,
events = {sgs.DamageCaused, sgs.DamageInflicted} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local damage = data:toDamage()
if event == sgs.DamageCaused then
if damage.to and damage.to:isAlive() and damage.to:getHp() >= player:getHp() and damage.to:objectName() ~= player:objectName() and player:canDiscard(player, "h") and room:askForCard(player, ".black", "@jieyuan-increase:" .. damage.to:objectName(), data, self:objectName()) then
damage.damage = damage.damage + 1
data:setValue(damage)
end
elseif event == sgs.DamageInflicted then
if damage.from and damage.from:isAlive() and damage.from:getHp() >= player:getHp() and damage.from:objectName() ~= player:objectName() and player:canDiscard(player, "h") and room:askForCard(player, ".red", "@jieyuan-decrease:" .. damage.from:objectName(), data, self:objectName()) then
damage.damage = damage.damage - 1
data:setValue(damage)
if damage.damage < 1 then return true end
end
end
return false
end
}
--[[
技能名:解烦(限定技)
相关武将:二将成名·韩当
描述:出牌阶段,你可以指定一名角色,攻击范围内含有该角色的所有角色须依次选择一项:弃置一张武器牌;或令该角色摸一张牌。
引用:LuaJiefan
状态:1217验证通过
]]--
LuaJiefanCard = sgs.CreateSkillCard{
name = "LuaJiefanCard" ,
filter = function(self, targets, to_select)
return #targets == 0
end ,
on_use = function(self, room, source, targets)
room:removePlayerMark(source, "@rescue")
local target = targets[1]
local _targetdata = sgs.QVariant()
_targetdata:setValue(target)
source:setTag("LuaJiefanTarget", _targetdata)
for _, player in sgs.qlist(room:getAllPlayers()) do
if player:isAlive() and player:inMyAttackRange(target) then
room:cardEffect(self, source, player)
end
end
source:removeTag("LuaJiefanTarget")
end ,
on_effect = function(self, effect)
local room = effect.to:getRoom()
local target = effect.from:getTag("LuaJiefanTarget"):toPlayer()
local data = effect.from:getTag("LuaJiefanTarget")
if target then
if not room:askForCard(effect.to, ".Weapon", "@jiefan-discard::" .. target:objectName(), data) then
target:drawCards(1)
end
end
end
}
LuaJiefanVS = sgs.CreateViewAsSkill{
name = "LuaJiefan" ,
n = 0,
view_as = function()
return LuaJiefanCard:clone()
end ,
enabled_at_play = function(self, player)
return player:getMark("@rescue") >= 1
end
}
LuaJiefan = sgs.CreateTriggerSkill{
name = "LuaJiefan" ,
frequency = sgs.Skill_Limited,
limit_mark = "@rescue",
events = {},
view_as_skill = LuaJiefanVS ,
on_trigger = function()
return false
end
}
--[[
技能名:解烦
相关武将:怀旧·韩当
描述:你的回合外,当一名角色处于濒死状态时,你可以对当前正进行回合的角色使用一张【杀】(无距离限制),此【杀】造成伤害时,你防止此伤害,视为对该濒死角色使用一张【桃】。
引用:LuaNosJiefan
状态:1217验证通过
]]--
LuaNosJiefanCard = sgs.CreateSkillCard{
name = "LuaNosJiefanCard",
target_fixed = true,
mute = true,
on_use = function(self,room,handang,targets)
local current = room:getCurrent()
if not current or current:isDead() or current:getPhase() == sgs.Player_NotActive then return end
local who = room:getCurrentDyingPlayer()
if not who then return end
handang:setFlags("NosJiefanUsed")
local data = sgs.QVariant()
data:setValue(who)
room:setTag("NosJiefanTarget",data)
local use_slash = room:askForUseSlashTo(handang,current,"nosjiefan-slash:"..current:objectName(),false)
if not use_slash then
handang:setFlags("-NosJiefanUsed")
room:removeTag("NosJiefanTarget")
room:setPlayerFlag(handang,"Global_NosJiefanFailed")
end
end
}
LuaNosJiefanvs = sgs.CreateViewAsSkill{
name = "LuaNosJiefan",
n = 0,
enabled_at_play = function(self,player)
return false
end,
enabled_at_response = function(self,player,pattern)
if not string.find(pattern,"peach") then return false end
if player:hasFlag("Global_NosJiefanFailed") then return false end
for _,p in sgs.qlist(player:getAliveSiblings()) do
if p:getPhase() ~=sgs.Player_NotActive then
return true
end
end
return false
end,
view_as = function(self,cards)
return LuaNosJiefanCard:clone()
end
}
LuaNosJiefan = sgs.CreateTriggerSkill{
name = "LuaNosJiefan",
events = {sgs.DamageCaused,sgs.CardFinished,sgs.PreCardUsed},
view_as_skill = LuaNosJiefanvs,
on_trigger = function(self,event,handang,data)
local room = handang:getRoom()
if event == sgs.PreCardUsed then
if not handang:hasFlag("NosJiefanUsed") then return false end
local use = data:toCardUse()
if use.card:isKindOf("Slash") then
handang:setFlags("-NosJiefanUsed")
room:setCardFlag(use.card,"nosjiefan-slash")
end
elseif event == sgs.DamageCaused then
local current = room:getCurrent()
local damage = data:toDamage()
if damage.card and damage.card:isKindOf("Slash") and damage.card:hasFlag("nosjiefan-slash") then
local log2 = sgs.LogMessage()
log2.type = "#NosJiefanPrevent"
log2.from = handang
log2.to:append(damage.to)
room:sendLog(log2)
local target = room:getTag("NosJiefanTarget"):toPlayer()
if target and target:getHp() > 0 then
local log = sgs.LogMessage()
log.type = "#NosJiefanNull1"
log.from = target
room:sendLog(log)
elseif target and target:isDead() then
local log = sgs.LogMessage()
log.type = "#NosJiefanNull2"
log.from = target
room:sendLog(log)
elseif handang:hasFlag("Global_PreventPeach") then
local log = sgs.LogMessage()
log.type = "#NosJiefanNull3"
log.from = current
log.to:append(handang)
room:sendLog(log)
else
local peach = sgs.Sanguosha:cloneCard("peach",sgs.Card_NoSuit,0)
peach:setSkillName(self:objectName())
room:setCardFlag(damage.card,"nosjiefan_success")
room:useCard(sgs.CardUseStruct(peach,handang,target))
end
return true
end
return false
elseif event == sgs.CardFinished and room:getTag("NosJiefanTarget"):toPlayer() then
local use = data:toCardUse()
if use.card:isKindOf("Slash") and use.card:hasFlag("nosjiefan-slash") then
if not use.card:hasFlag("nosjiefan_success") then
room:setPlayerFlag(handang,"Global_NosJiefanFailed")
end
room:removeTag("NosJiefanTarget")
end
end
return false
end
}
--[[
技能名:解惑(觉醒技)
相关武将:智·司马徽
描述:当你发动“授业”目标累计超过6个时,须减去一点体力上限,将技能“授业”改为每阶段限一次,并获得技能“师恩”
引用:LuaJiehuo
状态:1217验证通过
注:智水镜的三个技能均有联系,为了方便起见统一使用本LUA版本的技能,并非原版
]]--
LuaJiehuo = sgs.CreateTriggerSkill{
name = "LuaJiehuo" ,
events = {sgs.CardFinished} ,
frequency = sgs.Skill_Wake ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
room:setPlayerMark(player, "LuaJiehuo", 1)
player:loseAllMarks("@shouye")
if room:changeMaxHpForAwakenSkill(player) then
room:acquireSkill(player, "LuaShien")
end
return false
end ,
can_trigger = function(self, target)
return target and (target:getMark("LuaJiehuo") == 0) and (target:getMark("@shouye") >= 7)
end
}
--[[
技能名:解围
相关武将:风·曹仁
描述:每当你的武将牌翻面后,你可以摸一张牌,然后你可以使用一张锦囊牌或装备牌:若如此做,该牌结算后,你可以弃置场上一张同类型的牌。
状态:1217验证通过
]]--
LuaJiewei = sgs.CreateTriggerSkill{
name = "LuaJiewei",
events = {sgs.TurnedOver} ,
frequency = sgs.Skill_NotFrequent,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if not room:askForSkillInvoke(player, self:objectName()) then return false end
player:drawCards(1)
local card = room:askForUseCard(player, "TrickCard+^Nullification,EquipCard|.|.|hand", "@Luajiewei")
if not card then return false end
local targets = sgs.SPlayerList()
if card:getTypeId() == sgs.Card_TypeTrick then
for _, p in sgs.qlist(room:getAlivePlayers()) do
local can_discard = false
for _, judge in sgs.qlist(p:getJudgingArea()) do
if (judge:getTypeId() == sgs.Card_TypeTrick) and (player:canDiscard(p, judge:getEffectiveId())) then
can_discard = true
break
elseif judge:getTypeId() == sgs.Card_TypeSkill then
local real_card = Sanguosha:getEngineCard(judge:getEffectiveId())
if (real_card:getTypeId() == sgs.Card_TypeTrick) and (player:canDiscard(p, real_card:getEffectiveId())) then
can_discard = true
break
end
end
end
if can_discard then targets:append(p) end
end
elseif (card:getTypeId() == sgs.Card_TypeEquip) then
for _, p in sgs.qlist(room:getAlivePlayers()) do
if (not p:getEquips():isEmpty()) and (player:canDiscard(p, "e")) then
targets:append(p)
else
for _, judge in sgs.qlist(p:getJudgingArea()) do
if judge:getTypeId() == sgs.Card_TypeSkill then
local real_card = Sanguosha:getEngineCard(judge:getEffectiveId())
if (real_card:getTypeId() == sgs.Card_TypeEquip) and (player:canDiscard(p, real_card:getEffectiveId())) then
targets:append(p)
break
end
end
end
end
end
end
if targets:isEmpty() then return false end
local to_discard = room:askForPlayerChosen(player, targets, self:objectName(), "@Luajiewei-discard", true)
if to_discard then
local disabled_ids = sgs.IntList()