[Script Error][string"./script/c10007.lua"]:49:`)`expected near`&`
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
[Script Error]"CallCardFunction"(c10007 initial_effect):attempt to call an error function
function c10007.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c10007.activate)
c:RegisterEffect(e1)
--token
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(10007,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,10007)
e2:SetTarget(c10007.tktg1)
e2:SetOperation(c10007.tkop1)
c:RegisterEffect(e2)
--token2
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(10007,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_FZONE)
e3:SetCountLimit(1,10007)
e3:SetCondition(c10007.tkcon)
e3:SetTarget(c10007.tktg2)
e3:SetOperation(c10007.tkop2)
c:RegisterEffect(e3)
end
function c10007.thfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xfb) and c:IsAbleToHand()
end
function c10007.activate(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) or Duel.GetFlagEffect(tp,10007)>0 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c511600176.thfilter),tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(10007,0)) then
Duel.RegisterFlagEffect(tp,10007,RESET_PHASE+PHASE_END,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
function c10007.filter(c,e,tp)
return c:IsFaceup() and c:IsType(TYPE_LINK) and c:IsSetCard(0xfb)
and Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,c:GetLinkedZone()&0x1f)>0
end
function c10007.tktg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c10007.filter(chkc,e,tp) and chkc:IsControler(tp) end
if chk==0 then return Duel.IsExistingTarget(c511600176.filter,tp,LOCATION_MZONE,0,1,nil,e,tp)
and Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c10007.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function c10007.tkop1(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
local zones=tc:GetLinkedZone()&0x1f
local token=Duel.CreateToken(tp,10007)
if not tc:IsRelateToEffect(e) or not tc:IsFaceup()
or not token:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,tp,zones) then return end
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE,zones)
end
function c10007.cfilter(c)
return c:IsFacedown() and c:GetSequence()<5
end
function c10007.tkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c10007.cfilter,tp,0,LOCATION_SZONE,1,nil)
end
function c10007.tktg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
end
function c10007.tkop2(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,10007,0xfb,0x4011,0,0,1,RACE_FAIRY,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE) then return end
local token=Duel.CreateToken(tp,10007)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
毎度毎度すみません。よろしくお願いします。
このエラーが分からず困っています
[Script Error][string"./script/c10007.lua"]:60:attempt to call a nill value(method'IsExtraLinked')
現在作っているスクリプトが
function c10012.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkType,TYPE_EFFECT),2)
c:EnableReviveLimit()
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(5821478,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c10012.descon)
e1:SetTarget(c10012.destg)
e1:SetOperation(c10012.desop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(49352945,1))
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c10012.descon2)
e2:SetTarget(c10012.destg2)
e2:SetOperation(c10012.desop2)
c:RegisterEffect(e2)
--indes
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetCondition(c10012.descon2)
e3:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_LINK))
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c10012.cfilter(c,zone)
local seq=c:GetSequence()
if c:IsControler(1) then seq=seq+16 end
return bit.extract(zone,seq)~=0
end
function c10012.descon(e,tp,eg,ep,ev,re,r,rp)
local zone=Duel.GetLinkedZone(0)+Duel.GetLinkedZone(1)*0x10000
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c10012.cfilter,1,nil,zone)
and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0
end
function c10012.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,LOCATION_HAND,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c10012.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_HAND,LOCATION_HAND,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function c10012.descon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsExtraLinked()
end
function c10012.destg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_HAND,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_HAND,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,3000)
end
function c10012.desop2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_HAND,nil)
if Duel.Destroy(g,REASON_EFFECT)~=0 then
Duel.Damage(1-tp,3000,REASON_EFFECT)
end
end
--手札から通常召喚
function c11220.initial_effect(c)
--hand summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c11220.cost)
e1:SetTarget(c11220.target)
e1:SetOperation(c11220.operation)
c:RegisterEffect(e1)
end
function c11220.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 end
local e001=Effect.CreateEffect(e:GetHandler())
e001:SetType(EFFECT_TYPE_FIELD)
e001:SetCode(EFFECT_CANNOT_SUMMON)
e001:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e001:SetTargetRange(1,0)
e001:SetTarget(c11220.nslimit)
e001:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e001,tp)
end
function c11220.nslimit(e,c,sump,sumtype,sumpos,targetp,se)
return e:GetHandler()~=se:GetHandler()
end
function c11220.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,e:GetHandler(),1,0,0)
end
function c11220.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
--手札から通常召喚
function c11220.initial_effect(c)
--hand summon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c11220.cost)
e1:SetTarget(c11220.target)
e1:SetOperation(c11220.operation)
c:RegisterEffect(e1)
end
function c11220.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 end
local e001=Effect.CreateEffect(e:GetHandler())
e001:SetType(EFFECT_TYPE_FIELD)
e001:SetCode(EFFECT_CANNOT_SUMMON)
e001:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e001:SetTargetRange(1,0)
e001:SetTarget(c11220.nslimit)
e001:SetReset(RESET_PHASE+PHASE_END)
e001:SetLabelObject(e)
Duel.RegisterEffect(e001,tp)
end
function c11220.nslimit(e,c,sump,sumtype,sumpos,targetp,se)
return se~=e:GetLabelObject()
end
function c11220.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsSummonable(true,nil) end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,e:GetHandler(),1,0,0)
end
function c11220.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.Summon(tp,c,true,nil)
end
end
local c=e:GetHandler()
return bit.band(c:IsSetCard(0x0173),REASON_EFFECT)==0
こんな感じでしょうか? ただ、これだと以下のようなエラーが出てしまいます……。
どうすれば良いでしょうか。andでそのまま付け足した場合も同様でした。
[string "./script/utility.lua"]:10: attempt to perform bitwise operation on a boolean value (local 'a')
function c2016.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode2(c,65622692,64500000,true,true)
--spsummon condition
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(c2016.splimit)
c:RegisterEffect(e1)
--special summon rule
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_EXTRA)
e2:SetCondition(c2016.spcon)
e2:SetOperation(c2016.spop)
c:RegisterEffect(e2)
end
function c2016.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA+LOCATION_GRAVE)
end
function c2016.matfilter(c)
return c:IsFusionCode(65622692,64500000) and c:IsAbleToRemoveAsCost()
end
function c2016.spfilter1(c,tp,g)
return g:IsExists(c2016.spfilter2,1,c,tp,c)
end
function c2016.spfilter2(c,tp,mc)
return (c:IsFusionCode(65622692) and mc:IsFusionCode(64500000)
or c:IsFusionCode(64500000) and mc:IsFusionCode(65622692))
and Duel.GetLocationCountFromEx(tp,tp,Group.FromCards(c,mc))>0
end
function c2016.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
local g=Duel.GetMatchingGroup(c2016.matfilter,tp,LOCATION_ONFIELD,0,nil)
return g:IsExists(c2016.spfilter1,1,nil,tp,g)
end
function c2016.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c2016.matfilter,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=g:FilterSelect(tp,c2016.spfilter1,1,1,nil,tp,g)
local mc=g1:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=g:FilterSelect(tp,c2016.spfilter2,1,1,mc,tp,mc)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PREDRAW)
ge1:SetOperation(cXXX.sdop)
ge1:SetCountLimit(1,XXX+EFFECT_COUNT_CODE_DUEL)
ge1:SetCondition(cXXX.sdcon)
Duel.RegisterEffect(ge1,0)
end
function cXXX.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
if Duel.SelectYesNo(c,aux.Stringid(XXX,0)) then
Duel.SendtoDeck(Duel.CreateToken(0,YYY),tp,tp,REASON_RULE)
end
end
function cXXX.sdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetOwner()==Duel.GetTurnPlayer() and Duel.GetTurnCount()~=1
end
function c27551.initial_effect(c)
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PREDRAW)
ge1:SetOperation(c27551.sdop)
ge1:SetCondition(c27551.sdcon)
Duel.RegisterEffect(ge1,0)
end
function c27551.sdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
if Duel.GetFlagEffect(c,27551)==0 and Duel.SelectYesNo(c,aux.Stringid(27551,0)) then
Duel.SendtoDeck(Duel.CreateToken(0,27551),c,2,REASON_RULE)
end
Duel.RegisterFlagEffect(c,27551,nil,0,1)
end
function c27551.sdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()==1
end
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_BATTLE_DESTROYED)
e4:SetCondition(c220200329.condition)
e4:SetTarget(c220200329.target)
e4:SetOperation(c220200329.activate)
c:RegisterEffect(e4)
function c220200329.cfilter(c,tp)
return c:IsCord(220200347) and c:GetPreviousControler()==tp
end
function c220200329.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c220200329.cfilter,1,nil,tp)
end
function c220200329.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c220200329.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil)
if dg:GetCount()>0 then
if Duel.Destroy(dg,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
c:RegisterEffect(e1)
end
end
end
EXからXモンスターをX召喚扱いとして特殊召喚する。その後デッキからモンスターを1枚選びそのモンスターのX素材にできる。
という効果を作りたくて下のスクリプトを作ったのですがX召喚扱いになりません。理由が分からないのですが教えて頂けませんか?
function c10011.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCountFromEx(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10011.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
local tc=g:GetFirst()
ct=Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
if ct>0 then
local fg=Duel.GetMatchingGroup(c10011.matfilter,tp,LOCATION_DECK,0,nil,e,tp,false,false)
if fg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(10011,3)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL)
local g=Duel.SelectMatchingCard(tp,c10011.matfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.Overlay(tc,g)
end
end
end
end
function cyugioh.matfilter(c)
return c:IsLinkType(TYPE_EFFECT) and c:IsLinkAttribute(ATTRIBUTE_FIRE)
end
function cyugioh.filter(c,e,tp)
return c:IsType(TYPE_LINK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp)
end
function cyugioh.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and cyugioh.filter(chkc,e,tp) end
if chk==0 then return (Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0)
and Duel.IsExistingTarget(cyugioh.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,cyugioh.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function cyugioh.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.SpecialSummonStep(tc,0,tp,1-tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
Duel.SpecialSummonComplete()
end
function cyugioh.damfilter(c,e,tp)
return c:IsFaceup() and c:IsControler(1-tp) and c:IsType(TYPE_LINK) and (not e or c:IsRelateToEffect(e))
end
function cyugioh.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(cyugioh.damfilter,1,nil,nil,tp) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,eg,eg:GetCount(),0,0)
end
function cyugioh.operation(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(cyugioh.damfilter,nil,e,tp)
local dam=g:GetSum(Card.GetBaseAttack)
Duel.Damage(1-tp,dam,REASON_EFFECT)
end
function cyugioh.linkfilter(c)
return c:IsCode(yugioh)
end
function cyugioh.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) and c:GetMaterial():IsExists(cyugioh.linkfilter,1,nil)
end
function cyugioh.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function cyugioh.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function cyugioh.bdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLP(tp)>100 end
local lp=Duel.GetLP(tp)
e:SetLabel((lp-100)/1000)
Duel.PayLPCost(tp,lp-100)
end
function cyugioh.bdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,e:GetLabel()) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(e:GetLabel())
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,e:GetLabel())
end
function cyugioh.bdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local bd=e:GetLabel()
Duel.Draw(tp,bd-1,REASON_RULE)
end
function cyugioh.sdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetOwner()==Duel.GetTurnPlayer() and Duel.GetTurnCount()~=1
end
※以下例文
function cyugioh.bdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local bd=e:GetLabel()
Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(yugioh,0))
Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(yugioh,1))
Duel.Draw(tp,bd-1,REASON_RULE)
end
function cyugioh.initial_effect(c)
--trickster fraud
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e3:SetCountLimit(1,yugioh+EFFECT_COUNT_CODE_DUEL)
e3:SetCondition(cyugioh.tfcon)
e3:SetTarget(cyugioh.tftg)
e3:SetOperation(cyugioh.tfop)
e3:SetRange(0xff)
c:RegisterEffect(e3)
end
function cyugioh.tfcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function cyugioh.tftg(e,tp,eg,ep,ev,re,r,rp,chk)
local ht=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if chk==0 then return (ht<3 and Duel.IsPlayerCanDraw(1-tp,3-ht)) end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,3-ht)
end
function cyugioh.tfop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler():GetOwner()
local g=Group.CreateGroup()
local ht1=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if ht1<3 then
Duel.Draw(1-tp,3-ht1,REASON_RULE)
--Remove
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(0xff)
e1:SetCountLimit(1)
e1:SetTarget(cyugioh.remtg)
e1:SetOperation(cyugioh.remop)
Duel.RegisterEffect(e1,tp)
end
end
function cyugioh.remtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND)
end
function cyugioh.remop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ht2=Duel.GetMatchingGroupCount(Card.IsSetCard,c:GetControler(),LOCATION_GRAVE,0,nil,0xfb)
if ht2==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_HAND,ht2,ht2,nil)
if rg:GetCount()>0 then
Duel.Remove(rg,POS_FACEUP,REASON_RULE)
end
end
function cyugioh.initial_effect(c)
--Storm Access
local e1=Effect.CreateEffect(c)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,yugioh+EFFECT_COUNT_CODE_DUEL)
e1:SetCondition(cyugioh.sacon)
e1:SetTarget(cyugioh.satg)
e1:SetOperation(cyugioh.saop)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_INACTIVATE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
e1:SetRange(0xff)
c:RegisterEffect(e1)
end
function cyugioh.sacon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)<=1000
end
function cyugioh.satg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(tp)
end
function cyugioh.saop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.AnnounceCard(tp,TYPE_LINK)
local token=Duel.CreateToken(tp,tc,nil,nil,nil,nil,nil,nil)
if token then
Duel.SendtoDeck(token,nil,0,REASON_RULE)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
end
end