Commit 44ac56b2 authored by VanillaSalt's avatar VanillaSalt

fix

parent d673efd7
......@@ -18,13 +18,18 @@ function c43175858.initial_effect(c)
c:RegisterEffect(e2)
--cannot be target
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e3:SetRange(LOCATION_FZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_TOON))
e3:SetValue(c43175858.tgval)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(43175858)
c:RegisterEffect(e3)
if not c43175858.global_check then
c43175858.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD)
ge1:SetCode(EFFECT_CANNOT_SELECT_EFFECT_TARGET)
ge1:SetProperty(EFFECT_FLAG_IGNORE_RANGE)
ge1:SetValue(c43175858.etarget)
Duel.RegisterEffect(ge1,0)
end
--destroy replace
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -33,9 +38,6 @@ function c43175858.initial_effect(c)
e4:SetTarget(c43175858.reptg)
e4:SetValue(c43175858.repval)
c:RegisterEffect(e4)
local g=Group.CreateGroup()
g:KeepAlive()
e4:SetLabelObject(g)
end
function c43175858.target(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetDecktopGroup(tp,3)
......@@ -51,34 +53,27 @@ function c43175858.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.DisableShuffleCheck()
Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT)
end
function c43175858.tgval(e,re,rp)
return rp~=e:GetHandlerPlayer()
function c43175858.etarget(e,re,c)
local rp=re:GetHandlerPlayer()
local fc=Duel.GetFieldCard(1-rp,LOCATION_SZONE,5)
return fc and fc:IsFaceup() and fc:IsHasEffect(43175858)
and c:IsFaceup() and c:IsControler(1-rp) and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_TOON)
end
function c43175858.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
and c:IsType(TYPE_TOON) and c:IsReason(REASON_BATTLE+REASON_EFFECT)
end
function c43175858.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c43175858.repfilter,1,nil,tp) and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end
local ct1=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
local ct=eg:FilterCount(c43175858.repfilter,nil,tp)
local g=Duel.GetDecktopGroup(tp,ct)
if chk==0 then return g:IsExists(Card.IsAbleToRemove,ct,nil) end
if Duel.SelectYesNo(tp,aux.Stringid(43175858,0)) then
local g=eg:Filter(c43175858.repfilter,nil,tp)
local cg=nil
if g:GetCount()==1 then
cg=g
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
cg=g:Select(tp,1,ct1,nil)
end
e:GetLabelObject():Clear()
e:GetLabelObject():Merge(cg)
local dg=Duel.GetDecktopGroup(tp,cg:GetCount())
local dg=Duel.GetDecktopGroup(tp,ct)
Duel.DisableShuffleCheck()
Duel.Remove(dg,POS_FACEDOWN,REASON_EFFECT)
return true
else return false end
end
function c43175858.repval(e,c)
local g=e:GetLabelObject()
return g:IsContains(c)
return c43175858.repfilter(c,e:GetHandlerPlayer())
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