Files
UniverseDeck/lua/c56158660.lua

65 lines
2.2 KiB
Lua
Raw Permalink Normal View History

2021-12-01 19:25:02 +01:00
--Universe Union Dragon
local s,id=GetID()
function s.initial_effect(c)
--pendulum summon
Pendulum.AddProcedure(c,false)
2021-12-04 15:40:15 +01:00
--fusion summon
2021-12-03 20:22:46 +01:00
c:EnableReviveLimit()
2021-12-04 15:40:15 +01:00
Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,0x25E),2)
2021-12-20 15:26:01 +01:00
--dmg and destroy
2021-12-12 17:03:38 +01:00
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_IGNITION)
2021-12-12 17:03:38 +01:00
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,id)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
--place in pendulum zone
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROYED)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(s.pencon)
e2:SetTarget(s.pentg)
e2:SetOperation(s.penop)
c:RegisterEffect(e2)
2021-12-12 17:03:38 +01:00
end
--damage effect
function s.thfilter(c)
return c:IsFaceup() and c:IsAttackAbove(1)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
2021-12-12 17:03:38 +01:00
local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_MZONE,1,1,nil)
local d=g:GetFirst():GetAttack()
Duel.SetTargetPlayer(1-tp)
2021-12-12 17:03:38 +01:00
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,d)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
2021-12-12 17:03:38 +01:00
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
if tc and tc:IsRelateToEffect(e) and Duel.Damage(p,tc:GetAttack(),REASON_EFFECT) then
Duel.Destroy(tc, REASON_DESTROY)
2021-12-12 17:03:38 +01:00
end
end
-- place in pendulum zone functions
function s.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1) end
end
function s.penop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return false end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
2021-12-04 15:40:15 +01:00
end