Files
UniverseDeck/lua/c56158661.lua

117 lines
4.3 KiB
Lua
Raw Permalink Normal View History

2021-12-04 15:40:15 +01:00
--Universe Exceed Dragon
local s,id=GetID()
function s.initial_effect(c)
--pendulum summon
Pendulum.AddProcedure(c,false)
--xyz summon
Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute, ATTRIBUTE_DARK),4,2)
2021-12-04 15:40:15 +01:00
c:EnableReviveLimit()
--halve and gain
2021-12-16 12:25:30 +01:00
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_IGNITION)
2021-12-16 12:25:30 +01:00
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetRange(LOCATION_MZONE)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCountLimit(1)
e1:SetCondition(s.atkcon2)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.atkop2)
c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT)
--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)
2022-01-15 11:05:20 +01:00
--pendulum effect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_PZONE)
e3:SetTarget(s.gytarget)
c:RegisterEffect(e3)
2021-12-16 12:25:30 +01:00
end
--halve and gain functions
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.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
end
function s.atkcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function s.atkop2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
local atk=tc:GetAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(math.ceil(atk/2))
Duel.Recover(tp,atk/2,REASON_EFFECT,false)
tc:RegisterEffect(e1)
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e2:SetValue(math.ceil(atk/2))
c:RegisterEffect(e2)
end
end
end
-- place in pendulum zone functions
2021-12-16 12:25:30 +01:00
s.pendulum_level = 4
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
end
2022-01-15 11:05:20 +01:00
--pendulum effect functions
function s.gytarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) end
if chk==0 then return Duel.IsExistingTarget(Card.IsLocation,tp,0,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,Card.IsLocation,tp,0,LOCATION_GRAVE,1,1,nil)
end
--[[function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(c, LOCATION_GRAVE) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_GRAVE,1,1,nil)
local d=g:GetFirst():GetAttack()
Duel.SetTargetPlayer(tp)
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()
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)
end
end]]