魔力の枷から効果発動にコストを課す所だけ抜き出してみました
function c2000000005.initial_effect(c)
--Activate
〜〜e1は発動なので省略〜〜
--activate cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_ACTIVATE_COST)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(c2000000005.actarget)
e2:SetOperation(c2000000005.costop)
c:RegisterEffect(e2)
end
function c2000000005.actarget(e,te,tp)
return te:GetHandler():IsLocation(LOCATION_HAND)
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.PayLPCost(tp,500)
end
どうやらプレイヤーを対象にしているようですが……どこをどう攻めたらいいか全くわかりません
類似効果のカードがあれば参考にもできましょうが
>>280
うーむこういうことでしょうか
local e2=Effect.CreateEffect(c)
〜〜略〜〜
e2:SetRange(LOCATION_DECK)
e2:SetLabelObject(e3)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_ACTIVATE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetOperation(c2000000005.op)
c:RegisterEffect(e3)
end
function c2000000005.actarget(e,te,tp)
return te==e:GetLabelObject()
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.PayLPCost(tp,500)
end
function c2000000005.op(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Draw(tp,2,REASON_EFFECT)
end
local e2=e1:Clone()
e2:SetRange(LOCATION_DECK)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_ACTIVATE_COST)
e3:SetRange(LOCATION_DECK)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetTargetRange(1,1)
e3:SetTarget(c2000000005.actarget)
e3:SetOperation(c2000000005.costop)
c:RegisterEffect(e3)
e3:SetLabelObject(e2)
〜〜
function c2000000005.actarget(e,te,tp)
return te==e:GetLabelObject()
end
function c2000000005.costop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_SZONE,POS_FACEUP,true)
end
.filterとかは自分で宣言して作ってる関数だから引数は何でも入れられる
例えば
function cX.filter(c,tc)
return c:GetAttack()==tc:GetAttack()
end
〜〜
cX.filter(sc,e:GetHandler())
とか
function cX.filter(c,e)
return c:GetAttack()==e:GetHandler():GetAttack()
end
〜〜
cX.filter(sc,e)
とか
質問の答えはこれで良いのかな…?
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