Jump to content

YGOPro Scripting Help Thread


Flash Flyer - Sakura

Recommended Posts

If you need technical help with how to code effects in YGOPro, or if your card isn't doing what it's supposed to be doing, this is the place to ask. 

Please provide the following when you do:

 

1. Your code

 

It is advised that you comment your code, so we know what each effect is supposed to be doing. If you have some degree of coding knowledge, this should be standard fare by now.

 

At the moment, it is not possible for members to upload standard .lua files as attachments; just copy/paste the effects from the file and place it in a spoiler tag. It may also help if you mention which cards you tried to copy/paste from (which most of us probably do).

 

2. Card's effect written in standard OCG (basically, what are you trying to do?).

 

If you have a bug in your effect, then this will help us to determine what you may be doing wrong. If you need help with figuring out how to write it in the first place, we can suggest cards that do similar things and have you rip the code from there.

 

Most of the time, YGOPro has suitable cards that you can just borrow code from and replace as needed, but sometimes things may not be available (or you have to combine multiple codes).

 

----

If you've gotten help in this thread, please show appreciation for the member(s) who assisted you.

Link to comment
Share on other sites

Hello, this is a Ygopro custom card scripting related question.


I'm currently running into more problem with the functionality of one of the effects that I'm using for this card. I'm hoping anyone can help me answer or at least help with scripting this effect. Some of the effects below are already finished but feel free to make changes along the way.


 


Effect 1 (done):


When this card attacks a Defense Position monster, if the attack target is a non-LIGHT or a non-DARK monster during the Damage Step, inflict piercing battle damage to your opponent.


(This means if the monster is face-up (regardless if its flipped or not) during damage step, piercing battle damage is applied.)


 


Effect 2 (done):


This card is also treated as a DARK monster.


(self-explanatory)


 


Effect 3 (needs to be fixed):


Once per turn, during your Main Phase 1, you can banish 1 LIGHT and 1 DARK monster from your graveyard; until the end of this turn, this card can attack all monsters your opponent controls, once each. 


(For some reason, when activating the effect, it showed me all the cards in my graveyard and it allows me to banish any 2 cards, not just 1 light and 1 dark. I want the 1 light and 1 dark to be the cost only because we already have piercing from effect 1 and this effect can attack all monsters. I also tried looking at black luster soldier or any similar card but it doesnt quite help me unless i need to dig deeper.)


 


Effect 4 (done):


When this card destroys a monster as a result of battle, this card loses 200 ATK until the End Phase of this turn.


(This effect is almost pretty useless unless you're using effect 3. If anyone has ever played the game "Maplestory" and have made a 4th job Luminous character (I'm not making this card using the real luminous character), you can definitely understand why effect 3 and 4 are linked to each other.)


 


Feel free to comment down below if you know how to script the 3rd effect.  


My script:


--Lumino Voidslayer, Viper

function c20626169.initial_effect©

--Attribute Dark

local e1=Effect.CreateEffect©

e1:SetType(EFFECT_TYPE_SINGLE)

e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)

e1:SetCode(EFFECT_ADD_ATTRIBUTE)

e1:SetRange(LOCATION_MZONE)

e1:SetValue(ATTRIBUTE_DARK)

c:RegisterEffect(e1)

--pierce

local e2=Effect.CreateEffect©

e2:SetType(EFFECT_TYPE_SINGLE)

e2:SetCode(EFFECT_PIERCE)

e2:SetRange(LOCATION_MZONE) 

e2:SetCondition(c20626169.condtion)

c:RegisterEffect(e2)

--atkdown

local e3=Effect.CreateEffect©

e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)

e3:SetCode(EVENT_BATTLE_DESTROYING)

e3:SetOperation(c20626169.atkop)

c:RegisterEffect(e3)

--attack all

local e4=Effect.CreateEffect©

e4:SetType(EFFECT_TYPE_IGNITION)

e4:SetRange(LOCATION_MZONE)

e4:SetCountLimit(1)

e4:SetCost(c20626169.cost)

e4:SetOperation(c20626169.operation)

c:RegisterEffect(e4)

end

function c20626169.costfilter(c,att)

return c:IsAttribute(att) and c:IsAbleToRemoveAsCost()

end

function c20626169.cost(e,tp,eg,ep,ev,re,r,rp,chk)

if chk==0 then return Duel.IsExistingMatchingCard(c20626169.cfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)

and Duel.IsExistingMatchingCard(c20626169.cfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end

Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)

local g=Duel.SelectMatchingCard(tp,c20626169.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)

Duel.Remove(g,POS_FACEUP,REASON_COST)

g=Duel.SelectMatchingCard(tp,c20626169.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)

Duel.Remove(g,POS_FACEUP,REASON_COST)

end

function c20626169.operation(e,tp,eg,ep,ev,re,r,rp)

local c=e:GetHandler()

if c:IsRelateToEffect(e) and c:IsFaceup() then

local e1=Effect.CreateEffect©

e1:SetType(EFFECT_TYPE_SINGLE)

e1:SetCode(EFFECT_ATTACK_ALL)

e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)

e1:SetValue(1)

e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)

c:RegisterEffect(e1)

end

end

function c20626169.atkop(e,tp,eg,ep,ev,re,r,rp)

local c=e:GetHandler()

local e1=Effect.CreateEffect©

e1:SetType(EFFECT_TYPE_SINGLE)

e1:SetCode(EFFECT_UPDATE_ATTACK)

e1:SetValue(-200)

e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)

c:RegisterEffect(e1)

end

 

function c20626169.condtion(e)

local c=e:GetHandler()

local ph=Duel.GetCurrentPhase()

local bc=c:GetBattleTarget()

return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL)

and c:IsRelateToBattle() and bc:IsFaceup() and bc:IsAttribute(ATTRIBUTE_FIRE) or bc:IsAttribute(ATTRIBUTE_WATER) or bc:IsAttribute(ATTRIBUTE_WIND) or bc:IsAttribute(ATTRIBUTE_EARTH) or bc:IsAttribute(ATTRIBUTE_DIVINE) 

end

Link to comment
Share on other sites

Update#2: The cost for effect 4 is resolved but when i click on the card again, it shows me i can activate it even though i dont have the required cards in my graveyard and when i click activate, it still worked but no cost.

 

--attack all
local e4=Effect.CreateEffect©
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCost(c20626169.cost)
e4:SetOperation(c20626169.operation)
c:RegisterEffect(e4)
end
function c20626169.costfilter(c,att)
return c:IsAttribute(att) and c:IsAbleToRemoveAsCost()
end
function c20626169.cost(e,tp,eg,ep,ev,re,r,rp,chk,att)
if chk==0 then return Duel.IsExistingMatchingCard(c20626169.cfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)
and Duel.IsExistingMatchingCard(c20626169.cfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)
Duel.Remove(g,POS_FACEUP,REASON_COST)
g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
Link to comment
Share on other sites

more errors.

 

function c20626169.cost(e,tp,eg,ep,ev,re,r,rp,chk,att)

if chk==0 then returnDuel.IsExistingMatchingCard(c20626169.costfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)

and returnDuel.IsExistingMatchingCard(c20626169.costfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end

Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)

local g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)

Duel.Remove(g,POS_FACEUP,REASON_COST)

     g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)

Duel.Remove(g,POS_FACEUP,REASON_COST)

end

Link to comment
Share on other sites

function c20626169.cost(e,tp,eg,ep,ev,re,r,rp,chk,att)

if chk==0 then returnDuel.IsExistingMatchingCard(c20626169.costfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)

and returnDuel.IsExistingMatchingCard(c20626169.costfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end

Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)

local g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)

Duel.Remove(g,POS_FACEUP,REASON_COST)

     g=Duel.SelectMatchingCard(tp,c20626169.costfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)

Duel.Remove(g,POS_FACEUP,REASON_COST)

end

 

fixed

Link to comment
Share on other sites

woot! thank you so much man. but there's one slight problem. I was testing yugi's deck (unshuffled) and he currently has a beta on his field. i used ojama trio to summon 3 tokens on his side. i used the effect to attack all monsters. so i killed the ojamas first then killed beta and after 2 seconds, i crashed. when i changed the attack order and hit the one of the tokens last, i didnt crash. so the crash only happened if i killed beta last. is this a known bug?

Link to comment
Share on other sites

I just made another card and i got just one error. 

Spearing Voidslayer, Stormbreaker

LV3/Warrior/LIGHT/Tuner/ATK:1200/DEF:1000

When this card is Normal Summoned, you can Special Summon 1 Level 4 or lower "Voidslayer" monster from your graveyard in face-up Defense Mode. Once per turn, you can target cards your opponent controls, up to the number of other "Voidslayer" monsters you control; destroy them. You can only use this effect of "Spearing Voidslayer, Stormbreaker" once per turn.

 

So when i summoned this card, it showed me all the monsters in the archetype including the ones with lv 5 or higher. it should show only level 4 or lower monsters. 

Script:

--Spearing Voidslayer, Stormbreaker
function c49769794.initial_effect©
--special summon
local e1=Effect.CreateEffect©
e1:SetDescription(aux.Stringid(49769794,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c49769794.target)
e1:SetOperation(c49769794.operation)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect©
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCategory(CATEGORY_DESTROY)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,49769794)
e2:SetTarget(c49769794.destg)
e2:SetOperation(c49769794.desop)
c:RegisterEffect(e2)
end
function c49769794.filter(c,e,tp)
return c:GetLevel()<=4 and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x378) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function c49769794.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()==tp and chkc:GetLocation()==LOCATION_GRAVE and c49769794.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c49769794.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c49769794.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c49769794.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
end
end
function c49769794.filter©
return c:IsFaceup() and c:IsSetCard(0x378)
end
function c49769794.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsDestructable() end
if chk==0 then return Duel.IsExistingMatchingCard(c49769794.filter,tp,LOCATION_MZONE,0,1,e:GetHandler())
and Duel.IsExistingTarget(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
local ct=Duel.GetMatchingGroupCount(c49769794.filter,tp,LOCATION_MZONE,0,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c49769794.desop(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=tg:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
 
So my guess is that it has something to do with the filter or the target. Feel Free to comment below if you have any changes to this. Again, your help is appreciated in advance and thank you. You have my graditude! :3
Link to comment
Share on other sites

woot! thank you so much man. but there's one slight problem. I was testing yugi's deck (unshuffled) and he currently has a beta on his field. i used ojama trio to summon 3 tokens on his side. i used the effect to attack all monsters. so i killed the ojamas first then killed beta and after 2 seconds, i crashed. when i changed the attack order and hit the one of the tokens last, i didnt crash. so the crash only happened if i killed beta last. is this a known bug?

I tested a replica of your card in the same situation: Beta & 3 Ojama Tokens vs Voidslayer Viper. When I attacked and destroyed Beta after destroying the 3 Ojama Tokens by battle with Viper, the game didn't crash. Maybe something else is causing that problem...

Link to comment
Share on other sites

how would i code this effect. first time trying to add a card to ygopro

If an opponent's spell, trap, or monster effect would cause you to discard this card from your hand, special summon it instead.

 

 

 

 

what i have so far..

 

 


--Morkaz the Defiant

function c23472627.initial_effect©

local e1=Effect.CreateEffect©

e1:SetType(EFFECT_TYPE_SINGLE)

e1:SetRange(LOCATION_hand)

e1:SetCode(EFFECT_SPSUMMON_CONDITION)

Link to comment
Share on other sites

 

how would i code this effect. first time trying to add a card to ygopro
If an opponent's spell, trap, or monster effect would cause you to discard this card from your hand, special summon it instead.
 
 
 
 
what i have so far..
 
 
--Morkaz the Defiant
function c23472627.initial_effect©
local e1=Effect.CreateEffect©
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_hand)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)

 

I don't think you can special summon it instead of discarding it (in the same chain link as what discarded it), but you can come very close.

Try looking at this card's script:

http://yugioh.wikia.com/wiki/Despair_from_the_Dark

or that of most "Dark Word" monsters

 

Off the top of my head, e1:SetCode(EFFECT_SPSUMMON_CONDITION) isn't right. That's for cards like BLS - EotB's and chaos sorcerer's summoning conditions

Link to comment
Share on other sites

Might as well use my own support thread to get help on stuff (once the issues are fixed, I'll release the rest of the cards for public use).
 
Anyway, kind of a large request; two are coding and 1 is actually figuring out what went wrong.

 

[spoiler=Actual implementation]

(1) Once per turn, during either player's turn, if a card effect is activated that would target or destroy 1 or more "Snow Flyer" monsters you control: You can negate that effect, and if you do, destroy it.
 
(I tried using Bujingi Turtle and removing the banishing part from the Graveyard, but doesn't seem to be working. Next thing would be Guard Mines, but that requires said monsters to be targeted AND destroyed; this should work for either or [and obviously, trigger effect])

 

------

(SEPARATE CARD)

 

(1) "Flash Flyer" monsters you control and in your hand and Graveyard are treated as "Snow Flyer" monsters.

 

(Card is supposed to treat one Archetype as members of another; closest I can think of is that manga Trap Card Rua uses to change his sister's stuff into Morphtronics but YGOPro does not have it added.)

 

If 2nd one can't be done yet, then no big deal; first one is the one I need more.

 

 

 

[spoiler=Coding]

--Snowy Frontier
function c90001210.initial_effect©
    --Activate
    local e1=Effect.CreateEffect©
    e1:SetType(EFFECT_TYPE_ACTIVATE)
    e1:SetCode(EVENT_FREE_CHAIN)
    c:RegisterEffect(e1)
    --atk boost
    local e2=Effect.CreateEffect©
    e2:SetType(EFFECT_TYPE_FIELD)
    e2:SetCode(EFFECT_UPDATE_ATTACK)
    e2:SetRange(LOCATION_FZONE)
    e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
    e2:SetTarget(c90001210.tg)
    e2:SetValue(400)
    c:RegisterEffect(e2)    
    --def boost
    local e3=Effect.CreateEffect©
    e3:SetType(EFFECT_TYPE_FIELD)
    e3:SetCode(EFFECT_UPDATE_DEFENCE)
    e3:SetRange(LOCATION_FZONE)
    e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
    e3:SetTarget(c90001210.tg)
    e3:SetValue(400)
    c:RegisterEffect(e3)    
    --spsummon
    local e4=Effect.CreateEffect©
    e4:SetType(EFFECT_TYPE_IGNITION)
    e4:SetRange(LOCATION_FZONE)
    e4:SetCountLimit(1)
    e4:SetTarget(c90001210.target)
    e4:SetOperation(c90001210.activate)
    c:RegisterEffect(e4)
    --Draw
    local e5=Effect.CreateEffect©
    e5:SetDescription(aux.Stringid(90001210,0))
    e5:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
    e5:SetType(EFFECT_TYPE_QUICK_O)
    e5:SetCode(EVENT_FREE_CHAIN)
    e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e5:SetRange(LOCATION_FZONE)
    e5:SetCountLimit(1)
    e5:SetTarget(c90001210.drtg)
    e5:SetOperation(c90001210.drop)
    c:RegisterEffect(e5)

end

--Snow Flyer power up
function c90001210.tg(e,c)
    return c:IsSetCard(0x4C9)
end

-- spsummon
function c90001210.filter©
    return c:IsSetCard(0x4C9) and c:IsType(TYPE_MONSTER)
end
function c90001210.target(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
        and Duel.IsExistingMatchingCard(c90001210.filter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
    Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c90001210.activate(e,tp,eg,ep,ev,re,r,rp)
    if Duel.GetLocationCount(tp,LOCATION_MZONE)    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
    local g=Duel.SelectMatchingCard(tp,c90001210.filter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
    if g:GetCount()>0 then
        Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
    end
end
--return
function c90001210.filter2©
    return c:IsSetCard(0x4C9) and c:IsAbleToDeck()
end
function c90001210.target1(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return true end
    if e:GetHandler():GetFlagEffect(tp,90001210)==0
        and Duel.IsPlayerCanDraw(tp,1)
        and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,5,nil,0x4C9)
        and Duel.SelectYesNo(tp,aux.Stringid(90001210,0)) then
        e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
        e:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
        e:GetHandler():RegisterFlagEffect(tp,RESET_PHASE+PHASE_END,0,2)
        Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
        local g=Duel.SelectTarget(tp,c90001210.filter,tp,LOCATION_GRAVE,0,5,5,nil)
        Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,tp,LOCATION_HAND)
        Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
        e:SetLabel(1)
        e:GetHandler():RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(90001210,1))
    else
        e:SetCategory(0)
        e:SetProperty(0)
        e:SetLabel(0)
    end
end
function c90001210.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
    if chkc then return chkc:GetLocation()==LOCATION_GRAVE and chkc:GetControler()==tp and c90001210.filter(chkc) end
    if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and e:GetHandler():GetFlagEffect(tp,90001210)==0
        and Duel.IsExistingTarget(c90001210.filter,tp,LOCATION_GRAVE,0,5,nil) end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
    local g=Duel.SelectTarget(tp,c90001210.filter,tp,LOCATION_GRAVE,0,5,5,nil)
    Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0)
    Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c90001210.tgfilter(c,e)
    return not c:IsRelateToEffect(e)
end
function c90001210.drop(e,tp,eg,ep,ev,re,r,rp)
    local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
    if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=5 then return end
    Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
    local g=Duel.GetOperatedGroup()
    local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK+LOCATION_EXTRA)
    if ct==2 then
        Duel.ShuffleDeck(tp)
        Duel.BreakEffect()
        Duel.Draw(tp,1,REASON_EFFECT)
    end
end

 

Problem is the 5th one (e5); basically should work like Majespecter Supercell, but draw 2 cards instead (and return the Archetypal stuff back to the Deck). Everything else is fine.

 

For reference, Archetype code is 4C9.

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Snakarl Chains any Other Spell/Trap, while it is supposed to chain only Pendulum Monsters/Pendulum Summoned monsters.

 

--Binding Fairy
function c160000575.initial_effect(c)

	--Negate
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(160000575,0))
	e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_QUICK_O)
	e1:SetRange(LOCATION_GRAVE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetCondition(c160000575.condition)
	e1:SetTarget(c160000575.target)
	e1:SetOperation(c160000575.activate)
	c:RegisterEffect(e1)
	
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(160000575,0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SUMMON_SUCCESS)
	e2:SetCountLimit(1,160000575)
	e2:SetTarget(c160000575.sptg)
	e2:SetOperation(c160000575.spop)
	c:RegisterEffect(e2)

	local e0=Effect.CreateEffect(c)
	e0:SetType(EFFECT_TYPE_SINGLE)
	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
	e0:SetValue(c160000575.splimit)
	c:RegisterEffect(e0)

	

end
function c160000575.spfilter(c)
	return c:GetLevel()==4 and c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
end

function c160000575.condition(e,tp,eg,ep,ev,re,r,rp)
	return rp~=tp
	and not re:IsActiveType(EFFECT_TYPE_ACTIVATE) and (re:IsActiveType(TYPE_PENDULUM) or  bit.band(re:GetHandler():GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM) and Duel.IsChainNegatable(ev)
	end

function c160000575.costfilter(c)
	return c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAbleToGraveAsCost()
end

function c160000575.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 
		and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
	Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
		Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
		Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
	end
end


function c160000575.activate(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	Duel.NegateActivation(ev)
	if re:GetHandler():IsRelateToEffect(re) then
		if  c:IsRelateToEffect(e) and Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)~=0  and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)~=0 then 
			local e1=Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetReset(RESET_EVENT+0x47e0000)
		e1:SetValue(LOCATION_REMOVED)
		c:RegisterEffect(e1,true)
	end
end
end

function c160000575.spfilter(c,e,tp)
	return  c:IsAttackBelow(1500) and  c:IsSetCard(0xc910) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c160000575.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and Duel.IsExistingMatchingCard(c160000575.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c160000575.spop(e,tp,eg,ep,ev,re,r,rp)
	if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
		local g=Duel.SelectMatchingCard(tp,c160000575.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
		if g:GetCount()>0 then
			Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
		end
	end
	local e1=Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e1:SetReset(RESET_PHASE+PHASE_END)
	e1:SetTargetRange(1,0)
	e1:SetTarget(c160000575.splimit2)
	Duel.RegisterEffect(e1,tp)
end
	function c160000575.splimit(e,se,sp,st)
	return bit.band(st,SUMMON_TYPE_PENDULUM)~=SUMMON_TYPE_PENDULUM
end
	function c160000575.splimit2(e,c,sump,sumtype,sumpos,targetp,se)
	return bit.band(c:GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
end(
Link to comment
Share on other sites

Heya, I am having some trouble with a card I am working on.

 

Here is the effect:

 

You can Special Summon this card (from your hand or Deck) by sending 1 face-up "Lyna the Light Charmer" you control and 1 face-up LIGHT monster you control to the Graveyard. When you do: Target 1 banished monster; Special Summon that monster. If this card was Special Summoned by this effect and attacks a Defense Position monster, inflict piercing Battle Damage to your opponent.

 

 

I can't get spoiler to work on here, so I just put it on gist.

 

The summon from deck works fine, however the second effect that summons a banished monster does not.

I stole from Familiar-Possessed Dharc and Ritual Beast Tamer Wen. Ty for nay help!
Link to comment
Share on other sites

Sorry, I'm an idiot, I put it on gist but didn't link it https://gist.github.com/windikite/c155520bdc6c4c72b9f8

 

Also, a second one I'm working on that is giving me trouble if you don't mind c:

 

Discard a "Charmer" or "Possessed" monster: Draw 2 cards. If you drew a monster that shared an attribute with the monster discarded: Draw 1 card. You can only use the effect of "Charmer's Last Resort" once per turn.

 

https://gist.github.com/windikite/7760e5ce1d9ee8b66deaI stole from Pantheism of the Monarchs, though I have yet to steal from Koa'ke Meiru Speeder for the reveal to draw another card. Not sure how to do that yet.

 

ty for the help, I appreciate ti!

Link to comment
Share on other sites

 

Heya, I am having some trouble with a card I am working on.

 

Here is the effect:

 

You can Special Summon this card (from your hand or Deck) by sending 1 face-up "Lyna the Light Charmer" you control and 1 face-up LIGHT monster you control to the Graveyard. When you do: Target 1 banished monster; Special Summon that monster. If this card was Special Summoned by this effect and attacks a Defense Position monster, inflict piercing Battle Damage to your opponent.

 

 

I can't get spoiler to work on here, so I just put it on gist.

 

The summon from deck works fine, however the second effect that summons a banished monster does not.

I stole from Familiar-Possessed Dharc and Ritual Beast Tamer Wen. Ty for nay help!

 

 

Don't know if these will solve the problem, but I noticed two things:
 
e2:SetDescription(aux.Stringid(c13713701,1))
should be
e2:SetDescription(aux.Stringid(13713701,1))
 
and you are not setting the condition for effect2 ( e2:SetCondition(c13713701.condition) ).
Link to comment
Share on other sites

I finally got it to work! After rereading the code and comparing after a large break I figured out that the main reason was me not changing the effect from EVENT_SUMMON_SUCCESS to EVENT_SPSUUMON_SUCCESS, letting it activate on special summon. Also, setting the condition prevented a situation where you could monster reborn it, or even worse, FP Lyna to summon FP Lyna to summon FP Lyna.

 

Here is the updated code so you can see what I did: https://gist.github.com/windikite/c155520bdc6c4c72b9f8

 

It seems now the only effect I am having trouble getting to work is the second effect of this: https://gist.github.com/windikite/31738db0a808767e8fd1

 

It's supposed to let me change the attribute of a monster by banishing it from the graveyard during either player's turn, however it's only letting me target my monster and only during my turn. 

Link to comment
Share on other sites

Snakarl Chains any Other Spell/Trap, while it is supposed to chain only Pendulum Monsters/Pendulum Summoned monsters.

 

--Binding Fairy
function c160000575.initial_effect(c)

	--Negate
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(160000575,0))
	e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_QUICK_O)
	e1:SetRange(LOCATION_GRAVE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetCondition(c160000575.condition)
	e1:SetTarget(c160000575.target)
	e1:SetOperation(c160000575.activate)
	c:RegisterEffect(e1)
	
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(160000575,0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SUMMON_SUCCESS)
	e2:SetCountLimit(1,160000575)
	e2:SetTarget(c160000575.sptg)
	e2:SetOperation(c160000575.spop)
	c:RegisterEffect(e2)

	local e0=Effect.CreateEffect(c)
	e0:SetType(EFFECT_TYPE_SINGLE)
	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
	e0:SetValue(c160000575.splimit)
	c:RegisterEffect(e0)

	

end
function c160000575.spfilter(c)
	return c:GetLevel()==4 and c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
end

function c160000575.condition(e,tp,eg,ep,ev,re,r,rp)
	return rp~=tp
	and not re:IsActiveType(EFFECT_TYPE_ACTIVATE) and (re:IsActiveType(TYPE_PENDULUM) or  bit.band(re:GetHandler():GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM) and Duel.IsChainNegatable(ev)
	end

function c160000575.costfilter(c)
	return c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAbleToGraveAsCost()
end

function c160000575.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 
		and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
	Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
		Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
		Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
	end
end


function c160000575.activate(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	Duel.NegateActivation(ev)
	if re:GetHandler():IsRelateToEffect(re) then
		if  c:IsRelateToEffect(e) and Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)~=0  and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)~=0 then 
			local e1=Effect.CreateEffect(c)
		e1:SetType(EFFECT_TYPE_SINGLE)
		e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
		e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
		e1:SetReset(RESET_EVENT+0x47e0000)
		e1:SetValue(LOCATION_REMOVED)
		c:RegisterEffect(e1,true)
	end
end
end

function c160000575.spfilter(c,e,tp)
	return  c:IsAttackBelow(1500) and  c:IsSetCard(0xc910) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c160000575.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
		and Duel.IsExistingMatchingCard(c160000575.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c160000575.spop(e,tp,eg,ep,ev,re,r,rp)
	if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
		local g=Duel.SelectMatchingCard(tp,c160000575.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
		if g:GetCount()>0 then
			Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
		end
	end
	local e1=Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e1:SetReset(RESET_PHASE+PHASE_END)
	e1:SetTargetRange(1,0)
	e1:SetTarget(c160000575.splimit2)
	Duel.RegisterEffect(e1,tp)
end
	function c160000575.splimit(e,se,sp,st)
	return bit.band(st,SUMMON_TYPE_PENDULUM)~=SUMMON_TYPE_PENDULUM
end
	function c160000575.splimit2(e,c,sump,sumtype,sumpos,targetp,se)
	return bit.band(c:GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
end(

Any help with this?

Link to comment
Share on other sites

Any help with this?

Try this code; it's already tested.

[spoiler=Pendulady Snakarl]

--Binding Fairy
function c160000575.initial_effect(c)
	--Negate
	local e1=Effect.CreateEffect(c)
	e1:SetDescription(aux.Stringid(160000575,0))
	e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
	e1:SetType(EFFECT_TYPE_QUICK_O)
	e1:SetRange(LOCATION_GRAVE)
	e1:SetCode(EVENT_CHAINING)
	e1:SetCondition(c160000575.condition)
	e1:SetTarget(c160000575.target)
	e1:SetOperation(c160000575.activate)
	c:RegisterEffect(e1)
	local e2=Effect.CreateEffect(c)
	e2:SetDescription(aux.Stringid(160000575,0))
	e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
	e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
	e2:SetCode(EVENT_SUMMON_SUCCESS)
	e2:SetCountLimit(1,160000575)
	e2:SetTarget(c160000575.sptg)
	e2:SetOperation(c160000575.spop)
	c:RegisterEffect(e2)
	local e0=Effect.CreateEffect(c)
	e0:SetType(EFFECT_TYPE_SINGLE)
	e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
	e0:SetCode(EFFECT_SPSUMMON_CONDITION)
	e0:SetValue(c160000575.splimit)
	c:RegisterEffect(e0)
end
function c160000575.spfilter(c)
	return c:GetLevel()==4 and c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
end
function c160000575.condition(e,tp,eg,ep,ev,re,r,rp)
	local seq=re:GetHandler():GetSequence()
	return rp~=tp
		and not re:IsHasType(EFFECT_TYPE_ACTIVATE) and ((re:IsActiveType(TYPE_PENDULUM) and seq==6 or seq==7) or  bit.band(re:GetHandler():GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM) and Duel.IsChainNegatable(ev)
end
function c160000575.costfilter(c)
	return c:IsRace(RACE_FAIRY+RACE_THUNDER) and c:IsAbleToGraveAsCost()
end
function c160000575.target(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 
	and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
	Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
	if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
		Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
		Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
	end
end
function c160000575.activate(e,tp,eg,ep,ev,re,r,rp)
	local c=e:GetHandler()
	Duel.NegateActivation(ev)
	if re:GetHandler():IsRelateToEffect(re) then
		if  c:IsRelateToEffect(e) and Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)~=0  and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)~=0 then 
			local e1=Effect.CreateEffect(c)
			e1:SetType(EFFECT_TYPE_SINGLE)
			e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
			e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
			e1:SetReset(RESET_EVENT+0x47e0000)
			e1:SetValue(LOCATION_REMOVED)
			c:RegisterEffect(e1,true)
		end
	end
end
function c160000575.spfilter(c,e,tp)
	return  c:IsAttackBelow(1500) and  c:IsSetCard(0xc910) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c160000575.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
	if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
	and Duel.IsExistingMatchingCard(c160000575.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
	Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c160000575.spop(e,tp,eg,ep,ev,re,r,rp)
	if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
		Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
		local g=Duel.SelectMatchingCard(tp,c160000575.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
		if g:GetCount()>0 then
			Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
		end
	end
	local e1=Effect.CreateEffect(e:GetHandler())
	e1:SetType(EFFECT_TYPE_FIELD)
	e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
	e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
	e1:SetReset(RESET_PHASE+PHASE_END)
	e1:SetTargetRange(1,0)
	e1:SetTarget(c160000575.splimit2)
	Duel.RegisterEffect(e1,tp)
end
function c160000575.splimit(e,se,sp,st)
	return bit.band(st,SUMMON_TYPE_PENDULUM)~=SUMMON_TYPE_PENDULUM
end
function c160000575.splimit2(e,c,sump,sumtype,sumpos,targetp,se)
	return bit.band(c:GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
		and (re:IsActiveType(TYPE_PENDULUM) or  bit.band(re:GetHandler():GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM)
end

 

 

Link to comment
Share on other sites

Anyone know what I'm doing wrong here? It's supposed to distribute Fog Counters on every face-up monster when a monster is summoned. It's not doing that. I hope it's just a simple mistake.

 

https://gist.github.com/windikite/aacc8add35d2ddc8c34e

I'm pulling from Snow Dragon and Double Tag Team. Having trouble getting the summon proc to cause the counter distribution.

Link to comment
Share on other sites

  • 3 weeks later...

I can't get this effect working, any help?

 once per turn. You can Tribute this card and 1 "Fiber Vine" monster you control; Ritual Summon 1 "Fiber Vine" monster from your hand or Deck whose Level is equal to or less than the combined Levels of the Tributed monsters.

function c500314819.initial_effect(c)
                    --summon success
    local e2=Effect.CreateEffect(c)
    e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
    e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
    e2:SetCode(EVENT_SUMMON_SUCCESS)
    e2:SetCountLimit(1,500314820)
    e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
    e2:SetTarget(c500314819.thtg)
    e2:SetOperation(c500314819.thop)
    c:RegisterEffect(e2)
        --spsummon
    local e3=Effect.CreateEffect(c)
    e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
    e3:SetType(EFFECT_TYPE_IGNITION)
    e3:SetCountLimit(1,500314819)
    e3:SetRange(LOCATION_MZONE)
    --e3:SetCondition(c500314819.condition)
    e3:SetCost(c500314819.cost)
    e3:SetTarget(c500314819.target)
    e3:SetOperation(c500314819.operation)
    c:RegisterEffect(e3)
end
function c500314819.thfilter(c)
    return c:IsSetCard(0x785b) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c500314819.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
    if chk==0 then return Duel.IsExistingMatchingCard(c500314819.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
    Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function c500314819.thop(e,tp,eg,ep,ev,re,r,rp)
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
    local g=Duel.SelectMatchingCard(tp,c500314819.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
    if g:GetCount()>0 then
        Duel.SendtoHand(g,nil,REASON_EFFECT)
        if Duel.ConfirmCards(1-tp,g)~=0 then
                local e3=Effect.CreateEffect(e:GetHandler())
    e3:SetType(EFFECT_TYPE_IGNITION)
    e3:SetRange(LOCATION_MZONE)
    e3:SetCode(EVENT_FREE_CHAIN)
    e3:SetCountLimit(1)
    e3:SetTarget(c500314819.sumtg)
    e3:SetOperation(c500314819.sumop)
        Duel.RegisterEffect(e3,tp)
    end
end
end

function c500314819.cfilter(c)
    return c:IsFaceup() and bit.band(c:GetType(),0x81)==0x81
end
function c500314819.condition(e,tp,eg,ep,ev,re,r,rp)
    return not Duel.IsExistingMatchingCard(c500314819.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c500314819.filter(c,e,tp,m)
return  c:IsSetCard(0x785b) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true)
end
function c500314819.cost(e,tp,eg,ep,ev,re,r,rp,chk)
    e:SetLabel(100)
    return true
end
function c500314819.filter1(c,e,tp,cg)
    return c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,false)
        and cg:CheckWithSumEqual(Card.GetLevel,c:GetLevel(),1,99)
end
function c500314819.cgfilter(c)
    return c:GetLevel()>0 and  c:IsSetCard(0x785b) and c:IsReleasable()
end
function c500314819.target(e,tp,eg,ep,ev,re,r,rp,chk)
    local cg=Duel.GetMatchingGroup(c500314819.cgfilter,tp,LOCATION_MZONE,0,nil)

    if chk==0 then
        if e:GetLabel()~=100 then return false end
        e:SetLabel(0)
        return Duel.IsExistingMatchingCard(c500314819.filter1,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp,cg)
    end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
    local rg=Duel.SelectMatchingCard(tp,c500314819.filter1,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp,cg)
    e:SetLabel(rg:GetFirst():GetLevel())
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
    local sg=cg:SelectWithSumEqual(tp,Card.GetLevel,e:GetLabel(),1,99)
        g:AddCard(e:GetHandler())
    Duel.SendtoGrave(sg,REASON_COST)
    Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c500314819.filter2(c,e,tp,lv)
    return c:IsType(TYPE_RITUAL) and c:GetLevel()==lv and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,false)
end
function c500314819.operation(e,tp,eg,ep,ev,re,r,rp)
    if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
    Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
    local g=Duel.SelectMatchingCard(tp,c500314819.filter2,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp,e:GetLabel())
    if g:GetCount()>0 then
        Duel.SpecialSummon(g,SUMMON_TYPE_RITUAL,tp,tp,false,false,POS_FACEUP)
    end
end
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...