Skip to content

Commit 273e124

Browse files
authored
Update "Cobal, Excavator of Dark World"
- Slight rescript of Special Summon effect to work more like "D/D/D Marksman King Tell" - Adding from GY to hand should only trigger if this card inflicts damage to the opponent by a direct attack. - General script modernization
1 parent 09f48ab commit 273e124

1 file changed

Lines changed: 47 additions & 49 deletions

File tree

unofficial/c511000290.lua

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,70 @@
1+
--暗黒界の発掘師 コバル
12
--Cobal, Excavator of the Dark World
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--special summon
5-
local e1=Effect.CreateEffect(c)
6-
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
7-
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
8-
e1:SetRange(LOCATION_HAND)
9-
e1:SetCode(EVENT_DAMAGE)
10-
e1:SetCondition(s.con)
11-
e1:SetOperation(s.op)
12-
c:RegisterEffect(e1)
13-
--add
14-
local e2=Effect.CreateEffect(c)
15-
e2:SetDescription(aux.Stringid(id,1))
16-
e2:SetCategory(CATEGORY_TOHAND)
17-
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
18-
e2:SetType(EFFECT_TYPE_IGNITION)
19-
e2:SetRange(LOCATION_MZONE)
20-
e2:SetCost(s.addcost)
21-
e2:SetTarget(s.addtg)
22-
e2:SetOperation(s.addop)
23-
c:RegisterEffect(e2)
24-
end
25-
function s.con(e,tp,eg,ep,ev,re,r,rp)
26-
return (r&REASON_BATTLE)>0 and ep==tp
27-
end
28-
function s.op(e,tp,eg,ep,ev,re,r,rp)
29-
local c=e:GetHandler()
5+
--During the End Phase of a turn you took Battle Damage from your opponent: You can Special Summon this card from your hand.
306
local e1=Effect.CreateEffect(c)
317
e1:SetDescription(aux.Stringid(id,0))
328
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
339
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
3410
e1:SetCode(EVENT_PHASE+PHASE_END)
35-
e1:SetCountLimit(1)
3611
e1:SetRange(LOCATION_HAND)
12+
e1:SetCountLimit(1)
13+
e1:SetCondition(function(e) return Duel.HasFlagEffect(e:GetHandlerPlayer(),id) end)
3714
e1:SetTarget(s.sptg)
3815
e1:SetOperation(s.spop)
39-
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
4016
c:RegisterEffect(e1)
17+
--If this card inflicts Battle Damage to your opponent by a direct attack: You can send this face-up card to the Graveyard; add 1 "Dark World" card from your Graveyard to your hand.
18+
local e2=Effect.CreateEffect(c)
19+
e2:SetDescription(aux.Stringid(id,1))
20+
e2:SetCategory(CATEGORY_TOHAND)
21+
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
22+
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
23+
e2:SetCode(EVENT_BATTLE_DAMAGE)
24+
e2:SetRange(LOCATION_MZONE)
25+
e2:SetCost(Cost.SelfToGrave)
26+
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and Duel.GetAttackTarget()==nil end)
27+
e2:SetTarget(s.thtg)
28+
e2:SetOperation(s.thop)
29+
c:RegisterEffect(e2)
30+
--Register checks for battle damage
31+
aux.GlobalCheck(s,function()
32+
local ge1=Effect.CreateEffect(c)
33+
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
34+
ge1:SetCode(EVENT_BATTLE_DAMAGE)
35+
ge1:SetOperation(s.checkop)
36+
Duel.RegisterEffect(ge1,0)
37+
end)
38+
end
39+
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
40+
if ep==e:GetHandlerPlayer() then
41+
Duel.RegisterFlagEffect(ep,id,RESET_PHASE|PHASE_END,0,1)
42+
end
4143
end
4244
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
45+
local c=e:GetHandler()
4346
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
44-
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
45-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
47+
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
48+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
4649
end
4750
function s.spop(e,tp,eg,ep,ev,re,r,rp)
48-
if e:GetHandler():IsRelateToEffect(e) then
49-
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
51+
local c=e:GetHandler()
52+
if c:IsRelateToEffect(e) then
53+
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
5054
end
5155
end
52-
function s.addcost(e,tp,eg,ep,ev,re,r,rp,chk)
53-
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
54-
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
55-
end
56-
function s.filter(c)
56+
function s.thfilter(c)
5757
return c:IsSetCard(SET_DARK_WORLD) and c:IsAbleToHand()
5858
end
59-
function s.addtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
60-
if chkc then return chkc:GetLocation()==LOCATION_GRAVE and chkc:GetControler()==tp and c98494543.filter(chkc) end
61-
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end
62-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
63-
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil)
64-
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
59+
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
60+
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
61+
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
6562
end
66-
function s.addop(e,tp,eg,ep,ev,re,r,rp)
67-
local tc=Duel.GetFirstTarget()
68-
if tc and tc:IsRelateToEffect(e) then
69-
Duel.SendtoHand(tc,nil,REASON_EFFECT)
70-
Duel.ConfirmCards(1-tp,tc)
63+
function s.thop(e,tp,eg,ep,ev,re,r,rp)
64+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
65+
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
66+
if #g>0 then
67+
Duel.SendtoHand(g,nil,REASON_EFFECT)
68+
Duel.ConfirmCards(1-tp,g)
7169
end
72-
end
70+
end

0 commit comments

Comments
 (0)