Skip to content

Commit a174849

Browse files
committed
added functionality for change type and attributes of rush cards
1 parent 7613094 commit a174849

14 files changed

+44
-15
lines changed

proc_rush.lua

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,37 @@ if Duel.IsDuelType(DUEL_INVERTED_QUICK_PRIORITY) then
5252
end)()
5353
end
5454
function Card.IsCanChangePositionRush(c)
55-
return c:IsCanChangePosition() and not c:IsMaximumMode() and not c:IsHasEffect(EFFECT_CANNOT_CHANGE_POS_E)
55+
return c:IsCanChangePosition() and not c:IsMaximumMode()
56+
end
57+
function Card.CanChangeIntoTypeRush(c,type,turnvalue)
58+
if c:IsOriginalRace(type) then return false end
59+
if not c:IsRace(type) then return true end
60+
if not c:IsHasEffect(EFFECT_CHANGE_RACE) then return true end
61+
if nil==turnvalue then turnvalue=1 end
62+
eff={c:GetCardEffect(EFFECT_CHANGE_RACE)}
63+
for _,te in ipairs(eff) do
64+
local effType=te:GetType()
65+
if effType~=EFFECT_TYPE_FIELD and eff_type~=EFFECT_TYPE_EQUIP then
66+
local _,effectvalue=te:GetReset()
67+
if effectvalue>=turnvalue then return false end
68+
end
69+
end
70+
return true
71+
end
72+
function Card.CanChangeIntoAttributeRush(c,attribute,turnvalue)
73+
if c:IsOriginalAttribute(attribute) then return false end
74+
if not c:IsAttribute(attribute) then return true end
75+
if not c:IsHasEffect(EFFECT_CHANGE_ATTRIBUTE) then return true end
76+
if nil==turnvalue then turnvalue=1 end
77+
eff={c:GetCardEffect(EFFECT_CHANGE_ATTRIBUTE)}
78+
for _,te in ipairs(eff) do
79+
local effType=te:GetType()
80+
if effType~=EFFECT_TYPE_FIELD and eff_type~=EFFECT_TYPE_EQUIP then
81+
local _,effectvalue=te:GetReset()
82+
if effectvalue>=turnvalue then return false end
83+
end
84+
end
85+
return true
5686
end
5787

5888
--Add function to simplify some effect

rush/c160002043.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function s.rvfilter(c,tp)
1717
and Duel.IsExistingMatchingCard(aux.FilterMaximumSideFunctionEx(s.attfilter,c:GetAttribute()),tp,0,LOCATION_MZONE,1,nil,c:GetAttribute())
1818
end
1919
function s.attfilter(c,att)
20-
return c:IsFaceup() and c:IsMonster() and not c:IsAttribute(att)
20+
return c:IsFaceup() and c:IsMonster() and c:CanChangeIntoAttributeRush(att)
2121
end
2222
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
2323
if chk==0 then return Duel.IsExistingMatchingCard(s.rvfilter,tp,LOCATION_HAND,0,1,nil,tp) end

rush/c160003036.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function s.condition(e,tp,eg,ep,ev,re,r,rp)
2121
return Duel.GetMatchingGroupCountRush(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)>1
2222
end
2323
function s.attfilter(c)
24-
return c:IsFaceup() and not c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsNotMaximumModeSide()
24+
return c:IsFaceup() and c:CanChangeIntoAttributeRush(ATTRIBUTE_LIGHT) and c:IsNotMaximumModeSide()
2525
end
2626
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
2727
if chk==0 then return Duel.IsExistingMatchingCard(s.attfilter,tp,0,LOCATION_MZONE,1,e:GetHandler()) end

rush/c160004039.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function s.rvfilter(c,tp)
1616
and Duel.IsExistingMatchingCard(aux.FilterMaximumSideFunctionEx(s.attfilter,c:GetRace()),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,c:GetAttribute())
1717
end
1818
function s.attfilter(c,race)
19-
return c:IsFaceup() and c:IsMonster() and not c:IsRace(race)
19+
return c:IsFaceup() and c:IsMonster() and c:CanChangeIntoTypeRush(race)
2020
end
2121
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
2222
if chk==0 then return Duel.IsExistingMatchingCard(s.rvfilter,tp,LOCATION_HAND,0,1,nil,tp) end

rush/c160009030.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
4242
e1:SetValue(-300)
4343
e1:SetReset(RESETS_STANDARD_PHASE_END)
4444
tc:RegisterEffect(e1)
45-
if not tc:IsRace(RACE_INSECT) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
45+
if tc:CanChangeIntoTypeRush(RACE_INSECT) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
4646
Duel.BreakEffect()
4747
--Change type to Insect
4848
local e2=Effect.CreateEffect(c)

rush/c160010022.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
2929
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ct*200)
3030
end
3131
function s.mfilter(c)
32-
return c:IsFaceup() and not c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsNotMaximumModeSide()
32+
return c:IsFaceup() and c:CanChangeIntoAttributeRush(ATTRIBUTE_LIGHT) and c:IsNotMaximumModeSide()
3333
end
3434
function s.damop(e,tp,eg,ep,ev,re,r,rp)
3535
--Requirement

rush/c160010035.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ function s.rccost(e,tp,eg,ep,ev,re,r,rp,chk)
2222
end
2323
end
2424
function s.rcfilter(c)
25-
return c:IsFaceup() and not c:IsRace(RACE_INSECT) and c:IsNotMaximumModeSide()
25+
return c:IsFaceup() and c:CanChangeIntoTypeRush(RACE_INSECT) and c:IsNotMaximumModeSide()
2626
end
2727
function s.rctg(e,tp,eg,ep,ev,re,r,rp,chk)
2828
if chk==0 then return Duel.IsExistingMatchingCard(s.rcfilter,tp,0,LOCATION_MZONE,1,nil) end

rush/c160020032.lua

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp)
3434
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
3535
local g=Duel.SelectMatchingCard(tp,Card.IsCanChangePositionRush,tp,0,LOCATION_MZONE,1,1,nil)
3636
Duel.HintSelection(g)
37-
Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
3837
local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil,e:GetHandler():GetLevel())
39-
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
38+
if Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
4039
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
4140
local sg=g:Select(tp,1,1,nil)
4241
if #sg==0 then return end

rush/c160020033.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
3131
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end
3232
end
3333
function s.insectfilter(c)
34-
return c:IsFaceup() and c:IsNotMaximumModeSide() and not c:IsRace(RACE_INSECT)
34+
return c:IsFaceup() and c:IsNotMaximumModeSide() and c:CanChangeIntoTypeRush(RACE_INSECT,2)
3535
end
3636
function s.operation(e,tp,eg,ep,ev,re,r,rp)
3737
--Requirement

rush/c160209002.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
2727
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_GRAVE)
2828
end
2929
function s.attfilter(c)
30-
return c:IsFaceup() and not c:IsAttribute(ATTRIBUTE_LIGHT)
30+
return c:IsFaceup() and c:CanChangeIntoAttributeRush(ATTRIBUTE_LIGHT)
3131
end
3232
function s.operation(e,tp,eg,ep,ev,re,r,rp)
3333
if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end

0 commit comments

Comments
 (0)