Commit 03fceae4 authored by nekrozar's avatar nekrozar Committed by DailyShana

eratta (#824)

parent 92bc5f25
...@@ -3,29 +3,23 @@ function c21502796.initial_effect(c) ...@@ -3,29 +3,23 @@ function c21502796.initial_effect(c)
--flip --flip
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(21502796,0)) e1:SetDescription(aux.Stringid(21502796,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DESTROY) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP)
e1:SetTarget(c21502796.target) e1:SetTarget(c21502796.target)
e1:SetOperation(c21502796.operation) e1:SetOperation(c21502796.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c21502796.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c21502796.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsOnField() end
if chk==0 then return true end if chk==0 then return true end
if Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(21502796,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3) Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3)
end end
function c21502796.operation(e,tp,eg,ep,ev,re,r,rp) function c21502796.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if tc and tc:IsRelateToEffect(e) then if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(21502796,1)) then
Duel.Destroy(tc,REASON_EFFECT) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
Duel.BreakEffect() local sg=g:Select(tp,1,1,nil)
Duel.HintSelection(sg)
Duel.Destroy(sg,REASON_EFFECT)
end end
Duel.DiscardDeck(tp,3,REASON_EFFECT) Duel.DiscardDeck(tp,3,REASON_EFFECT)
end end
...@@ -6,13 +6,14 @@ function c78010363.initial_effect(c) ...@@ -6,13 +6,14 @@ function c78010363.initial_effect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_TO_GRAVE) e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,78010363)
e1:SetCondition(c78010363.condition) e1:SetCondition(c78010363.condition)
e1:SetTarget(c78010363.target) e1:SetTarget(c78010363.target)
e1:SetOperation(c78010363.operation) e1:SetOperation(c78010363.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c78010363.condition(e,tp,eg,ep,ev,re,r,rp) function c78010363.condition(e,tp,eg,ep,ev,re,r,rp)
return bit.band(e:GetHandler():GetPreviousLocation(),LOCATION_ONFIELD)>0 return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end end
function c78010363.target(e,tp,eg,ep,ev,re,r,rp,chk) function c78010363.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
...@@ -27,5 +28,21 @@ function c78010363.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -27,5 +28,21 @@ function c78010363.operation(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
local tc=g:GetFirst()
if tc:IsLocation(LOCATION_HAND) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c78010363.aclimit)
e1:SetLabelObject(tc)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end end
end end
function c78010363.aclimit(e,re,tp)
local tc=e:GetLabelObject()
return re:GetHandler():IsCode(tc:GetCode()) and not re:GetHandler():IsImmuneToEffect(e)
end
...@@ -28,6 +28,6 @@ end ...@@ -28,6 +28,6 @@ end
function c80168720.activate(e,tp,eg,ep,ev,re,r,rp) function c80168720.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.ChangePosition(tc,POS_FACEDOWN_ATTACK,0,POS_FACEDOWN_DEFENSE,0) Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE)
end end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment