--created by Jake, coded by Lyris --Il Reclutamento di una Bestia Bushido local s,id,o=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:Desc(0) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.ffilter(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsSetCard(0x4b0) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function s.mfilter1(c) return c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial() and c:IsAbleToRemove() end function s.mfilter2(c,e) return c:IsAbleToRemove() and not c:IsImmuneToEffect(e) end function s.filter(c,e,tp) return c:IsLevel(4) and c:IsSetCard(0x4b0) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(Card.IsAbleToRemove,nil)+Duel.GetMatchingGroup(s.mfilter1,tp,LOCATION_GRAVE,0,nil) local b1=Duel.IsExistingMatchingCard(s.ffilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) if not b1 then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg2=fgroup(ce,e,tp) local mf=ce:GetValue() b1=Duel.IsExistingMatchingCard(s.ffilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf) end end local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,2,nil,e,tp) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) if chk==0 then return b1 or b2 end local off=1 local ops={} local opval={} if b1 then ops[off]=1169 opval[off-1]=1 off=off+1 end if b2 then ops[off]=1152 opval[off-1]=2 off=off+1 end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EFFECT) local op=Duel.SelectOption(tp,table.unpack(ops)) if opval[op]==1 then e:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e:SetLabel(1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) elseif opval[op]==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) e:SetLabel(2) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND+LOCATION_GRAVE) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local opt=e:GetLabel() if opt==1 then s.fsum(e,tp,eg,ep,ev,re,r,rp) elseif opt==2 then s.ssum(e,tp,eg,ep,ev,re,r,rp) end end function s.fsum(e,tp,eg,ep,ev,re,r,rp) local chkf=tp local mg1=Duel.GetFusionMaterial(tp):Filter(s.mfilter2,nil,e)+Duel.GetMatchingGroup(s.mfilter1,tp,LOCATION_GRAVE,0,nil) local sg1=Duel.GetMatchingGroup(s.ffilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local mg2=nil local sg2=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg2=fgroup(ce,e,tp) local mf=ce:GetValue() sg2=Duel.GetMatchingGroup(s.ffilter,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf) end if #sg1>0 or (sg2~=nil and #sg2>0) then local sg=sg1:Clone() if sg2 then sg:Merge(sg2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) tc:SetMaterial(mat1) Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat2) end tc:CompleteProcedure() end end function s.ssum(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,nil,e,tp) if #g>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,2,2,nil) if #sg>0 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)>0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end end end function s.splimit(e,c) return not (c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) or c:IsSetCard(0x4b0)) end