-
Notifications
You must be signed in to change notification settings - Fork 59
/
ChapterZ.lua
1887 lines (1878 loc) · 62.3 KB
/
ChapterZ.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
--[[
代码速查手册(Z区)
技能索引:
灾变、再起、凿险、早夭、战神、昭烈、昭心、贞烈、贞烈、鸩毒、镇威、镇卫、争锋、争功、争功、征服、整军、直谏、直言、志继、制霸、制霸、制衡、智迟、智愚、忠义、咒缚、筑楼、追忆、惴恐、资粮、自立、自守、宗室、纵火、纵适、诈降、纵玄、醉乡
]]--
--[[
技能名:灾变(锁定技)
相关武将:僵尸·僵尸
描述:你的出牌阶段开始时,若人类玩家数-僵尸玩家数+1大于0,你多摸该数目的牌。
引用:LuaZaibian
状态:1217验证通过
]]--
isZombie = function(player) --这里是以副将来判断是否僵尸,与源码以身份来判断不同
if player:getGeneral2Name() == "zombie" then
return true
end
end
LuaZaibian = sgs.CreateTriggerSkill{
name = "LuaZaibian",
events = {sgs.EventPhaseStart},
frequency = sgs.Skill_Compulsory,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if player:getPhase() == sgs.Player_Play then
local ZombieNo = 0
local HumanNo = 0
for _,p in sgs.qlist(room:getAlivePlayers()) do
if isZombie(p) then
ZombieNo = ZombieNo +1
else
HumanNo = HumanNo +1
end
end
local x = HumanNo-ZombieNo+1
if x> 0 then
player:drawCards(x)
end
end
end
}
--[[
技能名:再起
相关武将:林·孟获
描述:摸牌阶段开始时,若你已受伤,你可以放弃摸牌,改为从牌堆顶亮出X张牌(X为你已损失的体力值),你回复等同于其中红桃牌数量的体力,然后将这些红桃牌置入弃牌堆,并获得其余的牌。
引用:LuaZaiqi
状态:1217验证通过
]]--
LuaZaiqi = sgs.CreateTriggerSkill{
name = "LuaZaiqi",
frequency = sgs.Skill_NotFrequent,
events = {sgs.EventPhaseStart},
on_trigger = function(self, event, player, data)
if player:getPhase() == sgs.Player_Draw then
if player:isWounded() then
local room = player:getRoom()
if room:askForSkillInvoke(player, self:objectName()) then
local x = player:getLostHp()
local has_heart = false
local ids = room:getNCards(x, 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 card_to_throw = {}
local card_to_gotback = {}
for i=0, x-1, 1 do
local id = ids:at(i)
local card = sgs.Sanguosha:getCard(id)
local suit = card:getSuit()
if suit == sgs.Card_Heart then
table.insert(card_to_throw, id)
else
table.insert(card_to_gotback, id)
end
end
if #card_to_throw > 0 then
local dummy = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
for _, id in ipairs(card_to_throw) do
dummy:addSubcard(id)
end
local recover = sgs.RecoverStruct()
recover.card = nil
recover.who = player
recover.recover = #card_to_throw
room:recover(player, recover)
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_NATURAL_ENTER, player:objectName(), self:objectName(), nil)
room:throwCard(dummy, reason, nil)
has_heart = true
end
if #card_to_gotback > 0 then
local dummy2 = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
for _, id in ipairs(card_to_gotback) do
dummy2:addSubcard(id)
end
room:obtainCard(player, dummy2)
end
return true
end
end
end
return false
end
}
--[[
技能名:凿险(觉醒技)
相关武将:山·邓艾
描述:回合开始阶段开始时,若“田”的数量达到3或更多,你须减1点体力上限,并获得技能“急袭”。
引用:LuaZaoxian
状态:1217验证通过
]]--
LuaZaoxian = sgs.CreateTriggerSkill{
name = "LuaZaoxian" ,
frequency = sgs.Skill_Wake ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
room:addPlayerMark(player, "LuaZaoxian")
if room:changeMaxHpForAwakenSkill(player) then
room:acquireSkill(player, "jixi")
end
end ,
can_trigger = function(self, target)
return (target and target:isAlive() and target:hasSkill(self:objectName()))
and (target:getPhase() == sgs.Player_Start)
and (target:getMark("LuaZaoxian") == 0)
and (target:getPile("field"):length() >= 3)
end
}
--[[
技能名:早夭(锁定技)
相关武将:倚天·曹冲
描述:回合结束阶段开始时,若你的手牌大于13张,则你必须弃置所有手牌并流失1点体力
引用:LuaZaoyao
状态:1217验证通过
]]--
LuaZaoyao = sgs.CreateTriggerSkill{
name = "LuaZaoyao" ,
frequency = sgs.Skill_Compulsory ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
if (player:getPhase() == sgs.Player_Finish) and (player:getHandcardNum() > 13) then
player:throwAllHandCards()
player:getRoom():loseHp(player)
end
return false
end
}
--[[
技能名:战神(觉醒技)
相关武将:2013-3v3·吕布
描述:准备阶段开始时,若你已受伤且有己方角色已死亡,你减1点体力上限,弃置装备区的武器牌,然后获得技能“马术”和“神戟”。
引用:LuaZhanshen
状态:1217验证通过
]]--
LuaZhanshen = sgs.CreateTriggerSkill{
name = "LuaZhanshen",
events = {sgs.Death, sgs.EventPhaseStart},
frequency = sgs.Skill_Wake,
can_trigger = function(self, target)
return target ~= nil
end,
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 lvbu = room:findPlayerBySkillName(self:objectName())
if string.sub(room:getMode(), 1, 3) == "06_" then
if lvbu:getMark(self:objectName()) == 0 and lvbu:getMark("zhanshen_fight") == 0
and string.sub(lvbu:getRole(), 1, 1) == string.sub(player:getRole(), 1, 1) then
lvbu:addMark("zhanshen_fight")
end
else
if lvbu:getMark(self:objectName()) == 0 and lvbu:getMark("@fight") == 0 --身份局
and room:askForSkillInvoke(player, self:objectName(), sgs.QVariant("mark:"..lvbu:objectName())) then
room:addPlayerMark(lvbu, "@fight")
end
end
else
if player:getPhase() == sgs.Player_Start and player:getMark(self:objectName()) == 0 and player:isWounded()
and (player:getMark("zhanshen_fight") > 0 or player:getMark("@fight") > 0) and player:hasSkill(self:objectName()) then
if player:getMark("@fight") > 0 then
room:setPlayerMark(player, "@fight", 0)
end
player:setMark("zhanshen_fight", 0)
room:addPlayerMark(player, self:objectName())
if room:changeMaxHpForAwakenSkill(player) then
if player:getWeapon() then
room:throwCard(player:getWeapon(), player)
end
room:handleAcquireDetachSkills(player, "mashu|shenji")
end
end
end
return false
end,
}
--[[
技能名:昭烈
相关武将:☆SP·刘备
描述:摸牌阶段摸牌时,你可以少摸一张牌,指定你攻击范围内的一名其他角色亮出牌堆顶上3张牌,将其中全部的非基本牌和【桃】置于弃牌堆,该角色进行二选一:你对其造成X点伤害,然后他获得这些基本牌;或他依次弃置X张牌,然后你获得这些基本牌。(X为其中非基本牌的数量)。
引用:LuaZhaolie、LuaZhaolieAct
状态:1217验证通过
]]--
LuaZhaolie = sgs.CreateTriggerSkill{
name = "LuaZhaolie",
frequency = sgs.Skill_NotFrequent,
events = {sgs.DrawNCards},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local targets = room:getOtherPlayers(player)
local victims = sgs.SPlayerList()
for _,p in sgs.qlist(targets) do
if player:inMyAttackRange(p) then
victims:append(p)
end
end
if victims:length() > 0 then
if room:askForSkillInvoke(player, self:objectName()) then
room:setPlayerFlag(player, "Invoked")
local count = data:toInt() - 1
data:setValue(count)
end
end
end
}
LuaZhaolieAct = sgs.CreateTriggerSkill{
name = "#LuaZhaolie",
frequency = sgs.Skill_Frequent,
events = {sgs.AfterDrawNCards},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local no_basic = 0
local cards = {}
local targets = room:getOtherPlayers(player)
local victims = sgs.SPlayerList()
for _,p in sgs.qlist(targets) do
if player:inMyAttackRange(p) then
victims:append(p)
end
end
if player:getPhase() == sgs.Player_Draw then
if player:hasFlag("Invoked") then
room:setPlayerFlag(player, "-Invoked")
local victim = room:askForPlayerChosen(player, victims, "LuaZhaolie")
local cardIds = sgs.IntList()
for i=1, 3, 1 do
local id = room:drawCard()
cardIds:append(id)
end
assert(cardIds:length() == 3)
local move = sgs.CardsMoveStruct()
move.card_ids = cardIds
move.to_place = sgs.Player_PlaceTable
move.reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_TURNOVER, player:objectName(), "", "LuaZhaolie", "")
room:moveCards(move, true)
room:getThread():delay()
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_NATURAL_ENTER, "", "LuaZhaolie", "")
for i=0, 2, 1 do
local card_id = cardIds:at(i)
local card = sgs.Sanguosha:getCard(card_id)
if not card:isKindOf("BasicCard") or card:isKindOf("Peach") then
if not card:isKindOf("BasicCard") then
no_basic = no_basic + 1
end
room:throwCard(card, reason, nil)
else
table.insert(cards, card)
end
end
local choicelist = "damage"
local flag = false
local victim_cards = victim:getCards("he")
if victim_cards:length() >= no_basic then
choicelist = "damage+throw"
flag = true
end
local choice
if flag then
local data = sgs.QVariant(no_basic)
choice = room:askForChoice(victim, "LuaZhaolie", choicelist, data)
else
choice = "damage"
end
if choice == "damage" then
if no_basic > 0 then
local damage = sgs.DamageStruct()
damage.card = nil
damage.from = player
damage.to = victim
damage.damage = no_basic
room:damage(damage)
end
if #cards > 0 then
local reasonA = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GOTBACK, victim:objectName())
local reasonB = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_NATURAL_ENTER, victim:objectName(), "LuaZhaolie", "")
for _,c in pairs(cards) do
if victim:isAlive() then
room:obtainCard(victim, c, true)
else
room:throwCard(c, reasonB, nil)
end
end
end
else
if no_basic > 0 then
while no_basic > 0 do
room:askForDiscard(victim, "LuaZhaolie", 1, 1, false, true)
no_basic = no_basic - 1
end
end
if #cards > 0 then
reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GOTBACK, player:objectName())
for _,c in pairs(cards) do
room:obtainCard(player, c)
end
end
end
end
end
return false
end
}
--[[
技能名:昭心
相关武将:贴纸·司马昭
描述:摸牌阶段结束时,你可以展示所有手牌,若如此做,视为你使用一张【杀】,每阶段限一次。
引用:LuaZhaoxin
状态:1217验证通过
]]--
LuaZhaoxinCard = sgs.CreateSkillCard{
name = "LuaZhaoxinCard" ,
filter = function(self, targets, to_select)
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
local tarlist = sgs.PlayerList()
for i = 1, #targets, 1 do
tarlist:append(targets[i])
end
return slash:targetFilter(tarlist, to_select, sgs.Self)
end ,
on_use = function(self, room, source, targets)
room:showAllCards(source)
local slash = sgs.Sanguosha:cloneCard("slash", sgs.Card_NoSuit, 0)
slash:setSkillName("_LuaZhaoxin")
local tarlist = sgs.SPlayerList()
for i = 1, #targets, 1 do
tarlist:append(targets[i])
end
room:useCard(sgs.CardUseStruct(slash, source, tarlist))
end
}
LuaZhaoxinVS = sgs.CreateViewAsSkill{
name = "LuaZhaoxin" ,
n = 0 ,
view_as = function()
return LuaZhaoxinCard:clone()
end ,
enabled_at_play = function()
return false
end ,
enabled_at_response = function(self, player, pattern)
return (pattern == "@@LuaZhaoxin") and sgs.Slash_IsAvailable(player)
end ,
}
LuaZhaoxin = sgs.CreateTriggerSkill{
name = "LuaZhaoxin" ,
events = {sgs.EventPhaseEnd} ,
view_as_skill = LuaZhaoxinVS ,
on_trigger = function(self, event, player, data)
if player:getPhase() ~= sgs.Player_Draw then return false end
if player:isKongcheng() or (not sgs.Slash_IsAvailable(player)) then return false end
local targets = sgs.SPlayerList()
for _, p in sgs.qlist(player:getRoom():getAllPlayers()) do
if player:canSlash(p) then
targets:append(p)
end
end
if targets:isEmpty() then return false end
player:getRoom():askForUseCard(player, "@@LuaZhaoxin", "@zhaoxin")
return false
end
}
--[[
技能名:贞烈
相关武将:一将成名2012·王异
描述: 每当你成为一名其他角色使用的【杀】或非延时类锦囊牌的目标后,你可以失去1点体力,令此牌对你无效,然后你弃置其一张牌。
引用:LuaZhenlie
状态:0405验证通过
]]--
LuaZhenlie = sgs.CreateTriggerSkill{
name = "LuaZhenlie" ,
events = {sgs.TargetConfirmed} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.TargetConfirmed then
local use = data:toCardUse()
if use.to:contains(player) and use.from:objectName() ~= player:objectName() then
if use.card:isKindOf("Slash") or use.card:isNDTrick() then
if room:askForSkillInvoke(player, self:objectName(), data) then
player:setFlags("-ZhenlieTarget")
player:setFlags("ZhenlieTarget")
room:loseHp(player)
if player:isAlive() and player:hasFlag("ZhenlieTarget") then
player:setFlags("-ZhenlieTarget")
local nullified_list = use.nullified_list
table.insert(nullified_list, player:objectName())
use.nullified_list = nullified_list
data:setValue(use)
if player:canDiscard(use.from, "he") then
local id = room:askForCardChosen(player, use.from, "he", self:objectName(), false, sgs.Card_MethodDiscard)
room:throwCard(id, use.from, player)
end
end
end
end
end
end
return false
end
}
--[[
技能名:贞烈·旧
相关武将:怀旧-一将2·王异-旧
描述:在你的判定牌生效前,你可以从牌堆顶亮出一张牌代替之。
引用:LuaNosZhenlie
状态:1217验证通过
]]--
LuaNosZhenlie = sgs.CreateTriggerSkill{
name = "LuaNosZhenlie" ,
events = {sgs.AskForRetrial} ,
on_trigger = function(self, event, player, data)
local judge = data:toJudge()
if judge.who:objectName() ~= player:objectName() then return false end
if player:askForSkillInvoke(self:objectName(), data) then
local room = player:getRoom()
local card_id = room:drawCard()
room:getThread():delay()
local card = sgs.Sanguosha:getCard(card_id)
room:retrial(card, player, judge, self:objectName())
end
return false
end
}
--[[
技能名:鸩毒
相关武将:阵·何太后
描述:每当一名其他角色的出牌阶段开始时,你可以弃置一张手牌:若如此做,视为该角色使用一张【酒】(计入限制),然后你对该角色造成1点伤害。
引用:LuaZhendu
状态:1217验证通过
]]--
LuaZhendu = sgs.CreateTriggerSkill {
name = "LuaZhendu",
events = {sgs.EventPhaseStart},
can_trigger = function(self, target)
return target ~= nil
end,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if player:getPhase() ~= sgs.Player_Play then
return false
end
local hetaihou = room:findPlayerBySkillName(self:objectName())
if not hetaihou or not hetaihou:isAlive() or not hetaihou:canDiscard(hetaihou, "h")
or hetaihou:getPhase() == sgs.Player_Play then
return false
end
if room:askForCard(hetaihou, ".", "@zhendu-discard", sgs.QVariant(), self:objectName()) then
local analeptic = sgs.Sanguosha:cloneCard("analeptic", sgs.Card_NoSuit, 0)
analeptic:setSkillName(self:objectName())
room:useCard(sgs.CardUseStruct(analeptic, player, sgs.SPlayerList(), true))
if player:isAlive() then
room:damage(sgs.DamageStruct(self:objectName(), hetaihou, player))
end
end
return false
end
}
--[[
技能名:镇威
相关武将:倚天·倚天剑
描述:你的【杀】被手牌中的【闪】抵消时,可立即获得该【闪】。
引用:LuaYTZhenwei
状态:1217验证通过
]]--
LuaYTZhenwei = sgs.CreateTriggerSkill{
name = "LuaYTZhenwei" ,
events = {sgs.SlashMissed} ,
on_trigger = function(self, event, player, data)
local effect = data:toSlashEffect()
if effect.jink and (player:getRoom():getCardPlace(effect.jink:getEffectiveId()) == sgs.Player_DiscardPile) then
if player:askForSkillInvoke(self:objectName(), data) then
player:obtainCard(effect.jink)
end
end
return false
end
}
--[[
技能名:镇卫(锁定技)
相关武将:2013-3v3·文聘
描述:对方角色与其他己方角色的距离+1。
身份局:回合结束後,你可以令至多X名其他角色获得“守”(X为其他存活角色数的一半(向下取整)),则其他角色计算与目标角色的距离时,始终+1,直到你的下回合开始。
引用:LuaZhenweiDistance、LuaZhenwei
状态:1217验证成功
]]--
LuaZhenweiDistance = sgs.CreateDistanceSkill{
name = "#LuaZhenwei",
correct_func = function(self, from, to)
if to:hasSkill("LuaZhenwei") then return 0
else
local hasWenpin = false
for _,p in sgs.qlist(to:getAliveSiblings()) do
if p:hasSkill("LuaZhenwei") then
hasWenpin = true
break
end
end
if not hasWenpin then return 0 end
end
if sgs.GetConfig("GameMode", "06_3v3") == "06_3v3" then --3v3
if string.sub(from:getRole(), 1, 1) ~= string.sub(to:getRole(), 1, 1) then
for _,p in sgs.qlist(to:getAliveSiblings()) do
if p:hasSkill(self:objectName()) and string.sub(p:getRole(), 1, 1) == string.sub(to:getRole(), 1, 1) then
return 1
end
end
end
else --身份局
if to:getMark("@defense") > 0 and from:getMark("@defense") == 0 and not from:hasSkill("LuaZhenwei") then
return 1
end
end
return 0
end
}
LuaZhenweiCard = sgs.CreateSkillCard{
name = "LuaZhenwei",
filter = function(self, targets, to_select, player)
local total = player:getSiblings():length()+1
return #targets < total / 2 - 1 and to_select ~= player
end,
on_effect = function(self, effect)
effect.to:gainMark("@defense")
end,
}
LuaZhenweiViewAsSkill = sgs.CreateZeroCardViewAsSkill{
name = "LuaZhenwei",
response_pattern = "@@zhenwei",
view_as = function(self)
return LuaZhenweiCard:clone()
end,
}
LuaZhenwei = sgs.CreateTriggerSkill{
name = "LuaZhenwei",
events = {sgs.EventPhaseChanging, sgs.Death, sgs.EventLoseSkill},
view_as_skill = LuaZhenweiViewAsSkill,
frequency = sgs.Skill_Compulsory,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if string.sub(room:getMode(),1,3) == "06_" then return false end
if event == sgs.EventLoseSkill then
if data:toString() ~= self:objectName() then
return false
end
elseif event == sgs.Death then
local death = data:toDeath()
if death.who:objectName() ~= player:objectName() or not player:hasSkill(self:objectName()) then
return false
end
elseif event == sgs.EventPhaseChanging then
local change = data:toPhaseChange()
if change.to ~= sgs.Player_NotActive then
return false
end
end
for _,p in sgs.qlist(room:getOtherPlayers(player)) do
room:setPlayerMark(p, "@defense", 0)
end
if event == sgs.EventPhaseChanging and sgs.Sanguosha:getPlayerCount(room:getMode()) > 3 then
room:askForUseCard(player, "@@zhenwei", "@zhenwei")
return false
end
end,
}
--[[
技能名:争锋(锁定技)
相关武将:倚天·倚天剑
描述:当你的装备区没有武器时,你的攻击范围为X,X为你当前体力值。
]]--
--[[
技能名:争功
相关武将:倚天·邓士载
描述:其他角色的回合开始前,若你的武将牌正面向上,你可以将你的武将牌翻面并立即进入你的回合,你的回合结束后,进入该角色的回合
引用:LuaXZhenggong
状态:1217验证通过
]]--
LuaXZhenggong = sgs.CreateTriggerSkill{
name = "LuaXZhenggong",
frequency = sgs.Skill_NotFrequent,
events = {sgs.TurnStart},
on_trigger = function(self, event, player, data)
if player then
local room = player:getRoom()
local dengshizai = room:findPlayerBySkillName(self:objectName())
if dengshizai and dengshizai:faceUp() then
if dengshizai:askForSkillInvoke(self:objectName()) then
dengshizai:turnOver()
local tag = room:getTag("Zhenggong")
if tag then
local zhenggong = tag:toPlayer()
if not zhenggong then
tag:setValue(player)
room:setTag("Zhenggong", tag)
player:gainMark("@zhenggong")
end
end
room:setCurrent(dengshizai)
dengshizai:play()
return true
end
end
local tag = room:getTag("Zhenggong")
if tag then
local p = tag:toPlayer()
if p and not player:hasFlag("isExtraTurn") then
p:loseMark("@zhenggong")
room:setCurrent(p)
room:setTag("Zhenggong", sgs.QVariant())
end
end
end
return false
end,
can_trigger = function(self, target)
if target then
return not target:hasSkill(self:objectName())
end
return false
end
}
--[[
技能名:争功(0610版)
相关武将:倚天·邓士载
描述:其他角色的回合开始前,若你的武将牌正面朝上,你可以进行一个额外的回合,然后将武将牌翻面。
引用:LuaZhenggong610
状态:1217验证通过
]]--
LuaZhenggong610 = sgs.CreateTriggerSkill{
name = "LuaZhenggong610" ,
events = {sgs.TurnStart} ,
on_trigger = function(self, event, player, data)
if not player then return false end
local room = player:getRoom()
local dengshizai = room:findPlayerBySkillName(self:objectName())
if dengshizai and dengshizai:faceUp() then
if dengshizai:askForSkillInvoke(self:objectName()) then
dengshizai:gainAnExtraTurn()
dengshizai:turnOver()
end
end
return false
end ,
can_trigger = function(self, target)
return target and not target:hasSkill(self:objectName())
end
}
--[[
技能名:征服
相关武将:E.SP 凯撒
描述:当你使用【杀】指定一个目标后,你可以选择一种牌的类别,令其选择一项:1.将一张此类别的牌交给你,若如此做,此次对其结算的此【杀】对其无效;2.不能使用【闪】响应此【杀】。
引用:LuaConqueror
状态:0425验证通过
]]--
LuaConqueror = sgs.CreateTriggerSkill{
name = "LuaConqueror" ,
events = {sgs.TargetConfirmed} ,
on_trigger = function(self, event, player, data)
local use = data:toCardUse()
if (use.card and use.card:isKindOf("Slash")) then
local n = 0
for _, target in sgs.qlist(use.to) do
local _target = sgs.QVariant()
_target:setValue(target)
if (player:askForSkillInvoke(self, _target)) then
local room = player:getRoom()
local choice = room:askForChoice(player, self:objectName(), "BasicCard+EquipCard+TrickCard", _target)
local c = room:askForCard(target, choice, "@conqueror-exchange:" .. player:objectName() .. "::" .. choice, sgs.QVariant(choice), sgs.Card_MethodNone)
if c then
local reason = sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_GIVE, target:objectName(), player:objectName(), self:objectName(), nil)
room:obtainCard(player, c, reason)
local nullified_list = use.nullified_list
table.insert(nullified_list, target:objectName())
use.nullified_list = nullified_list
data:setValue(use)
else
local jink_list = player:getTag("Jink_" .. use.card:toString()):toIntList()
jink_list:replace(n, 0)
local _jink_list = sgs.QVariant()
_jink_list:setValue(jink_list)
player:setTag("Jink_" .. use.card:toString(), _jink_list)
end
end
n = n + 1
end
end
return false
end ,
}
--[[
技能名:直谏
相关武将:山·张昭张纮
描述:出牌阶段,你可以将手牌中的一张装备牌置于一名其他角色装备区内:若如此做,你摸一张牌。
引用:LuaZhijian
状态:0405验证通过
]]--
LuaZhijianCard = sgs.CreateSkillCard{
name = "LuaZhijianCard",
will_throw = false,
handling_method = sgs.Card_MethodNone,
filter = function(self, targets, to_select, erzhang)
if #targets ~= 0 or to_select:objectName() == erzhang:objectName() then return false end
local card = sgs.Sanguosha:getCard(self:getSubcards():first())
local equip = card:getRealCard():toEquipCard()
local equip_index = equip:location()
return to_select:getEquip(equip_index) == nil
end,
on_effect = function(self, effect)
local erzhang = effect.from
erzhang:getRoom():moveCardTo(self, erzhang, effect.to, sgs.Player_PlaceEquip,sgs.CardMoveReason(sgs.CardMoveReason_S_REASON_PUT, erzhang:objectName(), "zhijian", ""))
erzhang:drawCards(1, "zhijian")
end
}
LuaZhijian = sgs.CreateOneCardViewAsSkill{
name = "LuaZhijian",
filter_pattern = "EquipCard|.|.|hand",
view_as = function(self, card)
local zhijian_card = LuaZhijianCard:clone()
zhijian_card:addSubcard(card)
zhijian_card:setSkillName(self:objectName())
return zhijian_card
end
}
--[[
技能名:直言
相关武将:一将成名2013·虞翻
描述:结束阶段开始时,你可以令一名角色摸一张牌并展示之。若此牌为装备牌,该角色回复1点体力,然后使用之。
引用:LuaZhiyan
状态:1217验证通过
]]--
LuaZhiyan = sgs.CreateTriggerSkill{
name = "LuaZhiyan" ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
if player:getPhase() ~= sgs.Player_Finish then return false end
local room = player:getRoom()
local to = room:askForPlayerChosen(player, room:getAlivePlayers(), self:objectName(), "LuaZhiyan-invoke", true, true)
if to then
local ids = room:getNCards(1, false)
local card = sgs.Sanguosha:getCard(ids:first())
room:obtainCard(to, card, false)
if not to:isAlive() then return false end
room:showCard(to, ids:first())
if card:isKindOf("EquipCard") then
if (to:isWounded()) then
local recover = sgs.RecoverStruct()
recover.who = player
room:recover(to, recover)
end
if to:isAlive() and (not to:isCardLimited(card, sgs.Card_MethodUse)) then
room:useCard(sgs.CardUseStruct(card, to, to))
end
end
end
return false
end
}
--[[
技能名:志继(觉醒技)
相关武将:山·姜维
描述:回合开始阶段开始时,若你没有手牌,你须选择一项:回复1点体力,或摸两张牌。然后你减1点体力上限,并获得技能“观星”。
引用:LuaZhiji
状态:1217验证通过
]]--
LuaZhiji = sgs.CreateTriggerSkill{
name = "LuaZhiji" ,
frequency = sgs.Skill_Wake ,
events = {sgs.EventPhaseStart} ,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if player:isWounded() then
if room:askForChoice(player, self:objectName(), "recover+draw") == "recover" then
local recover = sgs.RecoverStruct()
recover.who = player
room:recover(player, recover)
else
room:drawCards(player, 2)
end
else
room:drawCards(player, 2)
end
room:addPlayerMark(player, "LuaZhiji")
if room:changeMaxHpForAwakenSkill(player) then
room:acquireSkill(player, "guanxing")
end
return false
end ,
can_trigger = function(self, target)
return (target and target:isAlive() and target:hasSkill(self:objectName()))
and (target:getMark("LuaZhiji") == 0)
and (target:getPhase() == sgs.Player_Start)
and target:isKongcheng()
end
}
--[[
技能名:制霸(主公技)
相关武将:山·孙策
描述:出牌阶段限一次,其他吴势力角色的出牌阶段可以与你拼点(“魂姿”发动后,你可以拒绝此拼点)。若其没赢,你可以获得两张拼点的牌。
引用:LuaZhiba;LuaZhibaPindian(技能暗将)
状态:1217验证通过
]]--
LuaZhibaCard = sgs.CreateSkillCard{
name = "LuaZhibaCard",
target_fixed = false,
will_throw = false,
filter = function(self, targets, to_select)
if #targets == 0 then
if to_select:hasLordSkill("LuaSunceZhiba") then
if to_select:objectName() ~= sgs.Self:objectName() then
if not to_select:isKongcheng() then
return not to_select:hasFlag("ZhibaInvoked")
end
end
end
end
return false
end,
on_use = function(self, room, source, targets)
local target = targets[1]
room:setPlayerFlag(target, "ZhibaInvoked")
if target:getMark("hunzi") > 0 then
local choice = room:askForChoice(target, "LuaZhibaPindian", "accept+reject")
if choice == "reject" then
return
end
end
source:pindian(target, "LuaZhibaPindian", self)
local sunces = sgs.SPlayerList()
local players = room:getOtherPlayers(source)
for _,p in sgs.qlist(players) do
if p:hasLordSkill("sunce_zhiba") then
if not p:hasFlag("ZhibaInvoked") then
sunces:append(p)
end
end
end
if sunces:length() == 0 then
room:setPlayerFlag(source, "ForbidZhiba")
end
end
}
LuaZhibaPindian = sgs.CreateViewAsSkill{
name = "LuaZhibaPindian",
n = 1,
view_filter = function(self, selected, to_select)
return not to_select:isEquipped()
end,
view_as = function(self, cards)
if #cards == 1 then
local card = LuaZhibaCard:clone()
card:addSubcard(cards[1])
return card
end
end,
enabled_at_play = function(self, player)
if player:getKingdom() == "wu" then
if not player:isKongcheng() then
return not player:hasFlag("ForbidZhiba")
end
end
return false
end
}
LuaZhiba = sgs.CreateTriggerSkill{
name = "LuaZhiba$",
frequency = sgs.Skill_NotFrequent,
events = {sgs.TurnStart, sgs.Pindian, sgs.EventPhaseChanging, sgs.EventAcquireSkill, sgs.EventLoseSkill},
can_trigger = function(self, target)
return target ~= nil
end,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.TurnStart or event == sgs.EventAcquireSkill and data:toString() == self:objectName() then
local lords = sgs.SPlayerList()
for _,p in sgs.qlist(room:getAlivePlayers()) do
if p:hasLordSkill(self:objectName()) then
lords:append(p)
end
end
if lords:isEmpty() then return false end
local players = sgs.SPlayerList()
if lords:length()>1 then player = room:getAlivePlayers()
else players = room:getOtherPlayers(lords:first())
end
for _,p in sgs.qlist(players) do
if not p:hasSkill("LuaZhibaPindian") then
room:attachSkillToPlayer(p, "LuaZhibaPindian")
end
end
elseif event == sgs.EventLoseSkill and data:toString() == "LuaSunceZhiba" then
local lords = sgs.SPlayerList()
for _,p in sgs.qlist(room:getAlivePlayers()) do
if p:hasLordSkill(self:objectName()) then
lords:append(p)
end
end
if lords:length() > 2 then return false end
local players = sgs.SPlayerList()
if lords:isEmpty() then player = room:getAlivePlayers()
else players:append(lords:first())
end
for _,p in sgs.qlist(players) do
if p:hasSkill("LuaZhibaPindian") then
room:detachSkillToPlayer(p, "LuaZhibaPindian", true)
end
end
elseif event == sgs.Pindian then
local pindian = data:toPindian()
if pindian.reason == "LuaZhibaPindian" then
local target = pindian.to
if target:hasLordSkill(self:objectName()) then
if pindian.from_card:getNumber() <= pindian.to_card:getNumber() then
local choice = room:askForChoice(target, "LuaSunceZhiba", "yes+no")
if choice == "yes" then
target:obtainCard(pindian.from_card)
target:obtainCard(pindian.to_card)
end
end
end
end
elseif event == sgs.EventPhaseChanging then
local phase_change = data:toPhaseChange()
if phase_change.from == sgs.Player_Play then
if player:hasFlag("ForbidZhiba") then
room:setPlayerFlag(player, "-ForbidZhiba")
end
local players = room:getOtherPlayers(player)
for _,p in sgs.qlist(players) do
if p:hasFlag("ZhibaInvoked") then
room:setPlayerFlag(p, "-ZhibaInvoked")
end
end
end
end
return false
end,
priority = -1,
}
--[[
技能名:制霸
相关武将:测试·制霸孙权
描述:出牌阶段,你可以弃置任意数量的牌,然后摸取等量的牌。每阶段可用X+1次,X为你已损失的体力值
引用:LuaXZhiBa
状态:1217验证通过
]]--
LuaZhihengCard = sgs.CreateSkillCard{
name = "LuaZhihengCard",
target_fixed = true,
will_throw = false,
on_use = function(self, room, source, targets)
room:throwCard(self, source)
if source:isAlive() then
local count = self:subcardsLength()
room:drawCards(source, count)
end
end
}
LuaXZhiBa = sgs.CreateViewAsSkill{
name = "LuaXZhiba",
n = 999,
view_filter = function(self, selected, to_select)
return true
end,
view_as = function(self, cards)
if #cards > 0 then
local zhiheng_card = LuaZhihengCard:clone()
for _,card in pairs(cards) do
zhiheng_card:addSubcard(card)
end
zhiheng_card:setSkillName(self:objectName())
return zhiheng_card
end
end,
enabled_at_play = function(self, player)