ok finished the card here forgot to test the destruction effect but it should work fine
function c45003459.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.XyzFilterFunction(c,5),4)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c45003459.recon)
e1:SetOperation(c45003459.reop)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(c45003459.indes)
c:RegisterEffect(e2)
end
function c45003459.recon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ
and e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode,1,nil,2407234)
end
function c45003459.reop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--effect
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(45003459,1))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCost(c45003459.cost)
e3:SetTarget(c45003459.target)
e3:SetOperation(c45003459.operation)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_ATTACK_ANNOUNCE)
e4:SetCountLimit(1)
e4:SetCondition(c45003459.condition)
e4:SetCost(c45003459.cost)
e4:SetTarget(c45003459.target2)
e4:SetOperation(c45003459.operation2)
c:RegisterEffect(e4)
end
function c45003459.filter(c)
return c:IsFaceup()
end
function c45003459.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c45003459.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c45003459.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c45003459.filter,tp,0,LOCATION_MZONE,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c45003459.filter,tp,0,LOCATION_MZONE,1,1,e:GetHandler())
end
function c45003459.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local atk=tc:GetAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY,2)
c:RegisterEffect(e1)
c:CopyEffect(tc:GetOriginalCode(),RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY,2)
end
end
function c45003459.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
end
function c45003459.filter2(c)
return c:IsDestructable()
end
function c45003459.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c45003459.filter2,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(c45003459.filter2,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c45003459.operation2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c45003459.filter2,tp,0,LOCATION_ONFIELD,nil)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
function c45003459.indes(e,c)
return not c:IsSetCard(0x48)
end
http://www.youtube.com/user/MrTbowd12/videos