Commit 8a3a9a17 authored by zengsxing's avatar zengsxing

fix 机关傀儡

parent 39ed7107
Pipeline #25859 passed with stages
in 1 minute and 2 seconds
......@@ -14,7 +14,7 @@ function s.initial_effect(c)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--destroy
--level up
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_IGNITION)
......@@ -39,7 +39,7 @@ end
function s.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local lv=e:GetLabel()
if c:IsRelateToEffect(e) and c:IsFaceup() then
if c:IsRelateToEffect(e) and c:IsFaceup() and not c:IsLevel(lv) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
......
......@@ -4,7 +4,7 @@ function s.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
......@@ -19,7 +19,7 @@ function s.initial_effect(c)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,id+o)
e2:SetCost(s.spcost)
e2:SetCost(s.thcost)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
......@@ -30,7 +30,10 @@ function s.counterfilter(c)
return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsSetCard(0x1083)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
e:SetLabel(sc:GetRank())
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
......@@ -44,28 +47,26 @@ function s.splimit(e,c)
return c:IsLocation(LOCATION_EXTRA) and not c:IsSetCard(0x1083)
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0x1083) and c:IsRankAbove(1) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_DECK,0,1,nil,e,tp,c)
return c:IsSetCard(0x1083) and c:IsRankAbove(1) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetRank())
end
function s.spfilter2(c,e,tp,sc)
return c:IsSetCard(0x1083) and c:IsLevel(sc:GetRank()) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
function s.spfilter2(c,e,tp,lv)
return c:IsSetCard(0x1083) and c:IsLevel(lv) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local lv=e:GetLabel()
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,59822133)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_DECK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
local lv=e:GetLabel()
if not c:IsRelateToEffect(e) or Duel.IsPlayerAffectedByEffect(tp,59822133) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_DECK,0,1,1,nil,e,tp,sc):GetFirst()
local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_DECK,0,1,1,nil,e,tp,lv):GetFirst()
if tc and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 then
Duel.ConfirmCards(1-tp,sc)
Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP)
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
Duel.SpecialSummonComplete()
......@@ -75,6 +76,17 @@ function s.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return not c:IsPreviousLocation(LOCATION_HAND)
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetTargetRange(1,0)
e1:SetTarget(s.splimit)
Duel.RegisterEffect(e1,tp)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToHand() end
......
......@@ -21,7 +21,7 @@ function s.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,id+EFFECT_COUNT_CODE_DUEL)
e2:SetCountLimit(1,id+o)
e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
......@@ -88,6 +88,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
if sp and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil)and Duel.SelectYesNo(tp,aux.Stringid(id,5)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
......
......@@ -18,7 +18,7 @@ function s.initial_effect(c)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id+o)
......@@ -26,12 +26,12 @@ function s.initial_effect(c)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
--remove
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetCode(EVENT_CUSTOM+id)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,id+2*o)
......@@ -39,6 +39,7 @@ function s.initial_effect(c)
e3:SetTarget(s.destg)
e3:SetOperation(s.desop)
c:RegisterEffect(e3)
aux.RegisterMergedDelayedEvent(c,id,EVENT_SPSUMMON_SUCCESS)
end
function s.thfilter(c)
return c:IsSetCard(0x83) and c:IsType(TYPE_TRAP) and c:IsAbleToHand()
......@@ -62,19 +63,17 @@ end
function s.spfilter(c,e,tp)
return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp)
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)
end
end
function s.desfilter(c,tp,e)
......@@ -88,21 +87,23 @@ function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=eg:Filter(s.desfilter,nil,tp,e)
if chkc then return g:IsContains(chkc) end
if chk==0 then return #g>0 end
local tg=g:Clone()
if #g>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
tg=g:Select(tp,1,1,nil)
local sg
if g:GetCount()==1 then
sg=g:Clone()
Duel.SetTargetCard(sg)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
sg=Duel.SelectTarget(tp,aux.IsInGroup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,g)
end
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,0,0)
if math.max(0,tg:GetFirst():GetTextAttack())>0 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,1,0,0)
if math.max(0,sg:GetFirst():GetTextAttack())>0 then
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
local atk=tc:GetBaseAttack()
if tc:IsRelateToEffect(e) and tc:IsType(TYPE_MONSTER) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
local atk=math.max(0,tc:GetTextAttack())
if atk>0 then
Duel.Damage(1-tp,math.floor(atk/2),REASON_EFFECT)
end
......
......@@ -20,15 +20,15 @@ function s.initial_effect(c)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,id)
e2:SetCondition(aux.exccon)
e2:SetCountLimit(1,id+o)
e2:SetCondition(s.spcon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.filter(c)
return c:IsSetCard(0x1083) and c:IsFaceup()
return c:IsSetCard(0x1083) and c:IsType(TYPE_XYZ) and c:IsFaceup()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ct=math.min(Duel.GetFieldGroup(tp,LOCATION_MZONE,0):FilterCount(s.filter,nil),Duel.GetLocationCount(tp,LOCATION_MZONE))
......
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