Skip to content

Commit ea99551

Browse files
committed
"Riryoku" update
- fixed a bug where the part of the effect to halve the ATK would not apply in case one of the monsters left the field - moved the selection of which monster to halve the ATK to the resolution - fixed strings and added operation info
1 parent bb62fa8 commit ea99551

File tree

1 file changed

+32
-27
lines changed

1 file changed

+32
-27
lines changed

official/c34016756.lua

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--フォース
2+
--Riryoku
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--Activate
5+
--Halve the ATK of a monster and increase the ATK of another by the same amount
56
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
68
e1:SetCategory(CATEGORY_ATKCHANGE)
79
e1:SetType(EFFECT_TYPE_ACTIVATE)
810
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
@@ -14,32 +16,35 @@ end
1416
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
1517
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
1618
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil) end
17-
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0))
18-
local g1=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
19-
e:SetLabelObject(g1:GetFirst())
20-
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1))
21-
local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,g1:GetFirst())
19+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF)
20+
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,2,2,nil)
21+
Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,0)
2222
end
2323
function s.activate(e,tp,eg,ep,ev,re,r,rp)
24-
local hc=e:GetLabelObject()
25-
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
26-
local tc=g:GetFirst()
27-
if tc==hc then tc=g:GetNext() end
28-
if hc:IsFaceup() and hc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
29-
local atk=hc:GetAttack()
30-
local e1=Effect.CreateEffect(e:GetHandler())
31-
e1:SetType(EFFECT_TYPE_SINGLE)
32-
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
33-
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
34-
e1:SetValue(atk/2)
35-
hc:RegisterEffect(e1)
36-
if not hc:IsImmuneToEffect(e1) then
37-
local e2=Effect.CreateEffect(e:GetHandler())
38-
e2:SetType(EFFECT_TYPE_SINGLE)
39-
e2:SetCode(EFFECT_UPDATE_ATTACK)
40-
e2:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
41-
e2:SetValue(atk/2)
42-
tc:RegisterEffect(e2)
43-
end
24+
local g=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil)
25+
if #g==0 then return end
26+
local hc=g:GetFirst()
27+
if #g>1 then
28+
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1))
29+
hc=g:Select(tp,1,1,nil):GetFirst()
4430
end
45-
end
31+
g:RemoveCard(hc)
32+
local c=e:GetHandler()
33+
local atk=hc:GetAttack()
34+
--Halve the ATK of one monster
35+
local e1=Effect.CreateEffect(c)
36+
e1:SetType(EFFECT_TYPE_SINGLE)
37+
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
38+
e1:SetReset(RESETS_STANDARD_PHASE_END)
39+
e1:SetValue(atk/2)
40+
hc:RegisterEffect(e1)
41+
if not hc:IsImmuneToEffect(e1) and #g>0 then
42+
--Add that lost ATK to the other monster
43+
local e2=Effect.CreateEffect(c)
44+
e2:SetType(EFFECT_TYPE_SINGLE)
45+
e2:SetCode(EFFECT_UPDATE_ATTACK)
46+
e2:SetReset(RESETS_STANDARD_PHASE_END)
47+
e2:SetValue(atk/2)
48+
g:GetFirst():RegisterEffect(e2)
49+
end
50+
end

0 commit comments

Comments
 (0)