Commit 89bf8109 authored by nanahira's avatar nanahira

fix

parent 40a228b4
......@@ -58,10 +58,7 @@ function cm.eqlimit(e,c)
return e:GetLabelObject()==c
end
function cm.controlcon(e)
return e:GetLabelObject():GetEquipGroup():FilterCount(cm.flagfilter,nil)>1
end
function cm.flagfilter(c)
return c:GetFlagEffect(m)>0
return e:GetLabelObject():IsHasEffect(m)
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -72,20 +69,45 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and hc:IsFaceup() and hc:IsRelateToEffect(e) and hc:IsControler(1-tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local oc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.filter),tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,tc:GetCode()):GetFirst()
if Duel.Equip(tp,tc,hc) and Duel.Equip(tp,oc,hc) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetValue(cm.eqlimit)
e1:SetLabelObject(hc)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=e1:Clone()
oc:RegisterEffect(e2)
--control
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
oc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,1)
local tcEquipped=false
local ocEquipped=false
if Duel.Equip(tp,tc,hc,true) then
tcEquipped=true
end
if Duel.Equip(tp,oc,hc,true) then
ocEquipped=true
end
if tcEquipped or ocEquipped then
Duel.EquipComplete()
if tcEquipped then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetValue(cm.eqlimit)
e1:SetLabelObject(hc)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
if ocEquipped then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetValue(cm.eqlimit)
e1:SetLabelObject(hc)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
oc:RegisterEffect(e1)
end
end
if tcEquipped and ocEquipped then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(m)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_UNCOPYABLE)
e3:SetValue(tp)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_SET_CONTROL)
......@@ -94,16 +116,12 @@ function cm.activate(e,tp,eg,ep,ev,re,r,rp)
e3:SetLabelObject(hc)
e3:SetValue(tp)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
local e4=e3:Clone()
oc:RegisterEffect(e4)
oc:RegisterEffect(e3)
--code
local e5=e3:Clone()
e5:SetCode(EFFECT_ADD_SETCODE)
e5:SetValue(code)
tc:RegisterEffect(e5)
local e6=e5:Clone()
oc:RegisterEffect(e6)
oc:RegisterEffect(e5)
end
end
end
......@@ -123,8 +141,3 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
end
end
--yl_testok
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