--Dorein Giardiniera delle Rose --Scripted by: XGlitchy30 local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e1:SetCondition(s.damcon) e1:SetCost(s.damcost) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.damchk(1000)) e3:SetCost(s.damcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --negate local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_NEGATE) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.negcon) e4:SetCost(s.negcost) e4:SetTarget(s.negtg) e4:SetOperation(s.negop) c:RegisterEffect(e4) --replace local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,3)) e5:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_DESTROY_REPLACE) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(s.damchk(3000)) e5:SetTarget(s.reptg) e5:SetValue(s.repval) c:RegisterEffect(e5) --count damage if not s.global_check then s.global_check=true s[0]=0 s[1]=0 local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DAMAGE) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) end function s.chainfilter(re,tp,cid) return re:GetHandler():IsSetCard(0xd04) or not re:IsHasCategory(CATEGORY_DAMAGE) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if bit.band(r,REASON_EFFECT)~=0 and rp==1-ep then s[rp]=s[rp]+ev end end function s.damchk(val) return function(e,tp,eg,ep,ev,re,r,rp) if not tp then tp=e:GetHandlerPlayer() end return s[tp]>=val end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(1-tp)>=3000 end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) end function s.aclimit(e,re,tp) return not s.chainfilter(re,tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLP(1-tp)<3000 then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.filter(c,e,tp) return c:IsSetCard(0xd04) and c:GetType()&0x21==0x21 and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.negcon(e,tp,eg,ep,ev,re,r,rp) return s.damchk(2000)(e,tp) and re:IsActiveType(TYPE_ST) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) end function s.negcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.damcost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) s.damcost(e,tp,eg,ep,ev,re,r,rp,1) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateActivation(ev) end function s.repfilter(c,tp) return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0xd04) and c:IsType(TYPE_MONSTER) and c:IsReason(REASON_BATTLE+REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) return true end return false end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end