Skip to content

Commit eada7a7

Browse files
authored
Update "White Knight Lord (Anime)"
- First effect should apply during each End Phase, and if the monster didn't battle. - Tribute restriction is general, not just for Tribute Summons - Fixed incorrect category/damage information - General script polish/modernization
1 parent ad0efb4 commit eada7a7

1 file changed

Lines changed: 57 additions & 42 deletions

File tree

unofficial/c511000595.lua

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,100 @@
1-
--White Knight Lord
1+
--白騎士団のロード (Anime)
2+
--White Knight Lord (Anime)
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--
5+
--During each End Phase, if this card did battle this turn: Take 800 damage.
56
local e1=Effect.CreateEffect(c)
6-
e1:SetType(EFFECT_TYPE_SINGLE)
7-
e1:SetCode(EFFECT_UNRELEASABLE_SUM)
8-
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
7+
e1:SetCategory(CATEGORY_DAMAGE)
8+
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
9+
e1:SetCode(EVENT_PHASE|PHASE_END)
910
e1:SetRange(LOCATION_MZONE)
10-
e1:SetValue(1)
11+
e1:SetCountLimit(1)
12+
e1:SetCondition(function(e) return e:GetHandler():GetBattledGroupCount()==0 end)
13+
e1:SetTarget(s.selfepdamtg)
14+
e1:SetOperation(s.selfepdamop)
1115
c:RegisterEffect(e1)
12-
--damage LP
16+
--Cannot be destroyed by battle
1317
local e2=Effect.CreateEffect(c)
14-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
15-
e2:SetCode(EVENT_PHASE+PHASE_END)
16-
e2:SetRange(LOCATION_MZONE)
17-
e2:SetCountLimit(1)
18-
e2:SetOperation(s.retop)
18+
e2:SetType(EFFECT_TYPE_SINGLE)
19+
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
20+
e2:SetValue(1)
1921
c:RegisterEffect(e2)
20-
--
22+
--You take no battle damage from battles involving this card
2123
local e3=Effect.CreateEffect(c)
2224
e3:SetType(EFFECT_TYPE_SINGLE)
23-
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
25+
e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
2426
e3:SetValue(1)
2527
c:RegisterEffect(e3)
26-
local e4=Effect.CreateEffect(c)
27-
e4:SetType(EFFECT_TYPE_SINGLE)
28-
e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
29-
e4:SetValue(1)
30-
c:RegisterEffect(e4)
31-
--damage
28+
--This card cannot be Tributed
29+
local e4a=Effect.CreateEffect(c)
30+
e4a:SetType(EFFECT_TYPE_SINGLE)
31+
e4a:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
32+
e4a:SetCode(EFFECT_UNRELEASABLE_SUM)
33+
e4a:SetRange(LOCATION_MZONE)
34+
e4a:SetValue(1)
35+
c:RegisterEffect(e4a)
36+
local e4b=e4a:Clone()
37+
e4b:SetCode(EFFECT_UNRELEASABLE_NONSUM)
38+
c:RegisterEffect(e4b)
39+
--When this card destroys a monster by battle: Inflict 300 damage to your opponent
3240
local e5=Effect.CreateEffect(c)
3341
e5:SetDescription(aux.Stringid(id,1))
3442
e5:SetCategory(CATEGORY_DAMAGE)
3543
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
3644
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
3745
e5:SetCode(EVENT_BATTLE_DESTROYING)
38-
e5:SetCondition(s.damcon)
39-
e5:SetTarget(s.damtg)
40-
e5:SetOperation(s.damop)
46+
e5:SetCondition(s.batdesdamcon)
47+
e5:SetTarget(s.batdestg)
48+
e5:SetOperation(s.batdesop)
4149
c:RegisterEffect(e5)
42-
--special summon
50+
--When this card is destroyed by an opponent's card effect: Inflict 1000 damage to your opponent.
4351
local e6=Effect.CreateEffect(c)
4452
e6:SetDescription(aux.Stringid(id,2))
45-
e6:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
53+
e6:SetCategory(CATEGORY_DAMAGE)
4654
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
47-
e6:SetCode(EVENT_DESTROY)
48-
e6:SetCondition(s.damcon2)
49-
e6:SetTarget(s.damtg2)
50-
e6:SetOperation(s.damop2)
55+
e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
56+
e6:SetCode(EVENT_DESTROYED)
57+
e6:SetCondition(s.oppeffdesdamcon)
58+
e6:SetTarget(s.oppeffdesdamtg)
59+
e6:SetOperation(s.oppeffdesdamop)
5160
c:RegisterEffect(e6)
5261
end
53-
function s.retop(e,tp,eg,ep,ev,re,r,rp)
54-
local c=e:GetHandler()
55-
if Duel.IsTurnPlayer(tp) and c:GetAttackedCount()==0 then
56-
Duel.Damage(tp,800,REASON_EFFECT)
57-
end
62+
function s.selfepdamdamtg(e,tp,eg,ep,ev,re,r,rp,chk)
63+
if chk==0 then return true end
64+
Duel.SetTargetPlayer(tp)
65+
Duel.SetTargetParam(800)
66+
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,tp,800)
5867
end
59-
function s.damcon(e,tp,eg,ep,ev,re,r,rp)
68+
function s.selfepdamdamop(e,tp,eg,ep,ev,re,r,rp)
69+
if not e:GetHandler():IsRelateToEffect(e) then return end
70+
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
71+
Duel.Damage(p,d,REASON_EFFECT)
72+
end
73+
function s.batdesdamcon(e,tp,eg,ep,ev,re,r,rp)
6074
local c=e:GetHandler()
6175
return c:IsRelateToBattle() and c:GetBattleTarget():IsMonster()
6276
end
63-
function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
77+
function s.batdesdamtg(e,tp,eg,ep,ev,re,r,rp,chk)
6478
if chk==0 then return true end
6579
Duel.SetTargetPlayer(1-tp)
6680
Duel.SetTargetParam(300)
6781
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,300)
6882
end
69-
function s.damop(e,tp,eg,ep,ev,re,r,rp)
83+
function s.batdesdamop(e,tp,eg,ep,ev,re,r,rp)
7084
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
7185
Duel.Damage(p,d,REASON_EFFECT)
7286
end
73-
function s.damcon2(e,tp,eg,ep,ev,re,r,rp)
74-
return rp~=tp and (r&0x41)==0x41
87+
function s.oppeffdesdamcon(e,tp,eg,ep,ev,re,r,rp)
88+
local c=e:GetHandler()
89+
return rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp)
7590
end
76-
function s.damtg2(e,tp,eg,ep,ev,re,r,rp,chk)
91+
function s.oppeffdesdamtg(e,tp,eg,ep,ev,re,r,rp,chk)
7792
if chk==0 then return true end
7893
Duel.SetTargetPlayer(1-tp)
7994
Duel.SetTargetParam(1000)
8095
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000)
8196
end
82-
function s.damop2(e,tp,eg,ep,ev,re,r,rp)
97+
function s.oppeffdesdamop(e,tp,eg,ep,ev,re,r,rp)
8398
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
8499
Duel.Damage(p,d,REASON_EFFECT)
85-
end
100+
end

0 commit comments

Comments
 (0)