Commit 0437ad43 authored by mercury233's avatar mercury233

fix

parent 9c14e83b
......@@ -54,7 +54,7 @@ function c101012027.discon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev)
end
function c101012027.costfilter(c)
return c:IsSetCard(0x134) or c:IsRace(RACE_SPELLCASTER) and (c:IsControler(tp) or c:IsFaceup())
return c:IsSetCard(0x134) or c:IsRace(RACE_SPELLCASTER)
end
function c101012027.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c101012027.costfilter,2,nil) end
......
......@@ -58,21 +58,27 @@ function c101012036.disop(e,tp,eg,ep,ev,re,r,rp)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
local fid=c:GetFieldID()
tc:RegisterFlagEffect(101012036,RESET_EVENT+RESET_TURN_SET+RESET_OVERLAY+RESET_MSCHANGE+RESET_PHASE+PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(101012036,1))
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(101012036,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
e3:SetReset(RESET_EVENT+RESET_TURN_SET+RESET_OVERLAY+RESET_MSCHANGE+RESET_PHASE+PHASE_END)
e3:SetLabel(fid)
e3:SetLabelObject(tc)
e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetOperation(c101012036.damop)
tc:RegisterEffect(e3,true)
Duel.RegisterEffect(e3,tp)
end
end
function c101012036.damop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if not eg:IsContains(tc) then return end
if tc:GetFlagEffectLabel(101012036)~=e:GetLabel() then
e:Reset()
return
end
Duel.Hint(HINT_CARD,0,101012036)
local c=e:GetHandler()
local atk=c:GetTextAttack()
if atk<0 then atk=0 end
Duel.Damage(c:GetPreviousControler(),atk,REASON_EFFECT)
Duel.Damage(tc:GetPreviousControler(),tc:GetBaseAttack(),REASON_EFFECT)
tc:ResetFlagEffect(101012036)
e:Reset()
end
......@@ -2,14 +2,52 @@
--Scripted by mallu11
function c101012070.initial_effect(c)
--activate
--attack down
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(101012070,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMINGS_CHECK_MONSTER+TIMING_DAMAGE_STEP+TIMING_END_PHASE)
e1:SetTarget(c101012070.target)
e1:SetOperation(c101012070.activate)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(c101012070.atkcon)
e1:SetTarget(c101012070.atktg)
e1:SetOperation(c101012070.atkop)
c:RegisterEffect(e1)
--ritual summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(101012070,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e2:SetTarget(c101012070.sptg)
e2:SetOperation(c101012070.spop)
c:RegisterEffect(e2)
end
function c101012070.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c101012070.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_RITUAL)
end
function c101012070.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c101012070.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
end
function c101012070.atkop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(c101012070.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-ct*500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
function c101012070.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,greater_or_equal,chk)
if bit.band(c:GetType(),0x81)~=0x81 or (filter and not filter(c,e,tp,chk))
......@@ -29,76 +67,38 @@ function c101012070.RitualUltimateFilter(c,filter,e,tp,m1,m2,level_function,grea
aux.GCheckAdditional=nil
return res
end
function c101012070.filter(c,e,tp)
function c101012070.rfilter(c,e,tp)
return c:IsSetCard(0x138)
end
function c101012070.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_RITUAL)
end
function c101012070.target(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=Duel.IsExistingMatchingCard(c101012070.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil)
function c101012070.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local mg=Duel.GetRitualMaterial(tp)
local b2=Duel.IsExistingMatchingCard(c101012070.RitualUltimateFilter,tp,LOCATION_DECK,0,1,nil,c101012070.filter,e,tp,mg,nil,Card.GetLevel,"Equal")
if chk==0 then return b1 or b2 end
local opt=0
if b1 and not b2 then
opt=Duel.SelectOption(tp,aux.Stringid(101012070,0))
end
if not b1 and b2 then
opt=Duel.SelectOption(tp,aux.Stringid(101012070,1))+1
end
if b1 and b2 then
opt=Duel.SelectOption(tp,aux.Stringid(101012070,0),aux.Stringid(101012070,1))
end
e:SetLabel(opt)
if opt==0 then
e:SetCategory(CATEGORY_ATKCHANGE)
else
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
if chk==0 then return Duel.IsExistingMatchingCard(c101012070.RitualUltimateFilter,tp,LOCATION_DECK,0,1,nil,c101012070.rfilter,e,tp,mg,nil,Card.GetLevel,"Equal") end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c101012070.activate(e,tp,eg,ep,ev,re,r,rp)
local opt=e:GetLabel()
if opt==0 then
local ct=Duel.GetMatchingGroupCount(c101012070.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-ct*500)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc=g:GetNext()
function c101012070.spop(e,tp,eg,ep,ev,re,r,rp)
local mg=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c101012070.RitualUltimateFilter,tp,LOCATION_DECK,0,1,1,nil,c101012070.rfilter,e,tp,mg,nil,Card.GetLevel,"Equal")
local tc=tg:GetFirst()
if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if sg then
mg:Merge(sg)
end
else
local mg=Duel.GetRitualMaterial(tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=Duel.SelectMatchingCard(tp,c101012070.RitualUltimateFilter,tp,LOCATION_DECK,0,1,1,nil,c101012070.filter,e,tp,mg,nil,Card.GetLevel,"Equal")
local tc=tg:GetFirst()
if tc then
mg=mg:Filter(Card.IsCanBeRitualMaterial,tc,tc)
if sg then
mg:Merge(sg)
end
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,tc,tp)
else
mg:RemoveCard(tc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel()*2,"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel()*2,tp,tc,tc:GetLevel()*2,"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP_DEFENSE)
tc:CompleteProcedure()
if tc.mat_filter then
mg=mg:Filter(tc.mat_filter,tc,tp)
else
mg:RemoveCard(tc)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
aux.GCheckAdditional=aux.RitualCheckAdditional(tc,tc:GetLevel()*2,"Equal")
local mat=mg:SelectSubGroup(tp,aux.RitualCheck,false,1,tc:GetLevel()*2,tp,tc,tc:GetLevel()*2,"Equal")
aux.GCheckAdditional=nil
if not mat or mat:GetCount()==0 then return end
tc:SetMaterial(mat)
Duel.ReleaseRitualMaterial(mat)
Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP_DEFENSE)
tc:CompleteProcedure()
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