Skip to content
Open
Show file tree
Hide file tree
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
59 changes: 22 additions & 37 deletions official/c18486927.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@
--Ancient Gear Gadget
local s,id=GetID()
function s.initial_effect(c)
--declare card
--If this card is Normal or Special Summoned: You can declare 1 card type (Monster, Spell, or Trap); this turn, if your monster attacks, your opponent cannot activate Spell/Trap Cards or monster effects (whichever was declared) until the end of the Damage Step
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(s.dectg)
e1:SetOperation(s.decop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
--name change
--Once per turn: You can declare 1 "Gadget" monster's card name; until the End Phase, this card's name becomes that name
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
Expand All @@ -27,59 +28,43 @@ s.listed_series={SET_GADGET}
function s.dectg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
e:SetLabel(Duel.SelectOption(tp,70,71,72))
e:GetChainData().choice=Duel.SelectOption(tp,70,71,72)
end
function s.decop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local opt=e:GetLabel()
local ct=nil
if opt==0 then
ct=TYPE_MONSTER
elseif opt==1 then
ct=TYPE_SPELL
else
ct=TYPE_TRAP
end
local e1=Effect.CreateEffect(c)
local cd=e:GetChainData()
local typ=1<<cd.choice
--This turn, if your monster attacks, your opponent cannot activate Spell/Trap Cards or monster effects (whichever was declared) until the end of the Damage Step
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,cd.choice+2))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetLabel(ct)
e1:SetCondition(s.actcon)
e1:SetValue(s.actlimit)
e1:SetCondition(function(e)
local ac=Duel.GetAttacker()
return ac and ac:IsControler(e:GetHandlerPlayer())
end)
e1:SetValue(function(e,re) return re:IsActiveType(typ) and (ct==TYPE_MONSTER or re:IsHasType(EFFECT_TYPE_ACTIVATE)) end)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.actlimit(e,re,tp)
local ct=e:GetLabel()
return re:IsActiveType(ct) and (ct==TYPE_MONSTER or re:IsHasType(EFFECT_TYPE_ACTIVATE))
end
function s.actcon(e)
local tc=Duel.GetAttacker()
local tp=e:GetHandlerPlayer()
return tc and tc:IsControler(tp)
end
function s.nametg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local code=e:GetHandler():GetCode()
--"Gadget" monster, except this card's current name
s.announce_filter={SET_GADGET,OPCODE_ISSETCARD,code,OPCODE_ISCODE,OPCODE_NOT,OPCODE_AND,TYPE_MONSTER,OPCODE_ISTYPE,OPCODE_AND}
local ac=Duel.AnnounceCard(tp,table.unpack(s.announce_filter))
Duel.SetTargetParam(ac)
Duel.SetOperationInfo(0,CATEGORY_ANNOUNCE,nil,0,tp,ANNOUNCE_CARD_FILTER)
Duel.AnnounceCard(tp,DF.IsType(TYPE_MONSTER) & DF.IsSetCard(SET_GADGET) & ~DF.IsCode(code))
end
function s.nameop(e,tp,eg,ep,ev,re,r,rp)
local ac=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local cd=e:GetChainData()
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
--Until the End Phase, this card's name becomes that name
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(ac)
e1:SetValue(cd.announced_card)
e1:SetReset(RESETS_STANDARD_PHASE_END)
c:RegisterEffect(e1)
end
end
end
124 changes: 51 additions & 73 deletions official/c18631392.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,44 @@
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1)
--special summon
c:AddMustBeSpecialSummoned()
--Must be Special Summoned (from your hand) by sending 1 LIGHT Dragon-Type monster and 1 LIGHT Fairy-Type monster you control to the Graveyard, and cannot be Special Summoned by other ways
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetRange(LOCATION_HAND)
e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
--announce 3 cards
--Once per turn: You can declare 3 card names; excavate the top 3 cards of your Deck, add any of them that you named to your hand, also send the remaining cards to the Graveyard
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DECKDES+CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(s.anctg)
e3:SetTarget(s.exctg)
e3:SetOperation(s.excop)
c:RegisterEffect(e3)
end
function s.rescon(sg,e,tp,mg)
return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:IsExists(s.atchk1,1,nil,sg)
return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:GetBinClassCount(Card.GetRace)==2
end
function s.atchk1(c,sg)
return c:IsRace(RACE_FAIRY) and sg:FilterCount(Card.IsRace,c,RACE_DRAGON)==1
end
function s.spfilter(c,rac)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(rac) and c:IsAbleToGraveAsCost()
function s.spfilter(c,race)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY|RACE_DRAGON) and c:IsAbleToGraveAsCost()
end
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local rg1=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil,RACE_FAIRY)
local rg2=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil,RACE_DRAGON)
local rg=rg1:Clone()
rg:Merge(rg2)
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and #rg1>0 and #rg2>0
and aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,0)
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil)
return aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,0)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,c)
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil,RACE_FAIRY|RACE_DRAGON)
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil)
local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,1,tp,HINTMSG_TOGRAVE)
if #g>0 then
g:KeepAlive()
e:SetLabelObject(g)
return true
end
Expand All @@ -63,55 +50,46 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
if not g then return end
Duel.SendtoGrave(g,REASON_COST)
g:DeleteGroup()
end
function s.anctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if not Duel.IsPlayerCanDiscardDeck(tp,3) then return false end
local g=Duel.GetDecktopGroup(tp,3)
return g:FilterCount(Card.IsAbleToHand,nil)>0
function s.exctg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3)
and Duel.GetDecktopGroup(tp,3):IsExists(Card.IsAbleToHand,1,nil) end
local codes={}
for i=1,3 do
table.insert(codes,Duel.AnnounceCard(tp,DF.IsMainDeckCard()))
end
s.announce_filter={TYPE_EXTRA,OPCODE_ISTYPE,OPCODE_NOT}
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac1=Duel.AnnounceCard(tp,table.unpack(s.announce_filter))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac2=Duel.AnnounceCard(tp,table.unpack(s.announce_filter))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
local ac3=Duel.AnnounceCard(tp,table.unpack(s.announce_filter))
e:SetOperation(s.retop(ac1,ac2,ac3))
e:GetChainData().announced_card=codes
end
function s.thfilter(c,...)
return c:IsCode(...) and c:IsAbleToHand()
end
function s.hfilter(c,code1,code2,code3)
return c:IsCode(code1,code2,code3) and c:IsAbleToHand()
function s.excop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanDiscardDeck(tp,3) then return end
local cd=e:GetChainData()
Duel.ConfirmDecktop(tp,3)
local g=Duel.GetDecktopGroup(tp,3)
local hg,gg=g:Split(s.thfilter,nil,table.unpack(cd.announced_card))
if #hg>0 then
Duel.DisableShuffleCheck()
Duel.SendtoHand(hg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,hg)
Duel.ShuffleHand(tp)
end
if #gg>0 then
Duel.DisableShuffleCheck()
Duel.SendtoGrave(gg,REASON_EFFECT|REASON_EXCAVATE)
end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
--This card's ATK and DEF each become equal to the number of cards added to your hand by this effect x 1000
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(#hg*1000)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
c:RegisterEffect(e2)
end
end
function s.retop(code1,code2,code3)
return
function (e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsPlayerCanDiscardDeck(tp,3) then return end
local c=e:GetHandler()
Duel.ConfirmDecktop(tp,3)
local g=Duel.GetDecktopGroup(tp,3)
local hg=g:Filter(s.hfilter,nil,code1,code2,code3)
g:Sub(hg)
if #hg~=0 then
Duel.DisableShuffleCheck()
Duel.SendtoHand(hg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,hg)
Duel.ShuffleHand(tp)
end
if #g~=0 then
Duel.DisableShuffleCheck()
Duel.SendtoGrave(g,REASON_EFFECT|REASON_EXCAVATE)
end
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(#hg*1000)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
c:RegisterEffect(e2)
end
end
end
25 changes: 14 additions & 11 deletions official/c50078320.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
--Engraver of the Mark
local s,id=GetID()
function s.initial_effect(c)
--Declare 1 other card name
--When your opponent activates a card or effect by declaring exactly 1 card name (Quick Effect): You can send this card from your hand to the GY; declare 1 other card name.
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
Expand All @@ -12,7 +12,7 @@ function s.initial_effect(c)
e1:SetCost(Cost.SelfToGrave)
e1:SetOperation(s.declop)
c:RegisterEffect(e1)
--Destroy 1 face-up card on the field during the End Phase of the next turn
--Once per turn (Quick Effect): You can target 1 face-up card on the field; destroy it during the End Phase of the next turn
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DESTROY)
Expand All @@ -27,19 +27,22 @@ function s.initial_effect(c)
c:RegisterEffect(e2)
end
function s.declcon(e,tp,eg,ep,ev,re,r,rp)
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_ANNOUNCE)
return rp==1-tp and ex and (cv&ANNOUNCE_CARD+ANNOUNCE_CARD_FILTER)~=0
local ac=re:GetChainData(ev).announced_card
return rp==1-tp and ac and (type(ac)=="number" or #ac==1)
end
function s.declop(e,tp,eg,ep,ev,re,r,rp)
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_ANNOUNCE)
local ac=0
local rcd=re:GetChainData(ev)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE)
if (cv&ANNOUNCE_CARD)~=0 then
ac=Duel.AnnounceCard(tp,cv)
if rcd.announce_filter then
local announce_filter=type(rcd.announce_filter)=="function"
and rcd.announce_filter(e,tp,eg,ep,ev,re,r,rp)
or rcd.announce_filter
--can't exclude the announced name since we can't guarantee there'll be a declarable name left,
--and having a card declaration prompt with no valid options leads to a soft lock
rcd.announced_card=Duel.AnnounceCard(tp,announce_filter)
else
ac=Duel.AnnounceCard(tp,table.unpack(re:GetHandler().announce_filter))
rcd.announced_card=Duel.AnnounceCard(tp,~DF.IsCode(rcd.announced_card))
end
Duel.ChangeTargetParam(ev,ac)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsFaceup() end
Expand All @@ -62,4 +65,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp)
nil,2,aux.Stringid(id,2)
)
end
end
end
Loading