Commit b5cb7e48 authored by Grajade's avatar Grajade

Update expansions/script/c1150021.lua

parent 4e3a7af8
--玫瑰香水 --玫瑰香水
function c1150021.initial_effect(c) function c1150021.initial_effect(c)
-- --
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_CONTROL) e1:SetCategory(CATEGORY_CONTROL)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,1150021+EFFECT_COUNT_CODE_OATH) e1:SetCountLimit(1,1150021+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c1150021.tg1) e1:SetTarget(c1150021.tg1)
e1:SetOperation(c1150021.op1) e1:SetOperation(c1150021.op1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
-- --
end end
-- --
function c1150021.tfilter1(c)
return c:IsFaceup()
end
function c1150021.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c1150021.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c1150021.tfilter1(chkc) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(c1150021.tfilter1,tp,LOCATION_MZONE,0,1,nil) end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c1150021.tfilter1,tp,LOCATION_MZONE,0,1,1,nil) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
end end
-- --
function c1150021.ofilter1(c,e,tp) function c1150021.ofilter1(c,e,tp,tc)
local lv=e:GetLabel() local num1=math.max(c:GetLevel(),c:GetRank())
return c:IsFaceup() and c:IsControlerCanBeChanged() and ((c:IsType(TYPE_XYZ) and c:GetRace()<lv) or (not c:IsType(TYPE_XYZ) and c:GetLevel()<lv)) local num2=math.max(tc:GetLevel(),tc:GetRank())
return num1>0 and num2>0 and num2>=num1
and c:IsFaceup() and c:IsControlerCanBeChanged()
end end
function c1150021.op1(e,tp,eg,ep,ev,re,r,rp) function c1150021.op1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local c=e:GetHandler()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) then local tc=Duel.GetFirstTarget()
local g=Duel.TossCoin(tp,1) if not tc:IsFaceup() then return end
local lv=0 if not tc:IsRelateToEffect(e) then return end
if g==1 then if not tc:IsLocation(LOCATION_MZONE) then return end
if tc:IsType(TYPE_XYZ) then local ct=Duel.TossCoin(tp,1)
lv=tc:GetRank()+1 if ct==1 then
else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
lv=tc:GetLevel()+1 local sg=Duel.SelectMatchingCard(tp,c1150021.ofilter1,tp,0,LOCATION_MZONE,1,1,nil,e,tp,tc)
end if sg:GetCount()>0 then
e:SetLabel(lv) Duel.GetControl(sg,tp,PHASE_END,1)
if Duel.IsExistingMatchingCard(c1150021.ofilter1,tp,0,LOCATION_MZONE,1,nil,e,tp) then end
local g1=Duel.SelectMatchingCard(tp,c1150021.ofilter1,tp,0,LOCATION_MZONE,1,1,nil,e,tp) else
if g1:GetCount()>0 then local e1_1=Effect.CreateEffect(c)
Duel.GetControl(g1,tp,PHASE_END,1) e1_1:SetDescription(aux.Stringid(1150021,0))
end e1_1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
end e1_1:SetType(EFFECT_TYPE_QUICK_O)
end e1_1:SetCode(EVENT_CHAINING)
if g==0 then e1_1:SetRange(LOCATION_MZONE)
local e1_1=Effect.CreateEffect(e:GetHandler()) e1_1:SetCondition(c1150021.con1_1)
e1_1:SetDescription(aux.Stringid(1150021,0)) e1_1:SetTarget(c1150021.tg1_1)
e1_1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1_1:SetOperation(c1150021.op1_1)
e1_1:SetType(EFFECT_TYPE_QUICK_O) e1_1:SetReset(RESET_EVENT+0x1fe0000)
e1_1:SetCode(EVENT_CHAINING) tc:RegisterEffect(e1_1)
e1_1:SetRange(LOCATION_MZONE) end
e1_1:SetReset(RESET_EVENT+0x1fe0000)
e1_1:SetCondition(c1150021.con1_1)
e1_1:SetTarget(c1150021.tg1_1)
e1_1:SetOperation(c1150021.op1_1)
tc:RegisterEffect(e1_1)
end
end
end
--
function c1150021.con1_1(e,tp,eg,ep,ev,re,r,rp)
return not (re:GetHandler():IsType(TYPE_CONTINUOUS+TYPE_FIELD+TYPE_PENDULUM) and re:IsHasType(EFFECT_TYPE_ACTIVATE))
end end
-- --
function c1150021.tfilter1_1(c)
return c:IsAbleToHand()
end
function c1150021.tg1_1(e,tp,eg,ep,ev,re,r,rp,chk) function c1150021.tg1_1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c1150021.tfilter1_1,rp,0,LOCATION_ONFIELD,1,nil) and not e:GetHandler():IsStatus(STATUS_CHAINING) end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,rp,0,LOCATION_ONFIELD,1,nil)
and e:GetHandler():GetFlagEffect(1150021)<1 end
e:GetHandler():RegisterFlagEffect(1150021,RESET_CHAIN,0,1)
end end
-- --
function c1150021.op1_1(e,tp,eg,ep,ev,re,r,rp) function c1150021.op1_1(e,tp,eg,ep,ev,re,r,rp)
local g=Group.CreateGroup() local sg=Group.CreateGroup()
Duel.ChangeTargetCard(ev,g) Duel.ChangeTargetCard(ev,sg)
Duel.ChangeChainOperation(ev,c1150021.op1_1_1) Duel.ChangeChainOperation(ev,c1150021.op1_1_1)
end end
-- --
function c1150021.op1_1_1(e,tp,eg,ep,ev,re,r,rp) function c1150021.op1_1_1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
if c:GetType()~=TYPE_MONSTER+TYPE_CONTINUOUS+TYPE_FIELD+TYPE_PENDULUM then local sg=Duel.SelectMatchingCard(tp,c1150021.tfilter1_1,tp,0,LOCATION_ONFIELD,1,1,nil)
c:CancelToGrave(false) if sg:GetCount()>0 then
end Duel.HintSelection(sg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SendtoHand(sg,nil,REASON_EFFECT)
local g=Duel.SelectMatchingCard(tp,c1150021.tfilter1_1,tp,0,LOCATION_ONFIELD,1,1,nil) end
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
end end
--
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