Skip to content

Commit f01c036

Browse files
authored
Update "Secret Mission"
- Place target property in target function to properly raise events for when it might target a monster instead of it being inherent in the initial effect --Code modernization update
1 parent 320e7c1 commit f01c036

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

unofficial/c511001331.lua

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,13 @@ local s,id=GetID()
44
function s.initial_effect(c)
55
--Activate
66
local e1=Effect.CreateEffect(c)
7-
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
87
e1:SetType(EFFECT_TYPE_ACTIVATE)
98
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
10-
e1:SetCondition(s.condition)
9+
e1:SetCondition(function(e) return Duel.IsTurnPlayer(1-e:GetHandlerPlayer()) end)
1110
e1:SetTarget(s.target)
1211
e1:SetOperation(s.activate)
1312
c:RegisterEffect(e1)
1413
end
15-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
16-
return tp~=Duel.GetTurnPlayer()
17-
end
1814
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
1915
if chk==0 then return true end
2016
local opt=0
@@ -24,6 +20,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
2420
opt=Duel.SelectOption(1-tp,aux.Stringid(15552258,1))+1
2521
end
2622
if opt==0 then
23+
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
2724
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
2825
local sg=g:RandomSelect(1-tp,1)
2926
Duel.SetTargetCard(sg)
@@ -32,12 +29,13 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
3229
end
3330
function s.activate(e,tp,eg,ep,ev,re,r,rp)
3431
local opt=e:GetLabel()
35-
if opt==1 then
36-
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE_STEP,1)
32+
if opt==0 then
33+
local tc=Duel.GetFirstTarget()
34+
if tc and tc:IsRelateToEffect(e) then
35+
Duel.CalculateDamage(Duel.GetAttacker(),tc)
36+
end
37+
else
38+
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1)
3739
return
3840
end
39-
local tc=Duel.GetFirstTarget()
40-
if tc and tc:IsRelateToEffect(e) then
41-
Duel.CalculateDamage(Duel.GetAttacker(),tc)
42-
end
4341
end

0 commit comments

Comments
 (0)