Commit c6e52ecd authored by wyykak's avatar wyykak

fix c74563015.lua

parent f6cf5c5a
--圣拳月兔妖
function c74563015.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x258),c74563015.matfilter,true)
--equip
local e12=Effect.CreateEffect(c)
e12:SetCategory(CATEGORY_DISABLE)
e12:SetType(EFFECT_TYPE_QUICK_O)
e12:SetRange(LOCATION_MZONE)
e12:SetCode(EVENT_FREE_CHAIN)
e12:SetCost(c74563015.spcost)
e12:SetTarget(c74563015.eqtg)
e12:SetOperation(c74563015.eqop)
c:RegisterEffect(e12)
--draw
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_RECOVER)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,74563015)
e2:SetCondition(c74563015.drcon)
e2:SetTarget(c74563015.drtg)
e2:SetOperation(c74563015.drop)
c:RegisterEffect(e2)
end
c74563015.DescSetName=0x258
function c74563015.matfilter(c)
return c:IsFusionAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_WATER)
end
function c74563015.drcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp
end
function c74563015.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c74563015.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,74563011,RESET_PHASE+PHASE_END,0,1)
end
function c74563015.thfilter(c)
return c:IsSetCard(0x258) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c74563015.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) or Duel.IsExistingMatchingCard(c74563015.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
if Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) and (not Duel.IsExistingMatchingCard(c74563015.thfilter,tp,LOCATION_GRAVE,0,1,nil) or not Duel.SelectYesNo(tp,aux.Stringid(74563015,0))) then
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_DISCARD+REASON_COST,nil)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c74563015.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
end
function c74563015.desfilter2(c,num)
if c:IsType(TYPE_LINK) then
return num>1200
elseif c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsFaceup() then
return num>1200
else
return c:IsDefenseBelow(num) and c:IsFaceup()
end
end
function c74563015.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local lp=c:GetAttack()
e:SetLabel(lp)
local counter1=Duel.GetFlagEffect(tp,74563015)
local counter2=Duel.GetFlagEffect(tp,74563011)
if chk==0 then return Duel.IsExistingMatchingCard(c74563015.desfilter2,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,nil,lp) and counter1-counter2<=0 end
Duel.RegisterFlagEffect(tp,74563015,RESET_PHASE+PHASE_END,0,1)
end
function c74563015.gselect(g,num)
local def=0
local tc=g:GetFirst()
while tc do
if tc:IsDefenseAbove(0) and tc:IsFaceup() then
def=def+tc:GetDefense()
else
def=def+1200
end
tc=g:GetNext()
end
return def<=num
end
function c74563015.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local num=e:GetLabel()
local g=Duel.GetMatchingGroup(c74563015.desfilter2,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,nil,num)
if g:GetCount()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=g:SelectSubGroup(tp,c74563015.gselect,false,1,#g,num)
local tc=dg:GetFirst()
while tc do
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(74563015,2))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(74563015,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(74563015,2))
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
end
tc=dg:GetNext()
end
end
\ No newline at end of file
--圣拳月兔妖
function c74563015.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x258),c74563015.matfilter,true)
--equip
local e12=Effect.CreateEffect(c)
e12:SetCategory(CATEGORY_DISABLE)
e12:SetType(EFFECT_TYPE_QUICK_O)
e12:SetRange(LOCATION_MZONE)
e12:SetCode(EVENT_FREE_CHAIN)
e12:SetCost(c74563015.spcost)
e12:SetTarget(c74563015.eqtg)
e12:SetOperation(c74563015.eqop)
c:RegisterEffect(e12)
--draw
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_RECOVER)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,74563015)
e2:SetCondition(c74563015.drcon)
e2:SetTarget(c74563015.drtg)
e2:SetOperation(c74563015.drop)
c:RegisterEffect(e2)
end
c74563015.DescSetName=0x258
function c74563015.matfilter(c)
return c:IsFusionAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_WATER)
end
function c74563015.drcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp
end
function c74563015.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
end
function c74563015.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(tp,74563011,RESET_PHASE+PHASE_END,0,1)
end
function c74563015.thfilter(c)
return c:IsSetCard(0x258) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c74563015.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) or Duel.IsExistingMatchingCard(c74563015.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
if Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) and (not Duel.IsExistingMatchingCard(c74563015.thfilter,tp,LOCATION_GRAVE,0,1,nil) or not Duel.SelectYesNo(tp,aux.Stringid(74563015,0))) then
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_DISCARD+REASON_COST,nil)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c74563015.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
end
function c74563015.desfilter2(c,num)
return c74563015.customdef(c)<=num
end
function c74563015.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local lp=c:GetAttack()
e:SetLabel(lp)
local counter1=Duel.GetFlagEffect(tp,74563015)
local counter2=Duel.GetFlagEffect(tp,74563011)
if chk==0 then return Duel.IsExistingMatchingCard(c74563015.desfilter2,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,1,nil,lp) and counter1-counter2<=0 end
Duel.RegisterFlagEffect(tp,74563015,RESET_PHASE+PHASE_END,0,1)
end
function c74563015.gselect(g,num)
local def=0
local tc=g:GetFirst()
while tc do
if tc:IsDefenseAbove(0) and tc:IsFaceup() then
def=def+tc:GetDefense()
else
def=def+1200
end
tc=g:GetNext()
end
return def<=num
end
function c74563015.customdef(c)
if c:IsType(TYPE_LINK|TYPE_SPELL|TYPE_TRAP) and c:IsFaceup() then
return 1200
else
return c:GetDefense()
end
end
function c74563015.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local num=e:GetLabel()
local g=Duel.GetMatchingGroup(c74563015.desfilter2,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,nil,num)
if g:GetCount()==0 then return end
local dg=Group.CreateGroup()
while true do
g=Duel.GetMatchingGroup(c74563015.desfilter2,tp,0,LOCATION_ONFIELD+LOCATION_GRAVE+LOCATION_REMOVED,dg,num)
if #g==0 then
break
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLE)
local sc=g:SelectUnselect(dg,tp,#dg>0,#dg>0,1,99)
if not sc then
break
elseif g:IsContains(sc) then
g:RemoveCard(sc)
dg:AddCard(sc)
num=num-c74563015.customdef(sc)
else
dg:RemoveCard(sc)
g:AddCard(sc)
num=num+c74563015.customdef(sc)
end
end
local tc=dg:GetFirst()
while tc do
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(74563015,2))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(74563015,2))
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2)
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(74563015,2))
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3)
end
tc=dg:GetNext()
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