diff --git a/lua/c561586061.lua b/lua/c561586061.lua index 2fa7869..8e1bad3 100644 --- a/lua/c561586061.lua +++ b/lua/c561586061.lua @@ -6,4 +6,81 @@ function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,0x25E),4,2) c:EnableReviveLimit() -end \ No newline at end of file + --halve and gain | from dark anthelion + local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,1)) + e1:SetType(EFFECT_TYPE_QUICK_O) + 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) +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 +-- pendulum zone functions +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