Commit 39c58053 authored by Nemo Ma's avatar Nemo Ma

add

parent b8cdd324
No preview for this file type
--Confusione Totale - Ritiro
--Scripted by: XGlitchy30
local s,id=GetID()
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetCondition(s.condition)
e1:SetOperation(s.activate)
e1:SetHintTiming(TIMING_END_PHASE,0)
c:RegisterEffect(e1)
if not s.global_check then
s.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_TO_GRAVE)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function s.cfilter(c,tp)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_HAND)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
for p=0,1 do
local ct=eg:FilterCount(s.cfilter,nil,p)
if ct>0 then
for i=1,ct do
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1)
end
end
end
if Duel.GetFlagEffect(tp,id+100)<=0 then
Duel.RegisterFlagEffect(tp,id+100,RESET_PHASE+PHASE_END,0,1,0)
end
local saved_levels = Duel.GetFlagEffectLabel(tp,id+100)
local incr_lv=0
for tc in aux.Next(eg) do
if tc:HasLevel() then
local lv=tc:GetLevel()
if saved_levels&(2^lv)==0 and incr_lv&(2^lv)==0 then
incr_lv = incr_lv + (2^lv)
end
end
end
Duel.UpdateFlagEffectLabel(tp,id+100,incr_lv)
end
function s.condition(e,tp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_END and Duel.GetFlagEffect(1-tp,id)>=2
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(1-tp,id)<2 then return false end
local c=e:GetHandler()
local rct = Duel.GetTurnPlayer()~=tp and 1 or 2
local saved_levels = Duel.GetFlagEffectLabel(tp,id+100)
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ALL,LOCATION_ALL)
e1:SetTarget(s.distg)
e1:SetLabel(saved_levels)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e1,tp)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetTargetRange(0,1)
e2:SetValue(s.aclimit)
e2:SetLabel(saved_levels)
e2:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e2,tp)
--
if Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
local lp=Duel.GetLP(tp)
Duel.SetLP(tp,math.ceil(lp/2))
if math.abs(Duel.GetLP(tp)*2 - lp)<=1 then
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,3))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(s.damcon)
e3:SetOperation(s.damop)
e3:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e3,tp)
end
end
end
function s.distg(e,c)
local saved_levels = e:GetLabel()
return c:HasLevel() and saved_levels&(2^c:GetLevel())~=0
end
function s.aclimit(e,re,tp)
local saved_levels = e:GetLabel()
local rc=re:GetHandler()
return re:IsActiveType(TYPE_MONSTER) and rc and rc:HasLevel() and saved_levels&(2^rc:GetLevel())~=0
end
function s.df(c,tp)
return c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()~=tp
end
function s.damcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.df,1,nil,tp)
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,id)
local ct=eg:FilterCount(s.df,nil,tp)
Duel.Damage(1-tp,ct*1000,REASON_EFFECT)
end
\ No newline at end of file
--Confusione Totale - Confidenza
--Scripted by: XGlitchy30
local s,id=GetID()
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,2))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetCondition(s.condition)
e1:SetOperation(s.activate)
e1:SetHintTiming(TIMING_END_PHASE,0)
c:RegisterEffect(e1)
if not s.global_check then
s.global_check=true
Duel.RegisterFlagEffect(0,GLITCHY_ENABLE_TEST_CHAMBER,0,0,1)
end
end
function s.condition(e,tp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_END and Duel.GetLP(tp)-Duel.GetLP(1-tp)>=3000
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLP(tp)-Duel.GetLP(1-tp)<3000 then return false end
local c=e:GetHandler()
local rct = Duel.GetTurnPlayer()~=tp and 1 or 2
--immune
local g1=Effect.CreateEffect(c)
g1:SetDescription(aux.Stringid(id,3))
g1:SetType(EFFECT_TYPE_FIELD)
g1:SetCode(EFFECT_IMMUNE_EFFECT)
g1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT)
g1:SetTargetRange(LOCATION_ONFIELD,0)
g1:SetValue(s.efilter)
g1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(g1,tp)
local g2=Effect.CreateEffect(c)
g2:SetDescription(aux.Stringid(id,4))
g2:SetType(EFFECT_TYPE_FIELD)
g2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
g2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT)
g2:SetTargetRange(LOCATION_ONFIELD,0)
g2:SetValue(1)
g2:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(g2,tp)
--change targeting player
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,5))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_GLITCHY_CHANGE_TARGETING_PLAYER)
e1:SetTargetRange(1,0)
e1:SetValue(s.changetg)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e1,tp)
--opponent chooses search targers
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,6))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e2:SetCode(EFFECT_UTTER_CONFUSION_CONFIDENCE)
e2:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e2,tp)
--opponent chooses attack targets
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,7))
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_PATRICIAN_OF_DARKNESS)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e3:SetTargetRange(1,0)
e2:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e3,tp)
end
function s.efilter(e,te,c)
return te:GetOwner()~=c
end
function s.changetg(e,re,rp)
return re:IsActivated() and rp and rp==e:GetOwnerPlayer()
end
\ No newline at end of file
--Confusione Totale - Determinazione
--Scripted by: XGlitchy30
local s,id=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetCondition(s.condition)
e1:SetOperation(s.activate)
e1:SetHintTiming(TIMING_END_PHASE,0)
c:RegisterEffect(e1)
if not s.global_check then
s.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_DESTROYED)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function s.cfilter(c,tp)
return c:IsPreviousControler(tp)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
for p=0,1 do
local ct=eg:FilterCount(s.cfilter,nil,p)
if ct>0 then
for i=1,ct do
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,1)
end
end
end
end
function s.condition(e,tp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_END and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetFlagEffect(tp,id)>=2
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0 or Duel.GetFlagEffect(tp,id)<2 then return false end
local c=e:GetHandler()
local rct = Duel.GetTurnPlayer()~=tp and 1 or 2
local rct2 = Duel.GetTurnPlayer()==tp and 1 or 2
--
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_REVERSE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetTargetRange(1,0)
e1:SetValue(s.rev)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e1,tp)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,2))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_MUST_ATTACK)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetLabel(Duel.GetTurnCount()+rct2)
e2:SetCondition(s.con)
e2:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct2)
Duel.RegisterEffect(e2,tp)
--
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,3))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_BATTLE_START)
e3:SetCountLimit(1)
e3:SetLabel(Duel.GetTurnCount()+1)
e3:SetCondition(s.btcon)
e3:SetOperation(s.btop)
e3:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e3,tp)
end
function s.rev(e,re,r,rp,rc)
return bit.band(r,REASON_BATTLE)~=0
end
function s.con(e)
local tp=e:GetOwnerPlayer()
return Duel.GetTurnPlayer()==1-tp and Duel.GetTurnCount()==e:GetLabel()
end
function s.btcon(e)
return Duel.GetTurnCount()==e:GetLabel()
end
function s.btop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsExistingMatchingCard(aux.NOT(Card.IsControlerCanBeChanged),tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(1-tp,aux.Stringid(id,4)) then
Duel.Hint(HINT_CARD,tp,id)
local g=Duel.GetMatchingGroup(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,nil)
if not Duel.GetControl(g,tp,0,0,0xff,1-tp) then return end
local ph=Duel.GetCurrentPhase()
if g:FilterCount(Card.IsControler,nil,tp)==#g and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE then
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
end
end
end
\ No newline at end of file
--Confusione Totale - Noia
--Scripted by: XGlitchy30
local s,id=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1)
e1:SetCondition(s.condition)
e1:SetOperation(s.activate)
e1:SetHintTiming(TIMING_END_PHASE,0)
c:RegisterEffect(e1)
end
function s.condition(e,tp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_END and e:GetHandler():IsOnField() and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==1
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsOnField() or Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)~=1 then return false end
local c=e:GetHandler()
local rct = Duel.GetTurnPlayer()~=tp and 1 or 2
local rct2 = Duel.GetTurnPlayer()==tp and 1 or 2
--
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetTargetRange(1,0)
e1:SetValue(s.rev)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,rct)
Duel.RegisterEffect(e1,tp)
--
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetCountLimit(1)
e3:SetLabel(Duel.GetTurnCount()+rct2)
e3:SetCondition(s.btcon)
e3:SetOperation(s.btop)
e3:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,rct2)
Duel.RegisterEffect(e3,tp)
end
function s.rev(e,re,dam,r)
if bit.band(r,REASON_BATTLE+REASON_EFFECT)~=0 then
return math.floor(dam/2)
else return dam end
end
function s.btcon(e,tp)
return Duel.GetTurnPlayer()==1-tp and Duel.GetTurnCount()==e:GetLabel()
end
function s.filter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsControlerCanBeChanged() or not c:IsLocation(LOCATION_MZONE) and c:IsAbleToChangeControler()
end
function s.backrow(c)
return c:IsLocation(LOCATION_SZONE) and c:GetSequence()<5
end
function s.btop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)
if Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 and Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_ONFIELD,math.ceil(ct/2),nil) then
Duel.Hint(HINT_CARD,tp,id)
local g=Duel.SelectMatchingCard(1-tp,s.filter,tp,0,LOCATION_ONFIELD,math.ceil(ct/2),math.ceil(ct/2),nil)
if #g<math.ceil(ct/2) then return end
local monsters=g:Filter(Card.IsLocation,nil,LOCATION_MZONE)
local pendulums=g:Filter(Card.IsLocation,nil,LOCATION_PZONE)
local fieldsp=g:Filter(Card.IsLocation,nil,LOCATION_FZONE)
local backrow=g:Filter(s.backrow,nil)
if #monsters>0 then
Duel.GetControl(monsters,tp,0,0,0xff,1-tp)
end
if #pendulums>0 then
for pc in aux.Next(pendulums) do
Duel.MoveToField(pc,1-tp,tp,LOCATION_PZONE,pc:GetPosition(),true)
end
end
if #fieldsp>0 then
local fc=Duel.GetFieldCard(tp,LOCATION_SZONE,5)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
local pc=fieldsp:GetFirst()
Duel.MoveToField(pc,1-tp,tp,LOCATION_FZONE,pc:GetPosition(),true)
end
if #backrow>0 then
for pc in aux.Next(backrow) do
Duel.MoveToField(pc,1-tp,tp,LOCATION_SZONE,pc:GetPosition(),true)
end
end
end
end
\ No newline at end of file
--Risucchia Confusione - 996ICU
--Scripted by: XGlitchy30
local s,id=GetID()
xpcall(function() require("expansions/script/glitchylib_vsnemo") end,function() require("script/glitchylib_vsnemo") end)
function s.initial_effect(c)
--ss proc
local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(id,0))
e0:SetType(EFFECT_TYPE_FIELD)
e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e0:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e0:SetCondition(s.hspcon)
e0:SetTarget(s.hsptg)
e0:SetOperation(s.hspop)
c:RegisterEffect(e0)
--cannot material
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e1:SetValue(s.matlimit)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e3)
local e4=e1:Clone()
e4:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
c:RegisterEffect(e4)
--tribute protection
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetCode(EFFECT_UNRELEASABLE_SUM)
e5:SetValue(1)
c:RegisterEffect(e5)
local e6=e5:Clone()
e6:SetCode(EFFECT_UNRELEASABLE_NONSUM)
c:RegisterEffect(e6)
--hand traps
local e7=Effect.CreateEffect(c)
e7:SetType(EFFECT_TYPE_FIELD)
e7:SetCode(EFFECT_TRAP_ACT_IN_NTPHAND)
e7:SetRange(LOCATION_MZONE)
e7:SetTarget(s.trapfilter)
e7:SetTargetRange(LOCATION_HAND,0)
c:RegisterEffect(e7)
--apply effects
local e8=Effect.CreateEffect(c)
e8:SetDescription(aux.Stringid(id,1))
e8:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e8:SetCode(EVENT_SUMMON_SUCCESS)
e8:SetTarget(s.target)
e8:SetOperation(s.operation)
c:RegisterEffect(e8)
local e8x=e8:Clone()
e8x:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e8x)
local e8y=e8:Clone()
e8y:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e8y)
if not s.global_check then
s.global_check=true
s.resolution_tracker={}
s.resolution_count=0
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetOperation(s.regop)
Duel.RegisterEffect(e2,0)
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
if not re:GetHandler():IsCode(table.unpack(ARCHE_UTTER_CONFUSION)) or not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
local cid=re:GetHandler():GetCode()
if not s.resolution_tracker[cid] then
s.resolution_tracker[cid]=true
s.resolution_count = s.resolution_count + 1
end
end
function s.spfilter(c)
return c:IsCode(table.unpack(ARCHE_UTTER_CONFUSION)) and c:IsAbleToRemoveAsCost()
end
function s.mzonechk_g(g,tp)
return g:IsExists(s.mzonechk,1,nil,tp)
end
function s.mzonechk(g,tp)
return Duel.GetMZoneCount(tp,c)>0
end
function s.hspcon(e,c)
if c==nil then return true end
local eff={c:IsHasEffect(EFFECT_NECRO_VALLEY)}
for _,ce in ipairs(eff) do
if ce and aux.GetValueType(ce)=="Effect" and ce.GetLabel then
local op=ce:GetOperation()
if not op or op(e,c) then return false end
end
end
local tp=c:GetControler()
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,c)
return rg:CheckSubGroup(s.mzonechk_g,2,2,tp)
end
function s.hsptg(e,tp,eg,ep,ev,re,r,rp,c)
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,c)
local g=rg:SelectSubGroup(tp,s.mzonechk_g,true,2,2,tp)
if #g<2 then return false end
g:KeepAlive()
e:SetLabelObject(g)
return true
end
function s.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
if not g then return end
Duel.Remove(g,POS_FACEUP,REASON_COST)
g:DeleteGroup()
end
function s.matlimit(e,c)
if not c then return false end
return c:IsLocation(LOCATION_EXTRA)
end
function s.trapfilter(e,c)
return c:GetType()==0x4 and c:IsCode(table.unpack(ARCHE_UTTER_CONFUSION))
end
function s.df(c,e)
return c:IsOnField() or c:IsDestructable(e)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ct=s.resolution_count
if ct>=4 then
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
if ct>=7 then
local g=Duel.GetMatchingGroup(s.df,tp,0,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA,nil,e)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=s.resolution_count
if ct>=2 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ADJUST)
e1:SetLabel(e:GetFieldID())
e1:SetOperation(s.chkop)
Duel.RegisterEffect(e1,tp)
ct=s.resolution_count
Duel.RegisterFlagEffect(1-tp,id,0,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2))
Duel.BreakEffect()
end
if ct>=4 then
Duel.Damage(1-tp,Duel.GetLP(1-tp),REASON_EFFECT)
ct=s.resolution_count
Duel.BreakEffect()
end
if ct>=7 then
local g=Duel.GetMatchingGroup(s.df,tp,0,LOCATION_ONFIELD+LOCATION_HAND+LOCATION_DECK+LOCATION_EXTRA,nil,e)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
end
function s.notflag(c,lab)
return c:IsFaceup() and (c:GetFlagEffect(id)==0 or c:GetFlagEffectLabel(id)~=lab)
end
function s.chkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(s.notflag,tp,0,LOCATION_MZONE,nil,e:GetLabel())
if #g<=0 then return end
local dg=Group.CreateGroup()
for tc in aux.Next(g) do
local preatk,predef=tc:GetAttack(),tc:GetDefense()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-2000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
tc:RegisterEffect(e2)
tc:RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD,0,1,e:GetLabel())
if preatk~=0 and not tc:IsImmuneToEffect(e1) and tc:GetAttack()==0 and predef~=0 and not tc:IsImmuneToEffect(e2) and tc:GetDefense()==0 then
dg:AddCard(tc)
end
end
if #dg>0 then
for tc in aux.Next(dg) do
Duel.Negate(tc,e)
end
Duel.Readjust()
end
dg:DeleteGroup()
end
\ No newline at end of file
This diff is collapsed.
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