-
Notifications
You must be signed in to change notification settings - Fork 59
/
ChapterS.lua
1475 lines (1469 loc) · 47.9 KB
/
ChapterS.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
--[[
代码速查手册(S区)
技能索引:
伤逝、伤逝、尚义、烧营、涉猎、神愤、甚贤、神戟、神君、神力、神速、神威、神智、生息、师恩、识破、恃才、恃勇、弑神、誓仇、慎拒、守成、授业、淑德、淑慎、双刃、双雄、水箭、水泳、死谏、死节、死战、颂词、颂威、肃资、随势
]]--
--[[
技能名:伤逝
相关武将:一将成名·张春华
描述:弃牌阶段外,当你的手牌数小于X时,你可以将手牌补至X张(X为你已损失的体力值且最多为2)。
引用:LuaShangshi
状态:1217验证通过
]]--
LuaShangshi = sgs.CreateTriggerSkill{
name = "LuaShangshi",
events = {sgs.EventPhaseChanging, sgs.CardsMoveOneTime, sgs.MaxHpChanged, sgs.HpChanged},
frequency = sgs.Skill_Frequent,
on_trigger = function(self, triggerEvent, zhangchunhua, data)
local room = zhangchunhua:getRoom()
local losthp = math.min(zhangchunhua:getLostHp(),2)
--如果是怀旧版请这么写。
--local losthp = zhangchunhua:getLostHp()
if (triggerEvent == sgs.CardsMoveOneTime) then
local move = data:toMoveOneTime()
if zhangchunhua:getPhase() == sgs.Player_Discard then
local changed = false
if move.from and move.from:objectName() == zhangchunhua:objectName() and move.from_places:contains(sgs.Player_PlaceHand) then
changed = true
end
if move.to and move.to:objectName() == zhangchunhua:objectName() and move.to_place == sgs.Player_PlaceHand then
changed = true
end
if changed then
zhangchunhua:addMark("shangshi")
end
return false
else
local can_invoke = false
if move.from and move.from:objectName() == zhangchunhua:objectName() and move.from_places:contains(sgs.Player_PlaceHand) then
can_invoke = true
end
if move.to and move.to:objectName() == zhangchunhua:objectName() and move.to_place == sgs.Player_PlaceHand then
can_invoke = true
end
if not can_invoke then
return false
end
end
elseif triggerEvent == sgs.HpChanged or triggerEvent == sgs.MaxHpChanged then
if zhangchunhua:getPhase() == sgs.Player_Discard then
zhangchunhua:addMark("shangshi")
return false
end
elseif triggerEvent == sgs.EventPhaseChanging then
local change = data:toPhaseChange()
if change.from ~= sgs.Player_Discard then
return false
end
if zhangchunhua:getMark("shangshi") <= 0 then
return false
end
zhangchunhua:setMark("shangshi", 0)
end
if (zhangchunhua:getHandcardNum() < losthp and zhangchunhua:getPhase() ~= sgs.Player_Discard and zhangchunhua:askForSkillInvoke(self:objectName())) then
zhangchunhua:drawCards(losthp - zhangchunhua:getHandcardNum());
end
return false;
end
}
--[[
技能名:伤逝
相关武将:怀旧·张春华
描述:弃牌阶段外,当你的手牌数小于X时,你可以将手牌补至X张(X为你已损失的体力值)
引用:LuaNosShangshi
状态:1217验证通过(见上)
]]--
--[[
技能名:尚义
相关武将:阵·蒋钦
描述:出牌阶段限一次,你可以令一名其他角色观看你的手牌,然后你选择一项:1.观看其手牌,然后你可以弃置其中一张黑色牌。2.观看其身份牌。
引用:LuaShangyi
状态:1217验证通过
]]--
local json = require ("json")
LuaShangyiCard = sgs.CreateSkillCard{
name = "LuaShangyiCard",
target_fixed = false,
will_throw = true,
filter = function(self, targets, to_select)
return #targets == 0 and to_select:objectName() ~= sgs.Self:objectName()
end,
on_effect = function(self, effect)
local room = effect.from:getRoom()
local player = effect.to
if not effect.from:isKongcheng() then
room:showAllCards(effect.from, player)
end
local choicelist = {}
if not effect.to:isKongcheng() then
table.insert(choicelist,"handcards")
end
if (room:getMode() == "04_1v3" or room:getMode() == "06_3v3")then
elseif (room:getMode() == "06_XMode") then
local backup = player:getTag("XModeBackup"):toStringList()
if #backup > 0 then
table.insert(choicelist,"remainedgenerals")
end
elseif (room:getMode() == "02_1v1") then
local list = player:getTag("1v1Arrange"):toStringList()
if #list > 0 then
table.insert(choicelist,"remainedgenerals")
end
elseif sgs.GetConfig("EnableBasara",true) then
if player:getGeneralName() == "anjiang" or player:getGeneral2Name() == "anjiang"then
table.insert(choicelist,"generals")
end
elseif not player:isLord() then
table.insert(choicelist,"role")
end
if #choicelist == 0 then return end
local choice = room:askForChoice(effect.from, "shangyi", table.concat(choicelist,"+"))
local jsonLog ={
"$ShangyiView",
effect.from:objectName(),
effect.to:objectName(),
"",
"shangyi:" .. choice,
"",
}
room:doBroadcastNotify(room:getOtherPlayers(effect.from), sgs.CommandType.S_COMMAND_LOG_SKILL, json.encode(jsonLog))
if choice == "handcards"then
local ids = sgs.IntList()
for _,card in sgs.qlist(player:getHandcards())do
if card:isBlack() then
ids:append(card:getEffectiveId())
end
end
local card_id = room:doGongxin(effect.from, player, ids, "shangyi");
if card_id == -1 then return end
effect.from:removeTag("shangyi")
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_DISMANTLE, effect.from:objectName(),"", "shangyi","")
room:throwCard(sgs.Sanguosha:getCard(card_id), reason, effect.to, effect.from)
elseif choice == "remainedgenerals" then
local list;
if room:getMode() == "02_1v1" then
list = player:getTag("1v1Arrange"):toStringList()
elseif room:getMode() == "06_XMode" then
list = player:getTag("XModeBackup"):toStringList()
end
for _,name in pairs(list)do
local jsonLog ={
"$ShangyiViewRemained",
effect.from:objectName(),
player:objectName(),
"",
name,
"",
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_LOG_SKILL, json.encode(jsonLog))
end
local jsonValue = {
"shangyi",
sgs.QList2Table(list)
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_VIEW_GENERALS, json.encode(jsonValue))
elseif choice == "generals" then
local list = room:getTag(player:objectName()).toStringList();
for _,name in pairs(list)do
local jsonLog ={
"$ShangyiViewUnknown",
effect.from:objectName(),
player:objectName(),
"",
name,
"",
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_LOG_SKILL, json.encode(jsonLog))
end
local jsonValue = {
"shangyi",
sgs.QList2Table(list)
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_VIEW_GENERALS, json.encode(jsonValue))
elseif choice == "role" then
local jsonValue = {
player:objectName(),
"role",
player:getRole(),
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_SET_PROPERTY, json.encode(jsonValue)); --源码这里竟然有坑……
local jsonLog ={
"$ViewRole",
effect.from:objectName(),
player:objectName(),
"",
player:getRole(),
"",
}
room:doNotify(effect.from, sgs.CommandType.S_COMMAND_LOG_SKILL, json.encode(jsonLog))
end
end,
}
LuaShangyi = sgs.CreateZeroCardViewAsSkill{
name = "LuaShangyi",
view_as = function(self)
return LuaShangyiCard:clone()
end,
enabled_at_play = function(self, player)
return not player:hasUsed("#LuaShangyiCard")
end,
}
--[[
技能名:烧营
相关武将:倚天·陆伯言
描述:当你对一名不处于连环状态的角色造成一次火焰伤害时,你可选择一名其距离为1的另外一名角色并进行一次判定:若判定结果为红色,则你对选择的角色造成一点火焰伤害
引用:LuaShaoying
状态:1217验证通过
]]--
LuaShaoying = sgs.CreateTriggerSkill{
name = "LuaShaoying" ,
events = {sgs.PreDamageDone, sgs.DamageComplete} ,
on_trigger = function(self, event, player, data)
local damage = data:toDamage()
local room = player:getRoom()
if event == sgs.PreDamageDone then
if (not player:isChained()) and damage.from and (damage.nature == sgs.DamageStruct_Fire) and
(damage.from:isAlive() and damage.from:hasSkill(self:objectName())) then
local targets = sgs.SPlayerList()
for _, p in sgs.qlist(room:getAlivePlayers()) do
if (player:distanceTo(p) == 1) then
targets:append(p)
end
end
if targets:isEmpty() then return false end
if damage.from:askForSkillInvoke(self:objectName(), data) then
local target = room:askForPlayerChosen(damage.from, targets, self:objectName())
local _data = sgs.QVariant()
_data:setValue(target)
damage.from:setTag("LuaShaoyingTarget", _data)
end
end
return false
elseif event == sgs.DamageComplete then
if damage.from == nil then return false end
local target = damage.from:getTag("LuaShaoyingTarget"):toPlayer()
damage.from:removeTag("LuaShaoyingTarget")
if (not target) or (not damage.from) or (damage.from:isDead()) then return false end
local judge = sgs.JudgeStruct()
judge.pattern = ".|red"
judge.good = true
judge.reason = self:objectName()
judge.who = damage.from
room:judge(judge)
if judge:isGood() then
local shaoying_damage = sgs.DamageStruct()
shaoying_damage.nature = sgs.DamageStruct_Fire
shaoying_damage.from = damage.from
shaoying_damage.to = target
room:damage(shaoying_damage)
end
return false
end
return false
end ,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:涉猎
相关武将:神·吕蒙
描述:摸牌阶段开始时,你可以放弃摸牌并亮出牌堆顶的五张牌。若如此做,你获得其中每种花色的牌各一张,然后将其余的牌置入弃牌堆。
引用:LuaShelie
状态:0405验证通过
备注:与源码略有区别,源码的自定义函数删除,新增自定义函数
]]--
function getCardList(intlist)
local ids = sgs.CardList()
for _, id in sgs.qlist(intlist) do
ids:append(sgs.Sanguosha:getCard(id))
end
return ids
end
LuaShelie = sgs.CreateTriggerSkill{
name = "LuaShelie",
events = {sgs.EventPhaseStart},
on_trigger = function(self, event, shenlvmeng, data)
if shenlvmeng:getPhase() ~= sgs.Player_Draw then
return false
end
local room = shenlvmeng:getRoom()
if not shenlvmeng:askForSkillInvoke(self:objectName()) then
return false
end
local card_ids = room:getNCards(5)
room:fillAG(card_ids)
local to_get = sgs.IntList()
local to_throw = sgs.IntList()
while not card_ids:isEmpty() do
local card_id = room:askForAG(shenlvmeng, card_ids, false, "shelie")
card_ids:removeOne(card_id)
to_get:append(card_id)--弃置剩余所有符合花色的牌(原文:throw the rest cards that matches the same suit)
local card = sgs.Sanguosha:getCard(card_id)
local suit = card:getSuit()
room:takeAG(shenlvmeng, card_id, false)
local _card_ids = card_ids
for i = 0, 150 do--这一句不加的话 涉猎很多牌可能会bug,150可以改,数值越大,越精准,一般和你涉猎的牌数相等是没有bug的
for _,id in sgs.qlist(_card_ids) do
local c = sgs.Sanguosha:getCard(id)
if c:getSuit() == suit then
card_ids:removeOne(id)
room:takeAG(nil, id, false)
to_throw:append(id)
end
end
end
end
local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
if not to_get:isEmpty() then
dummy:addSubcards(getCardList(to_get))
shenlvmeng:obtainCard(dummy)
end
dummy:clearSubcards()
if not to_throw:isEmpty() then
dummy:addSubcards(getCardList(to_throw))
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_NATURAL_ENTER, shenlvmeng:objectName(), self:objectName(),"")
room:throwCard(dummy, reason, nil)
end
dummy:deleteLater()
room:clearAG()
return true
end
}
--[[
技能名:神愤
相关武将:神·吕布、SP·神吕布
描述:出牌阶段限一次,你可以弃六枚“暴怒”标记:若如此做,所有其他角色受到1点伤害,弃置装备区的所有牌,弃置四张手牌,然后你将武将牌翻面。
引用:LuaShenfen
状态:0405验证通过(未处理胆守)
]]--
LuaShenfenCard = sgs.CreateSkillCard{
name = "LuaShenfenCard" ,
target_fixed = true ,
on_use = function(self, room, source, targets)
source:setFlags("LuaShenfenUsing")
source:loseMark("@wrath", 6)
local players = room:getOtherPlayers(source)
for _, player in sgs.qlist(players) do
room:damage(sgs.DamageStruct("LuaShenfen", source, player))
end
for _, player in sgs.qlist(players) do
player:throwAllEquips()
end
for _, player in sgs.qlist(players) do
room:askForDiscard(player, "LuaShenfen", 4, 4)
end
source:turnOver()
source:setFlags("-LuaShenfenUsing")
end
}
LuaShenfen = sgs.CreateZeroCardViewAsSkill{
name = "LuaShenfen",
view_as = function()
return LuaShenfenCard:clone()
end ,
enabled_at_play = function(self,player)
return player:getMark("@wrath") >= 6 and not player:hasUsed("#LuaShenfenCard")
end
}
--[[
技能名:甚贤
相关武将:SP·星彩
描述:你的回合外,每当有其他角色因弃置而失去牌时,若其中有基本牌,你可以摸一张牌。
引用:LuaShenxian
状态:1217验证通过
]]--
LuaShenxian = sgs.CreateTriggerSkill{
name = "LuaShenxian" ,
frequency = sgs.Skill_Frequent ,
events = {sgs.CardsMoveOneTime},
on_trigger = function(self, event, player, data)
local move = data:toMoveOneTime()
if move.from and (move.from:objectName() ~= player:objectName())
and (move.from_places:contains(sgs.Player_PlaceHand) or move.from_places:contains(sgs.Player_PlaceEquip))
and (bit32.band(move.reason.m_reason, sgs.CardMoveReason_S_MASK_BASIC_REASON) == sgs.CardMoveReason_S_REASON_DISCARD)
and (player:getPhase() == sgs.Player_NotActive) then
local can_draw = 0
for _, id in sgs.qlist(move.card_ids) do
if sgs.Sanguosha:getCard(id):isKindOf("BasicCard") then
can_draw = can_draw + 1
end
end
if can_draw > 0 then
if move.reason.m_reason == sgs.CardMoveReason_S_REASON_RULEDISCARD then
local n = 0
for n = 1, can_draw , 1 do
if player:askForSkillInvoke(self:objectName()) then
player:drawCards(1)
else
break
end
end
elseif player:askForSkillInvoke(self:objectName()) then
player:drawCards(1)
end
end
end
return false
end ,
}
--[[
技能名:神戟
相关武将:SP·暴怒战神、2013-3v3·吕布
描述:若你的装备区没有武器牌,当你使用【杀】时,你可以额外选择至多两个目标。
引用:LuaShenji
状态:0405验证通过
]]--
LuaShenji = sgs.CreateTargetModSkill{
name = "LuaShenji" ,
extra_target_func = function(self, from)
if from:hasSkill(self:objectName()) and from:getWeapon() == nil then
return 2
else
return 0
end
end
}
--[[
技能名:神君(锁定技)
相关武将:倚天·陆伯言
描述:游戏开始时,你必须选择自己的性别。回合开始阶段开始时,你必须倒转性别,异性角色对你造成的非雷电属性伤害无效
引用:LuaShenjun
状态:1217验证通过
]]--
LuaShenjun = sgs.CreateTriggerSkill{
name = "LuaShenjun" ,
events = {sgs.GameStart, sgs.EventPhaseStart, sgs.DamageInflicted} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.GameStart then
local gender = room:askForChoice(player, self:objectName(), "male+female")
local is_male = player:isMale()
if gender == "female" then
if is_male then
player:setGender(sgs.General_Female)
end
elseif gender == "male" then
if not is_male then
player:setGender(sgs.General_Male)
end
end
elseif event == sgs.EventPhaseStart then
if player:getPhase() == sgs.Player_Start then
if player:isMale() then
player:setGender(sgs.General_Female)
else
player:setGender(sgs.General_Male)
end
end
elseif event == sgs.DamageInflicted then
local damage = data:toDamage()
if (damage.nature ~= sgs.DamageStruct_Thunder) and damage.from and
(damage.from:isMale() ~= player:isMale()) then
return true
end
end
return false
end
}
--[[
技能名:神力(锁定技)
相关武将:倚天·古之恶来
描述:出牌阶段,你使用【杀】造成的第一次伤害+X,X为当前死战标记数且最大为3
引用:LuaShenli
状态:1217验证通过
]]--
LuaShenli = sgs.CreateTriggerSkill{
name = "LuaShenli" ,
frequency = sgs.Skill_Compulsory ,
events = {sgs.ConfirmDamage} ,
on_trigger = function(self, event, player, data)
local damage = data:toDamage()
if damage.card and damage.card:isKindOf("Slash") and (player:getPhase() == sgs.Player_Play) and (not player:hasFlag("shenli")) then
player:setFlags("shenli")
local x = player:getMark("@struggle")
if x > 0 then
x = math.min(3, x)
damage.damage = damage.damage + x
data:setValue(damage)
end
end
return false
end
}
--[[
技能名:神速
相关武将:风·夏侯渊、1v1·夏侯渊1v1
描述:你可以选择一至两项:
1.跳过你的判定阶段和摸牌阶段。
2.跳过你的出牌阶段并弃置一张装备牌。
你每选择一项,视为对一名其他角色使用一张【杀】(无距离限制)。
引用:LuaShensu、LuaShensuSlash
状态:1217验证通过
]]--
LuaShensuCard = sgs.CreateSkillCard{
name = "LuaShensuCard" ,
filter = function(self, targets, to_select)
local targets_list = sgs.PlayerList()
for _, target in ipairs(targets) do
targets_list:append(target)
end
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
slash:setSkillName("LuaShensu")
slash:deleteLater()
return slash:targetFilter(targets_list, to_select, sgs.Self)
end ,
on_use = function(self, room, source, targets)
local targets_list = sgs.SPlayerList()
for _, target in ipairs(targets) do
if source:canSlash(target, nil, false) then
targets_list:append(target)
end
end
if targets_list:length() > 0 then
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
slash:setSkillName("LuaShensu")
room:useCard(sgs.CardUseStruct(slash, source, targets_list))
end
end
}
LuaShensuVS = sgs.CreateViewAsSkill{
name = "LuaShensu" ,
n = 1 ,
view_filter = function(self, selected, to_select)
if string.endsWith(sgs.Sanguosha:getCurrentCardUsePattern(), "1") then
return false
else
return #selected == 0 and to_select:isKindOf("EquipCard") and not sgs.Self:isJilei(to_select)
end
end ,
view_as = function(self, cards)
if string.endsWith(sgs.Sanguosha:getCurrentCardUsePattern(), "1") then
return #cards == 0 and LuaShensuCard:clone() or nil
else
if #cards ~= 1 then
return nil
end
local card = LuaShensuCard:clone()
for _, cd in ipairs(cards) do
card:addSubcard(cd)
end
return card
end
end ,
enabled_at_play = function()
return false
end ,
enabled_at_response = function(self, player, pattern)
return string.startsWith(pattern, "@@LuaShensu")
end
}
LuaShensu = sgs.CreateTriggerSkill{
name = "LuaShensu" ,
events = {sgs.EventPhaseChanging} ,
view_as_skill = LuaShensuVS ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local change = data:toPhaseChange()
if change.to == sgs.Player_Judge and not player:isSkipped(sgs.Player_Judge)
and not player:isSkipped(sgs.Player_Draw) then
if sgs.Slash_IsAvailable(player) and room:askForUseCard(player, "@@LuaShensu1", "@shensu1", 1) then
player:skip(sgs.Player_Judge)
player:skip(sgs.Player_Draw)
end
elseif sgs.Slash_IsAvailable(player) and change.to == sgs.Player_Play and not player:isSkipped(sgs.Player_Play) then
if player:canDiscard(player, "he") and room:askForUseCard(player, "@@LuaShensu2", "@shensu2", 2, sgs.Card_MethodDiscard) then
player:skip(sgs.Player_Play)
end
end
return false
end
}
LuaShensuSlash = sgs.CreateTargetModSkill{
name = "#LuaShensu-slash" ,
pattern = "Slash" ,
distance_limit_func = function(self, player, card)
if player:hasSkill("LuaShensu") and (card:getSkillName() == "LuaShensu") then
return 1000
else
return 0
end
end
}
--[[
技能名:神威(锁定技)
相关武将:SP·暴怒战神
描述:摸牌阶段,你额外摸两张牌;你的手牌上限+2。
引用:LuaShenwei、LuaShenweiDraw
状态:0405验证通过
]]--
LuaShenweiDraw = sgs.CreateDrawCardsSkill{
name = "#LuaShenwei-draw" ,
frequency = sgs.Skill_Compulsory ,
draw_num_func = function(self, player, n)
player:getRoom():sendCompulsoryTriggerLog(player, "LuaShenwei")
return n + 2
end
}
LuaShenwei = sgs.CreateMaxCardsSkill{
name = "LuaShenwei" ,
extra_func = function(self, target)
if target:hasSkill(self:objectName()) then
return 2
else
return 0
end
end
}
--[[
技能名:神智
相关武将:国战·甘夫人
描述:准备阶段开始时,你可以弃置所有手牌。若你以此法弃置的牌不少于X张,你回复1点体力。(X为你当前的体力值)
引用:LuaShenzhi
状态:1217验证通过
]]--
LuaShenzhi = sgs.CreateTriggerSkill{
name = "LuaShenzhi" ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if (player:getPhase() ~= sgs.Player_Start) or (player:isKongcheng()) then return false end
if room:askForSkillInvoke(player, self:objectName()) then
for _, card in sgs.qlist(player:getHandcards()) do
if player:isJilei(card) then return false end
end
local handcard_num = player:getHandcardNum()
player:throwAllHandCards()
if handcard_num >= player:getHp() then
local recover = sgs.RecoverStruct()
recover.who = player
room:recover(player, recover)
end
end
return false
end
}
--[[
技能名:生息
相关武将:阵·蒋琬&费祎
描述:每当你的出牌阶段结束时,若你于此阶段未造成伤害,你可以摸两张牌。
引用:LuaShengxi
状态:0405验证通过
]]--
LuaShengxi = sgs.CreateTriggerSkill{
name = "LuaShengxi",
frequency = sgs.Skill_Frequent,
events = {sgs.PreDamageDone,sgs.EventPhaseEnd},
global = true,
on_trigger = function(self, event, player, data)
if event == sgs.EventPhaseEnd then
local can_trigger = true
if player:hasFlag("ShengxiDamageInPlayPhase") then
can_trigger = false
player:setFlags("-ShengxiDamageInPlayPhase")
end
if player and player:isAlive() and player:hasSkill(self:objectName()) and player:getPhase() == sgs.Player_Play and can_trigger and player:askForSkillInvoke(self:objectName()) then
player:drawCards(2)
end
elseif event == sgs.PreDamageDone then
local damage = data:toDamage()
if damage.from and damage.from:getPhase() == sgs.Player_Play and not damage.from:hasFlag("ShengxiDamageInPlayPhase") then
damage.from:setFlags("ShengxiDamageInPlayPhase")
end
end
return false
end
}
--[[
技能名:师恩
相关武将:智·司马徽
描述:其他角色使用非延时锦囊时,可以让你摸一张牌
引用:LuaShien
状态:1217验证通过
注:智水镜的三个技能均有联系,为了方便起见统一使用本LUA版本的技能,并非原版
]]--
LuaShien = sgs.CreateTriggerSkill{
name = "LuaShien" ,
events = {sgs.CardUsed} ,
on_trigger = function(self, event, player, data)
if not player then return false end
if (player:getMark("forbid_LuaShien") > 0) or (player:hasFlag("forbid_LuaShien")) then return false end
local card = data:toCardUse().card
if card and card:isNDTrick() then
local room = player:getRoom()
local shuijing = room:findPlayerBySkillName(self:objectName())
if not shuijing then return false end
local _data = sgs.QVariant()
_data:setValue(shuijing)
if room:askForSkillInvoke(player, self:objectName(), _data) then
shuijing:drawCards(1)
else
local choice = room:askForChoice(player, "forbid_LuaShien", "yes+no+maybe")
if choice == "yes" then
room:setPlayerMark(player, "forbid_LuaShien", 1)
elseif choice == "maybe" then
room:setPlayerFlag(player, "forbid_LuaShien")
end
end
end
return false
end ,
can_trigger = function(self, target)
return target and (not target:hasSkill(self:objectName()))
end
}
--[[
技能名:识破
相关武将:智·田丰
描述:任意角色判定阶段判定前,你可以弃置两张牌,获得该角色判定区里的所有牌
引用:LuaShipo
状态:1217验证通过
]]--
LuaShipo = sgs.CreateTriggerSkill{
name = "LuaShipo" ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
if (player:getPhase() ~= sgs.Player_Judge) or (player:getJudgingArea():length() == 0) then return false end
local room = player:getRoom()
local tians = room:findPlayersBySkillName(self:objectName())
for _, tianfeng in sgs.qlist(tians) do
if tianfeng:getCardCount(true) >= 2 then
local _data = sgs.QVariant()
_data:setValue(player)
if room:askForSkillInvoke(tianfeng, self:objectName(), _data) then
if room:askForDiscard(tianfeng, self:objectName(), 2, 2, false, true) then
local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
dummy:addSubcards(player:getJudgingArea())
tianfeng:obtainCard(dummy)
break
end
end
end
end
return false
end ,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:恃才(锁定技)
相关武将:智·许攸
描述:当你拼点成功时,摸一张牌
引用:LuaShicai
状态:1217验证通过
]]--
LuaShicai = sgs.CreateTriggerSkill{
name = "LuaShicai" ,
events = {sgs.Pindian} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local xuyou = room:findPlayerBySkillName(self:objectName())
if not xuyou then return false end
local pindian = data:toPindian()
if (pindian.from:objectName() ~= xuyou:objectName()) and (pindian.to:objectName() ~= xuyou:objectName()) then return false end
local winner = nil
if pindian.from_number > pindian.to_number then
winner = pindian.from
else
winner = pindian.to
end
if winner:objectName() == xuyou:objectName() then
xuyou:drawCards(1)
end
return false
end ,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:恃勇(锁定技)
相关武将:二将成名·华雄
描述:每当你受到一次红色的【杀】或因【酒】生效而伤害+1的【杀】造成的伤害后,你减1点体力上限。
引用:LuaShiyong
状态:1217验证通过
]]--
LuaShiyong = sgs.CreateTriggerSkill{
name = "LuaShiyong" ,
events = {sgs.Damaged} ,
frequency = sgs.Skill_Compulsory ,
on_trigger = function(self, event, player, data)
local damage = data:toDamage()
if damage.card and damage.card:isKindOf("Slash")
and (damage.card:isRed() or damage.card:hasFlag("drank")) then
player:getRoom():loseMaxHp(player)
end
return false
end
}
--[[
技能名:誓仇(主公技、限定技)
相关武将:☆SP·刘备
描述:准备阶段开始时,你可以交给一名其他蜀势力角色两张牌。每当你受到伤害时,你将此伤害转移给该角色,然后该角色摸X张牌,直到其第一次进入濒死状态时。(X为伤害点数)
引用:LuaShichou
状态:1217验证通过
]]--
LuaShichou = sgs.CreateTriggerSkill{
name = "LuaShichou$",
frequency = sgs.Skill_Limited,
limit_mark = "@hate";
events = {sgs.EventPhaseStart, sgs.DamageInflicted, sgs.Dying, sgs.DamageComplete},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.EventPhaseStart then
if player:hasLordSkill(self:objectName()) then
if player:getPhase() == sgs.Player_Start then
if player:getMark("shichouInvoke") == 0 then
if player:getCards("he"):length() > 1 then
local targets = room:getOtherPlayers(player)
local victims = sgs.SPlayerList()
for _,target in sgs.qlist(targets) do
if target:getKingdom() == "shu" then
victims:append(target)
end
end
if victims:length() > 0 then
if player:askForSkillInvoke(self:objectName()) then
player:loseMark("@hate", 1)
room:setPlayerMark(player, "shichouInvoke", 1)
local victim = room:askForPlayerChosen(player, victims, self:objectName())
room:setPlayerMark(victim, "@chou", 1)
local tagvalue = sgs.QVariant()
tagvalue:setValue(victim)
room:setTag("ShichouTarget", tagvalue)
local card = room:askForExchange(player, self:objectName(), 2, true, "ShichouGive")
room:obtainCard(victim, card, false)
end
end
end
end
end
end
elseif event == sgs.DamageInflicted then
if player:hasLordSkill(self:objectName(), true) then
local tag = room:getTag("ShichouTarget")
if tag then
local target = tag:toPlayer()
if target then
room:setPlayerFlag(target, "Shichou")
if player:objectName() ~= target:objectName() then
local damage = data:toDamage()
damage.to = target
damage.transfer = true
room:damage(damage)
return true
end
end
end
end
elseif event == sgs.DamageComplete then
if player:hasFlag("Shichou") then
local damage = data:toDamage()
local count = damage.damage
player:drawCards(count)
room:setPlayerFlag(player, "-Shichou")
end
elseif event == sgs.Dying then
if player:getMark("@chou") > 0 then
player:loseMark("@chou")
local list = room:getAlivePlayers()
for _,lord in sgs.qlist(list) do
if lord:hasLordSkill(self:objectName(), true) then
local tag = room:getTag("ShichouTarget")
local target = tag:toPlayer()
if target:objectName() == player:objectName() then
room:removeTag("ShichouTarget")
end
end
end
end
end
return false
end,
can_trigger = function(self, target)
return target
end
}
--[[
技能名:慎拒(锁定技)
相关武将:1v1·吕蒙
描述:你的手牌上限+X。(X为弃牌阶段开始时其他角色最大的体力值)
引用:LuaShenju LuaShenjuMark
状态:1217验证通过
]]--
LuaShenju = sgs.CreateMaxCardsSkill{
name = "Luashenju",
extra_func = function(self, target)
if target:hasSkill(self:objectName()) then
return target:getMark("shenju")
else
return 0
end
end
}
LuaShenjuMark = sgs.CreateTriggerSkill{
name = "#LuaShenjuMark",
events = {sgs.EventPhaseStart},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if player:getPhase() == sgs.Player_Discard then
local max_hp = -1000
for _, p in sgs.qlist(room:getOtherPlayers(player)) do
local hp = p:getHp()
if hp > max_hp then
max_hp = hp
end
end
player:setMark("shenju", math.max(max_hp, 0))
end
return false
end,
}
--[[
技能名:守成
相关武将:阵·蒋琬费祎
描述:每当一名角色于其回合外失去最后的手牌后,你可以令该角色选择是否摸一张牌。
引用:LuaShoucheng
状态:1217验证通过
]]--
LuaShoucheng = sgs.CreateTriggerSkill{
name = "LuaShoucheng",
frequency = sgs.Skill_NotFrequency, --Frequent, NotFrequent, Compulsory, Limited, Wake
events = {sgs.CardsMoveOneTime},
on_trigger = function(self, event, player, data)
local move = data:toMoveOneTime()
local room = player:getRoom()
if (move.from and move.from:isAlive() and move.from:getPhase() == sgs.Player_NotActive
and move.from_places:contains(sgs.Player_PlaceHand) and move.is_last_handcard) then
local target = nil
for _,p in sgs.qlist(room:getAlivePlayers())do
if p:objectName() == move.from:objectName() then
target = p
end
end
local ai_data = sgs.QVariant()
ai_data:setValue(target)
if (room:askForSkillInvoke(player, self:objectName(), ai_data)) then
target:drawCards(1)
end
end
return false
end,
}
--[[
技能名:授业
相关武将:智·司马徽
描述:出牌阶段,你可以弃置一张红色手牌,指定最多两名其他角色各摸一张牌
引用:LuaShouye
状态:1217验证通过
注:智水镜的三个技能均有联系,为了方便起见统一使用本LUA版本的技能,并非原版
]]--
LuaShouyeCard = sgs.CreateSkillCard{
name = "LuaShouyeCard" ,
filter = function(self, targets, to_select)
if #targets >= 2 then return false end
if to_select:objectName() == sgs.Self:objectName() then return false end
return true
end ,
on_effect = function(self, effect)
effect.to:drawCards(1)
if effect.from:getMark("LuaJiehuo") == 0 then
effect.from:gainMark("@shouye")
end
end
}
LuaShouye = sgs.CreateViewAsSkill{
name = "LuaShouye" ,
n = 1 ,
view_filter = function(self, selected, to_select)
return (#selected == 0) and (not to_select:isEquipped()) and (to_select:isRed())
end ,
view_as = function(self, cards)
if #cards ~= 1 then return nil end
local card = LuaShouyeCard:clone()
card:addSubcard(cards[1])
return card
end ,
enabled_at_play = function(self, player)
return (player:getMark("LuaJiehuo") == 0) or (not player:hasUsed("#LuaShouyeCard"))
end
}
--[[
技能名:淑德
相关武将:贴纸·王元姬