Commit 509e59b9 authored by 聖園ミカ's avatar 聖園ミカ 🐟

update

parent 175b094b
No preview for this file type
--双叶的夏日
local m=81021038
local cm=_G["c"..m]
Duel.LoadScript("c81000000.lua")
function cm.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,m)
e1:SetCost(cm.cost)
e1:SetTarget(cm.target)
e1:SetOperation(cm.activate)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,1))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1,m+900)
e2:SetCondition(cm.descon)
e2:SetCost(cm.cost)
e2:SetTarget(cm.destg)
e2:SetOperation(cm.desop)
c:RegisterEffect(e2)
--Protect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_GRAVE)
e3:SetCost(aux.bfgcost)
e3:SetOperation(cm.immop)
c:RegisterEffect(e3)
end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function cm.thfilter(c,e,tp)
if not (c:IsSetCard(0x818) and c:IsType(TYPE_MONSTER)) then return false end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
return c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false))
end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(cm.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
end
function cm.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPERATECARD)
local g=Duel.SelectMatchingCard(tp,cm.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if tc:IsAbleToHand() and (not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or ft<=0 or Duel.SelectOption(tp,1190,1152)==0) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetOperation(cm.ret)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1,true)
end
end
end
function cm.ret(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
end
function cm.descfilter(c)
return c:IsFaceup() and c:IsSetCard(0x818)
end
function cm.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.descfilter,tp,LOCATION_MZONE,0,1,nil)
end
function cm.desfilter(c,atk)
return c:IsFaceup() and c:IsAttackBelow(atk) and c:IsAbleToRemove()
end
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local atk=math.abs(Duel.GetLP(tp)-Duel.GetLP(1-tp))
if chk==0 then return Duel.IsExistingMatchingCard(cm.desfilter,tp,0,LOCATION_MZONE,1,nil,atk) end
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil,atk)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function cm.fselect(g,atk)
return g:GetSum(Card.GetAttack)<=atk
end
function cm.desop(e,tp,eg,ep,ev,re,r,rp)
local atk=e:GetLabel()
local g=Duel.GetMatchingGroup(cm.desfilter,tp,0,LOCATION_MZONE,nil,atk)
if g:GetCount()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local dg=g:SelectSubGroup(tp,cm.fselect,false,1,g:GetCount(),atk)
Duel.HintSelection(dg)
Duel.Remove(dg,POS_FACEUP,REASON_EFFECT)
end
function cm.immop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetValue(1)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x818))
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
Duel.RegisterEffect(e2,tp)
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