Commit ef44f86f authored by Vury Leo's avatar Vury Leo

Add 捕食植物トリアンティス and 召喚魔術 to new fusion

parent dc9d8d5c
--捕食植物トリアンティス
local s,id,o=GetID()
function s.initial_effect(c)
--pendulum summon
aux.EnablePendulumAttribute(c)
-- if you Fusion Summon a DARK Fusion Monster, you can also use cards in your Pendulum Zones as monsters on the field, as material for its Fusion Summon.
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL)
e1:SetRange(LOCATION_PZONE)
e1:SetTargetRange(LOCATION_PZONE,0)
e1:SetValue(s.mtval)
e1:SetOperation(function() return FusionSpell.FUSION_OPERATION_INHERIT end)
-- as of 2025 May, there is no card can add LOCATION_MZONE base on material group. So we can just check pre_select_mat_location.
e1:SetLabel(0xff,LOCATION_MZONE) --- only avaliable when pre_select_mat_location contains LOCATION_MZONE, 1st number is limitaion of count materials, set 0xff as a placeholder
c:RegisterEffect(e1)
--counter
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_COUNTER)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(s.ctcon)
e2:SetTarget(s.cttg)
e2:SetOperation(s.ctop)
c:RegisterEffect(e2)
end
function s.mtval(e,c)
return c and c:IsAttribute(ATTRIBUTE_DARK)
end
function s.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsLocation(LOCATION_GRAVE+LOCATION_EXTRA) and r==REASON_FUSION
end
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0
and Duel.IsExistingMatchingCard(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,0x1041,1) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
local g=Duel.GetMatchingGroup(Card.IsCanAddCounter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,0x1041,1)
if ct>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_COUNTER)
local sg=g:Select(tp,1,ct,nil)
local sc=sg:GetFirst()
while sc do
if sc:AddCounter(0x1041,1) and sc:GetLevel()>1 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetCondition(s.lvcon)
e1:SetValue(1)
sc:RegisterEffect(e1)
end
sc=sg:GetNext()
end
end
end
function s.lvcon(e)
return e:GetHandler():GetCounter(0x1041)>0
end
\ No newline at end of file
--召喚魔術
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=FusionSpell.CreateSummonEffect(c,{
pre_select_mat_location=s.pre_select_mat_location,
pre_select_mat_opponent_location=s.pre_select_mat_opponent_location,
mat_operation_code_map={
{ [LOCATION_GRAVE|LOCATION_ONFIELD] = FusionSpell.FUSION_OPERATION_BANISH },
{ [0xff] = FusionSpell.FUSION_OPERATION_GRAVE }
},
extra_target=s.extra_target
})
e1:SetDescription(aux.Stringid(id,0))
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,id)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
end
---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
function s.pre_select_mat_location(tc,tp)
local res=LOCATION_HAND
if tc:IsSetCard(0xf4) then
res=res|LOCATION_MZONE|LOCATION_GRAVE
end
return res
end
---@type FUSION_SPELL_PRE_SELECT_MAT_LOCATION_FUNCTION
function s.pre_select_mat_opponent_location(tc,tp)
local res=0
if tc:IsSetCard(0xf4) then
res=res|LOCATION_GRAVE
end
return res
end
function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return true
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_MZONE+LOCATION_GRAVE)
end
function s.thfilter(c)
return c:IsFaceup() and c:IsCode(86120751) and c:IsAbleToHand()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter(chkc) end
if chk==0 then return e:GetHandler():IsAbleToDeck()
and Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
\ No newline at end of file
This diff is collapsed.
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