Commit e03ce3ba authored by oilloillo's avatar oilloillo

fix judge of IsRelateToEffect

fix invaild Loc count
parent 0e537522
--地底蔷薇✿濑笈叶 --地底蔷薇✿濑笈叶
local M = c999019 local M = c999019
local Mid = 999019 local Mid = 999019
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, 0x514a), true) aux.AddFusionProcFun2(c, aux.FilterBoolFunction(Card.IsFusionSetCard, 0xaa6), aux.FilterBoolFunction(Card.IsFusionSetCard, 0x514a), 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,0x514a), aux.FilterBoolFunction(Card.IsFusionSetCard,0x514a),
} }
function M.addEff1(c) function M.addEff1(c)
local function filter(c, e, tp, mg) local function filter(c, e, tp, mg)
local chkf = Duel.GetLocationCountFromEx(tp, tp, mg, c) > 0 and PLAYER_NONE or tp local chkf = Duel.GetLocationCountFromEx(tp, tp, mg, c) > 0 and PLAYER_NONE or tp
return c:IsType(TYPE_FUSION) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false) return c:IsType(TYPE_FUSION) and c:IsCanBeSpecialSummoned(e, SUMMON_TYPE_FUSION, tp, false, false)
and c:CheckFusionMaterial(mg, e:GetHandler(), chkf) and c:CheckFusionMaterial(mg, e:GetHandler(), chkf)
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)
if chk == 0 then if chk == 0 then
return Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_DECK, 0, 1, nil, TYPE_MONSTER) return Duel.IsExistingMatchingCard(Card.IsType, tp, LOCATION_DECK, 0, 1, nil, TYPE_MONSTER)
end end
end end
local function op(e,tp,eg,ep,ev,re,r,rp) local function op(e,tp,eg,ep,ev,re,r,rp)
local sg = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_DECK, 0, nil, TYPE_MONSTER) local sg = Duel.GetMatchingGroup(Card.IsType, tp, LOCATION_DECK, 0, nil, TYPE_MONSTER)
if sg:GetCount() > 0 then if sg:GetCount() > 0 then
local mc = sg:RandomSelect(tp, 1) local mc = sg:RandomSelect(tp, 1)
Duel.ConfirmCards(1-tp, mc) Duel.ConfirmCards(1-tp, mc)
Duel.ConfirmCards(tp, mc) Duel.ConfirmCards(tp, mc)
local c = e:GetHandler() local c = e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local mg = Group.FromCards(mc, c)
local fg = Duel.GetMatchingGroup(filter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg) local mg = Group.FromCards(mc, c)
if fg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(Mid, 3)) then local fg = Duel.GetMatchingGroup(filter, tp, LOCATION_EXTRA, 0, nil, e, tp, mg)
Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON) if fg:GetCount() > 0 and Duel.SelectYesNo(tp, aux.Stringid(Mid, 3)) then
local fc = fg:Select(tp, 1, 1, nil):GetFirst() Duel.Hint(HINT_SELECTMSG, tp, HINTMSG_SPSUMMON)
local fc = fg:Select(tp, 1, 1, nil):GetFirst()
fc:SetMaterial(mg)
Duel.SendtoGrave(mg, REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) fc:SetMaterial(mg)
Duel.BreakEffect() Duel.SendtoGrave(mg, REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP) Duel.BreakEffect()
fc:CompleteProcedure() Duel.SpecialSummon(fc, SUMMON_TYPE_FUSION, tp, tp, false, false, POS_FACEUP)
else fc:CompleteProcedure()
Duel.SendtoGrave(mc, REASON_EFFECT) else
end Duel.SendtoGrave(mc, REASON_EFFECT)
end end
end end
end
local e1 = Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O) local e1 = Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(Mid, 0)) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetDescription(aux.Stringid(Mid, 0))
e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1, Mid*10+1) e1:SetRange(LOCATION_MZONE)
e1:SetTarget(tg) e1:SetCountLimit(1, Mid*10+1)
e1:SetOperation(op) e1:SetTarget(tg)
c:RegisterEffect(e1) e1:SetOperation(op)
end c:RegisterEffect(e1)
end
function M.addEff2(c)
local function costfilter(c) function M.addEff2(c)
return c:IsAbleToGraveAsCost() and c:IsSetCard(0xaa6) local function costfilter(c)
and bit.band(c:GetSummonType(), SUMMON_TYPE_SPECIAL) == SUMMON_TYPE_SPECIAL return c:IsAbleToGraveAsCost() and c:IsSetCard(0xaa6)
end and bit.band(c:GetSummonType(), SUMMON_TYPE_SPECIAL) == SUMMON_TYPE_SPECIAL
end
local function cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk == 0 then return Duel.IsExistingMatchingCard(costfilter, tp, LOCATION_MZONE, 0, 1, e:GetHandler()) end local function cost(e,tp,eg,ep,ev,re,r,rp,chk)
local sg = Duel.SelectMatchingCard(tp, costfilter, tp, LOCATION_MZONE, 0, 1, 1, e:GetHandler()) if chk == 0 then return Duel.IsExistingMatchingCard(costfilter, tp, LOCATION_MZONE, 0, 1, e:GetHandler()) end
Duel.SendtoGrave(sg, REASON_COST) local sg = Duel.SelectMatchingCard(tp, costfilter, tp, LOCATION_MZONE, 0, 1, 1, e:GetHandler())
end Duel.SendtoGrave(sg, REASON_COST)
end
local function tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk == 0 then local function tg(e,tp,eg,ep,ev,re,r,rp,chk)
return Duel.GetLocationCount(tp, LOCATION_MZONE) > 0 and e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false) if chk == 0 then
end return e:GetHandler():IsCanBeSpecialSummoned(e, 0, tp, false, false)
Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, tp, LOCATION_EXTRA) end
end Duel.SetOperationInfo(0, CATEGORY_SPECIAL_SUMMON, e:GetHandler(), 1, tp, LOCATION_EXTRA)
end
local function op(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler() local function op(e,tp,eg,ep,ev,re,r,rp)
if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_EXTRA) then local c = e:GetHandler()
Duel.SpecialSummon(c, 0, tp, tp, false, false,POS_FACEUP) if c:IsRelateToEffect(e) and c:IsLocation(LOCATION_EXTRA) then
end Duel.SpecialSummon(c, 0, tp, tp, false, false,POS_FACEUP)
end end
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_QUICK_O) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetDescription(aux.Stringid(Mid, 1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetDescription(aux.Stringid(Mid, 1))
e1:SetRange(LOCATION_EXTRA) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1, Mid*10+2) e1:SetRange(LOCATION_EXTRA)
e1:SetCost(cost) e1:SetCountLimit(1, Mid*10+2)
e1:SetTarget(tg) e1:SetCost(cost)
e1:SetOperation(op) e1:SetTarget(tg)
c:RegisterEffect(e1) e1:SetOperation(op)
end c:RegisterEffect(e1)
end
function M.addCommonEff(c)
local function thfilter(c) function M.addCommonEff(c)
return c:IsAbleToHand() and (c:IsSetCard(0x514a) or c:GetCode() == 24235) local function thfilter(c)
end return c:IsAbleToHand() and (c:IsSetCard(0x514a) or c:GetCode() == 24235)
end
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 local function thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, 0) if chk == 0 then return Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) end
end Duel.SetOperationInfo(0, CATEGORY_TOHAND, nil, 1, 0, 0)
end
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 local function thop(e,tp,eg,ep,ev,re,r,rp)
local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, 1, nil) if not Duel.IsExistingMatchingCard(thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, nil) then return end
if g:GetCount() > 0 then local g = Duel.SelectMatchingCard(tp, thfilter, tp, LOCATION_GRAVE+LOCATION_DECK, 0, 1, 1, nil)
Duel.SendtoHand(g, nil, REASON_EFFECT) if g:GetCount() > 0 then
Duel.ConfirmCards(1-tp, g) Duel.SendtoHand(g, nil, REASON_EFFECT)
end Duel.ConfirmCards(1-tp, g)
end end
end
local function thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) local function thcon(e,tp,eg,ep,ev,re,r,rp)
end return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
local function repop(e,tp,eg,ep,ev,re,r,rp)
local c = e:GetHandler() local function repop(e,tp,eg,ep,ev,re,r,rp)
local e1 = Effect.CreateEffect(c) local c = e:GetHandler()
e1:SetDescription(aux.Stringid(Mid, 2)) local e1 = Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetDescription(aux.Stringid(Mid, 2))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCountLimit(1) e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetTarget(thtg) e1:SetCountLimit(1)
e1:SetOperation(thop) e1:SetTarget(thtg)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetOperation(thop)
Duel.RegisterEffect(e1, tp) e1:SetReset(RESET_PHASE+PHASE_END)
end Duel.RegisterEffect(e1, tp)
end
local e2 = Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TODECK) local e2 = Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(Mid, 2)) e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetDescription(aux.Stringid(Mid, 2))
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetCountLimit(1, Mid*10+3) e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(thcon) e2:SetCountLimit(1, Mid*10+3)
e2:SetOperation(repop) e2:SetCondition(thcon)
c:RegisterEffect(e2) e2:SetOperation(repop)
local e3 = e2:Clone() c:RegisterEffect(e2)
e3:SetCode(EVENT_REMOVE) local e3 = e2:Clone()
c:RegisterEffect(e3) e3:SetCode(EVENT_REMOVE)
local e4 = e2:Clone() c:RegisterEffect(e3)
e4:SetCode(EVENT_TO_DECK) local e4 = e2:Clone()
c:RegisterEffect(e4) e4:SetCode(EVENT_TO_DECK)
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