-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathYKStdGeneral.lua
1576 lines (1357 loc) · 41.9 KB
/
YKStdGeneral.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
--SANGUOSHA Standard Version Generals--
--Design: YOKA (2011)
--Code: hypercross ibicdlcod roxiel 【群】皇叔 William915 coldera
--Version:14.10 (After Chibi 14)
--Last Update:Dec 5 2011 20:33 UTC+8
module("extensions.YKStdGeneral", package.seeall)
extension = sgs.Package("YKStdGeneral")
--0101 刘备
luarende_card = sgs.CreateSkillCard
{--仁德技能卡 by roxiel, ibicdlcod修复各种BUG(几乎所有技能皆有参考原CPP代码,不再赘述)
name = "luarende",
target_fixed = true, --其实这里可以不用FIX掉,不过这样也简单 先选牌再选人
will_throw = false, --不扔
once = false,
on_use = function(self, room, source, targets)
source:gainMark("luarendecount", self:subcardsLength())
local t = room:askForPlayerChosen(source, room:getOtherPlayers(source), "luarende")
room:playSkillEffect("luarende",math.random(1, 2))
room:moveCardTo(self, t, sgs.Player_Hand, false)
local x = source:getMark("luarendecount")
if x >= 2 and not source:hasFlag("recovered") then --多于两张且没有回复过的标记,就补血 然后计数清零
local recover = sgs.RecoverStruct() --回复结构体
recover.recover = 1 --回复点数
recover.who = source --回复来源
room:recover(source,recover)
if source:isKongcheng() then
room:setPlayerFlag(source,"-luarende_canuse") --空城就禁用技能
end
return true
end
end,
}
luarendevs = sgs.CreateViewAsSkill
{--仁德视为技 by roxiel
name = "luarendevs",
n = 999,
view_filter = function(self, selected, to_select)
if to_select:isEquipped() then return false end --装备不可以使用
return true
end,
view_as = function(self, cards)
if #cards == 0 then return end
local acard = luarende_card:clone()
for var = 1, #cards, 1 do --将所有选中的牌加入仁德技能牌的Subcards
acard:addSubcard(cards[var])
end
acard:setSkillName(self:objectName())
return acard
end,
enabled_at_play = function()
return sgs.Self:hasFlag("luarende_canuse")
end,
}
luarende = sgs.CreateTriggerSkill
{--仁德 by roxiel
name = "luarende",
view_as_skill = luarendevs,
events = {sgs.PhaseChange},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if player:getPhase() == sgs.Player_Play then
room:setPlayerFlag(player, "luarende_canuse") --回合开始 让VIEWAS可以使用
else if player:getPhase() == sgs.Player_Finish then
room:setPlayerFlag(player, "-luarende_canuse") --回合结束 让VIEWAS禁用
room:setPlayerMark(player, "luarendecount",0) --计数清零
end
end
end,
}
--0102 关羽
luawusheng = sgs.CreateViewAsSkill
{--武圣 by 【群】皇叔
name = "luawusheng",
n = 1,
view_filter = function(self, selected, to_select)
return to_select:isRed()
end,
view_as = function(self, cards)
if #cards == 0 then return nil end
if #cards == 1 then
local card = cards[1]
local acard = sgs.Sanguosha:cloneCard("slash", card:getSuit(), card:getNumber())
acard:addSubcard(card:getId())
acard:setSkillName(self:objectName())
return acard
end
end,
enabled_at_play = function()
return (sgs.Self:canSlashWithoutCrossbow()) or (sgs.Self:getWeapon() and sgs.Self:getWeapon():className() == "Crossbow")
end,
enabled_at_response = function(self, player, pattern)
return pattern == "slash"
end,
}
--0103 张飞
luapaoxiao=sgs.CreateTriggerSkill
{--咆哮 by 佚名
name="luapaoxiao",
events=sgs.PhaseChange,
frequency=sgs.Skill_Compulsory,
priority=0,
on_trigger=function(self,event,player,data)
if player:getPhase()==sgs.Player_Play then
player:clearHistory()--清空记录,是否可用这个函数实现咆哮?
local room=player:getRoom()
local card_use=nil
local b=true
while player:isAlive() do
card_use=nil
card_use=sgs.CardUseStruct()
room:activate(player,card_use)--让玩家自由出牌,对ai同样,记录在card_use里
if card_use:isValid() then
b=not card_use.card:inherits("Slash")
room:useCard(card_use,b)--使用
else
return true--如果第一次未使用则跳过第二次询问
end
end
return true
end
end,
}
--0104 诸葛亮
luaguanxing = sgs.CreateTriggerSkill
{--观星 by 【群】皇叔
name = "luaguanxing",
frequency = sgs.Skill_Frequent,
events = {sgs.PhaseChange},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if (player:getPhase() == sgs.Player_Start) then
if (not room:askForSkillInvoke(player,self:objectName())) then return false end
local x = room:alivePlayerCount()
if x > 5 then
x = 5
end
room:doGuanxing(player,room:getNCards(x),false)
end
end,
--[[
警告:一切没有lua化而有(to:hasSkill("kongcheng")) and (to:isKongcheng())的内核技能都会出现无视lua空城的BUG!
已知的有:
Player::CanSlash player.cpp 593
函数涉及 姜维 挑衅 mountainpackage.cpp 576
大乔 流离 standard-skillcards.cpp 254
刘备 激将 standard-skillcards.cpp 273
贾诩 乱武 thicket.cpp 662
【倚】夏侯涓 连理【杀】 yitian-package.cpp 492
【倚】邓艾 偷渡 yitian-package.cpp 1565
【将】凌统 旋风 yjcm-package.cpp 440
【将】高顺 陷阵 yjcm-package.cpp 533
【将】陈宫 明策 yjcm-package.cpp 650
貂蝉 离间 standard-skillcards.cpp 173
夏侯渊 神速 wind.cpp 243
【智】姜维 异才 wisdompackage.cpp 199
【智】孙策 霸王 wisdompackage.cpp 300
红颜百合 百合离间 hongyanscenario.cpp 60
]]
}
luakongcheng = sgs.CreateProhibitSkill
{--空城 by 【群】皇叔
name = "luakongcheng",
is_prohibited = function(self, from, to, card)
if(to:hasSkill("luakongcheng")) and (to:isKongcheng()) then
return card:inherits("Slash") or card:inherits("Duel")
end
end,
}
--0105 赵云
ldtmp={}
lualongdan = sgs.CreateViewAsSkill
{--龙胆 by 【群】皇叔
name = "lualongdan",
n = 1,
view_filter = function(self, selected, to_select)
return (to_select:inherits("Slash")) or (to_select:inherits("Jink"))
end,
view_as = function(self, cards)
if #cards == 1 then
local card = cards[1]
local ld_card = sgs.Sanguosha:cloneCard(ldtmp[1], cards[1]:getSuit(), cards[1]:getNumber())
ld_card:addSubcard(cards[1])
ld_card:setSkillName(self:objectName())
return ld_card
end
end,
enabled_at_play = function()
ldtmp[1] = "slash"
return(sgs.Self:canSlashWithoutCrossbow()) or (sgs.Self:getWeapon() and sgs.Self:getWeapon():className() == "Crossbow")
end,
enabled_at_response = function(self, player, pattern)
if(pattern == "jink") or (pattern == "slash") then
ldtmp[1] = pattern
return true
end
end,
}
--0106 马超
luatieqi = sgs.CreateTriggerSkill
{--铁骑 by 【群】皇叔
name = "luatieqi",
frequency = sgs.Skill_Frequency,
events = {sgs.SlashProceed},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
if event == sgs.SlashProceed then
if (not room:askForSkillInvoke(player, self:objectName())) then return false end
local judge = sgs.JudgeStruct()
judge.pattern = sgs.QRegExp("(.*):(heart|diamond):(.*)")
judge.good = true
judge.reason = self:objectName()
judge.who = player
room:judge(judge)
if(judge:isGood()) then
local effect = data:toSlashEffect()
room:slashResult(effect, nil)
return true
end
end
end
}
luamashu = sgs.CreateDistanceSkill
{--马术 by 【群】皇叔
name = "luamashu",
correct_func = function(self, from, to)
if from:hasSkill("luamashu") then
return -1
end
end,
}
--0107 黄月英
luajizhi = sgs.CreateTriggerSkill
{--集智 by 【群】皇叔
name = "luajizhi",
events = {sgs.CardUsed},
frequency = sgs.Skill_Frequent,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local card = data:toCardUse().card
if card:isNDTrick() then
if not room:askForSkillInvoke(player, "luajizhi") then return false end
player:drawCards(1)
end
end,
}
LUAQiCaiCard=sgs.CreateSkillCard{
name="LUAQiCaiCard",
target_fixed=true,--应该是不用选对象
on_use=function(self,room,source,targets)
room:setPlayerFlag(source,"LUAQiCaiUsing")
local card_use=sgs.CardUseStruct()
room:activate(source,card_use)--让玩家自由出牌,对ai同样,记录在card_use里
if card_use:isValid() then
if card_use.card:inherits("TrickCard") then room:useCard(card_use) end
end
room:setPlayerFlag(source,"-LUAQiCaiUsing")
end,
}
luaqicai=sgs.CreateViewAsSkill
{--奇才 by 佚名
name="luaqicai",
n=0,
view_as=function()
acard=LUAQiCaiCard:clone()--复制一张卡的效果
return acard--返回一张新卡
end,
}
LUAQiCaiDT=sgs.CreateDistanceSkill{
name="LUAQiCaiDT",
correct_func=function(self,from,to)
if from:hasSkill("LUAQiCaiDT") and from:hasFlag("LUAQiCaiUsing") then
return -99
end
end,
}
--0101
lualiubei = sgs.General(extension, "lualiubei$", "shu", 4)
lualiubei:addSkill(luarende)
--0102
luaguanyu = sgs.General(extension, "luaguanyu", "shu", 4)
luaguanyu:addSkill(luawusheng)
--0103
luazhangfei = sgs.General(extension, "luazhangfei", "shu", 4)
luazhangfei:addSkill(luapaoxiao)
--0104
luazhugeliang = sgs.General(extension, "luazhugeliang", "shu", 4)
luazhugeliang:addSkill(luaguanxing)
luazhugeliang:addSkill(luakongcheng)
--0105
luazhaoyun = sgs.General(extension, "luazhaoyun", "shu", 4)
luazhaoyun:addSkill(lualongdan)
--0106
luamachao = sgs.General(extension, "luamachao", "shu", 4)
luamachao:addSkill(luatieqi)
luamachao:addSkill(luamashu)
--0107
luahuangyueying = sgs.General(extension, "luahuangyueying", "shu", 3, false)
luahuangyueying:addSkill(luajizhi)
luahuangyueying:addSkill(luaqicai)
luahuangyueying:addSkill(LUAQiCaiDT)
--0201 曹操
luajianxiong = sgs.CreateTriggerSkill
{--奸雄 by hypercross
frequency = sgs.Skill_NotFrequent,
name = "luajianxiong",
events = {sgs.Damaged},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local card = data:toDamage().card
if not room:obtainable(card, player) then return end
if room:askForSkillInvoke(player, "luajianxiong") then
room:playSkillEffect("luajianxiong")
player:obtainCard(card)
end
end
}
luahujia = sgs.CreateTriggerSkill
{--护驾 by ibicdlcod
name = "luahujia$",
default_choice = "ignore",
events = {sgs.CardAsked, sgs.Damaged},
on_trigger = function(self,event,player,data)
local room = player:getRoom()
if(not player:hasLordSkill("luahujia")) then return false end
if(data:toString() ~= "jink") then return false end
if(not room:askForSkillInvoke(player, "luahujia")) then return false end
room:playSkillEffect("luahujia")
for _,liege in sgs.qlist(room:getOtherPlayers(player)) do
local data = sgs.QVariant(0)
local jink = 0
if(liege:getKingdom() ~= "wei") then return false end
data:setValue(player)
jink = room:askForCard(liege, "jink", "@hujia-jink", data)
if(jink) then
room:provide(jink)
return true
end
end
return false
end
--事实上,Masochism此类多余,并且似乎有问题,而且带感情色彩,建议不用
}
--0202 司马懿
luafankui = sgs.CreateTriggerSkill
{--反馈 by ibicdlcod
frequency = sgs.Skill_NotFrequent,
name = "luafankui",
events = {sgs.Damaged},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local from = data:toDamage().from
local data = sgs.QVariant(0)
data:setValue(from)
if(from and (not from:isNude()) and room:askForSkillInvoke(player, "luafankui", data)) then
local card_id = room:askForCardChosen(player, from, "he", "luafankui")
if(room:getCardPlace(card_id) == sgs.Player_Hand) then
room:moveCardTo(sgs.Sanguosha:getCard(card_id), player, sgs.Player_Hand, false)
else
room:obtainCard(player, card_id)
end
room:playSkillEffect("luafankui")
end
end
}
luaguicai_card = sgs.CreateSkillCard
{--鬼才技能卡 by roxiel
name = "luaguicai_effect",
target_fixed = true,
will_throw = false,
}
luaguicaivs = sgs.CreateViewAsSkill
{--鬼才Viewas by roxiel
name = "luaguicaivs",
n = 1,
view_filter = function(self, selected, to_select)
if not to_select:isEquipped() then return true
else return false end
end,
view_as = function(self, cards)
if #cards == 1 then
local acard = luaguicai_card:clone()
acard:addSubcard(cards[1])
acard:setSkillName("luaguicai")
return acard end
end,
enabled_at_play = function()
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "@@luaguicai" --仅响应 要求一张luaguicai_card
end
}
luaguicai = sgs.CreateTriggerSkill
{--鬼才 by roxiel
name = "luaguicai",
events = sgs.AskForRetrial, --听说这个事件不需要cantrigger
view_as_skill = luaguicaivs,
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local simashi = room:findPlayerBySkillName(self:objectName())
local judge = data:toJudge() --获取判定结构体
simashi:setTag("Judge",data) --SET技能拥有者TAG
if (room:askForSkillInvoke(simashi, self:objectName()) ~= true) then return false end --询问发动 可以去掉
local card = room:askForCard(simashi, "@@luaguicai", "@luaguicai", data) --要求一张luaguicai_card 别忘了@luaguicai是询问字符串
if card ~= nil then -- 如果打出了
room:throwCard(judge.card) --原判定牌丢弃如果是想要鬼道那样的替换回来就应该改为simashi:obtainCard(judge.card)
judge.card = sgs.Sanguosha:getCard(card:getEffectiveId()) --判定牌更改
room:moveCardTo(judge.card, nil, sgs.Player_Special) --移动到判定区
local log = sgs.LogMessage() --LOG 以下是改判定专用的TYPE
log.type = "$ChangedJudge"
log.from = player
log.to:append(judge.who)
log.card_str = card:getEffectIdString()
room:sendLog(log)
room:sendJudgeResult(judge)
end
return false --要FALSE~~
end,
}
--0203 夏侯惇
luaganglie = sgs.CreateTriggerSkill
{--刚烈 by ibicdlcod
name = "luaganglie",
events = {sgs.Damaged},
on_trigger=function(self, event, player, data)
local room = player:getRoom()
local from = data:toDamage().from
source = sgs.QVariant(0)
source:setValue(from)
if(from and from:isAlive() and room:askForSkillInvoke(player, "luaganglie", source)) then
room:playSkillEffect("luaganglie")
local judge = sgs.JudgeStruct()
judge.pattern = sgs.QRegExp("(.*):(heart):(.*)")
judge.good = false
judge.reason = self:objectName()
judge.who = player
room:judge(judge)
if(judge:isGood()) then
if(not room:askForDiscard(from, "luaganglie", 2, true)) then
local damage = sgs.DamageStruct()
damage.from = player
damage.to = from
room:damage(damage)
end
room:setEmotion(player, "good")
else
room:setEmotion(player, "bad")
end
end
end
}
--0204 张辽
luatuxi_card = sgs.CreateSkillCard
{--突袭技能卡 by ibicdlcod
name = "luatuxi",
target_fixed = false,
will_throw = false,
filter = function(self, targets, to_select)
if(#targets > 1) then return false end
if(to_select == self) then return false end
return not to_select:isKongcheng()
end,
on_effect = function(self, effect)
local from = effect.from
local to = effect.to
local room = to:getRoom()
local card_id = room:askForCardChosen(from, to, "h", "luatuxi_main")
local card = sgs.Sanguosha:getCard(card_id)
room:moveCardTo(card, from, sgs.Player_Hand, false)
room:setEmotion(to, "bad")
room:setEmotion(from, "good")
end,
}
luatuxi_viewas = sgs.CreateViewAsSkill
{--突袭视为技 by ibicdlcod
name = "luatuxi_viewas",
n = 0,
view_as = function()
return luatuxi_card:clone()
end,
enabled_at_play = function()
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "@@luatuxi_main"
end
}
luatuxi_main = sgs.CreateTriggerSkill
{--突袭 by ibicdlcod
name = "luatuxi_main",
view_as_skill = luatuxi_viewas,
events = {sgs.PhaseChange},
on_trigger = function(self, event, player, data)
if(player:getPhase() == sgs.Player_Draw) then
local room = player:getRoom()
local can_invoke = false
local other = room:getOtherPlayers(player)
for _,aplayer in sgs.qlist(other) do
if(not aplayer:isKongcheng()) then
can_invoke = true
break
end
end
if(not room:askForSkillInvoke(player, "luatuxi_main")) then return false end
if(can_invoke and room:askForUseCard(player, "@@luatuxi_main", "@luatuxi_card")) then return true end
return false
end
end
}
--0205 许褚
lualuoyi_buff = sgs.CreateTriggerSkill
{--裸衣效果 by ibicdlcod
name = "#lualuoyi",
events = {sgs.Predamage},
on_trigger = function(self, event, player, data)
if(player:hasFlag("lualuoyi") and player:isAlive()) then
local damage = data:toDamage()
local room = player:getRoom()
local reason = damage.card
if(not reason) then return false end
if(reason:inherits("Slash") or reason:inherits("Duel")) then
local log = sgs.LogMessage()
log.type = "#LuaLuoyiBuff"
log.from = player
log.to:append(damage.to)
log.arg = tonumber(damage.damage)
log.arg2 = log.arg+1
room:sendLog(log)
damage.damage = damage.damage+1
data:setValue(damage)
return false
end
else return false
end
end
}
lualuoyi = sgs.CreateTriggerSkill
{--裸衣 by ibicdlcod
name = "lualuoyi",
events = {sgs.DrawNCards},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local x = data:toInt()
if(room:askForSkillInvoke(player, "lualuoyi")) then
room:playSkillEffect("lualuoyi")
player:setFlags("lualuoyi")
data:setValue(x-1)
end
end
}
--0206 郭嘉
luatiandu = sgs.CreateTriggerSkill
{--天妒 by ibicdlcod
name = "luatiandu",
frequency = sgs.Skill_Frequent,
events = {sgs.FinishJudge},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local judge = data:toJudge()
local card = judge.card
data_card = sgs.QVariant(0)
data_card:setValue(card)
if(player:askForSkillInvoke("luatiandu", data_card)) then
player:obtainCard(judge.card)
room:playSkillEffect("luatiandu")
return true
end
return false
end
}
luanewyiji = sgs.CreateTriggerSkill
{--2011终极典藏版遗计 by ibicdlcod
name = "luanewyiji",
frequency = sgs.Skill_Frequent,
events = {sgs.Damaged},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local damage = data:toDamage()
local listt = room:getAlivePlayers()
if(not room:askForSkillInvoke(player, "luanewyiji")) then return false end
room:playSkillEffect("luanewyiji")
for var = 1, damage.damage, 1 do
room:doGuanxing(player, room:getNCards(2, false), true)
player1 = room:askForPlayerChosen(player, listt, "luanewyiji")
player1:drawCards(1)
player2 = room:askForPlayerChosen(player, listt, "luanewyiji")
player2:drawCards(1)
end
end
}
luayiji = sgs.CreateTriggerSkill
{--遗计 by roxiel, ibicdlcod修复两张牌不能分给两名其他角色的BUG
name = "luayiji",
frequency = sgs.Skill_Frequent,
events = {sgs.Damaged},
on_trigger = function(self, event, player, data)
local room = player:getRoom()
local damage = data:toDamage() --获取伤害结构体
if(not room:askForSkillInvoke(player, "luayiji"))
then return false end
room:playSkillEffect("luayiji") --音效(音效和LOG属于非核心的内容,建议上下空白一行)
for var = 1, damage.damage, 1 do --每点伤害执行下面的语句
player:drawCards(2) --先摸(典藏版描述改了,估计以后也得改)
local hnum = player:getHandcardNum() --手牌数
local cdlist = sgs.IntList() --Int类型的list
cdlist:append(player:handCards():at(hnum-1)) --插入刚摸的
cdlist:append(player:handCards():at(hnum-2)) --还是插入刚摸的
room:askForYiji(player, cdlist) --这个。。内核自带的一个函数,想必实现遗计神哥花了不少功夫,观星同样
if(player:getHandcardNum() == hnum-1) then
celist = sgs.IntList()
celist:append(player:handCards():at(hnum-2))
room:askForYiji(player, celist)
end
end
end
}
--0207 甄姬
luaqingguo = sgs.CreateViewAsSkill
{--倾国 by ibicdlcod, 【群】皇叔修复response无效的BUG
name = "luaqingguo",
n = 1,
view_filter = function(self, selected, to_select)
return to_select:isBlack() and not to_select:isEquipped()
end,
view_as = function(self, cards)
if #cards == 1 then
local card = cards[1]
local new_card = sgs.Sanguosha:cloneCard("jink", card:getSuit(), card:getNumber())
new_card:addSubcard(card:getId())
new_card:setSkillName(self:objectName())
return new_card
end
end,
enabled_at_play = function()
return false
end,
enabled_at_response = function(self, player, pattern)
return pattern == "jink"
end
}
lualuoshen = sgs.CreateTriggerSkill
{--洛神 by ibicdlcod
name = "lualuoshen",
frequency = sgs.Skill_Frequent,
events = {sgs.PhaseChange, sgs.FinishJudge},
on_trigger = function(self, event, player, data)
if(event == sgs.PhaseChange and player:getPhase() == sgs.Player_Start) then
local room = player:getRoom()
while(player:askForSkillInvoke("lualuoshen")) do
room:playSkillEffect("lualuoshen")
local judge = sgs.JudgeStruct()
judge.pattern = sgs.QRegExp("(.*):(spade|club):(.*)")
judge.good = true
judge.reason = "lualuoshen"
judge.who = player
room:judge(judge)
if(judge:isBad()) then break end
end
end
if(event == sgs.FinishJudge) then
judge = data:toJudge()
if(judge.reason == "lualuoshen") then
if(judge.card:isBlack()) then
player:obtainCard(judge.card)
return true
end
end
end
end
}
--0201
luacaocao = sgs.General(extension, "luacaocao$", "wei", 4)
luacaocao:addSkill(luajianxiong)
luacaocao:addSkill(luahujia)
--0202
luasimayi = sgs.General(extension, "luasimayi", "wei", 3)
luasimayi:addSkill(luafankui)
luasimayi:addSkill(luaguicai)
--0203
luaxiahoudun = sgs.General(extension, "luaxiahoudun", "wei", 4)
luaxiahoudun:addSkill(luaganglie)
--0204
luazhangliao = sgs.General(extension, "luazhangliao", "wei", 4)
luazhangliao:addSkill(luatuxi_main)
--0205
luaxuchu = sgs.General(extension, "luaxuchu", "wei", 4)
luaxuchu:addSkill(lualuoyi_buff)
luaxuchu:addSkill(lualuoyi)
--0206
luaguojia = sgs.General(extension, "luaguojia", "wei", 3)
luaguojia:addSkill(luatiandu)
luaguojia:addSkill(luanewyiji)
--0207
luazhenji = sgs.General(extension, "luazhenji", "wei", 3, false)
luazhenji:addSkill(luaqingguo)
luazhenji:addSkill(lualuoshen)
--0301 孙权
luazhiheng_card = sgs.CreateSkillCard
{--制衡技能卡 by hypercross, ibicdlcod修复getsubcards BUG, coldera修复技能卡objectName失效的BUG
name = "luazhiheng",
target_fixed = true,
will_throw = true,
on_use = function(self, room, source, targets)
if(source:isAlive()) then
room:drawCards(source, self:subcardsLength())--尼玛#getsubcards坑爹了N天啊
room:setPlayerFlag(source, "luazhiheng_used")
room:throwCard(self)
end
end,
}
luazhiheng = sgs.CreateViewAsSkill
{--制衡 by ibicdlcod
name = "luazhiheng",
n = 998,--传说中的“不设上限请设为998,对,只要998”(hypercross语)
view_filter = function(self, selected, to_select)
return true
end,
view_as = function(self, cards)
if #cards > 0 then
local new_card = luazhiheng_card:clone()
local i = 0
while(i < #cards) do
i = i + 1
local card = cards[i]
new_card:addSubcard(card:getId())
end
new_card:setSkillName("luazhiheng")
return new_card
else return nil
end
end,
enabled_at_play = function()
return not sgs.Self:hasFlag("luazhiheng_used")
end
}
luajiuyuan = sgs.CreateTriggerSkill
{--救援 by ibicdlcod **未测试,欢迎测试BUG**
name = "luajiuyuan$",
events = {sgs.Dying, sgs.AskForPeachesDone, sgs.CardEffected},
frequency = sgs.Skill_Compulsory,
on_trigger = function(self,event,player,data)
local room = player:getRoom()
if(not player:hasLordSkill("luajiuyuan")) then return false end
if(event == sgs.Dying) then
for _,liege in sgs.qlist(room:getOtherPlayers(player)) do
if(liege:getKingdom() == "wu") then
room:playSkillEffect("luajiuyuan", 1)
break;
end
end
end
if(event == sgs.CardEffected) then
local cardeffect = data:toCardEffect()
if(effect.card:inherits("Peach") and effect.from:getKingdom() == "wu"
and player ~= effect.from and player:hasFlag("dying")) then
local index = 0
if(effect.from:getGeneral():isMale()) then index = 2 else index = 3 end
room:playSkillEffect("jiuyuan", index);
player:setFlags("jiuyuan")
local log = sgs.LogMessage()
log.from = player
log.type = "#luaJiuyuanExtraRecover"
log.from:append(player)
log.to:append(effect.from)
room:sendLog(log)
local rec = sgs.RecoverStruct()
rec.who = effect.from
room:recover(player,rec)
room:getThread():delay(1000)
end
end
if(event == sgs.AskForPeachesDone) then
if(player:getHp() > 0 and player:hasFlag("jiuyuan")) then
room:playSkillEffect("jiuyuan", 4);
player:setFlags("-jiuyuan");
end
end
end
}
--0302 甘宁
luaqixi = sgs.CreateViewAsSkill
{--奇袭 by ibicdlcod
name = "luaqixi",
n = 1,
view_filter = function(self, selected, to_select)
return to_select:isBlack()
end,
view_as = function(self, cards)
if #cards == 1 then
local card = cards[1]
local new_card =sgs.Sanguosha:cloneCard("dismantlement", card:getSuit(), card:getNumber())
new_card:addSubcard(card:getId())
new_card:setSkillName(self:objectName())
return new_card
end
end
}
--0303 吕蒙
luakeji = sgs.CreateTriggerSkill
{--克己 by ibicdlcod
name = "luakeji",
events = {sgs.CardResponsed, sgs.PhaseChange},
frequency = sgs.Skill_Frequent,
on_trigger = function(self, event, player, data)
if(event == sgs.CardResponsed) then
local card_star = data:toCard()
if(card_star:inherits("slash")) then
player:setFlags("luakeji_use_slash")
end
return false
elseif(event == sgs.PhaseChange) then
if(player:getPhase() == sgs.Player_Start) then
player:setFlags("-keji_use_slash")
elseif(player:getPhase() == sgs.Player_Discard) then
if(player:getSlashCount() == 0 and player:askForSkillInvoke("luakeji") and not player:hasFlag("keji_use_slash")) then
return true
end
return false
end
end
end
}
--0304 黄盖
luakurou = sgs.CreateViewAsSkill
{--苦肉 by ibicdlcod
name = "luakurou",
n = 0,
view_as = function(self, cards)
local card = luakurou_card:clone()
card:setSkillName(self:objectName())
return card
end
}
luakurou_card = sgs.CreateSkillCard
{--苦肉技能卡 by ibicdlcod
name = "luakurou",
target_fixed = true,
will_throw = false,
on_use = function(self, room, source, targets)
room:loseHp(source)
if(source:isAlive()) then
room:drawCards(source, 2)
end
end,
enabled_at_play = function()
return true
end
}
--0305 周瑜
luayingzi = sgs.CreateTriggerSkill
{--英姿 by ibicdlcod
name = "luayingzi",
frequency = sgs.Skill_Frequent,
events = {sgs.PhaseChange},
on_trigger = function(self, event, player, data)
if(player:getPhase() == sgs.Player_NotActive) then
player:setFlags("-luayingzi_used")
return false
end
if(not player:getPhase() == sgs.Player_Draw) then return false end
if(player:hasFlag("luayingzi_used")) then return false end
if(player:askForSkillInvoke("luayingzi")) then
player:drawCards(1)
player:setFlags("luayingzi_used")
end
return false
end