--Sunhewer of Rhythm, Potem local ref,id=GetID() Duel.LoadScript("Sunhew.lua") function ref.initial_effect(c) aux.AddOrigDriveType(c) --Drive Effects aux.AddDriveProc(c,3) c:DriveEffect(0,0,CATEGORY_SPECIAL_SUMMON+CATEGORY_SEARCH,EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O,EFFECT_FLAG_DELAY,EVENT_ENGAGE, nil, nil, ref.sstg, ref.ssop ) local d1=c:DriveEffect(0,0,0,EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS,nil,EVENT_SUMMON_SUCCESS,nil,nil,nil, ref.regop) c:DriveEffect(0,0,0,EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS,nil,EVENT_SPSUMMON_SUCCESS,nil,nil,nil,ref.regop) c:DriveEffect(0,0,0,EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS,nil,EVENT_FLIP_SUMMON_SUCCESS,nil,nil,nil,ref.regop) ----Monster Effects --Seal local e3=Effect.CreateEffect(c) e3:Desc(1) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:HOPT() e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_DRAW_PHASE+TIMING_TOHAND) e3:SetCondition(function(e) local c=e:GetHandler() return c:IsSummonType(SUMMON_TYPE_DRIVE) or c:IsSummonType(SUMMON_TYPE_NORMAL) end) e3:SetTarget(ref.nultg) e3:SetOperation(ref.nulop) c:RegisterEffect(e3) --Swap Hand local e4=Effect.CreateEffect(c) e4:Desc(2) e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_GRAVE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:HOPT() e4:SetCost(ref.thcost) e4:SetTarget(ref.thtg) e4:SetOperation(ref.thop) c:RegisterEffect(e4) end function ref.regop(e,tp,eg,rp,ev,re,r,rp) local c=e:GetHandler() if not (rp==tp) then return end local oen=c:GetEnergy() local en=math.min(eg:GetCount(),6-oen) if en>0 then c:UpdateEnergy(en,tp,REASON_EFFECT,true) end end --Summon function ref.ssfilter(c,e,tp) return Sunhew.Is(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) end function ref.hdfilter(c) return c:IsDiscardable() and c:GetFlagEffect(FLAG_ENGAGE)<1 end function ref.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE>0) and Duel.IsExistingMatchingCard(ref.ssfilter,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(ref.hdfilter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function ref.ssop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,ref.ssfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 and Duel.IsExistingMatchingCard(ref.hdfilter,tp,LOCATION_HAND,0,1,nil) then Duel.BreakEffect() Duel.DiscardHand(tp,ref.hdfilter,1,1,REASON_EFFECT,nil) end end --Ban function ref.nultg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) local ac=Duel.AnnounceCard(tp) Duel.SetTargetParam(ac) Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,0) end function ref.nulop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) c:SetHint(CHINT_CARD,ac) --Cannot Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(0,1) e1:SetValue(ref.limfilter) e1:SetLabel(ac) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) --Cannot Summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e2:SetTargetRange(0,1) e2:SetTarget(ref.splimit) e2:SetLabel(ac) e2:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e2,tp) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) Duel.RegisterEffect(e3,tp) local e4=e2:Clone() e4:SetCode(EFFECT_CANNOT_FLIP_SUMMON) Duel.RegisterEffect(e4,tp) end function ref.limval(e,re,tp) local ac=e:GetLabel() return re:GetHandler():IsCode(ac) and re:IsHasType(EFFECT_TYPE_ACTIVATE) end function ref.splimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsCode(e:GetLabel()) end --Swap Hand function ref.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToDeckAsCost() and Duel.IsExistingMatchingCard(ref.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_COST) end function ref.thfilter(c) return Sunhew.Is(c) and c:IsAbleToHand() end function ref.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(ref.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,ref.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,1,tp,LOCATION_HAND) end function ref.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)~=0 then Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT,nil) end end