Skip to content

Commit 5515f46

Browse files
authored
Added new card scripts
1 parent 497da0e commit 5515f46

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

pre-release/c100295111.lua

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
--魔弾の悪魔 カスパール
2+
--Magical Musket Mastermind Caspar
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
c:EnableReviveLimit()
7+
--Link Summon procedure: 2 monsters, including a LIGHT Fiend monster
8+
Link.AddProcedure(c,nil,2,2,s.matcheck)
9+
--Take 2 "Magical Musket" cards from your hand and/or Deck, including a monster, Special Summon 1 of those monsters, and Set the other card to your opponent's field
10+
local e1=Effect.CreateEffect(c)
11+
e1:SetDescription(aux.Stringid(id,0))
12+
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
13+
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
14+
e1:SetProperty(EFFECT_FLAG_DELAY)
15+
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
16+
e1:SetCountLimit(1,id)
17+
e1:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end)
18+
e1:SetTarget(s.spsettg)
19+
e1:SetOperation(s.spsetop)
20+
c:RegisterEffect(e1)
21+
--During either player's turn, you can activate "Magical Musket" Spell/Trap Cards from your hand.
22+
local e2a=Effect.CreateEffect(c)
23+
e2a:SetType(EFFECT_TYPE_FIELD)
24+
e2a:SetCode(EFFECT_QP_ACT_IN_NTPHAND)
25+
e2a:SetRange(LOCATION_MZONE)
26+
e2a:SetTargetRange(LOCATION_HAND,0)
27+
e2a:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_MAGICAL_MUSKET))
28+
c:RegisterEffect(e2a)
29+
local e2b=e2a:Clone()
30+
e2b:SetCode(EFFECT_TRAP_ACT_IN_HAND)
31+
c:RegisterEffect(e2b)
32+
end
33+
s.listed_series={SET_MAGICAL_MUSKET}
34+
function s.matfilter(c,lc,sumtype,tp)
35+
return c:IsAttribute(ATTRIBUTE_LIGHT,lc,sumtype,tp) and c:IsRace(RACE_FIEND,lc,sumtype,tp)
36+
end
37+
function s.matcheck(g,lc,sumtype,tp)
38+
return g:IsExists(s.matfilter,1,nil,lc,sumtype,tp)
39+
end
40+
function s.rescon(sg,e,tp,mg)
41+
return sg:IsExists(Card.IsMonster,1,nil) and sg:IsExists(s.spfilter,1,nil,e,tp,sg)
42+
end
43+
function s.spfilter(c,e,tp,sg)
44+
return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and sg:IsExists(s.setfilter,1,c,e,tp,1-tp)
45+
end
46+
function s.setfilter(c,e,tp,opp)
47+
return (Duel.GetMZoneCount(opp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE,opp)) or c:IsSSetable(false,opp)
48+
end
49+
function s.spsettg(e,tp,eg,ep,ev,re,r,rp,chk)
50+
if chk==0 then
51+
if Duel.GetMZoneCount(tp)<=0 then return false end
52+
local g=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_HAND|LOCATION_DECK,0,nil,SET_MAGICAL_MUSKET)
53+
return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0)
54+
end
55+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK)
56+
end
57+
function s.spsetop(e,tp,eg,ep,ev,re,r,rp)
58+
if Duel.GetMZoneCount(tp)<=0 then return end
59+
local g=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_HAND|LOCATION_DECK,0,nil,SET_MAGICAL_MUSKET)
60+
if #g<2 then return end
61+
local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,aux.Stringid(id,1))
62+
if #sg~=2 then return end
63+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
64+
local spg=sg:FilterSelect(tp,s.spfilter,1,1,nil,e,tp,sg)
65+
if #spg>0 and Duel.SpecialSummon(spg,0,tp,tp,false,false,POS_FACEUP)>0 then
66+
local opp=1-tp
67+
local setc=(sg-spg):GetFirst()
68+
local b1=Duel.GetMZoneCount(opp)>0 and setc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE,opp)
69+
local b2=setc:IsSSetable(false,opp)
70+
local op=nil
71+
if b1 and b2 then
72+
op=Duel.SelectEffect(tp,
73+
{b1,aux.Stringid(id,2)},
74+
{b2,aux.Stringid(id,3)})
75+
else
76+
op=b1 and 1 or 2
77+
end
78+
if op==1 then
79+
Duel.SpecialSummon(setc,0,tp,opp,false,false,POS_FACEDOWN_DEFENSE)
80+
Duel.ConfirmCards(tp,setc)
81+
elseif op==2 then
82+
Duel.SSet(tp,setc,opp)
83+
end
84+
end
85+
end

pre-release/c100348006.lua

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
--シンクロ・ワンウェイ
2+
--Synchro Oneway
3+
--scripted by pyrQ
4+
local s,id=GetID()
5+
function s.initial_effect(c)
6+
--Add to your hand, or Special Summon, 1 Level 1 Tuner from your Deck or GY
7+
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
9+
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON)
10+
e1:SetType(EFFECT_TYPE_ACTIVATE)
11+
e1:SetCode(EVENT_FREE_CHAIN)
12+
e1:SetCountLimit(1,id)
13+
e1:SetTarget(s.target)
14+
e1:SetOperation(s.activate)
15+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
16+
c:RegisterEffect(e1)
17+
--Set this card, but banish it when it leaves the field
18+
local e2=Effect.CreateEffect(c)
19+
e2:SetDescription(aux.Stringid(id,1))
20+
e2:SetCategory(CATEGORY_LEAVE_GRAVE)
21+
e2:SetType(EFFECT_TYPE_QUICK_O)
22+
e2:SetCode(EVENT_FREE_CHAIN)
23+
e2:SetRange(LOCATION_GRAVE)
24+
e2:SetCountLimit(1,id)
25+
e2:SetCondition(s.setcon)
26+
e2:SetTarget(s.settg)
27+
e2:SetOperation(s.setop)
28+
e2:SetHintTiming(TIMING_END_PHASE)
29+
c:RegisterEffect(e2)
30+
end
31+
s.listed_names={CARD_JUNK_WARRIOR}
32+
function s.thspfilter(c,e,tp,sp_chk)
33+
return c:IsLevel(1) and c:IsType(TYPE_TUNER) and (c:IsAbleToHand()
34+
or (sp_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false)))
35+
end
36+
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
37+
if chk==0 then
38+
local sp_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
39+
return Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp,sp_chk)
40+
end
41+
Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE)
42+
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE)
43+
end
44+
function s.activate(e,tp,eg,ep,ev,re,r,rp)
45+
local sp_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
46+
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2))
47+
local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thspfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp,sp_chk):GetFirst()
48+
if not sc then return end
49+
aux.ToHandOrElse(sc,tp,
50+
function() return sp_chk and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end,
51+
function() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end,
52+
aux.Stringid(id,3)
53+
)
54+
end
55+
function s.setconfilter(c)
56+
return (c:IsCode(CARD_JUNK_WARRIOR) or (c:ListsCode(CARD_JUNK_WARRIOR) and c:IsMonster())) and c:IsFaceup()
57+
end
58+
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
59+
return Duel.IsExistingMatchingCard(s.setconfilter,tp,LOCATION_ONFIELD,0,1,nil)
60+
end
61+
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
62+
local c=e:GetHandler()
63+
if chk==0 then return c:IsSSetable() end
64+
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0)
65+
end
66+
function s.setop(e,tp,eg,ep,ev,re,r,rp)
67+
local c=e:GetHandler()
68+
if c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 then
69+
--Banish it when it leaves the field
70+
local e1=Effect.CreateEffect(c)
71+
e1:SetDescription(3300)
72+
e1:SetType(EFFECT_TYPE_SINGLE)
73+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT)
74+
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
75+
e1:SetValue(LOCATION_REMOVED)
76+
e1:SetReset(RESET_EVENT|RESETS_REDIRECT)
77+
c:RegisterEffect(e1)
78+
end
79+
end

0 commit comments

Comments
 (0)