Commit 46cead35 authored by mercury233's avatar mercury233 Committed by GitHub

update 血の代償 (#2046)

parent 48987a5c
...@@ -2,81 +2,46 @@ ...@@ -2,81 +2,46 @@
function c80604091.initial_effect(c) function c80604091.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c80604091.cost1)
e1:SetTarget(c80604091.target1)
e1:SetOperation(c80604091.activate1)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--instant --summon
local e3=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(80604091,0)) e2:SetDescription(aux.Stringid(80604091,0))
e3:SetCategory(CATEGORY_SUMMON) e2:SetCategory(CATEGORY_SUMMON)
e3:SetType(EFFECT_TYPE_QUICK_O) e2:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_SZONE) e2:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_FREE_CHAIN) e2:SetCode(EVENT_FREE_CHAIN)
e3:SetCondition(c80604091.condition2) e2:SetHintTiming(0,TIMING_BATTLE_START+TIMING_BATTLE_END)
e3:SetCost(c80604091.cost2) e2:SetCondition(c80604091.condition)
e3:SetTarget(c80604091.target2) e2:SetCost(c80604091.cost)
e3:SetOperation(c80604091.activate2) e2:SetTarget(c80604091.target)
c:RegisterEffect(e3) e2:SetOperation(c80604091.activate)
end c:RegisterEffect(e2)
function c80604091.filter(c) end
return c:IsSummonable(true,nil) or c:IsMSetable(true,nil) function c80604091.condition(e,tp,eg,ep,ev,re,r,rp)
end
function c80604091.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetLabel(0)
local tn=Duel.GetTurnPlayer() local tn=Duel.GetTurnPlayer()
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
if ((tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)) or (tn~=tp and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)) return (tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2))
and Duel.CheckLPCost(tp,500) or (tn==1-tp and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)
and Duel.IsExistingMatchingCard(c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(80604091,1)) then
Duel.PayLPCost(tp,500)
e:SetLabel(1)
end
end
function c80604091.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if e:GetLabel()~=1 then return end
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c80604091.activate1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()~=1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if tc:IsSummonable(true,nil) and (not tc:IsMSetable(true,nil)
or Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) then
Duel.Summon(tp,tc,true,nil)
else Duel.MSet(tp,tc,true,nil) end
end
end end
function c80604091.condition2(e,tp,eg,ep,ev,re,r,rp) function c80604091.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local tn=Duel.GetTurnPlayer() if chk==0 then return Duel.CheckLPCost(tp,500) end
local ph=Duel.GetCurrentPhase() Duel.PayLPCost(tp,500)
return (tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)) or (tn~=tp and ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE)
end end
function c80604091.cost2(e,tp,eg,ep,ev,re,r,rp,chk) function c80604091.filter(c)
if chk==0 then return Duel.CheckLPCost(tp,500) return c:IsSummonable(true,nil) or c:IsMSetable(true,nil)
else Duel.PayLPCost(tp,500) end
end end
function c80604091.target2(e,tp,eg,ep,ev,re,r,rp,chk) function c80604091.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
if not e:GetHandler():IsStatus(STATUS_CHAINING) then local ct1=Duel.GetMatchingGroupCount(c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil)
local ct=Duel.GetMatchingGroupCount(c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,nil) local ct2=Duel.GetFlagEffect(tp,80604091)
e:SetLabel(ct) return ct1-ct2>0
return ct>0
else return e:GetLabel()>0 end
end end
e:SetLabel(e:GetLabel()-1) Duel.RegisterFlagEffect(tp,80604091,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end end
function c80604091.activate2(e,tp,eg,ep,ev,re,r,rp) function c80604091.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,c80604091.filter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil)
local tc=g:GetFirst() local tc=g:GetFirst()
......
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