Commit 2b8de11e authored by 未闻皂名's avatar 未闻皂名

2022/3/16 新增:古之规则,模块化部分KP04

parent 08d20863
No preview for this file type
......@@ -105,6 +105,15 @@ function RushDuel.CanSelectAndSpecialSummon(desc, filter, tp, s_range, o_range,
end
return 0
end
-- 操作: 选择怪兽特殊召唤
function RushDuel.SelectGroupAndSpecialSummon(filter, check, tp, s_range, o_range, min, max, expect, e, pos, break_effect)
local ct = RushDuel.GetMZoneCount(tp, max)
if ct >= min then
local hint_selection = RushDuel._private_is_include_public(s_range, o_range)
return RushDuel._private_action_select_group(HINTMSG_SPSUMMON, filter, check, tp, s_range, o_range, min, ct, expect, hint_selection, false, RushDuel._special_summon, e, tp, pos, break_effect)
end
return 0
end
-- 操作: 选择魔法·陷阱卡盖放
function RushDuel.SelectAndSet(filter, e, tp, s_range, o_range, min, max, expect, break_effect)
local ct = RushDuel.GetSZoneCount(tp, max)
......
......@@ -133,6 +133,11 @@ end
function RushDuel.CostSendGraveToDeck(filter, min, max, set_label_before, set_object_before, set_label_after, set_object_after)
return RushDuel.CostSendMatchToDeckSort(filter, LOCATION_GRAVE, min, max, false, 2, false, true, set_label_before, set_object_before, set_label_after, set_object_after)
end
-- 代价: 让墓地的卡返回卡组 (子卡片组)
function RushDuel.CostSendGraveSubToDeck(filter, check, min, max, set_label_before, set_object_before, set_label_after, set_object_after)
return RushDuel.CostSendGroupToDeckSort(filter, check, LOCATION_GRAVE, min, max, false, 2, false, true, set_label_before, set_object_before, set_label_after, set_object_after)
end
-- 代价: 让墓地的卡返回卡组下面
function RushDuel.CostSendGraveToDeckBottom(filter, min, max, set_label_before, set_object_before, set_label_after, set_object_after)
return RushDuel.CostSendMatchToDeckSort(filter, LOCATION_GRAVE, min, max, false, 1, false, true, set_label_before, set_object_before, set_label_after, set_object_after)
......
......@@ -58,6 +58,13 @@ function RushDuel.GetSZoneCount(player, max)
return math.min(ct, max)
end
-- 将玩家卡组最上面的N张卡移到卡组最下面
function RushDuel.SendDeckTopToBottom(player, count)
for i = 1, count do
Duel.MoveSequence(Duel.GetDecktopGroup(player, 1):GetFirst(), 1)
end
end
-- 返回卡组并排序
function RushDuel.SendToDeckSort(target, sequence, reason, sort_player, target_player)
local g = RushDuel.ToMaximunGroup(target)
......@@ -71,10 +78,7 @@ function RushDuel.SendToDeckSort(target, sequence, reason, sort_player, target_p
if sequence ~= 2 and ct > 1 then
Duel.SortDecktop(sort_player, target_player, ct)
if sequence == 1 then
for i = 1, ct do
local tc = Duel.GetDecktopGroup(target_player, 1):GetFirst()
Duel.MoveSequence(tc, 1)
end
RushDuel.SendDeckTopToBottom(target_player, ct)
end
end
return og, ct
......
......@@ -13,9 +13,9 @@ end
--Activate
function cm.costfilter(c,e,tp)
return c:IsType(TYPE_MONSTER) and not c:IsPublic()
and Duel.IsExistingMatchingCard(cm.attrfilter,tp,0,LOCATION_MZONE,1,nil,c:GetAttribute())
and Duel.IsExistingMatchingCard(cm.filter,tp,0,LOCATION_MZONE,1,nil,c:GetAttribute())
end
function cm.attrfilter(c,attr)
function cm.filter(c,attr)
return c:IsFaceup() and not c:IsAttribute(attr)
end
cm.cost=RD.CostShowHand(cm.costfilter,1,1,function(g)
......@@ -24,7 +24,7 @@ end)
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local attr=e:GetLabel()
local function filter(c)
return cm.attrfilter(c,attr)
return cm.filter(c,attr)
end
RD.SelectAndDoAction(aux.Stringid(m,1),filter,tp,0,LOCATION_MZONE,1,3,nil,function(g)
g:ForEach(function(c)
......
......@@ -11,36 +11,24 @@ function cm.initial_effect(c)
c:RegisterEffect(e1)
end
--Activate
function cm.costfilter(c,tp)
function cm.costfilter(c,e,tp)
return c:IsType(TYPE_MONSTER) and not c:IsPublic()
and Duel.IsExistingMatchingCard(cm.racefilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,c:GetRace())
and Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,c:GetRace())
end
function cm.racefilter(c,race)
function cm.filter(c,race)
return c:IsFaceup() and not c:IsRace(race)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.costfilter,tp,LOCATION_HAND,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local g=Duel.SelectMatchingCard(tp,cm.costfilter,tp,LOCATION_HAND,0,1,1,nil,tp)
e:SetLabel(g:GetFirst():GetRace())
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
end
cm.cost=RD.CostShowHand(cm.costfilter,1,1,function(g)
return g:GetFirst():GetRace()
end)
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local race=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,1))
local g=Duel.SelectMatchingCard(tp,cm.racefilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,3,nil,race)
if g:GetCount()>0 then
Duel.HintSelection(g)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_RACE)
e1:SetValue(race)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
local function filter(c)
return cm.filter(c,race)
end
RD.SelectAndDoAction(aux.Stringid(m,1),filter,tp,0,LOCATION_MZONE,1,3,nil,function(g)
g:ForEach(function(c)
RD.ChangeRace(e,c,race,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
end)
end)
end
\ No newline at end of file
......@@ -21,35 +21,16 @@ end
function cm.filter(c)
return c:IsFaceup() and c:IsLevelBelow(8)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(cm.costfilter,tp,LOCATION_GRAVE,0,nil)
if chk==0 then return g:CheckSubGroup(cm.costcheck,2,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=g:SelectSubGroup(tp,cm.costcheck,false,2,2,nil)
Duel.ConfirmCards(1-tp,sg)
Duel.SendtoDeck(sg,nil,2,REASON_COST)
end
cm.cost=RD.CostSendGraveSubToDeck(cm.costfilter,cm.costcheck,2,2)
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_MZONE,0,1,nil) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(m,1))
local g=Duel.SelectMatchingCard(tp,cm.filter,tp,LOCATION_MZONE,0,1,2,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(m,2))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetValue(cm.indval)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
RD.SelectAndDoAction(aux.Stringid(m,1),cm.filter,tp,LOCATION_MZONE,0,1,2,nil,function(g)
g:ForEach(function(tc)
RD.AttachEffectIndes(e,tc,cm.indval,aux.Stringid(m,2),RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
end)
end)
end
function cm.indval(e,re,rp)
return rp==1-e:GetHandlerPlayer() and re:IsActiveType(TYPE_TRAP)
......
......@@ -15,7 +15,7 @@ end
--Activate
function cm.spfilter(c,e,tp)
return c:IsType(TYPE_NORMAL) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FIEND) and c:IsLevelAbove(1)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK)
and RD.IsCanBeSpecialSummoned(c,e,tp,POS_FACEUP_ATTACK)
end
function cm.check(g)
return g:GetSum(Card.GetLevel)<=10
......@@ -30,33 +30,10 @@ function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_GRAVE)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetMZoneCount(tp)>1 then
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(cm.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp)
if g:CheckSubGroup(cm.check,2,2,nil) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:SelectSubGroup(tp,cm.check,false,2,2,nil)
if sg:GetCount()>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
end
end
RD.SelectGroupAndSpecialSummon(aux.NecroValleyFilter(cm.spfilter),cm.check,tp,LOCATION_GRAVE,0,2,2,nil,e,POS_FACEUP_ATTACK)
if Duel.GetFlagEffect(tp,m)~=0 then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(cm.atktg)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
--Hint
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetDescription(aux.Stringid(m,1))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
RD.CreateHintEffect(e,aux.Stringid(m,1),tp,1,0,RESET_PHASE+PHASE_END)
RD.CreateAttackLimitEffect(e,cm.atktg,tp,LOCATION_MZONE,0,RESET_PHASE+PHASE_END)
Duel.RegisterFlagEffect(tp,m,RESET_PHASE+PHASE_END,0,1)
end
function cm.atktg(e,c)
......
......@@ -21,9 +21,7 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmDecktop(tp,ct)
local op=Duel.SelectOption(tp,aux.Stringid(m,1),aux.Stringid(m,2))
if ct>1 then Duel.SortDecktop(tp,tp,ct) end
if op==0 then return end
for i=1,ct do
local tc=Duel.GetDecktopGroup(tp,1):GetFirst()
Duel.MoveSequence(tc,1)
if op==1 then
RD.SendDeckTopToBottom(tp,ct)
end
end
\ No newline at end of file
......@@ -16,22 +16,19 @@ end
function cm.confilter(c)
return c:IsFaceup() and c:IsRace(RACE_WYRM)
end
function cm.tdfilter(c)
function cm.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToDeck()
end
function cm.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.confilter,tp,LOCATION_MZONE,0,1,nil)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.tdfilter,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(cm.tdfilter,tp,0,LOCATION_ONFIELD,nil)
if chk==0 then return Duel.IsExistingMatchingCard(cm.filter,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(cm.filter,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,cm.tdfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 then
Duel.HintSelection(g)
Duel.SendtoDeck(g,nil,1,REASON_EFFECT)
end
RD.SelectAndDoAction(HINTMSG_TODECK,cm.filter,tp,0,LOCATION_ONFIELD,1,1,nil,function(g)
RD.SendToOpponentDeckBottom(g,tp)
end)
end
\ No newline at end of file
local m=120212010
local cm=_G["c"..m]
cm.name="古之规则"
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
end
--Activate
function cm.spfilter(c,e,tp)
return c:IsLevelAbove(5) and c:IsType(TYPE_NORMAL) and RD.IsCanBeSpecialSummoned(c,e,tp,POS_FACEUP)
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMZoneCount(tp)>0
and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
RD.SelectAndSpecialSummon(cm.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,POS_FACEUP)
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment