--Heroic Champion Masamune function c249001047.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),4,3) c:EnableReviveLimit() c:SetSPSummonOnce(249001047) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c249001047.sptg) e1:SetOperation(c249001047.spop) c:RegisterEffect(e1) --immune to spells/traps local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetCondition(c249001047.imcon) e2:SetValue(c249001047.efilter) c:RegisterEffect(e2) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(56921677,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_BATTLED) e4:SetTarget(c249001047.destg) e4:SetOperation(c249001047.desop) c:RegisterEffect(e4) end function c249001047.filter(c,e,tp) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x6F) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c249001047.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c249001047.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c249001047.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c249001047.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c249001047.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) local g1=c:GetOverlayGroup() if tc:IsType(TYPE_XYZ) and g1:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(47660516,0)) local mg2=g1:Select(tp,1,1,nil) local oc=mg2:GetFirst() Duel.Overlay(tc,mg2) Duel.RaiseSingleEvent(oc,EVENT_DETACH_MATERIAL,e,0,0,0,0) end end end function c249001047.imcon(e) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,0x6F) end function c249001047.efilter(e,te) return (te:IsActiveType(TYPE_SPELL) or te:IsActiveType(TYPE_TRAP)) and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function c249001047.desfilter(c) return c:IsFaceup() and c:IsSetCard(0x6F) end function c249001047.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chk==0 then local ct=Duel.GetMatchingGroupCount(c249001047.descfilter,tp,LOCATION_MZONE,0,nil) e:SetLabel(ct) return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end local ct=e:GetLabel() local sg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,ct,0,0) end function c249001047.desop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(c249001047.descfilter,tp,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_ONFIELD,nil) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,ct,nil) Duel.HintSelection(sg) Duel.Destroy(sg,REASON_EFFECT) end end