--赤月之少年 local m=33701429 local cm=_G["c"..m] function cm.initial_effect(c) --xyz summon aux.AddXyzProcedureLevelFree(c,aux.FilterBoolFunction(Card.IsRace,RACE_PSYCHO),aux.TRUE,100) c:EnableReviveLimit() --special summon rule local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_EXTRA) e1:SetValue(SUMMON_TYPE_XYZ) e1:SetCondition(cm.sprcon) e1:SetOperation(cm.sprop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) c:RegisterEffect(e2) --damage conversion local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_REVERSE_DAMAGE) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetValue(cm.rev) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DAMAGE+CATEGORY_SEARCH+CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCost(cm.thcost) e4:SetTarget(cm.thtg) e4:SetOperation(cm.thop) c:RegisterEffect(e4) end function cm.sprfilter(c) return c:IsCanBeXyzMaterial(nil) and c:IsCode(33701424) and not c:IsPublic() end function cm.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_HAND,0,nil) return g:GetCount()>0 end function cm.sprop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.GetMatchingGroup(cm.sprfilter,tp,LOCATION_HAND,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local mg=Duel.SelectMatchingCard(tp,cm.sprfilter,tp,LOCATION_HAND,0,3,3,nil) Duel.ConfirmCards(1-tp,mg) c:SetMaterial(mg) Duel.Overlay(c,mg) end function cm.rev(e,re,r,rp,rc) local c=e:GetHandler() return bit.band(r,REASON_BATTLE)~=0 and (c==Duel.GetAttacker() or c==Duel.GetAttackTarget()) end function cm.thcost(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 cm.thfilter(c) return c:IsSetCard(0x9449) and c:IsAbleToHand() end function cm.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function cm.thop(e,tp,eg,ep,ev,re,r,rp) local lp=Duel.GetLP(tp) local m=math.floor(math.min(lp,8000)/2000) local t={} for i=1,m do t[i]=i*2000 end local ac=Duel.AnnounceNumber(tp,table.unpack(t)) local ct=math.floor(Duel.Damage(tp,ac,REASON_EFFECT)/2000) if ct>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,ct,ct,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end local tc=g:GetFirst() while tc do if tc:IsLocation(LOCATION_HAND) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(cm.aclimit) e1:SetLabel(tc:GetCode()) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end tc=g:GetNext() end end end function cm.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabel()) end