diff --git a/unofficial/c511027561.lua b/unofficial/c511027561.lua new file mode 100644 index 0000000000..1176c52a1a --- /dev/null +++ b/unofficial/c511027561.lua @@ -0,0 +1,104 @@ +--海晶乙女の決意マリンセス・デシジョン +--Marincess Decision +--Made by When +local s,id=GetID() +function s.initial_effect(c) + --Activate + local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_POSITION+CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) + e1:SetCost(s.cost) + e1:SetTarget(s.target) + e1:SetOperation(s.activate) + c:RegisterEffect(e1) + --Reduce ATK + local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_ATKCHANGE) + e2:SetType(EFFECT_TYPE_QUICK_O) + e2:SetCode(EVENT_FREE_CHAIN) + e2:SetRange(LOCATION_GRAVE) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetCost(s.atkcost) + e2:SetTarget(s.atktg) + e2:SetOperation(s.atkop) + c:RegisterEffect(e2) +end +s.listed_series={0x12b} +function s.atkfilter(c) + return c:IsSetCard(0x12b) and c:IsMonster() and c:IsAbleToRemoveAsCost() +end +function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) + and Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_GRAVE,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local g=Duel.SelectMatchingCard(tp,s.atkfilter,tp,LOCATION_GRAVE,0,1,1,nil) + e:SetLabel(g:GetFirst():GetTextAttack()) + g:AddCard(e:GetHandler()) + Duel.Remove(g,POS_FACEUP,REASON_COST) +end +function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end + if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) + Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) +end +function s.atkop(e,tp,eg,ep,ev,re,r,rp) + local c=e:GetHandler() + local tc=Duel.GetFirstTarget() + if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_UPDATE_ATTACK) + e1:SetValue(-e:GetLabel()) + e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_END) + tc:RegisterEffect(e1) + end +end +function s.linkfilter(c,mc,fg) + return c:IsLinkSummonable(mc,fg+mc) +end +function s.cfilter(c) + return c:IsSetCard(0x12b) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) +end +function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) + Duel.Remove(g,POS_FACEUP,REASON_COST) +end +function s.filter(c,tp,fg) + return c:IsFacedown() and c:IsDefensePos() and c:IsCanBeLinkMaterial() and c:IsCanChangePosition() + and Duel.IsExistingMatchingCard(s.linkfilter,tp,LOCATION_EXTRA,0,1,nil,c,fg) +end +function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + local fg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeLinkMaterial),tp,LOCATION_MZONE,0,nil) + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc,chkc:GetControler(),fg) end + if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,tp,fg) and Duel.IsPlayerCanSpecialSummonCount(tp,1) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWNDEFENSE) + local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,tp,fg) + Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) +end +function s.activate(e,tp,eg,ep,ev,re,r,rp) + local tc=Duel.GetFirstTarget() + if tc and tc:IsRelateToEffect(e) and tc:IsFacedown() then + if Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)~=0 then + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_CANNOT_TRIGGER) + e1:SetReset(RESET_EVENT+RESETS_STANDARD) + tc:RegisterEffect(e1) + local fg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeLinkMaterial),tp,LOCATION_MZONE,0,nil) + local tg=Duel.GetMatchingGroup(s.linkfilter,tp,LOCATION_EXTRA,0,nil,tc,fg) + if #tg>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local sg=tg:Select(tp,1,1,nil) + local sc=sg:GetFirst() + Duel.LinkSummon(tp,sc,tc,nil) + end + end + end +end