--D/D/D Archfiend Emperor's Right Hand function c155300.initial_effect(c) --Synchro Summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_FIEND),aux.NonTuner(Card.IsRace,RACE_FIEND),1) c:EnableReviveLimit() --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(155300,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c155300.condition) e1:SetTarget(c155300.target) e1:SetOperation(c155300.activate) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,155300) e2:SetCost(c155300.descost) e2:SetTarget(c155300.destg) e2:SetOperation(c155300.desop) c:RegisterEffect(e2) --Change Damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CHANGE_DAMAGE) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetValue(c155300.val) c:RegisterEffect(e3) end function c155300.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO end function c155300.filter(c,tp) return (c:IsSetCard(0xAE) and c:IsType(TYPE_CONTINUOUS)) or (c:IsCode(94585852)) or (c:IsCode(63883999)) and c:GetActivateEffect():IsActivatable(tp) end function c155300.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c155300.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,tp) end end function c155300.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.SelectMatchingCard(tp,c155300.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil) if g:GetCount()>0 and not g:GetFirst():IsHasEffect(EFFECT_NECRO_VALLEY) then local tc=g:GetFirst() Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) local te=tc:GetActivateEffect() local tep=tc:GetControler() local cost=te:GetCost() if cost then cost(te,tep,eg,ep,ev,re,r,rp,1) end Duel.RaiseEvent(tc,EVENT_CHAIN_SOLVED,te,0,tp,tp,Duel.GetCurrentChain()) end end function c155300.rfilter(c) return c:IsSetCard(0x45) and c:IsAbleToRemoveAsCost() end function c155300.dfilter(c) return c:IsDestructable() end function c155300.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c155300.rfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c155300.rfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function c155300.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(c155300.dfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if g:GetCount()>0 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end end function c155300.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c155300.dfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,2,nil) Duel.Destroy(sg,REASON_EFFECT) end end function c155300.val(e,re,dam,r,rp,rc) if bit.band(r,REASON_EFFECT)~=0 then return dam/2 else return dam end end