--Proto-Summoner 千早 function c33700030.initial_effect(c) aux.EnablePendulumAttribute(c) --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(33700004,0)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCategory(CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCost(c33700030.cost) e1:SetTarget(c33700030.target) e1:SetOperation(c33700030.operation) c:RegisterEffect(e1) --summon with no tribute local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(33700030,0)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SUMMON_PROC) e2:SetValue(1) e2:SetCondition(c33700030.ntcon) e2:SetOperation(c33700030.ntop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetDescription(aux.Stringid(33700030,1)) e3:SetCode(EFFECT_SET_PROC) c:RegisterEffect(e3) --equip local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(33700030,2)) e4:SetCategory(CATEGORY_EQUIP) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE) e4:SetCondition(c33700030.eqcon) e4:SetTarget(c33700030.eqtg) e4:SetOperation(c33700030.eqop) c:RegisterEffect(e4) --destroy local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(33700030,3)) e5:SetCategory(CATEGORY_DESTROY) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1,EFFECT_COUNT_CODE_SINGLE) e5:SetCost(c33700030.descost) e5:SetTarget(c33700030.destg) e5:SetOperation(c33700030.desop) c:RegisterEffect(e5) --destroy2 local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(33700030,4)) e6:SetCategory(CATEGORY_DESTROY) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_BATTLE_START) e6:SetCondition(c33700030.bacon) e6:SetTarget(c33700030.batg) e6:SetOperation(c33700030.baop) c:RegisterEffect(e6) -- local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e7:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e7:SetCode(EVENT_SUMMON_SUCCESS) e7:SetCondition(c33700030.valcon) e7:SetOperation(c33700030.valop) c:RegisterEffect(e7) end function c33700030.costfilter(c,tp) return c:IsControler(tp) and c:IsSetCard(0x6440) end function c33700030.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,c33700030.costfilter,1,nil,tp) end local g=Duel.SelectReleaseGroup(tp,c33700030.costfilter,1,1,nil,tp) local atk=g:GetFirst():GetAttack() local def=g:GetFirst():GetDefense() if atk>def then e:SetLabel(atk) else e:SetLabel(def) end Duel.Release(g,REASON_COST) end function c33700030.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(e:GetLabel()) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,e:GetLabel()) e:SetLabel(0) end function c33700030.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end function c33700030.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:GetLevel()>4 and Duel.GetMZoneCount(c:GetControler())>0 end function c33700030.ntop(e,tp,eg,ep,ev,re,r,rp,c) --change base attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT+0xff0000) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(c:GetBaseAttack()/2) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(c:GetBaseDefense()/2) c:RegisterEffect(e2) end function c33700030.valcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonType(SUMMON_TYPE_NORMAL)+1 end function c33700030.valop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESET_EVENT+0x1fe0000) e:GetHandler():RegisterEffect(e1) end function c33700030.eqcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=e:GetLabelObject() return ec==nil or ec:GetFlagEffect(33700030)==0 end function c33700030.eqfilter(c,tp) return c:IsFacedown() and (c:IsControler(tp) or c:IsAbleToChangeControler()) end function c33700030.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and c33700030.eqfilter(chkc,tp) end if chk==0 then return (ft>0 and Duel.IsExistingTarget(c33700030.eqfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil,tp))or (ft<=0 and Duel.IsExistingTarget(c33700030.eqfilter,tp,0,LOCATION_SZONE,1,nil,tp)) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,c33700030.eqfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) end function c33700030.eqlimit(e,c) return e:GetOwner()==c end function c33700030.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if c:IsFaceup() and c:IsRelateToEffect(e) then if not Duel.Equip(tp,tc,c,false) then return end --Add Equip limit tc:RegisterFlagEffect(33700030,RESET_EVENT+0x1fe0000,0,0) e:SetLabelObject(tc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetValue(c33700030.eqlimit) tc:RegisterEffect(e1) else Duel.SendtoGrave(tc,REASON_EFFECT) end end end function c33700030.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetEquipGroup():IsExists(Card.IsAbleToGraveAsCost,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=c:GetEquipGroup():FilterSelect(tp,Card.IsAbleToGraveAsCost,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c33700030.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,PLAYER_ALL,LOCATION_ONFIELD) end function c33700030.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if g:GetCount()>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function c33700030.bacon(e) local eg=e:GetHandler():GetEquipGroup() return eg:GetCount()>0 end function c33700030.batg(e,tp,eg,ep,ev,re,r,rp,chk) local tc=e:GetHandler():GetBattleTarget() if chk==0 then return tc and tc:IsDestructable() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0) end function c33700030.baop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetBattleTarget() if tc:IsRelateToBattle() and Duel.Destroy(tc,REASON_EFFECT)>0 then local eg=e:GetHandler():GetEquipGroup() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=eg:FilterSelect(tp,Card.IsAbleToGrave,1,1,nil) Duel.SendtoGrave(g,REASON_EFFECT) end end