Skip to content

Commit 70317de

Browse files
authored
Added new card script
1 parent 8d535f4 commit 70317de

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

pre-release/c101303078.lua

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
--武器庫整理
2+
--Arsenal Organization
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Send up to 2 Equip Spells with different names from your Deck to the GY
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_TOGRAVE)
10+
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetCode(EVENT_FREE_CHAIN)
12+
e1:SetCountLimit(1,id)
13+
e1:SetTarget(s.tgtg)
14+
e1:SetOperation(s.tgop)
15+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
16+
c:RegisterEffect(e1)
17+
--Equip 1 face-up monster you control with up to 2 Equip Spells with different names from your hand and/or GY that can equip to it, but any battle damage it inflicts to your opponent is halved while equipped with any of those Equip Spells
18+
local e2=Effect.CreateEffect(c)
19+
e2:SetDescription(aux.Stringid(id,1))
20+
e2:SetCategory(CATEGORY_EQUIP)
21+
e2:SetType(EFFECT_TYPE_QUICK_O)
22+
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
23+
e2:SetCode(EVENT_FREE_CHAIN)
24+
e2:SetRange(LOCATION_GRAVE)
25+
e2:SetCountLimit(1,id)
26+
e2:SetCost(Cost.SelfBanish)
27+
e2:SetTarget(s.eqtg)
28+
e2:SetOperation(s.eqop)
29+
e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
30+
c:RegisterEffect(e2)
31+
end
32+
function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
33+
if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsEquipSpell,Card.IsAbleToGrave),tp,LOCATION_DECK,0,1,nil) end
34+
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
35+
end
36+
function s.tgop(e,tp,eg,ep,ev,re,r,rp)
37+
local g=Duel.GetMatchingGroup(aux.AND(Card.IsEquipSpell,Card.IsAbleToGrave),tp,LOCATION_DECK,0,nil)
38+
if #g==0 then return end
39+
local sg=aux.SelectUnselectGroup(g,e,tp,1,2,aux.dncheck,1,tp,HINTMSG_TOGRAVE)
40+
if #sg>0 then
41+
Duel.SendtoGrave(sg,REASON_EFFECT)
42+
end
43+
end
44+
function s.eqtargetfilter(c,tp)
45+
return c:IsFaceup() and Duel.IsExistingMatchingCard(s.eqspellfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,c)
46+
end
47+
function s.eqspellfilter(c,tc)
48+
return c:IsEquipSpell() and c:CheckEquipTarget(tc)
49+
end
50+
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
51+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.eqtargetfilter(chkc,tp) end
52+
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
53+
and Duel.IsExistingTarget(s.eqtargetfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
54+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
55+
Duel.SelectTarget(tp,s.eqtargetfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
56+
end
57+
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
58+
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE)
59+
if ft<=0 then return end
60+
local tc=Duel.GetFirstTarget()
61+
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
62+
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.eqspellfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,nil,tc)
63+
if #g==0 then return end
64+
ft=math.min(2,ft)
65+
local sg=aux.SelectUnselectGroup(g,e,tp,1,ft,aux.dncheck,1,tp,HINTMSG_EQUIP)
66+
if #sg==0 then return end
67+
local fid=e:GetFieldID()
68+
local equip_success=false
69+
for ec in sg:Iter() do
70+
if Duel.Equip(tp,ec,tc,true,true) then
71+
equip_success=true
72+
ec:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,fid,aux.Stringid(id,2))
73+
end
74+
end
75+
Duel.EquipComplete()
76+
if equip_success then
77+
--Any battle damage it inflicts to your opponent is halved while equipped with any of those Equip Spells
78+
local e1=Effect.CreateEffect(e:GetHandler())
79+
e1:SetDescription(aux.Stringid(id,3))
80+
e1:SetType(EFFECT_TYPE_SINGLE)
81+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
82+
e1:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE)
83+
e1:SetCondition(function(e) return e:GetHandler():GetEquipGroup():IsExists(function(ec) return ec:GetFlagEffectLabel(id)==fid end,1,nil) end)
84+
e1:SetValue(aux.ChangeBattleDamage(1,HALF_DAMAGE))
85+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
86+
tc:RegisterEffect(e1)
87+
end
88+
end
89+
end

0 commit comments

Comments
 (0)