Commit c6af66a4 authored by Chrono-Genex's avatar Chrono-Genex Committed by GitHub

update Cry Havoc!, Ordeal of a Traveler, Scrubbed Raid (#2056)

parent c13764e8
......@@ -4,8 +4,6 @@ function c39537362.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c39537362.target1)
e1:SetOperation(c39537362.activate)
c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
......@@ -14,31 +12,27 @@ function c39537362.initial_effect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetLabel(1)
e2:SetCondition(c39537362.condition)
e2:SetTarget(c39537362.target2)
e2:SetCost(c39537362.cost)
e2:SetTarget(c39537362.target)
e2:SetOperation(c39537362.activate)
c:RegisterEffect(e2)
end
function c39537362.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and tp~=Duel.GetTurnPlayer()
and Duel.SelectYesNo(tp,aux.Stringid(39537362,1)) then
e:SetLabel(1)
Duel.SetTargetCard(Duel.GetAttacker())
e:GetHandler():RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(39537362,2))
else e:SetLabel(0) end
end
function c39537362.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
return Duel.GetAttacker():IsControler(1-tp)
end
function c39537362.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(39537362)==0 end
c:RegisterFlagEffect(39537362,RESET_CHAIN,0,1)
end
function c39537362.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) end
function c39537362.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 end
Duel.SetTargetCard(Duel.GetAttacker())
end
function c39537362.activate(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()~=1 or Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0
or not e:GetHandler():IsRelateToEffect(e) or not Duel.GetAttacker():IsRelateToEffect(e) then return end
if Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0
or not Duel.GetAttacker():IsRelateToEffect(e) then return end
local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0):RandomSelect(1-tp,1,nil)
local tc=g:GetFirst()
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CARDTYPE)
......
......@@ -2,88 +2,49 @@
function c39712330.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c39712330.cost1)
e1:SetTarget(c39712330.target1)
e1:SetOperation(c39712330.activate1)
c:RegisterEffect(e1)
--instant
--summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(39712330,0))
e2:SetCategory(CATEGORY_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c39712330.condition2)
e2:SetCost(c39712330.cost2)
e2:SetTarget(c39712330.target2)
e2:SetOperation(c39712330.activate2)
e2:SetCondition(c39712330.condition)
e2:SetCost(c39712330.cost)
e2:SetTarget(c39712330.target)
e2:SetOperation(c39712330.activate)
c:RegisterEffect(e2)
end
function c39712330.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c39712330.filter(c)
return c:IsType(TYPE_NORMAL) and (c:IsSummonable(true,nil) or c:IsMSetable(true,nil))
end
function c39712330.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 ph=Duel.GetCurrentPhase()
if tn~=tp or (ph~=PHASE_MAIN1 and ph~=PHASE_MAIN2) then return false end
if not Duel.IsExistingMatchingCard(c39712330.cfilter,tp,LOCATION_GRAVE,0,1,nil) then return false end
if Duel.IsExistingMatchingCard(c39712330.filter,tp,LOCATION_HAND,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(39712330,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c39712330.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetLabel(1)
end
end
function c39712330.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 c39712330.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,c39712330.filter,tp,LOCATION_HAND,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
function c39712330.condition2(e,tp,eg,ep,ev,re,r,rp)
function c39712330.condition(e,tp,eg,ep,ev,re,r,rp)
local tn=Duel.GetTurnPlayer()
local ph=Duel.GetCurrentPhase()
return tn==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
end
function c39712330.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
function c39712330.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c39712330.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c39712330.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c39712330.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c39712330.target2(e,tp,eg,ep,ev,re,r,rp,chk)
function c39712330.filter(c)
return c:IsType(TYPE_NORMAL) and (c:IsSummonable(true,nil) or c:IsMSetable(true,nil))
end
function c39712330.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if not e:GetHandler():IsStatus(STATUS_CHAINING) then
local ct=Duel.GetMatchingGroupCount(c39712330.filter,tp,LOCATION_HAND,0,nil)
e:SetLabel(ct)
return ct>0
else return e:GetLabel()>0 end
local ct1=Duel.GetMatchingGroupCount(c39712330.filter,tp,LOCATION_HAND,0,nil)
local ct2=Duel.GetFlagEffect(tp,39712330)
return ct1-ct2>0
end
e:SetLabel(e:GetLabel()-1)
Duel.RegisterFlagEffect(tp,39712330,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function c39712330.activate2(e,tp,eg,ep,ev,re,r,rp)
function c39712330.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,c39712330.filter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
......
......@@ -4,44 +4,30 @@ function c79205581.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c79205581.cost1)
e1:SetOperation(c79205581.operation1)
c:RegisterEffect(e1)
--instant(chain)
--battle end
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(79205581,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c79205581.condition2)
e2:SetTarget(c79205581.cost2)
e2:SetOperation(c79205581.operation2)
e2:SetCondition(c79205581.condition)
e2:SetTarget(c79205581.cost)
e2:SetOperation(c79205581.operation)
c:RegisterEffect(e2)
end
function c79205581.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,e:GetHandler())
and (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<PHASE_BATTLE) and Duel.SelectYesNo(tp,aux.Stringid(79205581,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.SendtoGrave(g,REASON_COST)
e:SetLabel(1)
else e:SetLabel(0) end
function c79205581.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<PHASE_BATTLE
end
function c79205581.operation1(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==1 then
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
end
end
function c79205581.condition2(e,tp,eg,ep,ev,re,r,rp)
return (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<PHASE_BATTLE) and not e:GetHandler():IsStatus(STATUS_CHAINING)
end
function c79205581.cost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end
function c79205581.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetFlagEffect(79205581)==0
and Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,c) end
c:RegisterFlagEffect(79205581,RESET_CHAIN,0,1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,1,c)
Duel.SendtoGrave(g,REASON_COST)
end
function c79205581.operation2(e,tp,eg,ep,ev,re,r,rp)
function c79205581.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
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