Skip to content

Commit 454bc6d

Browse files
authored
Moar Xyz updates
1 parent 73a3a16 commit 454bc6d

2 files changed

Lines changed: 109 additions & 138 deletions

File tree

official/c9161357.lua

Lines changed: 48 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,82 @@
1-
--No.6 先史遺産アトランタル
1+
--No.6 先史遺産アトランタル
22
--Number 6: Chronomaly Atlandis
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--xyz summon
6-
Xyz.AddProcedure(c,nil,6,2)
75
c:EnableReviveLimit()
8-
--equip
6+
--Xyz Summon procedure: 2 Level 6 monsters
7+
Xyz.AddProcedure(c,nil,6,2)
8+
--Equip 1 "Number" monster from your GY to this card
99
local e1=Effect.CreateEffect(c)
1010
e1:SetDescription(aux.Stringid(id,0))
11-
e1:SetCategory(CATEGORY_LEAVE_GRAVE+CATEGORY_EQUIP)
11+
e1:SetCategory(CATEGORY_EQUIP)
1212
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
13-
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
1413
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
15-
e1:SetCondition(s.eqcon)
14+
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
15+
e1:SetCondition(function(e) return e:GetHandler():IsXyzSummoned() end)
1616
e1:SetTarget(s.eqtg)
1717
e1:SetOperation(s.eqop)
1818
c:RegisterEffect(e1)
19-
aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e1)
20-
--lp
19+
aux.AddEREquipLimit(c,nil,function(ec,c,tp) return ec:IsSetCard(SET_NUMBER) and ec:IsControler(tp) end,function(c,e,tp,tc) c:EquipByEffectAndLimitRegister(e,tp,tc,id) end,e1)
20+
--This card gains ATK equal to half the ATK of that equipped monster
2121
local e2=Effect.CreateEffect(c)
22-
e2:SetDescription(aux.Stringid(id,1))
23-
e2:SetType(EFFECT_TYPE_IGNITION)
24-
e2:SetCountLimit(1)
22+
e2:SetType(EFFECT_TYPE_SINGLE)
23+
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
24+
e2:SetCode(EFFECT_UPDATE_ATTACK)
2525
e2:SetRange(LOCATION_MZONE)
26-
e2:SetCost(s.lpcost)
27-
e2:SetOperation(s.lpop)
26+
e2:SetValue(function(e,c) return c:GetEquipGroup():Match(Card.HasFlagEffect,nil,id):GetSum(Card.GetAttack)/2 end)
2827
c:RegisterEffect(e2)
28+
--Halve your opponent's Life Points
29+
local e3=Effect.CreateEffect(c)
30+
e3:SetDescription(aux.Stringid(id,1))
31+
e3:SetType(EFFECT_TYPE_IGNITION)
32+
e3:SetRange(LOCATION_MZONE)
33+
e3:SetCountLimit(1)
34+
e3:SetCost(Cost.AND(Cost.Detach(1),s.halvelpcost))
35+
e3:SetOperation(function(e,tp) local opp=1-tp Duel.SetLP(opp,Duel.GetLP(opp)/2) end)
36+
c:RegisterEffect(e3)
2937
end
30-
s.listed_series={SET_NUMBER}
3138
s.xyz_number=6
32-
function s.eqval(ec,c,tp)
33-
return ec:IsControler(tp) and ec:IsSetCard(SET_NUMBER)
34-
end
35-
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
36-
return e:GetHandler():IsXyzSummoned()
37-
end
38-
function s.filter(c)
39-
return c:IsSetCard(SET_NUMBER) and c:IsMonster() and not c:IsForbidden()
39+
s.listed_series={SET_NUMBER}
40+
function s.eqfilter(c,tp)
41+
return c:IsSetCard(SET_NUMBER) and c:IsMonster() and not c:IsForbidden() and c:CheckUniqueOnField(tp)
4042
end
4143
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
42-
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end
44+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc,tp) end
4345
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
44-
and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end
46+
and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end
4547
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
46-
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil)
47-
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
48-
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
49-
end
50-
function s.equipop(c,e,tp,tc)
51-
if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end
52-
local atk=tc:GetBaseAttack()/2
53-
if atk>0 then
54-
local e2=Effect.CreateEffect(c)
55-
e2:SetType(EFFECT_TYPE_EQUIP)
56-
e2:SetProperty(EFFECT_FLAG_OWNER_RELATE+EFFECT_FLAG_IGNORE_IMMUNE)
57-
e2:SetCode(EFFECT_UPDATE_ATTACK)
58-
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
59-
e2:SetValue(atk)
60-
tc:RegisterEffect(e2)
61-
end
48+
local g=Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp)
49+
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0)
6250
end
6351
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
64-
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
6552
local c=e:GetHandler()
6653
local tc=Duel.GetFirstTarget()
67-
if tc and tc:IsRelateToEffect(e) then
68-
s.equipop(c,e,tp,tc)
54+
if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) then
55+
c:EquipByEffectAndLimitRegister(e,tp,tc,id)
6956
end
7057
end
71-
function s.eqfilter(c,tp)
72-
return c:GetFlagEffect(id)~=0 and c:IsControler(tp) and c:IsLocation(LOCATION_SZONE) and c:IsAbleToGraveAsCost()
58+
function s.halvelpcostfilter(c,tp)
59+
return c:HasFlagEffect(id) and c:IsControler(tp) and c:IsAbleToGraveAsCost()
7360
end
74-
function s.lpcost(e,tp,eg,ep,ev,re,r,rp,chk)
61+
function s.halvelpcost(e,tp,eg,ep,ev,re,r,rp,chk)
7562
local c=e:GetHandler()
76-
local eqg=c:GetEquipGroup()
77-
if chk==0 then return Duel.IsPhase(PHASE_MAIN1) and #eqg>0 and eqg:IsExists(s.eqfilter,1,nil,tp)
78-
and c:CheckRemoveOverlayCard(tp,1,REASON_COST) end
79-
c:RemoveOverlayCard(tp,1,1,REASON_COST)
80-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
81-
local ec=eqg:FilterSelect(tp,s.eqfilter,1,1,nil,tp)
82-
Duel.SendtoGrave(ec,REASON_COST)
63+
local eqg=c:GetEquipGroup():Match(s.halvelpcostfilter,nil,tp)
64+
if chk==0 then return Duel.IsPhase(PHASE_MAIN1) and #eqg>0 end
65+
local g=nil
66+
if #eqg==1 then
67+
g=eqg
68+
else
69+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
70+
g=eqg:Select(tp,1,1,nil)
71+
end
72+
Duel.SendtoGrave(g,REASON_COST)
73+
--You cannot conduct your Battle Phase the turn you activate this effect
8374
local e1=Effect.CreateEffect(c)
75+
e1:SetDescription(aux.Stringid(id,2))
8476
e1:SetType(EFFECT_TYPE_FIELD)
77+
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT)
8578
e1:SetCode(EFFECT_CANNOT_BP)
86-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
8779
e1:SetTargetRange(1,0)
8880
e1:SetReset(RESET_PHASE|PHASE_END)
8981
Duel.RegisterEffect(e1,tp)
90-
local e2=Effect.CreateEffect(c)
91-
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
92-
e2:SetDescription(aux.Stringid(id,2))
93-
e2:SetReset(RESET_PHASE|PHASE_END)
94-
e2:SetTargetRange(1,0)
95-
Duel.RegisterEffect(e2,tp)
96-
end
97-
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
98-
Duel.SetLP(1-tp,Duel.GetLP(1-tp)/2)
99-
end
82+
end

official/c95134948.lua

Lines changed: 61 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
--No.99 希望皇ホープドラグナー
1+
--No.99 希望皇ホープドラグナー
22
--Number 99: Utopia Dragonar
33
--Scripted by Larry126
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--xyz summon
76
c:EnableReviveLimit()
7+
--Xyz Summon procedure: 3+ Level 12 monsters
88
Xyz.AddProcedure(c,nil,12,3,nil,nil,Xyz.InfiniteMats)
9-
--Special Summon
9+
--Special Summon from your Extra Deck, 1 "Number" monster that has a number between "1" and "100" in its name (this is treated as an Xyz Summon)
1010
local e1=Effect.CreateEffect(c)
1111
e1:SetDescription(aux.Stringid(id,0))
1212
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
1313
e1:SetType(EFFECT_TYPE_QUICK_O)
1414
e1:SetCode(EVENT_FREE_CHAIN)
1515
e1:SetRange(LOCATION_MZONE)
16-
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E)
1716
e1:SetCountLimit(1,id)
18-
e1:SetCost(s.cost)
19-
e1:SetTarget(s.target)
20-
e1:SetOperation(s.operation)
17+
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
18+
e1:SetCost(Cost.AND(Cost.Detach(2),s.spcost))
19+
e1:SetTarget(s.sptg)
20+
e1:SetOperation(s.spop)
2121
c:RegisterEffect(e1)
22-
--disable attack
22+
--Change the ATK of the opponent's monster to 0
2323
local e2=Effect.CreateEffect(c)
2424
e2:SetDescription(aux.Stringid(id,1))
2525
e2:SetCategory(CATEGORY_ATKCHANGE)
2626
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
27-
e2:SetRange(LOCATION_MZONE)
2827
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
28+
e2:SetRange(LOCATION_MZONE)
2929
e2:SetCountLimit(1,{id,1})
30-
e2:SetCondition(s.atkcon)
30+
e2:SetCondition(function(e,tp) return Duel.GetAttacker():IsControler(1-tp) end)
3131
e2:SetTarget(s.atktg)
3232
e2:SetOperation(s.atkop)
3333
c:RegisterEffect(e2)
34-
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter)
34+
--Keep track of Special Summons and direct attacks
35+
Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,function(c) return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_XYZ) end)
3536
aux.GlobalCheck(s,function()
3637
local ge1=Effect.CreateEffect(c)
3738
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
@@ -40,87 +41,74 @@ function s.initial_effect(c)
4041
Duel.RegisterEffect(ge1,0)
4142
end)
4243
end
43-
s.listed_series={SET_NUMBER}
4444
s.xyz_number=99
45-
function s.counterfilter(c)
46-
return c:IsType(TYPE_XYZ) or c:GetSummonLocation()~=LOCATION_EXTRA
47-
end
45+
s.listed_series={SET_NUMBER}
4846
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
49-
local tc=eg:GetFirst()
5047
if not Duel.GetAttackTarget() then
5148
Duel.RegisterFlagEffect(ep,id,RESET_PHASE|PHASE_END,0,1)
52-
tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
49+
eg:GetFirst():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
5350
end
5451
end
55-
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
52+
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
5653
local c=e:GetHandler()
57-
if chk==0 then return c:CheckRemoveOverlayCard(tp,2,REASON_COST)
58-
and Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
59-
and (Duel.GetFlagEffect(tp,id)==0 or Duel.GetFlagEffect(tp,id)==c:GetFlagEffect(id)) end
60-
c:RemoveOverlayCard(tp,2,2,REASON_COST)
61-
aux.RegisterClientHint(e:GetHandler(),EFFECT_FLAG_OATH,tp,1,0,aux.Stringid(id,2),nil)
62-
local ge1=Effect.CreateEffect(c)
63-
ge1:SetType(EFFECT_TYPE_FIELD)
64-
ge1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
65-
ge1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
66-
ge1:SetTargetRange(1,0)
67-
ge1:SetTarget(s.splimit)
68-
ge1:SetReset(RESET_PHASE|PHASE_END)
69-
Duel.RegisterEffect(ge1,tp)
70-
--lizard check
71-
aux.addTempLizardCheck(c,tp,s.lizfilter)
72-
--cannot attack directly with other cards
73-
local ge2=Effect.CreateEffect(c)
74-
ge2:SetType(EFFECT_TYPE_FIELD)
75-
ge2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
76-
ge2:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_IGNORE_IMMUNE)
77-
ge2:SetTargetRange(LOCATION_MZONE,0)
78-
ge2:SetTarget(s.ftarget)
79-
ge2:SetLabel(c:GetFieldID())
80-
ge2:SetReset(RESET_PHASE|PHASE_END)
81-
Duel.RegisterEffect(ge2,tp)
82-
end
83-
function s.splimit(e,c,sump,sumtype,sumpos,targetp,se)
84-
return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA)
85-
end
86-
function s.lizfilter(e,c)
87-
return not c:IsOriginalType(TYPE_XYZ)
88-
end
89-
function s.ftarget(e,c)
90-
return e:GetLabel()~=c:GetFieldID()
54+
if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0
55+
and (not Duel.HasFlagEffect(tp,id) or Duel.GetFlagEffect(tp,id)==c:GetFlagEffect(id)) end
56+
local fid=c:GetFieldID()
57+
--The turn you activate this effect, other monsters you control cannot attack directly
58+
local e1=Effect.CreateEffect(c)
59+
e1:SetType(EFFECT_TYPE_FIELD)
60+
e1:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_IGNORE_IMMUNE)
61+
e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
62+
e1:SetTargetRange(LOCATION_MZONE,0)
63+
e1:SetTarget(function(e,c) return c:GetFieldID()~=fid end)
64+
e1:SetReset(RESET_PHASE|PHASE_END)
65+
Duel.RegisterEffect(e1,tp)
66+
--Also you cannot Special Summon from the Extra Deck, except Xyz Monsters
67+
local e2=Effect.CreateEffect(c)
68+
e2:SetDescription(aux.Stringid(id,2))
69+
e2:SetType(EFFECT_TYPE_FIELD)
70+
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT)
71+
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
72+
e2:SetTargetRange(1,0)
73+
e2:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_XYZ) end)
74+
e2:SetReset(RESET_PHASE|PHASE_END)
75+
Duel.RegisterEffect(e2,tp)
76+
--"Clock Lizard" check
77+
aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalType(TYPE_XYZ) end)
9178
end
92-
function s.filter(c,e,tp,rp)
93-
return c:IsSetCard(SET_NUMBER) and c.xyz_number and c.xyz_number>=1 and c.xyz_number<=100
94-
and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,true)
79+
function s.spfilter(c,e,tp)
80+
return c:IsSetCard(SET_NUMBER) and c.xyz_number and c.xyz_number>=1 and c.xyz_number<=100 and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0
81+
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
9582
end
96-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
97-
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp,rp) end
83+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
84+
if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
9885
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
9986
end
100-
function s.operation(e,tp,eg,ep,ev,re,r,rp)
87+
function s.spop(e,tp,eg,ep,ev,re,r,rp)
10188
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
102-
local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rp):GetFirst()
103-
if tc then
104-
Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,true,POS_FACEUP)
105-
tc:CompleteProcedure()
89+
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
90+
if not sc then return end
91+
sc:SetMaterial(nil)
92+
if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then
93+
sc:CompleteProcedure()
10694
end
10795
end
108-
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
109-
return Duel.GetAttacker():IsControler(1-tp)
110-
end
11196
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
112-
local at=Duel.GetAttacker()
113-
if chk==0 then return at:IsOnField() and at:HasNonZeroAttack() end
114-
Duel.SetTargetCard(at)
97+
local bc=Duel.GetAttacker()
98+
if chk==0 then return bc:IsOnField() and bc:HasNonZeroAttack() end
99+
e:SetLabelObject(bc)
100+
bc:CreateEffectRelation(e)
115101
end
116102
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
117-
local tc=Duel.GetFirstTarget()
118-
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
103+
local bc=e:GetLabelObject()
104+
if bc:IsRelateToEffect(e) and bc:IsFaceup() and bc:IsControler(1-tp) then
105+
--The ATK of that opponent's monster becomes 0
119106
local e1=Effect.CreateEffect(e:GetHandler())
120107
e1:SetType(EFFECT_TYPE_SINGLE)
108+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
121109
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
122-
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
123110
e1:SetValue(0)
124-
tc:RegisterEffect(e1)
111+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
112+
bc:RegisterEffect(e1)
125113
end
126-
end
114+
end

0 commit comments

Comments
 (0)