Skip to content

Commit 87cbab6

Browse files
authored
Update "Contagion of Madness"
-Should only be able to activate when an opponent's monster attacks -Should not negate attacks -Script polishing/modernization
1 parent 9395586 commit 87cbab6

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

unofficial/c511000408.lua

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1+
--狂気の伝染
12
--Contagion of Madness
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--Activate
5+
-Activate when your opponent's monster declares an attack
56
local e1=Effect.CreateEffect(c)
67
e1:SetCategory(CATEGORY_DAMAGE)
78
e1:SetType(EFFECT_TYPE_ACTIVATE)
89
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
9-
e1:SetTarget(s.target)
10-
e1:SetOperation(s.activate)
10+
e1:SetCondition(function(e) return Duel.GetAttacker():IsControler(1-e:GetHandlerPlayer()) end)
11+
e1:SetOperation(s.operation)
1112
c:RegisterEffect(e1)
1213
end
13-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
14-
local tg=Duel.GetAttacker()
15-
if chk==0 then return tg:IsOnField() end
16-
local dam=tg:GetAttack()
17-
Duel.SetTargetParam(dam)
18-
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,dam)
14+
function s.operation(e,tp,eg,ep,ev,re,r,rp)
15+
--Your opponent takes damage equal to half the battle damage you would take from this battle
16+
local e1=Effect.CreateEffect(e:GetHandler())
17+
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
18+
e1:SetCode(EVENT_BATTLE_DAMAGE)
19+
e1:SetRange(LOCATION_MZONE)
20+
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==tp end)
21+
e1:SetOperation(function(e) Duel.Damage(1-e:GetHandlerPlayer(),Duel.GetBattleDamage(e:GetHandlerPlayer())/2,REASON_EFFECT) end)
22+
e1:SetReset(RESET_PHASE|PHASE_DAMAGE)
23+
Duel.RegisterEffect(e1,tp)
1924
end
20-
function s.activate(e,tp,eg,ep,ev,re,r,rp)
21-
local tg,d=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS,CHAININFO_TARGET_PARAM)
22-
local tc=Duel.GetAttacker()
23-
local ap=tc:GetControler()
24-
if tc:IsFaceup() and tc:CanAttack() then
25-
if Duel.NegateAttack() then
26-
Duel.Damage(1-ap,d,REASON_BATTLE)
27-
Duel.Damage(ap,d/2,REASON_EFFECT)
28-
end
29-
end
30-
end

0 commit comments

Comments
 (0)