Commit f3364263 authored by gggg's avatar gggg

add makina

parent 30d13b13
Pipeline #35675 failed with stage
in 8 seconds
--DARK EX MAKINA
local s,id,o=GetID()
---@param c Card
function s.initial_effect(c)
--xyz summon
c:EnableReviveLimit()
aux.AddXyzProcedureLevelFree(c,s.mfilter,s.xyzcheck,2,128)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCategory(CATEGORY_DICE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
end
function s.mfilter(c,xyzc)
return c:IsXyzType(TYPE_XYZ) and not c:IsSetCard(0x48)
end
function s.xyzcheck(g)
return g:GetClassCount(Card.GetRank)==1
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_MZONE,0,1,e:GetHandler())
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,PLAYER_ALL,1)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local res=Duel.TossDice(tp,1)
if res<1 or res>6 then return end
local effects={
-- ●1:召蕾弹
function(factory)
local e2=factory()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SELF_DESTROY)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(function(e,c)
return c:GetAttack()<=1000 and c:IsFaceup() and not c:IsImmuneToEffect(e) and c:IsDestructable()
end)
e2:SetValue(aux.TRUE)
return e2
end,
-- ●2:虚无之力
function(factory)
local e2=factory()
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e2:SetTargetRange(LOCATION_DECK,LOCATION_DECK)
e2:SetValue(LOCATION_REMOVED)
return e2
end,
-- ●3:孤寂
function(factory)
local e1=factory()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(e1:GetProperty() | EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_MAX_MZONE)
e1:SetTargetRange(1,1)
e1:SetValue(1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_FLAG_CONTNUOUS)
e2:SetProperty(e1:GetProperty() | EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_ADJUST)
e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
local function select_send_grave(p)
local c2=Duel.GetFieldGroupCount(p,LOCATION_MZONE,0)
if c2>1 then
Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(p,aux.TRUE,p,LOCATION_MZONE,0,c2-1,c2-1,nil)
return g2
end
return Group.CreateGroup()
end
local g1=select_send_grave(tp)
local g2=select_send_grave(1-tp)
local g=g1+g2
if #g>0 then
Duel.SendtoGrave(g,REASON_RULE)
Duel.Readjust()
end
end)
return e1,e2
end,
-- ●4:Ice Sill
function(factory)
--disable
local e1=factory()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e1:SetTarget(s.distarget)
--disable effect
local e2=factory()
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetOperation(s.disoperation)
--disable trap monster
local e3=factory()
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e3:SetTarget(s.distarget2)
--disable trap monster
local e4=factory()
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_REMOVE)
e4:SetTargetRange(LOCATION_GRAVE,LOCATION_GRAVE)
end,
-- ●5:希望的碎片
function(factory)
local e1=factory()
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(e:GetProperty() | EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(function(e,c,sump,sumtype,sumpos,targetp)
return c:IsLocation(LOCATION_EXTRA)
end)
return e1
end,
-- ●6:无尽的轮回
function(factory)
local e1=factory()
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAINING)
e1:SetOperation(function(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimit(aux.FALSE)
end)
return e1
end
}
local first=true
local function factory()
local e1=Effect.CreateEffect(c)
if first then
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetDescription(aux.Stringid(id,res))
else
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
end
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,2)
e1:SetRange(LOCATION_MZONE)
return e1
end
local use_effect=effects[res]
if not use_effect then return end
local effects={use_effect(factory)}
for _,effect in ipairs(effects) do
if effect then
c:RegisterEffect(effect,true)
end
end
end
function s.distarget(e,c)
return c:IsType(TYPE_TRAP+TYPE_SPELL)
end
function s.distarget2(e,c)
return c:IsType(TYPE_TRAP)
end
function s.disoperation(e,tp,eg,ep,ev,re,r,rp)
local tl=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
if tl==LOCATION_ONFIELD and re:IsActiveType(TYPE_TRAP+TYPE_SPELL) then
Duel.NegateEffect(ev)
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