Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions unofficial/c511003244.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
--バッド・エンド・クイーン・ドラゴン (Anime)
--Dragon Queen of Tragic Endings (Anime)
--Scripted by The Razgriz
local s,id=GetID()
function s.initial_effect(c)
--Cannot be Normal Summoned/Set
c:EnableUnsummonable()
--When this attacking monster inflicts battle damage, your opponent sends 1 card from their hand to the GY and you draw 1 card
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_HANDES+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(s.handesdrawcon)
e1:SetTarget(s.handesdrawtg)
e1:SetOperation(s.handesdrawop)
c:RegisterEffect(e1)
--Special Summon this card from your GY by sending 1 Continuous Spell from your field to the GY
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end)
e2:SetCost(s.spcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.handesdrawcon(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp and Duel.GetAttacker()==e:GetHandler()
end
function s.handesdrawtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function s.handesdrawop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 and Duel.IsPlayerCanDraw(tp,1) and Duel.DiscardHand(1-tp,nil,1,1,REASON_EFFECT)>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(aux.AND(Card.IsFaceup,Card.IsContinuousSpell,Card.IsAbleToGraveAsCost),tp,LOCATION_ONFIELD,0,nil)
if chk==0 then return #g>0 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=Duel.SelectMatchingCard(tp,aux.AND(Card.IsFaceup,Card.IsContinuousSpell,Card.IsAbleToGraveAsCost),tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SendtoGrave(sg,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_GRAVE)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end