Commit fe8d35ac authored by oilloillo's avatar oilloillo

fix error setcode

parent 0e537522
--绿叶之主✿濑笈叶 --绿叶之主✿濑笈叶
local M = c999017 local M = c999017
local Mid = 999017 local Mid = 999017
function M.initial_effect(c) function M.initial_effect(c)
-- fusion material -- fusion material
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, 0xaa6), aux.FilterBoolFunction(Card.IsFusionSetCard, 0x3208), true) aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, 0xaa6), aux.FilterBoolFunction(Card.IsFusionSetCard, 0x3208), true)
M.addEff1(c) M.addEff1(c)
M.addEff2(c) M.addEff2(c)
M.addCommonEff(c) M.addCommonEff(c)
end end
M.hana_mat={ M.hana_mat={
aux.FilterBoolFunction(Card.IsFusionSetCard,0xaa6), aux.FilterBoolFunction(Card.IsFusionSetCard,0xaa6),
aux.FilterBoolFunction(Card.IsFusionSetCard,0x3208), aux.FilterBoolFunction(Card.IsFusionSetCard,0x3208),
} }
function M.addEff1(c) function M.addEff1(c)
local function filter(c, tp) local function filter(c, tp)
return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() return c:IsLocation(LOCATION_MZONE) and c:IsFaceup()
and c:IsType(TYPE_FUSION) and c:IsSetCard(0xaa6) and c:GetSummonPlayer() == tp and c:IsType(TYPE_FUSION) and c:IsSetCard(0xaa6) and c:GetSummonPlayer() == tp
end end
local function thfilter(c) local function thfilter(c)
return c:IsAbleToHand() and c:IsSetCard(0xaa6) return c:IsAbleToHand() and c:IsSetCard(0xaa6)
end end
local function target(e,tp,eg,ep,ev,re,r,rp,chk) local function target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk == 0 then if chk == 0 then
return eg:FilterCount(filter, nil, tp) > 0 return eg:FilterCount(filter, nil, tp) > 0
and Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_DECK, 0, 1, nil) and Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_DECK, 0, 1, nil)
end end
end end
local function operation(e,tp,eg,ep,ev,re,r,rp,chk) local function operation(e,tp,eg,ep,ev,re,r,rp,chk)
if not Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_DECK, 0, 1, nil) then return end if not Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_DECK, 0, 1, nil) then return end
local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_DECK, 0, 1, 1, nil) local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_DECK, 0, 1, 1, nil)
if g:GetCount() > 0 then if g:GetCount() > 0 then
Duel.SendtoHand(g, nil, REASON_EFFECT) Duel.SendtoHand(g, nil, REASON_EFFECT)
Duel.ConfirmCards(1-tp, g) Duel.ConfirmCards(1-tp, g)
end end
end end
local e = Effect.CreateEffect(c) local e = Effect.CreateEffect(c)
e:SetCategory(CATEGORY_TOHAND) e:SetCategory(CATEGORY_TOHAND)
e:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e:SetDescription(aux.Stringid(Mid, 0)) e:SetDescription(aux.Stringid(Mid, 0))
e:SetCode(EVENT_SPSUMMON_SUCCESS) e:SetCode(EVENT_SPSUMMON_SUCCESS)
e:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e:SetRange(LOCATION_MZONE) e:SetRange(LOCATION_MZONE)
e:SetCountLimit(1, Mid*10+1) e:SetCountLimit(1, Mid*10+1)
e:SetTarget(target) e:SetTarget(target)
e:SetOperation(operation) e:SetOperation(operation)
c:RegisterEffect(e) c:RegisterEffect(e)
end end
function M.addEff2(c) function M.addEff2(c)
local function discardFilter(c) local function discardFilter(c)
return c:IsDiscardable() and c:IsType(TYPE_SPELL) return c:IsDiscardable() and c:IsType(TYPE_SPELL)
end end
local function cost(e,tp,eg,ep,ev,re,r,rp,chk) local function cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk == 0 then return Duel.IsExistingMatchingCard(discardFilter, tp, LOCATION_HAND, 0, 1, nil) end if chk == 0 then return Duel.IsExistingMatchingCard(discardFilter, tp, LOCATION_HAND, 0, 1, nil) end
Duel.DiscardHand(tp, discardFilter, 1, 1, REASON_COST+REASON_DISCARD, nil) Duel.DiscardHand(tp, discardFilter, 1, 1, REASON_COST+REASON_DISCARD, nil)
end end
local function tg(e,tp,eg,ep,ev,re,r,rp,chk) local function tg(e,tp,eg,ep,ev,re,r,rp,chk)
local c = e:GetHandler() local c = e:GetHandler()
if chk == 0 then return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 if chk == 0 then return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0
and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and c:IsLocation(LOCATION_GRAVE) and c:IsCanBeSpecialSummoned(e, 0, tp, false, false) and c:IsLocation(LOCATION_GRAVE)
end end
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0) Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, c, 1, 0, 0)
end end
local function op(e,tp,eg,ep,ev,re,r,rp,chk) local function op(e,tp,eg,ep,ev,re,r,rp,chk)
local c = e:GetHandler() local c = e:GetHandler()
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_GRAVE) then if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_GRAVE) then
if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then if Duel.SpecialSummon(c, 0, tp, tp, false, false, POS_FACEUP) > 0 then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE) e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_SET_ATTACK) e3:SetCode(EFFECT_SET_ATTACK)
e3:SetValue(4000) e3:SetValue(4000)
e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) e3:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
end end
end end
local e1 = Effect.CreateEffect(c) local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetDescription(aux.Stringid(Mid, 1)) e1:SetDescription(aux.Stringid(Mid, 1))
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_GRAVE) e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1, Mid*10+2) e1:SetCountLimit(1, Mid*10+2)
e1:SetCost(cost) e1:SetCost(cost)
e1:SetTarget(tg) e1:SetTarget(tg)
e1:SetOperation(op) e1:SetOperation(op)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function M.addCommonEff(c) function M.addCommonEff(c)
local function thfilter(c) local function thfilter(c)
return c:IsAbleToHand() and (c:IsSetCard(0x3028) or c:GetCode() == 24235) return c:IsAbleToHand() and (c:IsSetCard(0x3208) or c:GetCode() == 24235)
end end
local function thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local function thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk == 0 then return Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) end if chk == 0 then return Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) end
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, 0) Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, 0)
end end
local function thop(e,tp,eg,ep,ev,re,r,rp) local function thop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) then return end if not Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) then return end
local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, 1, nil) local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, 1, nil)
if g:GetCount() > 0 then if g:GetCount() > 0 then
Duel.SendtoHand(g, nil, REASON_EFFECT) Duel.SendtoHand(g, nil, REASON_EFFECT)
Duel.ConfirmCards(1-tp, g) Duel.ConfirmCards(1-tp, g)
end end
end end
local function thcon(e,tp,eg,ep,ev,re,r,rp) local function thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end end
local function repop(e,tp,eg,ep,ev,re,r,rp) local function repop(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler() local c = e:GetHandler()
local e1 = Effect.CreateEffect(c) local e1 = Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(Mid, 2)) e1:SetDescription(aux.Stringid(Mid, 2))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetTarget(thtg) e1:SetTarget(thtg)
e1:SetOperation(thop) e1:SetOperation(thop)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1, tp) Duel.RegisterEffect(e1, tp)
end end
local e2 = Effect.CreateEffect(c) local e2 = Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK) e2:SetCategory(CATEGORY_TODECK)
e2:SetDescription(aux.Stringid(Mid, 2)) e2:SetDescription(aux.Stringid(Mid, 2))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE) e2:SetCode(EVENT_TO_GRAVE)
e2:SetCountLimit(1, Mid*10+3) e2:SetCountLimit(1, Mid*10+3)
e2:SetCondition(thcon) e2:SetCondition(thcon)
e2:SetOperation(repop) e2:SetOperation(repop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
local e3 = e2:Clone() local e3 = e2:Clone()
e3:SetCode(EVENT_REMOVE) e3:SetCode(EVENT_REMOVE)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4 = e2:Clone() local e4 = e2:Clone()
e4:SetCode(EVENT_TO_DECK) e4:SetCode(EVENT_TO_DECK)
c:RegisterEffect(e4) c:RegisterEffect(e4)
end end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment