Commit a5468a08 authored by Nemo Ma's avatar Nemo Ma

fix

parent c4537df5
...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c) ...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -50,13 +51,18 @@ end ...@@ -50,13 +51,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -34,6 +34,7 @@ function cm.eqlimit(e,c) ...@@ -34,6 +34,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -49,13 +50,18 @@ end ...@@ -49,13 +50,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c) ...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -50,13 +51,18 @@ end ...@@ -50,13 +51,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -32,6 +32,7 @@ function cm.eqlimit(e,c) ...@@ -32,6 +32,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -47,13 +48,18 @@ end ...@@ -47,13 +48,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.filter(c,type1) function cm.filter(c,type1)
......
...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c) ...@@ -35,6 +35,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -50,13 +51,18 @@ end ...@@ -50,13 +51,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -136,6 +136,7 @@ function cm.eqlimit(e,c) ...@@ -136,6 +136,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -151,13 +152,18 @@ end ...@@ -151,13 +152,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -137,6 +137,7 @@ function cm.eqlimit(e,c) ...@@ -137,6 +137,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -152,13 +153,18 @@ end ...@@ -152,13 +153,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -136,6 +136,7 @@ function cm.eqlimit(e,c) ...@@ -136,6 +136,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -151,13 +152,18 @@ end ...@@ -151,13 +152,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_DECK,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_DECK,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -54,6 +54,7 @@ function cm.eqlimit(e,c) ...@@ -54,6 +54,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -69,13 +70,18 @@ end ...@@ -69,13 +70,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,0,LOCATION_EXTRA,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,0,LOCATION_EXTRA,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,0,LOCATION_EXTRA,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,0,LOCATION_EXTRA,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -49,6 +49,7 @@ function cm.eqlimit(e,c) ...@@ -49,6 +49,7 @@ function cm.eqlimit(e,c)
return e:GetOwner()==c return e:GetOwner()==c
end end
function cm.equipfd(c,tp,tc) function cm.equipfd(c,tp,tc)
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if not Duel.Equip(tp,tc,c,false) then return false end if not Duel.Equip(tp,tc,c,false) then return false end
--Add Equip limit --Add Equip limit
tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0) tc:RegisterFlagEffect(m,RESET_EVENT+RESETS_STANDARD,0,0)
...@@ -64,13 +65,18 @@ end ...@@ -64,13 +65,18 @@ end
function cm.adjustop(e,tp,eg,ep,ev,re,r,rp) function cm.adjustop(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase() local phase=Duel.GetCurrentPhase()
local c=e:GetHandler() local c=e:GetHandler()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL or c:IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsPlayerCanSSet(tp) then return end
if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_EXTRA,0,nil)>0 then if not c:GetEquipGroup():IsExists(cm.eqfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetMatchingGroupCount(nil,tp,LOCATION_EXTRA,0,nil)>0 then
Duel.Hint(HINT_CARD,0,m) Duel.Hint(HINT_CARD,0,m)
local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_EXTRA,0,nil):GetMaxGroup(Card.GetSequence):GetFirst() local tc=Duel.GetMatchingGroup(nil,tp,LOCATION_EXTRA,0,nil):GetMaxGroup(Card.GetSequence):GetFirst()
Duel.DisableShuffleCheck() Duel.DisableShuffleCheck()
if tc:IsPosition(POS_FACEUP) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if tc:IsForbidden() then
if cm.equipfd(c,tp,tc) then Duel.Readjust() end Duel.DiscardDeck(tp,1,REASON_RULE)
Duel.Readjust()
elseif cm.equipfd(c,tp,tc) then
Duel.RaiseEvent(tc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
Duel.Readjust()
end
end end
end end
function cm.con(e,tp,eg,ep,ev,re,r,rp) function cm.con(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -43,22 +43,26 @@ end ...@@ -43,22 +43,26 @@ end
function cm.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tc=re:GetHandler():GetPreviousEquipTarget() local tc=re:GetHandler():GetPreviousEquipTarget()
if chkc then return false end if chkc then return false end
if chk==0 then return tc and Duel.IsPlayerCanDraw(tp,1) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() and tc:IsCanBeEffectTarget(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end if chk==0 then return tc and Duel.IsPlayerCanDraw(tp,1) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() and tc:IsCanBeEffectTarget(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsPlayerCanSSet(tp) end
Duel.SetTargetCard(tc) Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_HAND)
end end
function cm.nffilter(c)
return not c:IsForbidden()
end
function cm.eqlimit(e,c) function cm.eqlimit(e,c)
return c==e:GetLabelObject() return c==e:GetLabelObject()
end end
function cm.eqop(e,tp,eg,ep,ev,re,r,rp) function cm.eqop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if Duel.Draw(tp,1,REASON_EFFECT)>0 and tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then if Duel.Draw(tp,1,REASON_EFFECT)>0 and tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsPlayerCanSSet(tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local ec=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,1,1,nil):GetFirst() local ec=Duel.SelectMatchingCard(tp,cm.nffilter,tp,LOCATION_HAND,0,1,1,nil):GetFirst()
if ec and ec:IsPublic() then Duel.MoveToField(ec,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end if ec and ec:IsPublic() then Duel.MoveToField(ec,tp,tp,LOCATION_SZONE,POS_FACEDOWN,false) end
if ec and Duel.Equip(tp,ec,tc,false) then if ec and Duel.Equip(tp,ec,tc,false) then
Duel.RaiseEvent(ec,EVENT_SSET,e,REASON_EFFECT,tp,tp,0)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
......
...@@ -93,7 +93,7 @@ function cm.thop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -93,7 +93,7 @@ function cm.thop2(e,tp,eg,ep,ev,re,r,rp)
local g2=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) local g2=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #g2>0 then if #g2>0 then
Duel.HintSelection(g2) Duel.HintSelection(g2)
if Duel.Destroy(g2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(tp,aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then if Duel.Destroy(g2,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
local tg=Duel.SelectMatchingCard(tp,aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil) local tg=Duel.SelectMatchingCard(tp,aux.disfilter1,tp,LOCATION_ONFIELD,0,1,1,nil)
local tc=tg:GetFirst() local tc=tg:GetFirst()
Duel.NegateRelatedChain(tc,RESET_TURN_SET) Duel.NegateRelatedChain(tc,RESET_TURN_SET)
......
...@@ -14,15 +14,15 @@ function cm.initial_effect(c) ...@@ -14,15 +14,15 @@ function cm.initial_effect(c)
e1:SetOperation(cm.activate) e1:SetOperation(cm.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function cm.refilter(c) function cm.refilter(c,tp)
return ((c:IsType(TYPE_EFFECT) and c:IsDisabled()) or c:IsType(TYPE_NORMAL) or c:IsType(TYPE_TOKEN)) and c:IsReleasable() return ((c:IsType(TYPE_EFFECT) and c:IsDisabled()) or c:IsType(TYPE_NORMAL) or c:IsType(TYPE_TOKEN)) and c:IsReleasable() and Duel.IsExistingMatchingCard(cm.tgfilter,tp,LOCATION_MZONE,0,1,c,tp)
end end
function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST) or Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil) end if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST) or Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil,tp) end
local b1=Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST) local b1=Duel.IsCanRemoveCounter(tp,1,0,0x34f,2,REASON_COST)
local b2=Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil) local b2=Duel.IsExistingMatchingCard(cm.refilter,tp,LOCATION_MZONE,0,1,nil,tp)
if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(m,2))) then if b2 and (not b1 or Duel.SelectYesNo(tp,aux.Stringid(m,2))) then
local g=Duel.SelectMatchingCard(tp,cm.refilter,tp,LOCATION_MZONE,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,cm.refilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
e:SetLabel(1) e:SetLabel(1)
else else
...@@ -30,17 +30,17 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -30,17 +30,17 @@ function cm.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RemoveCounter(tp,1,0,0x34f,2,REASON_COST) Duel.RemoveCounter(tp,1,0,0x34f,2,REASON_COST)
end end
end end
function cm.tgfilter(c,e,tp) function cm.tgfilter(c,tp)
return c:IsAbleToGrave() and (c:GetSequence()<5 or Duel.GetLocationCount(tp,LOCATION_MZONE)>0) return c:IsReleasable() and (c:GetSequence()<5 or Duel.GetLocationCount(tp,LOCATION_MZONE)>0)
end end
function cm.spfilter(c,e,tp) function cm.spfilter(c,e,tp)
return c:IsSetCard(0x9344) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsSetCard(0x9344) and c:IsType(TYPE_MONSTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end end
function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp) if chk==0 then return Duel.IsExistingTarget(cm.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) and Duel.IsExistingMatchingCard(cm.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil,e,tp)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.SelectTarget(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SelectTarget(tp,cm.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
end end
function cm.activate(e,tp,eg,ep,ev,re,r,rp) function cm.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
......
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