local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
ここのcの定義を水属性モンスターに変更するにはどうすればいいでしょうか?
定義のやり方だけでもいいので教えてください…
結局ダイナスターからひっぱてやってみたんですが
素材揃っていても出せず「e2:SetCondition(c300.spcon)」を消したら素材の有無に関係なく出せてしまい素材もリリースされません
function c300.initial_effect(c)
--fusion material
c:EnableReviveLimit()
--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(c300.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(c300.spcon)
e2:SetOperation(c300.spop)
c:RegisterEffect(e2)
end
function c300.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function c300.spfilter1(c,tp,fc)
return c:IsFusionSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsCanBeFusionMaterial(fc)
and Duel.CheckReleaseGroup(tp,c300.spfilter2,1,c,fc)
end
function c300.spfilter2(c,fc)
return c:IsType(TYPE_FIELD) and c:IsSetCard(0xe2) and c:IsCanBeFusionMaterial(fc)
end
function c300.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_ONFIELD+LOCATION_HAND)>-2
and Duel.CheckReleaseGroup(tp,c300.spfilter1,1,nil,tp,c)
end
function c300.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g1=Duel.SelectReleaseGroup(tp,c300.spfilter1,1,1,nil,tp,c)
local g2=Duel.SelectReleaseGroup(tp,c300.spfilter2,1,1,g1:GetFirst(),c)
g1:Merge(g2)
c:SetMaterial(g1)
Duel.Release(g1,REASON_COST+REASON_FUSION+REASON_MATERIAL)
end
function c300.spfilter(c,e,tp)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsSetCard(0xe2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
自分はこんな感じに落ち着きましたがいかがでしょうか?
function c2129638.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFunFunRep(c,c2129638.mfilter1,c2129638.mfilter2,1,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(c2129638.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(c2129638.spcon)
e2:SetOperation(c2129638.spop)
c:RegisterEffect(e2)
end
function c2129638.mfilter1(c)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD)
end
function c2129638.mfilter2(c)
return c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER)
end
function c2129638.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
function c2129638.spfilter1(c,fc)
return c:IsSetCard(0xe2) and c:IsType(TYPE_FIELD) and c:IsCanBeFusionMaterial(fc) and c:IsAbleToGraveAsCost()
end
function c2129638.spfilter2(c,fc)
return c:IsSetCard(0xe2) and c:IsType(TYPE_MONSTER) and c:IsCanBeFusionMaterial(fc) and c:IsAbleToGraveAsCost()
end
function c2129638.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_ONFIELD+LOCATION_HAND)>-2
and Duel.IsExistingMatchingCard(c2129638.spfilter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,c)
and Duel.IsExistingMatchingCard(c2129638.spfilter2,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,nil,c)
end
function c2129638.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,c2129638.spfilter1,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,c)
local g2=Duel.SelectMatchingCard(tp,c2129638.spfilter2,tp,LOCATION_ONFIELD+LOCATION_HAND,0,1,1,nil,c)
g1:Merge(g2)
c:SetMaterial(g1)
Duel.SendtoGrave(g1,REASON_COST)
end
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
これのcってどうやって「同名カードを除く水属性モンスター」を定義するように書き換えるんですか?
元は
local c=e:GetHandler()
です。
選択肢を出す奴を作ってみてるのですが以下のエラーが出ます
22:Parameter 2 should be "Effect".
該当行は
function c1500.filter2(c,e,tp)
return c:IsType(TYPE_MONSTER)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
の特殊召喚の下りです
そこを消したらエラーは出ないのですがいろいろと困ります
アドバイスよろしくお願いします
function c3006.filter(c)
return c:IsCode(78785392) and c:IsAbleToHand()
end
function c3006.target (e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c3006.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c3006.target (e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c3006.filter,tp,LOCATION_DECK,0,1,nil) end
local sg=Duel.GetMatchingGroup(c3006.filter,tp,LOCATION_DECK,0,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg,sg:GetCount(),0,0)
end
function c3006.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c3006.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.BreakEffect()
local sg=Duel.GetMatchingGroup(c3006.filter,tp,LOCATION_DECK,0,nil)
Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)
end
end
function c2261.desfilter(c)
return c:IsFaceup() and c:IsSetCard(0x798)
and Duel.IsExistingTarget(aux.TRUE,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c)
end
function c2261.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c2261.desfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c2261.desfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst())
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0)
end
function c2261.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(g,REASON_EFFECT)
end
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(130000001,0))
e5:SetType(EFFECT_TYPE_QUICK_O)
e5:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e5:SetCode(EVENT_FREE_CHAIN)
e5:SetProperty(EFFECT_FLAG_CHAIN_UNIQUE)
e5:SetHintTiming(0,0x1c0)
e5:SetRange(LOCATION_EXTRA)
e5:SetCondition(c130000001.sprdon)
e5:SetOperation(c130000001.sprdop)
c:RegisterEffect(e5)
function c130000001.sprdon(e,tp,eg,ep,ev,re,r,rp)
if c==nil then return true end
local tp=c:GetControler()
local selfExist = not Duel.IsExistingMatchingCard(c130000001.sprdfilter,tp,LOCATION_ONFIELD,0,1,nil)
--醒めない悪夢からの移植記述1
local selfNotChain = e:GetHandler():GetFlagEffect(130000001)==0
return selfExist and selfNotChain
--醒めない悪夢からの移植記述2(この行でエラー発生)
e:GetHandler():RegisterFlagEffect(130000001,RESET_CHAIN,0,1)
end
function c130000001.sprdfilter(c)
return c:IsCode(130000001) and c:IsFaceup()
end
function c130000001.sprdop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
if Duel.SpecialSummon(e:GetHandler(),SUMMON_TYPE_FUSION,tp,tp,true,false,POS_FACEUP_ATTACK)~=0 then
e:GetHandler():CompleteProcedure()
end
end
end
function c1000.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_REMOVED)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_REMOVE)
e1:SetCondition(c9000.thcon)
e1:SetTarget(c9000.thtg)
e1:SetOperation(c9000.thop)
c:RegisterEffect(e1)
end
function c1000.thfilter(c,e,tp)
return c:IsPreviousLocation(LOCATION_MZONE) and c:GetPreviousControler()==tp
end
function c1000.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c1000.thfilter,1,nil,e,tp)
end
function c1000.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
end
function c1000.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
end
end
return x~=0
は「xが真であるならば真を返し、偽であるならば偽を返す」という意味で用いられている可能性が(そのコードを書いた人が常識知らずでなければ)非常に高い。
また、
if x==0 then return false end
は「xが偽であるならば偽を返す。真である場合は以降のコードに進む」という意味合いであろう。
>>384
どっちも書いてる事は同じ(マットの書き方は冗長)
「Aの効果を発動した」かどうかは大体の場合は
① AのCost内でRegisterFlagEffectで自身にフラグを立てる
② GetFlagEffectでAを発動したか判断
という手順
永続罠の効果の発動なんかでも良く見られる書き方だね