|
| 1 | +--霊剣タナトス |
1 | 2 | --Sacred Sword Thanatos |
2 | 3 | local s,id=GetID() |
3 | 4 | function s.initial_effect(c) |
4 | 5 | aux.AddEquipProcedure(c) |
5 | | - --atkup |
6 | | - local e3=Effect.CreateEffect(c) |
7 | | - e3:SetType(EFFECT_TYPE_EQUIP) |
8 | | - e3:SetCode(EFFECT_UPDATE_ATTACK) |
9 | | - e3:SetValue(300) |
10 | | - c:RegisterEffect(e3) |
11 | | - --Token destroy and atk up |
12 | | - local e4=Effect.CreateEffect(c) |
13 | | - e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) |
14 | | - e4:SetCode(EVENT_ADJUST) |
15 | | - e4:SetRange(LOCATION_SZONE) |
16 | | - e4:SetOperation(s.desop) |
17 | | - c:RegisterEffect(e4) |
| 6 | + --The equipped monster gains 300 ATK |
| 7 | + local e1=Effect.CreateEffect(c) |
| 8 | + e1:SetType(EFFECT_TYPE_EQUIP) |
| 9 | + e1:SetCode(EFFECT_UPDATE_ATTACK) |
| 10 | + e1:SetValue(300) |
| 11 | + c:RegisterEffect(e1) |
| 12 | + --Destroy all Tokens on the field, and if you do, the equipped monster gains ATK equal to their ATK |
| 13 | + local e2=Effect.CreateEffect(c) |
| 14 | + e2:SetCategory(CATEGORY_DESTROY) |
| 15 | + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) |
| 16 | + e2:SetCode(EVENT_ADJUST) |
| 17 | + e2:SetRange(LOCATION_SZONE) |
| 18 | + e2:SetOperation(s.desop) |
| 19 | + c:RegisterEffect(e2) |
18 | 20 | end |
19 | | -function s.filter(c,e) |
20 | | - return c:IsType(TYPE_TOKEN) and c:IsDestructable(e) |
| 21 | +function s.desfilter(c,e,tp) |
| 22 | + if not c:IsType(TYPE_TOKEN) then return false end |
| 23 | + if c:IsDestructable(e) then return true end |
| 24 | + local indes_eff=c:IsHasEffect(EFFECT_INDESTRUCTABLE_EFFECT) |
| 25 | + return c:IsHasEffect(EFFECT_INDESTRUCTABLE_COUNT) and not (indes_eff |
| 26 | + and (type(indes_eff:GetValue())~='function' or indes_eff:GetValue()(indes_eff,e,tp,c))) |
21 | 27 | end |
22 | 28 | function s.desop(e,tp,eg,ep,ev,re,r,rp) |
23 | | - local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e) |
24 | | - local atk=g:GetSum(Card.GetAttack) |
25 | | - Duel.Destroy(g,REASON_EFFECT) |
26 | | - if e:GetHandler():GetEquipTarget() and atk>0 then |
27 | | - local e1=Effect.CreateEffect(e:GetHandler()) |
| 29 | + local c=e:GetHandler() |
| 30 | + local ec=c:GetEquipTarget() |
| 31 | + if not ec then return end |
| 32 | + local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e,tp) |
| 33 | + if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 then |
| 34 | + local atk=Duel.GetOperatedGroup():GetSum(Card.GetPreviousAttackOnField) |
| 35 | + if atk==0 then return end |
| 36 | + --The equipped monster gains ATK equal to the total ATK of the destroyed Tokens |
| 37 | + local e1=Effect.CreateEffect(c) |
28 | 38 | e1:SetType(EFFECT_TYPE_SINGLE) |
| 39 | + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) |
29 | 40 | e1:SetCode(EFFECT_UPDATE_ATTACK) |
30 | | - e1:SetReset(RESET_EVENT+RESETS_STANDARD) |
31 | 41 | e1:SetValue(atk) |
32 | | - e:GetHandler():GetEquipTarget():RegisterEffect(e1) |
| 42 | + e1:SetReset(RESET_EVENT|RESETS_STANDARD) |
| 43 | + ec:RegisterEffect(e1) |
33 | 44 | end |
34 | 45 | end |
0 commit comments