--Number P658: Shinobi Toad xpcall(function() require("expansions/script/bannedlist") end,function() require("script/bannedlist") end) function c249001082.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(82670878,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_CUSTOM+249001082) e1:SetRange(LOCATION_HAND) e1:SetCondition(c249001082.condition) e1:SetTarget(c249001082.target) e1:SetOperation(c249001082.operation) c:RegisterEffect(e1) --atk down local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(31833038,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetHintTiming(TIMING_DAMAGE_STEP+TIMING_END_PHASE) e2:SetCountLimit(3) e2:SetCondition(aux.dscon) e2:SetTarget(c249001082.atktg) e2:SetOperation(c249001082.atkop) c:RegisterEffect(e2) --change race local e3=Effect.CreateEffect(c) e3:SetDescription(563) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(c249001082.racetg) e3:SetOperation(c249001082.raceop) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetDescription(2) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PHASE+PHASE_BATTLE) e4:SetRange(LOCATION_MZONE) e4:SetCondition(c249001082.spcon) e4:SetTarget(c249001082.sptg) e4:SetOperation(c249001082.spop) c:RegisterEffect(e4) --immune local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e6:SetRange(LOCATION_MZONE) e6:SetCode(EFFECT_IMMUNE_EFFECT) e6:SetValue(c249001082.efilter) c:RegisterEffect(e6) if not c249001082.global_check then c249001082.global_check=true c249001082[0]=0 c249001082[1]=0 local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_ATTACK_ANNOUNCE) ge1:SetOperation(c249001082.check) Duel.RegisterEffect(ge1,0) local ge2=Effect.CreateEffect(c) ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge2:SetCode(EVENT_ATTACK_DISABLED) ge2:SetOperation(c249001082.check2) Duel.RegisterEffect(ge2,0) local ge3=Effect.CreateEffect(c) ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge3:SetCode(EVENT_PHASE_START+PHASE_DRAW) ge3:SetOperation(c249001082.clear) Duel.RegisterEffect(ge3,0) end end function c249001082.check(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if Duel.GetAttackTarget()==nil then c249001082[1-tc:GetControler()]=c249001082[1-tc:GetControler()]+1 if c249001082[1-tc:GetControler()]==1 then c249001082[2]=tc tc:RegisterFlagEffect(249001082,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1) elseif c249001082[1-tc:GetControler()]==2 then Duel.RaiseEvent(tc,EVENT_CUSTOM+249001082,e,0,0,0,0) end end end function c249001082.check2(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if tc:GetFlagEffect(249001082)~=0 and Duel.GetAttackTarget()~=nil then c249001082[1-tc:GetControler()]=c249001082[1-tc:GetControler()]-1 end end function c249001082.clear(e,tp,eg,ep,ev,re,r,rp) c249001082[0]=0 c249001082[1]=0 end function c249001082.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp and Duel.GetAttackTarget()==nil and c249001082[tp]==2 end function c249001082.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c249001082.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function c249001082.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function c249001082.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(-400) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end function c249001082.racetg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) local race=Duel.AnnounceRace(tp,1,RACE_ALL-e:GetHandler():GetRace()) e:SetLabel(race) end function c249001082.raceop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) e1:SetValue(e:GetLabel()) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_DISABLE) c:RegisterEffect(e1) end end function c249001082.spfilter(c) return c:IsSetCard(0xC048) and c:IsType(TYPE_MONSTER) end function c249001082.spcon(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c249001082.filter1,tp,LOCATION_GRAVE,0,nil) local ct=g:GetClassCount(Card.GetCode) return e:GetHandler():GetBattledGroupCount()>0 and ct>1 end function c249001082.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) and Duel.IsPlayerCanSpecialSummonMonster(tp,249001083,0xC048,TYPE_MONSTER+TYPE_XYZ+TYPE_EFFECT,2600,1300,7,RACE_AQUA,ATTRIBUTE_WATER) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and not banned_list_table[249001083] end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c249001082.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not aux.MustMaterialCheck(c,tp,EFFECT_MUST_BE_XMATERIAL) then return end if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsControler(tp) and not c:IsImmuneToEffect(e) then local sc=Duel.CreateToken(tp,249001083) Duel.SendtoDeck(sc,nil,0,REASON_RULE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if sc and sc:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 then local mg=c:GetOverlayGroup() if mg:GetCount()~=0 then Duel.Overlay(sc,mg) end sc:SetMaterial(Group.FromCards(c)) Duel.Overlay(sc,Group.FromCards(c)) Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,true,false,POS_FACEUP) sc:CompleteProcedure() end end end function c249001082.efilter(e,te) return te:IsActiveType(TYPE_MONSTER) and te:GetHandler():IsRace(e:GetHandler():GetRace()) and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end