Commit c78e608a authored by mercury233's avatar mercury233

add scripts KC01

parent a6a6137b
--攻撃誘導アーマー
function c3103067.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCountLimit(1,3103067+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c3103067.target)
e1:SetOperation(c3103067.operation)
c:RegisterEffect(e1)
end
function c3103067.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local a,d=Duel.GetBattleMonster(0)
local ad=Group.FromCards(a,d)
local s=0
local b=Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,ad)
if b then
s=Duel.SelectOption(tp,aux.Stringid(3103067,0),aux.Stringid(3103067,1))
end
e:SetLabel(s)
if s==0 then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,a,1,0,0)
end
if s==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,ad)
end
end
function c3103067.operation(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
if e:GetLabel()==0 then
if a and a:IsRelateToBattle() then
Duel.Destroy(a,REASON_EFFECT)
end
end
if e:GetLabel()==1 then
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and a:IsAttackable() and not a:IsImmuneToEffect(e) then
Duel.CalculateDamage(a,tc)
end
end
end
\ No newline at end of file
--削りゆく命
function c38105306.initial_effect(c)
c:SetUniqueOnField(1,0,38105306)
c:EnableCounterPermit(0x62)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_COUNTER)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c38105306.ctcon)
e2:SetTarget(c38105306.cttg)
e2:SetOperation(c38105306.ctop)
c:RegisterEffect(e2)
--discard
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_HANDES)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetRange(LOCATION_SZONE)
e3:SetHintTiming(0,TIMING_MAIN_END+TIMING_BATTLE_END)
e3:SetCondition(c38105306.hdcon)
e3:SetTarget(c38105306.hdtg)
e3:SetOperation(c38105306.hdop)
c:RegisterEffect(e3)
end
function c38105306.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==1-tp
end
function c38105306.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x62)
end
function c38105306.ctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
c:AddCounter(0x62,1)
end
end
function c38105306.hdcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph>=PHASE_MAIN1 and ph<=PHASE_MAIN2 and e:GetHandler():GetCounter(0x62)>0
end
function c38105306.hdtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToGrave() and c:GetFlagEffect(38105306)==0 end
e:SetLabel(c:GetCounter(0x62))
c:RegisterFlagEffect(38105306,RESET_CHAIN,0,1)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,0,0)
end
function c38105306.hdop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) and Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT) then
Duel.BreakEffect()
Duel.DiscardHand(1-tp,nil,e:GetLabel(),e:GetLabel(),REASON_EFFECT+REASON_DISCARD)
end
end
--機械じかけのマジックミラー
function c85758066.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(c85758066.condition)
e1:SetTarget(c85758066.target)
e1:SetOperation(c85758066.activate)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e2:SetCost(c85758066.spcost)
e2:SetTarget(c85758066.sptg)
e2:SetOperation(c85758066.spop)
c:RegisterEffect(e2)
end
function c85758066.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
end
function c85758066.filter(c,tp,ft)
return c:IsType(TYPE_SPELL) and c:IsSSetable(true) and (c:IsType(TYPE_FIELD) or Duel.GetLocationCount(tp,LOCATION_SZONE)>ft)
end
function c85758066.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ft=0
if e:GetHandler():IsLocation(LOCATION_HAND) then ft=1 end
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and c85758066.filter(chkc,tp,ft) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft
and Duel.IsExistingTarget(c85758066.filter,tp,0,LOCATION_GRAVE,1,nil,tp,ft) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectTarget(tp,c85758066.filter,tp,0,LOCATION_GRAVE,1,1,nil,tp,ft)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
end
function c85758066.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SSet(tp,tc)
end
end
function c85758066.costfilter(c)
return c:IsCode(83764718) and c:IsAbleToGraveAsCost()
and (c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_SZONE) and c:IsFacedown()))
end
function c85758066.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost()
and Duel.IsExistingMatchingCard(c85758066.costfilter,tp,LOCATION_HAND+LOCATION_SZONE,0,1,nil) end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c85758066.costfilter,tp,LOCATION_HAND+LOCATION_SZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c85758066.spfilter(c,e,tp)
return c:IsCode(10000000) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function c85758066.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c85758066.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c85758066.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,c85758066.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0
and Duel.GetTurnPlayer()==1-tp then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,LOCATION_MZONE)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
e1:SetValue(c85758066.atklimit)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_MUST_ATTACK)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
end
end
function c85758066.atklimit(e,c)
return c~=e:GetHandler()
end
\ No newline at end of file
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