这里贴一下相关代码:
function this.initial_effect(c)
...
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_GRAVE_ACTION)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id+offset)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(this.condition)
e2:SetTarget(this.target)
e2:SetOperation(this.operation)
c:RegisterEffect(e2)
end
--2效果的发动时段,不能是伤害计算阶段
function this.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL
end
--2效果场上·墓地卡片筛选,要求表侧表示、有等级且能够返回卡组
function this.synfilter1(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and not (c:IsType(TYPE_LINK) or c:IsType(TYPE_XYZ)) and c:IsAbleToDeck() and c:IsCanBeSynchroMaterial()
end
--2效果手卡筛选,要求怪兽卡且能够返回卡组(没有等级的怪兽不会出现在手卡中)
function this.synfilter2(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToDeck() and c:IsCanBeSynchroMaterial()
end
--2效果手卡素材筛选,用于展示手卡素材
function this.handfilter(c)
return c:IsLocation(LOCATION_HAND)
end
function this.synmfilter(c,tp,syncard,mg)
local ret=Duel.CheckSynchroMaterial(syncard,nil,this.synfilter2,1,mg:GetCount(),nil,mg)
return ret
end
--2效果的效果目标,被同调召唤的怪兽
function this.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local mg=Duel.GetMatchingGroup(this.synfilter1,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil)
local handmg=Duel.GetMatchingGroup(this.synfilter2,tp,LOCATION_HAND,0,nil)
mg:Merge(handmg)
return Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,mg)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
--2效果的效果操作,选素材进行同调召唤
function this.operation(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetMatchingGroup(this.synfilter1,tp,LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE,nil)
local handmg=Duel.GetMatchingGroup(this.synfilter2,tp,LOCATION_HAND,0,nil)
mg:Merge(handmg)
local g2=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil,mg)
if g2:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g2:Select(tp,1,1,nil)
local syncard=sg:GetFirst() --要同调召唤的同调怪兽
if syncard ~= nil then
Debug.Message(syncard:IsHasEffect(EFFECT_SPSUMMON_PROC))
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local copymg=mg:Clone()
local mg2=mg:Filter(this.synmfilter,nil,tp,syncard,copymg)
local mat1=Duel.SelectSynchroMaterial(tp,syncard,this.synfilter2,nil,1,99,e:GetHandler(),mg2) --让玩家选择同调素材
if mat1 ~= nil then
--展示手卡中的同调素材
if mat1:IsExists(this.handfilter,1,nil) then
local showHandmg=mat1:Filter(this.handfilter,nil)
Duel.ConfirmCards(1-tp,showHandmg)
end
syncard:SetMaterial(mat1) --设置同调素材
aux.PlaceCardsOnDeckBottom(tp,mat1,REASON_EFFECT+REASON_MATERIAL+REASON_SYNCHRO)
Duel.BreakEffect()
Duel.SpecialSummon(syncard,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)
syncard:CompleteProcedure()
end
end
end
--添加自肃
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0) e2:SetTarget(this.synsplimit)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
end
--2效果的自肃筛选,不是同调怪兽不能从额外卡组特殊召唤
function this.synsplimit(e,c)
return not c:IsType(TYPE_SYNCHRO) and c:IsLocation(LOCATION_EXTRA)
end