Commit b5208630 authored by POLYMER's avatar POLYMER

fix

parent 6e8bd36a
No preview for this file type
......@@ -8,6 +8,7 @@ function cm.initial_effect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_RELEASE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(cm.adcon)
e1:SetTarget(cm.adtg)
......
......@@ -292,7 +292,6 @@ function cm.efop2(e,tp,eg,ep,ev,re,r,rp)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCountLimit(1)
e2:SetCondition(cm.drcon1)
e2:SetTarget(cm.drtg)
e2:SetOperation(cm.drop)
......@@ -360,7 +359,7 @@ function cm.drcon2(e,tp,eg,ep,ev,re,r,rp)
end
function cm.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(m+1)<2 end
if chk==0 then return true end --c:GetFlagEffect(m+1)<2 end
c:RegisterFlagEffect(m+1,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
......
......@@ -57,7 +57,8 @@ function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local num=eg:FilterCount(Card.IsType,nil,TYPE_MONSTER)
local tg=eg:Filter(cm.tgfilter,nil)
local spg=tg:Filter(cm.spfilter,nil,e,tp)
if chk==0 then return (num>=2 or (Duel.IsPlayerAffectedByEffect(tp,11451481) and num>=1)) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and #spg>0 end
if chk==0 then return (num>=2 or (Duel.IsPlayerAffectedByEffect(tp,11451481) and num>=1)) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and #spg>0 and c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
if Duel.IsPlayerAffectedByEffect(tp,11451481) then
if num>=2 then
local op=Duel.SelectOption(tp,aux.Stringid(11451483,2),aux.Stringid(11451483,3))
......@@ -93,7 +94,8 @@ function cm.thfilter(c)
end
function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return (#eg>=2 or Duel.IsPlayerAffectedByEffect(tp,11451481)) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) and not e:GetHandler():IsStatus(STATUS_CHAINING) end
if chk==0 then return (#eg>=2 or Duel.IsPlayerAffectedByEffect(tp,11451481)) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) and c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
if Duel.IsPlayerAffectedByEffect(tp,11451481) then
if #eg>=2 then
local op=Duel.SelectOption(tp,aux.Stringid(11451483,2),aux.Stringid(11451483,3))
......
--魔人★双子 菈·赛泽尔
local m=11451482
local cm=_G["c"..m]
local cm,m=GetID()
function cm.initial_effect(c)
--effect1
local e1=Effect.CreateEffect(c)
......@@ -140,7 +139,8 @@ end
function cm.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local num=e:GetLabel()
if chk==0 then return (num>=2 or (Duel.IsPlayerAffectedByEffect(tp,11451482) and num>=1)) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
if chk==0 then return (num>=2 or (Duel.IsPlayerAffectedByEffect(tp,11451482) and num>=1)) and not Duel.IsPlayerAffectedByEffect(tp,59822133) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) and c:GetFlagEffect(m)==0 end
c:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD+RESET_CHAIN,0,1)
if Duel.IsPlayerAffectedByEffect(tp,11451482) then
if num>=2 then
local op=Duel.SelectOption(tp,aux.Stringid(11451483,2),aux.Stringid(11451483,3))
......
......@@ -115,11 +115,11 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetDescription(aux.Stringid(m,3))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
--e1:SetCountLimit(1)
e1:SetLabel(Duel.GetCurrentPhase())
e1:SetLabelObject(tc)
e1:SetCondition(cm.retcon)
e1:SetOperation(cm.retop)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
if c:IsRelateToEffect(e) then
Duel.BreakEffect()
......@@ -128,6 +128,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.retcon(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return false end
local tc=e:GetLabelObject()
if tc:GetFlagEffect(m)==0 then
e:Reset()
......@@ -137,9 +138,12 @@ function cm.retcon(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return end
pnfl_adjusting=true
local tc=e:GetLabelObject()
local ph,ph2=Duel.GetCurrentPhase(),e:GetLabel()
if ph~=ph2 and (ph<=PHASE_MAIN1 or ph>=PHASE_MAIN2 or ph2<=PHASE_MAIN1 or ph2>=PHASE_MAIN2) then
Duel.SendtoHand(tc,1-tp,REASON_EFFECT)
end
pnfl_adjusting=false
end
\ No newline at end of file
......@@ -29,6 +29,7 @@ function cm.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e2:SetCode(EVENT_MOVE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCondition(cm.actcon)
e2:SetCost(cm.bfgcost)
e2:SetOperation(cm.actop)
......
......@@ -59,10 +59,13 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetLabel(Duel.GetCurrentPhase())
e1:SetCondition(function() return not pnfl_adjusting end)
e1:SetOperation(cm.adjustop)
Duel.RegisterEffect(e1,tp)
end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return end
pnfl_adjusting=true
local ph,ph2=Duel.GetCurrentPhase(),e:GetLabel()
if ph~=ph2 and (ph<=PHASE_MAIN1 or ph>=PHASE_MAIN2 or ph2<=PHASE_MAIN1 or ph2>=PHASE_MAIN2) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......@@ -78,6 +81,7 @@ function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
end
e:Reset()
end
pnfl_adjusting=false
end
function cm.setfilter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0x9977) and ((c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1) or c:IsSSetable())
......
......@@ -16,6 +16,7 @@ function cm.initial_effect(c)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCondition(cm.con)
e2:SetTarget(cm.tg)
e2:SetOperation(cm.op)
......
......@@ -17,6 +17,7 @@ function cm.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_MOVE)
e2:SetRange(LOCATION_HAND+LOCATION_MZONE+LOCATION_GRAVE)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(cm.spcon)
e2:SetTarget(cm.sptg)
......
......@@ -267,6 +267,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.retcon(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return false end
local g=e:GetLabelObject()
if not g:IsExists(cm.filter6,1,nil) then
g:DeleteGroup()
......@@ -303,6 +304,8 @@ function cm.returntofield(tc)
end
end
function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return end
pnfl_adjusting=true
local g=e:GetLabelObject()
local sg=g:Filter(cm.filter6,nil,e)
local ph,ph2=Duel.GetCurrentPhase(),e:GetLabel()
......@@ -357,4 +360,5 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(tc,tc:GetPreviousControler(),REASON_EFFECT)
end
end
pnfl_adjusting=false
end
\ No newline at end of file
......@@ -74,7 +74,7 @@ function cm.initial_effect(c)
local tc=obj
if aux.GetValueType(obj)=="Group" then tc=obj:GetFirst() end
local tp=tc:GetControler()
if tc:IsLevel(3) then --and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
if 1==1 then --and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451912,0))
local tg=Duel.SelectMatchingCard(tp,cm.tspfilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,0,1,nil,cm[1],tp,tc)
if #tg>0 then Duel.RegisterFlagEffect(tp,tg:GetFirst():GetOriginalCode(),RESET_PHASE+PHASE_END,0,1) cm[1]=nil return _Merge(sg,tg) end
......@@ -86,7 +86,7 @@ function cm.initial_effect(c)
function Duel.SpecialSummonRule(tp,tc,sumtype)
if sumtype~=SUMMON_TYPE_PENDULUM then _SpecialSummonRule(tp,tc,sumtype) end
local tp=tc:GetControler()
if tc:IsLevel(3) then --and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
if 1==1 then --and not Duel.IsPlayerAffectedByEffect(tp,59822133) then
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(11451912,0))
local tg=Duel.SelectMatchingCard(tp,cm.tspfilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,0,1,nil,nil,tp,tc)
if #tg>0 then Duel.RegisterFlagEffect(tp,tg:GetFirst():GetOriginalCode(),RESET_PHASE+PHASE_END,0,1) local tc2=tg:GetFirst() tc2.pendulum_rule[tc2]:SetLabel(1) if tc.pendulum_rule and tc.pendulum_rule[tc] then tc.pendulum_rule[tc]:SetLabel(0) end return _SpecialSummonRule(tp,tc2,SUMMON_TYPE_PENDULUM) end
......@@ -212,7 +212,6 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetDescription(aux.Stringid(m,1))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetCurrentPhase())
e1:SetLabelObject(og)
e1:SetCondition(cm.retcon)
......@@ -223,6 +222,7 @@ function cm.spop(e,tp,eg,ep,ev,re,r,rp)
end
end
function cm.retcon(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return false end
local g=e:GetLabelObject()
if not g:IsExists(cm.filter6,1,nil) then
g:DeleteGroup()
......@@ -259,6 +259,8 @@ function cm.returntofield(tc)
end
end
function cm.retop(e,tp,eg,ep,ev,re,r,rp)
if pnfl_adjusting then return end
pnfl_adjusting=true
local g=e:GetLabelObject()
local sg=g:Filter(cm.filter6,nil,e)
local ph,ph2=Duel.GetCurrentPhase(),e:GetLabel()
......@@ -313,4 +315,5 @@ function cm.retop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(tc,tc:GetPreviousControler(),REASON_EFFECT)
end
end
pnfl_adjusting=false
end
\ No newline at end of file
......@@ -66,6 +66,7 @@ function cm.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetCondition(cm.rmcon)
e2:SetTarget(cm.rmtg)
e2:SetOperation(cm.rmop)
......@@ -87,7 +88,7 @@ end
function cm.checkop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(Card.IsPreviousLocation,nil,LOCATION_ONFIELD):Filter(Card.IsPreviousPosition,nil,POS_FACEUP)
for tc in aux.Next(g) do
local code,code2=tc:GetCode()
local code,code2=tc:GetPreviousCodeOnField()
PNFL_TURN_TOHAND_CHECK[code]=true
if code2 then PNFL_TURN_TOHAND_CHECK[code2]=true end
end
......
......@@ -24,6 +24,7 @@ function cm.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
e2:SetRange(LOCATION_GRAVE+LOCATION_REMOVED)
e2:SetLabelObject(e0)
e2:SetCondition(cm.adcon2)
......
......@@ -90,7 +90,7 @@ function c21185825.LCheckGoal2(sg,tp,lc,lmat)
and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0
and not sg:IsExists(aux.LUncompatibilityFilter,1,nil,sg,lc,tp)
and (not lmat or sg:IsContains(lmat))
and #sg==sg:Filter(Card.IsLinkType,nil,TYPE_EFFECT)
and #sg==sg:Filter(Card.IsLinkType,nil,TYPE_EFFECT):GetCount()
end
function c21185825.linkcon()
return function(e,c,og,lmat,min,max)
......
......@@ -27,9 +27,9 @@ end
function c21185845.tg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local ct=c:GetMutualLinkedGroupCount()
if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end
if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,1,nil) end
Duel.Hint(3,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,ct,nil)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,0,800)
end
......
......@@ -4,7 +4,7 @@ function c21185848.initial_effect(c)
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c21185848.tg)
......
......@@ -157,6 +157,7 @@ function s.drop(e,tp,eg,ep,ev,re,r,rp)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetValue(s.aclimit2)
Duel.RegisterEffect(e1,tp)
end
......
......@@ -67,6 +67,36 @@ function s.initial_effect(c)
ge3:SetCondition(s.hintcon)
ge3:SetOperation(s.hintop)
Duel.RegisterEffect(ge3,0)
--save rg
s.sumgroup=Group.CreateGroup()
s.sumgroup:KeepAlive()
local sge1=Effect.CreateEffect(c)
sge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
sge1:SetCode(EVENT_SUMMON)
sge1:SetOperation(s.sumop)
Duel.RegisterEffect(sge1,0)
local sge2=sge1:Clone()
sge2:SetCode(EVENT_FLIP_SUMMON)
Duel.RegisterEffect(sge2,0)
local sge3=sge1:Clone()
sge3:SetCode(EVENT_SPSUMMON)
Duel.RegisterEffect(sge3,0)
s.sumsgroup=Group.CreateGroup()
s.sumsgroup:KeepAlive()
local sge4=Effect.CreateEffect(c)
sge4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
sge4:SetCode(EVENT_SUMMON_SUCCESS)
sge4:SetOperation(s.sumsop)
Duel.RegisterEffect(sge1,0)
local sge5=sge4:Clone()
sge5:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
Duel.RegisterEffect(sge5,0)
local sge6=sge4:Clone()
sge6:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(sge6,0)
s.RandomSelect=Group.RandomSelect
s.TossCoin=Duel.TossCoin
s.TossDice=Duel.TossDice
......@@ -86,6 +116,11 @@ function s.initial_effect(c)
s.SpecialSummon=Duel.SpecialSummon
s.SpecialSummonStep=Duel.SpecialSummonStep
s.MoveToField=Duel.MoveToField
s.SSet=Duel.SSet
s.GetControl=Duel.GetControl
s.SelectDisableField=Duel.SelectDisableField
s.SelectField=Duel.SelectField
s.SelectEffectYesNo=Duel.SelectEffectYesNo
s.SelectYesNo=Duel.SelectYesNo
......@@ -112,10 +147,8 @@ function s.startcon(e,tp,eg,ep,ev,re,r,rp)
end
function s.startop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
local xg=Duel.GetOverlayGroup(0,0x7f,0x7f)
g:Merge(xg)
g=g:Filter(s.cfilter,nil)
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(tc)
......@@ -132,6 +165,24 @@ function s.startop(e,tp,eg,ep,ev,re,r,rp)
e2:SetCondition(s.menucon)
e2:SetOperation(s.menuop)
tc:RegisterEffect(e2,true)
--be material
local e4=Effect.CreateEffect(tc)
e4:SetType(EFFECT_TYPE_XMATERIAL+EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCode(EVENT_ADJUST)
e4:SetRange(LOCATION_MZONE)
e4:SetLabelObject(tc)
e4:SetCondition(s.matcon)
e4:SetOperation(s.matop)
tc:RegisterEffect(e4)
--move
local e5=Effect.CreateEffect(tc)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCode(EVENT_MOVE)
e5:SetCondition(s.mvcon)
e5:SetOperation(s.mvop)
tc:RegisterEffect(e5)
local effect_list={
EFFECT_CANNOT_TO_DECK,
EFFECT_CANNOT_TO_HAND,
......@@ -142,6 +193,10 @@ function s.startop(e,tp,eg,ep,ev,re,r,rp)
EFFECT_CANNOT_SSET,
EFFECT_IMMUNE_EFFECT,
EFFECT_CANNOT_BE_EFFECT_TARGET,
EFFECT_CANNOT_BE_FUSION_MATERIAL,
EFFECT_CANNOT_BE_SYNCHRO_MATERIAL,
EFFECT_CANNOT_BE_XYZ_MATERIAL,
EFFECT_CANNOT_BE_LINK_MATERIAL,
EFFECT_CANNOT_CHANGE_CONTROL,
}
for _,v in pairs(effect_list) do
......@@ -156,6 +211,7 @@ function s.startop(e,tp,eg,ep,ev,re,r,rp)
tc:SetStatus(STATUS_SUMMONING,true)
tc:SetStatus(STATUS_SUMMON_DISABLED,true)
tc:SetStatus(STATUS_ACTIVATE_DISABLED,true)
tc:SetStatus(STATUS_INITIALIZING,true)
end
e:Reset()
end
......@@ -167,10 +223,8 @@ function s.cfilter2(c)
end
function s.adjustop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
local xg=Duel.GetOverlayGroup(0,0x7f,0x7f)
g:Merge(xg)
g=g:Filter(s.cfilter2,nil)
for tc in aux.Next(g) do
local bool1=tc:IsHasEffect(EFFECT_CANNOT_SPECIAL_SUMMON)
......@@ -253,13 +307,13 @@ function s.chcost(_cost)
end
function s.chtg(_tg)
return function(e,c,...)
if c:IsHasEffect(id) and c:GetFlagEffect(id)==0 then return false end
if c and c:IsHasEffect(id) and c:GetFlagEffect(id)==0 then return false end
return _tg(e,c,...)
end
end
function s.chtg2(_tg)
return function(e,c,sump,sumtype,sumpos,targetp,se)
if c:IsHasEffect(id) and se:GetHandler()==c and c:GetFlagEffect(id)==0 then return false end
if c and c:IsHasEffect(id) and se:GetHandler()==c and c:GetFlagEffect(id)==0 then return false end
return _tg(e,c,sump,sumtype,sumpos,targetp,se)
end
end
......@@ -274,8 +328,8 @@ function s.resetop(e,tp,eg,ep,ev,re,r,rp)
end
function s.menucon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
local bool=ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE and ph~=PHASE_BATTLE_STEP or ph==PHASE_MAIN1 or ph==PHASE_MAIN2
return tp==e:GetHandler():GetOwner() and (s.Wild_Mode or Duel.GetTurnPlayer()==tp and Duel.GetCurrentChain()==0 and Duel.GetTurnPlayer()==tp and bool)
local bool=Duel.GetAttacker()==nil and ph==PHASE_BATTLE_STEP or ph==PHASE_MAIN1 or ph==PHASE_MAIN2
return tp==e:GetHandler():GetOwner() and (s.Wild_Mode or Duel.GetTurnPlayer()==tp and Duel.GetCurrentChain()==0 and bool)
end
function s.menuop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
local page=1
......@@ -340,6 +394,36 @@ function s.menuop(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
end
if not s.Theworld_Mode then Duel.AdjustAll() end
end
function s.matcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
return tc:GetOverlayTarget()==c
end
function s.matop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
local c=e:GetHandler()
if tc:GetOverlayTarget()==c then
Duel.SendtoGrave(tc,REASON_RULE+REASON_RETURN)
end
end
function s.mvcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return not c:IsLocation(LOCATION_EXTRA)
end
function s.mvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
c:SetStatus(STATUS_SPSUMMON_STEP,false)
c:SetStatus(STATUS_SUMMONING,false)
c:SetStatus(STATUS_SUMMON_DISABLED,false)
c:SetStatus(STATUS_ACTIVATE_DISABLED,false)
c:SetStatus(STATUS_INITIALIZING,false)
Duel.SendtoDeck(c,nil,0,REASON_RULE)
c:SetStatus(STATUS_SPSUMMON_STEP,true)
c:SetStatus(STATUS_SUMMONING,true)
c:SetStatus(STATUS_SUMMON_DISABLED,true)
c:SetStatus(STATUS_ACTIVATE_DISABLED,true)
c:SetStatus(STATUS_INITIALIZING,true)
end
function s.movecard(e,tp)
local c=e:GetHandler()
local ot=s.SelectOption(tp,1152,1190,1191,1192,1105)
......@@ -406,6 +490,7 @@ function s.movespop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SpecialSummonStep(tc,sumtype,tp,tp,bool,bool,POS_FACEUP+POS_FACEDOWN_DEFENSE) then
Debug.Message("特殊召唤失败了!")
else
if sumtype~=0 then tc:CompleteProcedure() end
if tc:IsType(TYPE_XYZ) then
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
......@@ -457,7 +542,7 @@ function s.printcard(e,tp)
local codetable={}
local ac=s.AnnounceCard(tp)
table.insert(codetable,ac)
if KOISHI_CHECK and IO_CHECK then
if KOISHI_CHECK and IO_CHECK and Duel.SelectYesNo(tp,aux.Stringid(id,15)) then
local luatable=s.get_lua_numbers("script")
for _,i in ipairs(luatable) do
if ac==Duel.ReadCard(i,2) and ac~=i then
......@@ -499,7 +584,7 @@ function s.printcard(e,tp)
tc:RegisterFlagEffect(id+10,0,0,0)
end
end
if s.Control_Mode then
if s.Control_Mode and KOISHI_CHECK then
local cm=_G["c"..tc:GetOriginalCode()]
if not cm.Is_Add_Effect_Id then
local inie=cm.initial_effect
......@@ -509,14 +594,14 @@ function s.printcard(e,tp)
Card.RegisterEffect=function(card,effect,...)
if effect and s.Control_Mode then
if effect:GetType()&EFFECT_TYPE_GRANT~=0 then
local labeff=s.change_effect(effect:GetLabelObject())
local labeff=s.change_effect(effect:GetLabelObject(),c,tp)
if labeff~=0 then
local eff=effect:Clone()
eff:SetLabelObject(labeff)
_CReg(card,eff,...)
end
else
local eff=s.change_effect(effect,c)
local eff=s.change_effect(effect,c,tp)
if eff~=0 then
_CReg(card,eff,...)
end
......@@ -578,9 +663,10 @@ function s.setcard(e,tp)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(p)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
mc:RegisterEffect(e1)
mc:RegisterEffect(e1,true)
end
else
if flag>0xff00 then
......@@ -609,9 +695,10 @@ function s.setcard(e,tp)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(p)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
mc:RegisterEffect(e1)
mc:RegisterEffect(e1,true)
end
end
end
......@@ -673,11 +760,9 @@ function s.cheatmode(e)
Duel.RegisterEffect(kge,0)
end
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
g=g:Filter(s.addfilter,nil)
local xg=Duel.GetOverlayGroup(0,0x7f,0x7f)
g:Merge(xg)
g=g:Filter(s.addfilter,c)
for tc in aux.Next(g) do
if tc:GetFlagEffect(id+10)==0 then
local e1=Effect.CreateEffect(tc)
......@@ -973,9 +1058,10 @@ function s.loadcard(c,data)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_CONTROL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetValue(p)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
tc:RegisterEffect(e1,true)
end
for _,counter in ipairs(cdata.counter) do
tc:AddCounter(counter.type,counter.count)
......@@ -989,28 +1075,71 @@ function s.loadcard(c,data)
end
Debug.Message("读档完成")
end
function s.confirmfilter(c,tp)
return not c:IsControler(tp) and c:IsFacedown()
end
function s.mindcontrol(e,tp)
s.Control_Mode=not s.Control_Mode
if s.Control_Mode then
Debug.Message("骇入开始")
function Group.Select(g,sp,min,max,nc) return s.Select(g,tp,min,max,nc) end
function Group.FilterSelect(g,sp,...) return s.FilterSelect(g,tp,...) end
function Group.SelectUnselect(cg,sg,sp,...) return s.SelectUnselect(cg,sg,tp,...) end
function Group.Select(g,sp,min,max,nc) Duel.ConfirmCards(tp,g:Filter(s.confirmfilter,nil,tp)) return s.Select(g,tp,min,max,nc) end
function Group.FilterSelect(g,sp,...) Duel.ConfirmCards(tp,g:Filter(s.confirmfilter,nil,tp)) return s.FilterSelect(g,tp,...) end
function Group.SelectUnselect(cg,sg,sp,...) Duel.ConfirmCards(tp,cg:Filter(s.confirmfilter,nil,tp)) return s.SelectUnselect(cg,sg,tp,...) end
function Card.RemoveOverlayCard(oc,sp,...) return s.CRemoveOverlayCard(oc,tp,...) end
function Duel.SelectFusionMaterial(sp,...) return s.SelectFusionMaterial(tp,...) end
function Duel.SelectTarget(sp,...) return s.SelectTarget(tp,...)end
function Duel.SelectFusionMaterial(sp,c,g,...) Duel.ConfirmCards(tp,g:Filter(s.confirmfilter,nil,tp)) return s.SelectFusionMaterial(tp,c,g,...) end
function Duel.SelectTarget(sp,f,p,sl,ol,max,min,ex,...)
local sg=Duel.GetMatchingGroup(f,p,sl,ol,ex,...)
Duel.ConfirmCards(tp,sg:Filter(s.confirmfilter,nil,tp))
return s.SelectTarget(tp,f,p,sl,ol,max,min,ex,...)
end
function Duel.SelectTribute(sp,...) return s.SelectTribute(tp,...)end
function Duel.DiscardHand(sp,f,min,max,r,nc,...)
local dg=Duel.SelectMatchingCard(tp,f,sp,LOCATION_HAND,0,min,max,nc,...)
return Duel.SendtoGrave(dg,r)
end
function Duel.RemoveOverlayCard(sp,...) return s.DRemoveOverlayCard(tp,...) end
function Duel.SelectMatchingCard(sp,...) return s.SelectMatchingCard(tp,...) end
function Duel.SelectMatchingCard(sp,f,p,sl,ol,max,min,ex,...)
local sg=Duel.GetMatchingGroup(f,p,sl,ol,ex,...)
Duel.ConfirmCards(tp,sg:Filter(s.confirmfilter,nil,tp))
return s.SelectMatchingCard(tp,f,p,sl,ol,max,min,ex,...)
end
function Duel.SelectReleaseGroup(sp,...) return s.SelectReleaseGroup(tp,...) end
function Duel.SelectReleaseGroupEx(sp,...) return s.SelectReleaseGroupEx(tp,...) end
function Duel.SpecialSummon(tg,stype,sp,...) return s.SpecialSummon(tg,stype,tp,...) end
function Duel.SpecialSummonStep(tg,stype,sp,...) return s.SpecialSummonStep(tg,stype,tp,...)end
function Duel.SpecialSummonStep(tg,stype,sp,...) return s.SpecialSummonStep(tg,stype,tp,...) end
function Duel.MoveToField(c,mp,...) return s.MoveToField(c,tp,...) end
function Duel.SSet(p,tg,sp,...) if not sp then sp=p end return s.SSet(tp,tg,sp,...) end
function Duel.GetControl(tg,p,rphase,rcount,zone,...)
if zone==nil then zone=0x1f end
local flag=0x1f-zone
for i=0,4 do
if not Duel.CheckLocation(p,LOCATION_MZONE,i) then
flag=flag|2^i
end
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
if tp==p then
flag=s.SelectField(tp,1,LOCATION_MZONE,0,flag+0x60)
else
flag=s.SelectField(tp,1,0,LOCATION_MZONE,(flag+0x60)<<16)>>16
end
return s.GetControl(tg,p,rphase,rcount,flag,...)
end
function Duel.SelectDisableField(p,count,sl,ol,filter)
if tp==p then
return s.SelectDisableField(tp,count,sl,ol,filter)
else
return s.SelectDisableField(tp,count,ol,sl,filter)
end
end
function Duel.SelectField(p,count,sl,ol,filter)
if tp==p then
return s.SelectField(tp,count,sl,ol,filter)
else
return s.SelectField(tp,count,ol,sl,filter)
end
end
function Duel.SelectEffectYesNo(sp,...) return s.SelectEffectYesNo(tp,...) end
function Duel.SelectYesNo(sp,desc) return s.SelectYesNo(tp,desc) end
......@@ -1030,7 +1159,16 @@ function s.mindcontrol(e,tp)
ge0:SetTargetRange(0,LOCATION_HAND)
ge0:SetTarget(function() return s.Control_Mode end)
Duel.RegisterEffect(ge0,tp)
Duel.ConfirmCards(tp,Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_EXTRA+LOCATION_REMOVED+LOCATION_DECK+LOCATION_ONFIELD,nil),true)
--local hintcard=Duel.CreateToken(tp,id+1)
local sge=Effect.CreateEffect(e:GetHandler())
sge:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
sge:SetCode(EVENT_FREE_CHAIN)
sge:SetCondition(s.setactcon)
sge:SetOperation(s.setactop)
Duel.RegisterEffect(sge,tp)
Duel.ConfirmCards(tp,Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_EXTRA+LOCATION_REMOVED+LOCATION_ONFIELD+LOCATION_DECK,nil),true)
--Summon
local e1=Effect.GlobalEffect()
e1:SetDescription(aux.Stringid(id+1,10))
......@@ -1071,13 +1209,25 @@ function s.mindcontrol(e,tp)
ge3:SetTargetRange(0,LOCATION_SZONE)
ge3:SetLabelObject(e3)
Duel.RegisterEffect(ge3,tp)
s.controltable={ge0,ge1,ge2,ge3}
--SSet
local e4=Effect.GlobalEffect()
e4:SetDescription(1153)
e4:SetType(EFFECT_TYPE_IGNITION+EFFECT_TYPE_CONTINUOUS)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_BOTH_SIDE)
e4:SetRange(LOCATION_HAND)
e4:SetCondition(s.ssetcon)
e4:SetOperation(s.ssetactivate)
local ge4=Effect.GlobalEffect()
ge4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
ge4:SetTargetRange(0,LOCATION_HAND)
ge4:SetLabelObject(e4)
Duel.RegisterEffect(ge4,tp)
s.controltable={sge,ge0,ge1,ge2,ge3,ge4}
if not KOISHI_CHECK then return end
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
local xg=Duel.GetOverlayGroup(0,0x7f,0x7f)
g:Merge(xg)
for tc in aux.Next(g) do
local cm=_G["c"..tc:GetOriginalCode()]
if not cm.Is_Add_Effect_Id then
......@@ -1088,14 +1238,14 @@ function s.mindcontrol(e,tp)
Card.RegisterEffect=function(card,effect,...)
if effect and s.Control_Mode then
if effect:GetType()&EFFECT_TYPE_GRANT~=0 then
local labeff=s.change_effect(effect:GetLabelObject(),c,tp)
local labeff=s.change_effect(effect:GetLabelObject(),card,tp)
if labeff~=0 then
local eff=effect:Clone()
eff:SetLabelObject(labeff)
_CReg(card,eff,...)
end
else
local eff=s.change_effect(effect,c,tp)
local eff=s.change_effect(effect,card,tp)
if eff~=0 then
_CReg(card,eff,...)
end
......@@ -1131,6 +1281,11 @@ function s.mindcontrol(e,tp)
Duel.SpecialSummon=s.SpecialSummon
Duel.SpecialSummonStep=s.SpecialSummonStep
Duel.MoveToField=s.MoveToField
Duel.SSet=s.SSet
Duel.GetControl=s.GetControl
Duel.SelectDisableField=s.SelectDisableField
Duel.SelectField=s.SelectField
Duel.SelectEffectYesNo=s.SelectEffectYesNo
Duel.SelectYesNo=s.SelectYesNo
......@@ -1144,7 +1299,6 @@ function s.mindcontrol(e,tp)
Duel.ConfirmCards=s.ConfirmCards
Duel.Hint=s.Hint
for _,eff in ipairs(s.controltable) do
eff:Reset()
end
......@@ -1370,35 +1524,162 @@ function s.pspop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(sg,SUMMON_TYPE_PENDULUM,tp,tp,true,true,POS_FACEUP)
e:Reset()
end
function s.atarget(e,c)
return c==e:GetHandler()
end
function s.sumop(e,tp,eg,ep,ev,re,r,rp)
if eg then s.sumgroup:Merge(eg) end
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_END)
ge1:SetLabelObject(s.sumgroup)
ge1:SetOperation(s.sumresetop)
Duel.RegisterEffect(ge1,0)
end
function s.sumsop(e,tp,eg,ep,ev,re,r,rp)
if eg then s.sumsgroup:Merge(eg) end
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAIN_END)
ge1:SetLabelObject(s.sumsgroup)
ge1:SetOperation(s.sumresetop)
Duel.RegisterEffect(ge1,0)
end
function s.sumresetop(e,tp,eg,ep,ev,re,r,rp)
e:GetLabelObject():Clear()
e:Reset()
end
function s.ssetcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return s.Control_Mode and tp~=e:GetHandler():GetOwner() and c:IsSSetable()
end
function s.ssetactivate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tep=c:GetControler()
if c:IsSSetable() then
Duel.SSet(tep,c,tep,false)
end
end
function s.setactfilter(c)
local ae=c:GetActivateEffect()
local ph=Duel.GetCurrentPhase()
return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2 or c:IsType(TYPE_QUICKPLAY+TYPE_TRAP)) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsFacedown() and ae and ae:IsActivatable(c:GetControler(),false,false)
end
function s.setactcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.setactfilter,tp,0,LOCATION_SZONE,1,nil)
end
function s.setactop(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(s.setactfilter,tp,0,LOCATION_SZONE,nil)
if sg:GetCount()==0 then return end
local tc=sg:Select(tp,1,1,nil):GetFirst()
local effect=tc:GetActivateEffect()
local eff=effect:Clone()
local code=tc:GetOriginalCode()
if eff and aux.GetValueType(eff)=="Effect"then
eff:SetProperty(effect:GetProperty()|EFFECT_FLAG_SET_AVAILABLE)
eff:SetRange(LOCATION_SZONE)
eff:SetDescription(aux.Stringid(id+1,9))
eff:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
eff:SetCode(id+code)
eff:SetCountLimit(1)
eff:SetCost(s.addeffcost(effect))
eff:SetCondition(s.addeffcon(effect))
eff:SetTarget(s.addefftg(effect))
eff:SetOperation(s.addeffop(effect))
eff:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_CHAIN)
tc:RegisterEffect(eff,true)
end
Duel.ChangePosition(tc,POS_FACEUP)
Duel.RaiseSingleEvent(tc,id+code,re,r,1-tp,1-tp,ev)
end
function s.change_effect(effect,c,mp)
local cardtype=c:GetType()
local eff=Effect.CreateEffect(c)
eff:SetDescription(aux.Stringid(id+1,9))
eff:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_QUICK_O)
eff:SetProperty(EFFECT_FLAG_BOTH_SIDE)
eff:SetCountLimit(1,EFFECT_COUNT_CODE_CHAIN)
eff:SetLabelObject(effect)
eff:SetLabel(mp)
eff:SetCondition(s.mindcon)
if effect:GetType()&EFFECT_TYPE_IGNITION~=0 then
eff:SetRange(effect:GetRange())
eff:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_IGNITION)
eff:SetTarget(s.mindtg)
return eff
elseif effect:GetType()&EFFECT_TYPE_QUICK_O~=0 then
eff:SetCode(EVENT_FREE_CHAIN)
eff:SetRange(effect:GetRange())
eff:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_QUICK_O)
eff:SetTarget(s.mindtg2)
return eff
elseif effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 and not c:IsType(TYPE_MONSTER) then
eff:SetCondition(s.mindcon2)
eff:SetRange(LOCATION_HAND+LOCATION_SZONE)
if cardtype&(TYPE_QUICKPLAY+TYPE_TRAP)~=0 then
eff:SetCode(EVENT_FREE_CHAIN)
eff:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_QUICK_O)
eff:SetTarget(s.mindtg2)
else
eff:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_IGNITION)
eff:SetTarget(s.mindtg)
end
return eff
else
return 0
end
end
function s.mindcon(e,tp)
local effect=e:GetLabelObject()
local mp=e:GetLabel()
local c=e:GetHandler()
local tep=c:GetControler()
return s.Control_Mode and tp~=tep and tp==mp and effect:IsActivatable(tep,false,false)
end
function s.mindcon2(e,tp)
local effect=e:GetLabelObject()
local c=e:GetHandler()
local mp=e:GetLabel()
local tep=c:GetControler()
Duel.DisableActionCheck(true)
local dc=Duel.CreateToken(tep,effect:GetHandler():GetOriginalCode())
local res=dc:GetActivateEffect():IsActivatable(tep,false,false)
Duel.DisableActionCheck(false)
return s.Control_Mode and (c:IsFacedown() or not c:IsLocation(LOCATION_SZONE)) and tp~=tep and tp==mp and res
end
function s.addeffcost(effect)
return function (e,tp,eg,ep,ev,re,r,rp,chk,...)
local cost=effect:GetCost()
local c=e:GetHandler()
local tep=c:GetControler()
if effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 then
e:SetType(EFFECT_TYPE_ACTIVATE)
if chk==0 then
return (c:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tep,LOCATION_SZONE)>0 or c:IsLocation(LOCATION_SZONE) and c:IsFacedown()) and tp~=tep and (not cost or cost(e,tep,eg,ep,ev,re,r,rp,chk,...))
return (not c:IsLocation(LOCATION_HAND) or Duel.GetLocationCount(tp,LOCATION_SZONE)>0) and (not cost or cost(e,tp,eg,ep,ev,re,r,rp,chk,...))
else
--e:SetType(effect:GetType())
--e:SetCode(effect:GetCode())
if c:IsLocation(LOCATION_SZONE) then Duel.ChangePosition(c,POS_FACEUP) end
if c:IsLocation(LOCATION_HAND) then Duel.MoveToField(c,tp,tep,LOCATION_SZONE,POS_FACEUP,true) end
if cost then cost(e,tep,eg,ep,ev,re,r,rp,chk,...) end
if c:IsLocation(LOCATION_HAND) then Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end
if cost then cost(e,tp,eg,ep,ev,re,r,rp,chk,...) end
end
else
if chk==0 then
return (not cost or cost(e,tep,eg,ep,ev,re,r,rp,chk,...))
return (not cost or cost(e,tp,eg,ep,ev,re,r,rp,chk,...))
else
if cost then cost(e,tep,eg,ep,ev,re,r,rp,chk,...) end
--e:SetType(effect:GetType())
--e:SetCode(effect:GetCode())
if cost then cost(e,tp,eg,ep,ev,re,r,rp,chk,...) end
end
end
end
end
function s.addeffcon(effect,mp)
function s.addeffcon(effect)
return function (e,tp,...)
local con=effect:GetCondition()
local c=e:GetHandler()
local tep=c:GetControler()
return tp~=tep and (not con or con(e,tep,...))
return not con or con(e,tp,...)
end
end
function s.addefftg(effect)
......@@ -1407,58 +1688,102 @@ function s.addefftg(effect)
local c=e:GetHandler()
local tep=c:GetControler()
if chk==0 then
return (not tg or tg(e,tep,eg,ep,ev,re,r,rp,chk,...))
return (not tg or tg(e,tp,eg,ep,ev,re,r,rp,chk,...))
else
if tg then tg(e,tep,eg,ep,ev,re,r,rp,chk,...) end
if tg then tg(e,tp,eg,ep,ev,re,r,rp,chk,...) end
end
end
end
function s.addeffop(effect)
return function (e,tp,eg,ep,ev,...)
return function (e,tp,eg,ep,ev,re,r,rp,...)
local op=effect:GetOperation()
local c=e:GetHandler()
local tep=c:GetControler()
if effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 and c:GetType()&(TYPE_FIELD+TYPE_CONTINUOUS+TYPE_EQUIP)==0 then e:GetHandler():CancelToGrave(false) end
if op then op(e,tep,eg,ep,ev,...) end
--e:SetType(effect:GetType())
if effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 and c:GetType()&(TYPE_FIELD+TYPE_CONTINUOUS+TYPE_EQUIP)==0 then c:CancelToGrave(false) end
if op then op(e,tp,eg,ep,ev,re,r,rp,...) end
end
end
function s.change_effect(effect,c,mp)
function s.mindtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local effect=e:GetLabelObject()
local eff=effect:Clone()
local etype=EFFECT_TYPE_IGNITION+EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_QUICK_O
if effect:GetType()&etype~=0 then
local mp=e:GetLabel()
local c=effect:GetHandler()
local code=c:GetOriginalCode()
if eff and aux.GetValueType(eff)=="Effect"then
if effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 then
eff:SetProperty(effect:GetProperty()|EFFECT_FLAG_BOTH_SIDE|EFFECT_FLAG_SET_AVAILABLE)
eff:SetRange(LOCATION_HAND+LOCATION_SZONE)
end
eff:SetDescription(aux.Stringid(id+1,9))
eff:SetProperty(effect:GetProperty()|EFFECT_FLAG_BOTH_SIDE|EFFECT_FLAG_EVENT_PLAYER)
eff:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
eff:SetCode(id+code)
eff:SetCountLimit(1)
eff:SetCost(s.addeffcost(effect))
eff:SetCondition(s.addeffcon(effect,mp))
eff:SetCondition(s.addeffcon(effect))
eff:SetTarget(s.addefftg(effect))
eff:SetOperation(s.addeffop(effect))
return eff
elseif effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 and not c:IsType(TYPE_MONSTER) then
eff:SetDescription(aux.Stringid(id+1,9))
if c and (c:IsType(TYPE_TRAP) or c:IsType(TYPE_QUICKPLAY)) then
eff:SetType(EFFECT_TYPE_QUICK_O)
eff:SetCode(EVENT_FREE_CHAIN)
else
eff:SetType(EFFECT_TYPE_IGNITION)
end
eff:SetReset(RESET_CHAIN)
c:RegisterEffect(eff,true)
end
local erg=Group.CreateGroup()
local fre=Effect.GlobalEffect()
local feg=Group.CreateGroup()
local ftp=1-tp
Duel.RaiseEvent(feg,id+code,fre,r,frp,frp,ev)
end
function s.mindtg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local effect=e:GetLabelObject()
local eff=effect:Clone()
local mp=e:GetLabel()
local c=effect:GetHandler()
local code=c:GetOriginalCode()
if eff and aux.GetValueType(eff)=="Effect"then
if effect:GetType()&EFFECT_TYPE_ACTIVATE~=0 then
eff:SetProperty(effect:GetProperty()|EFFECT_FLAG_BOTH_SIDE|EFFECT_FLAG_SET_AVAILABLE)
eff:SetRange(LOCATION_HAND+LOCATION_SZONE)
eff:SetProperty(effect:GetProperty()|EFFECT_FLAG_BOTH_SIDE|EFFECT_FLAG_SET_AVAILABLE|EFFECT_FLAG_EVENT_PLAYER)
end
eff:SetDescription(aux.Stringid(id+1,9))
eff:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
eff:SetCode(id+code)
eff:SetCountLimit(1)
eff:SetCost(s.addeffcost(effect))
eff:SetCondition(s.addeffcon(effect,mp))
eff:SetCondition(s.addeffcon(effect))
eff:SetTarget(s.addefftg(effect))
eff:SetOperation(s.addeffop(effect))
return eff
else
return 0
end
eff:SetReset(RESET_CHAIN)
c:RegisterEffect(eff,true)
local eff2=eff:Clone()
eff2:SetType(EFFECT_TYPE_QUICK_F)
eff2:SetCode(EVENT_CHAINING)
eff2:SetRange(effect:GetRange())
c:RegisterEffect(eff2,true)
end
local erg=Group.CreateGroup()
local fre=Effect.GlobalEffect()
local feg=Group.CreateGroup()
local ftp=1-tp
local effectcode=effect:GetCode()
if effectcode==EVENT_CHAINING then
fre,ftp=Duel.GetChainInfo(ev-1,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER)
local fc=fre:GetHandler()
feg:AddCard(fc)
end
if effectcode==EVENT_SUMMON or effectcode==EVENT_FLIP_SUMMON or effectcode==EVENT_SPSUMMON then
feg:Merge(s.sumgroup)
end
if effectcode==EVENT_SUMMON_SUCCESS or effectcode==EVENT_FLIP_SUMMON_SUCCESS or effectcode==EVENT_SPSUMMON_SUCCESS then
feg:Merge(s.sumsgroup)
end
Duel.RaiseEvent(feg,id+code,fre,r,frp,frp,ev)
end
function s.wildop()
s.Wild_Mode=not s.Wild_Mode
local g=Duel.GetFieldGroup(0,0x7f,0x7f)
local xg=Duel.GetFieldGroup(0,0x4d,0x4d)
for xc in aux.Next(xg) do
g:Merge(xc:GetOverlayGroup())
end
local xg=Duel.GetOverlayGroup(0,0x7f,0x7f)
g:Merge(xg)
if s.Wild_Mode then
Debug.Message("歼灭模式 开")
s.SetCountLimit=Effect.SetCountLimit
......
--地中族邪界兽·阿尔沃海龙
function c65979995.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(65979995,1))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,65979995)
e1:SetTarget(c65979995.thtg)
e1:SetOperation(c65979995.thop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(65979995,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END)
e2:SetRange(LOCATION_HAND)
e2:SetCost(c65979995.cost)
e2:SetCondition(c65979995.spcon)
e2:SetTarget(c65979995.sptg)
e2:SetOperation(c65979995.spop)
c:RegisterEffect(e2)
--effect gain
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(65979995,2))
e3:SetCategory(CATEGORY_POSITION)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_CHAIN_SOLVED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c65979995.poscon)
e3:SetTarget(c65979995.postg)
e3:SetOperation(c65979995.posop)
c:RegisterEffect(e3)
--local e4=Effect.CreateEffect(c)
--e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT)
--e4:SetRange(LOCATION_MZONE)
--e4:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
--e4:SetTarget(c65979995.eftg)
--e4:SetLabelObject(e3)
--c:RegisterEffect(e4)
end
function c65979995.thfilter(c)
return c:IsSetCard(0x10ed) and not c:IsCode(65979995) and c:IsAbleToHand()
end
function c65979995.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c65979995.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c65979995.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c65979995.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c65979995.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(65979995)==0 end
c:RegisterFlagEffect(65979995,RESET_CHAIN,0,1)
end
function c65979995.spcon(e,tp,eg,ep,ev,re,r,rp)
if not (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2) then return false end
return not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil)
end
function c65979995.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil)
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c65979995.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
function c65979995.eftg(e,c)
return c:IsType(TYPE_EFFECT) and c:IsSetCard(0x10ed) and e:GetHandler()~=c
end
function c65979995.poscon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp
end
function c65979995.filter(c)
return c:IsSetCard(0xed) and c:IsFaceup() and c:IsCanTurnSet()
end
function c65979995.postg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c65979995.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,0,0)
end
function c65979995.posop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectMatchingCard(tp,c65979995.filter,tp,LOCATION_MZONE,0,1,99,nil)
if g:GetCount()>0 then
local fid=e:GetHandler():GetFieldID()
Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE)
local tc=g:GetFirst()
while tc do
tc:RegisterFlagEffect(65979995,RESET_EVENT+RESETS_STANDARD,0,1,fid)
tc=g:GetNext()
end
g:KeepAlive()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(g)
e1:SetCondition(c65979995.poscon2)
e1:SetOperation(c65979995.posop2)
Duel.RegisterEffect(e1,tp)
end
end
--function c65979995.poscon(e,tp,eg,ep,ev,re,r,rp)
-- return rp==1-tp
--end
--function c65979995.postg(e,tp,eg,ep,ev,re,r,rp,chk)
-- local c=e:GetHandler()
-- if chk==0 then return c:IsCanTurnSet() end
-- Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0)
--end
--function c65979995.posop(e,tp,eg,ep,ev,re,r,rp)
-- local c=e:GetHandler()
-- if c:IsRelateToEffect(e) and c:IsFaceup() then
-- Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE)
-- end
-- local e1=Effect.CreateEffect(e:GetHandler())
-- e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
-- e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
-- e1:SetCode(EVENT_CHAINING)
-- e1:SetCountLimit(1)
-- e1:SetLabel(fid)
-- e1:SetLabelObject(g)
-- e1:SetCondition(c65979995.poscon)
-- e1:SetOperation(c65979995.posop2)
-- Duel.RegisterEffect(e1,tp)
--end
--function c65979995.filter(c)
-- return c:IsSetCard(0x10ed) and c:IsFacedown()
--end
--function c65979995.posop2(e,tp,eg,ep,ev,re,r,rp)
-- Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
-- local g=Duel.SelectMatchingCard(tp,c65979995.filter,tp,LOCATION_MZONE,0,1,1,nil)
-- local tc=g:GetFirst()
-- if tc then
-- Duel.Hint(HINT_CARD,0,e:GetHandler():GetOriginalCodeRule())
-- Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)
-- Duel.AdjustInstantly()
-- end
-- e:Reset()
--end
function c65979995.posfilter(c,fid)
return c:GetFlagEffectLabel(65979995)==fid and c:IsPosition(POS_FACEDOWN)
end
function c65979995.poscon2(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if g then
else
e:Reset()
g:DeleteGroup()
return false
end
if g:GetCount()~=0 then
else
e:Reset()
g:DeleteGroup()
return false
end
if not g:IsExists(c65979995.posfilter,1,nil,e:GetLabel()) then
g:DeleteGroup()
e:Reset()
return false
else return rp==1-tp end
end
function c65979995.posop2(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local tg=g:Filter(c65979995.posfilter,nil,e:GetLabel())
g:DeleteGroup()
Duel.Hint(HINT_CARD,0,65979995)
Duel.ChangePosition(tg,POS_FACEUP_DEFENSE)
e:Reset()
end
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