|
| 1 | +-- 王者の聖外套 |
1 | 2 | --Emperor's Armor |
2 | 3 | local s,id=GetID() |
3 | 4 | function s.initial_effect(c) |
| 5 | + --Equip procedure |
4 | 6 | aux.AddEquipProcedure(c) |
5 | | - --Attack |
6 | | - local e3=Effect.CreateEffect(c) |
7 | | - e3:SetType(EFFECT_TYPE_EQUIP) |
8 | | - e3:SetCode(EFFECT_SET_ATTACK) |
9 | | - e3:SetCondition(s.atkcon) |
10 | | - e3:SetValue(s.atkval) |
11 | | - c:RegisterEffect(e3) |
12 | | - --Save Monster |
13 | | - local e4=Effect.CreateEffect(c) |
14 | | - e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_EQUIP) |
15 | | - e4:SetCode(EFFECT_DESTROY_REPLACE) |
16 | | - e4:SetTarget(s.destg) |
17 | | - e4:SetOperation(s.desop) |
18 | | - c:RegisterEffect(e4) |
| 7 | + --Equipped monster's ATK becomes battling monster's ATK |
| 8 | + local e1=Effect.CreateEffect(c) |
| 9 | + e1:SetType(EFFECT_TYPE_EQUIP) |
| 10 | + e1:SetCode(EFFECT_SET_ATTACK) |
| 11 | + e1:SetCondition(s.atkcon) |
| 12 | + e1:SetValue(s.atkval) |
| 13 | + c:RegisterEffect(e1) |
| 14 | + --Send this card to the GY to prevent battle destruction |
| 15 | + local e2=Effect.CreateEffect(c) |
| 16 | + e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_EQUIP) |
| 17 | + e2:SetCode(EFFECT_DESTROY_REPLACE) |
| 18 | + e2:SetTarget(s.destg) |
| 19 | + e2:SetOperation(s.desop) |
| 20 | + c:RegisterEffect(e2) |
19 | 21 | end |
20 | 22 | function s.atkcon(e) |
21 | | - local eq=e:GetHandler():GetEquipTarget() |
22 | | - return Duel.GetCurrentPhase()==PHASE_DAMAGE_CAL and (Duel.GetAttacker()==eq or Duel.GetAttackTarget()==eq) and Duel.GetAttackTarget()~=nil |
| 23 | + local ec=e:GetHandler():GetEquipTarget() |
| 24 | + return ec and (Duel.GetAttacker()==ec or Duel.GetAttackTarget()==ec) |
23 | 25 | end |
24 | 26 | function s.atkval(e,c) |
25 | 27 | local eq=e:GetHandler():GetEquipTarget() |
26 | 28 | return eq:GetBattleTarget():GetAttack() |
27 | 29 | end |
28 | 30 | function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) |
29 | 31 | local c=e:GetHandler() |
30 | | - local tg=c:GetEquipTarget() |
| 32 | + local ec=c:GetEquipTarget() |
31 | 33 | if chk==0 then return c and not c:IsStatus(STATUS_DESTROY_CONFIRMED) |
32 | | - and tg and tg:IsReason(REASON_BATTLE) end |
| 34 | + and ec and ec:IsReason(REASON_BATTLE) end |
33 | 35 | return Duel.SelectYesNo(tp,aux.Stringid(id,0)) |
34 | 36 | end |
35 | 37 | function s.desop(e,tp,eg,ep,ev,re,r,rp) |
36 | 38 | local c=e:GetHandler() |
37 | | - local tg=c:GetEquipTarget() |
38 | | - Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT) |
39 | | - local bt=tg:GetBattleTarget() |
40 | | - local ph=Duel.GetCurrentPhase() |
41 | | - if Duel.GetTurnPlayer()==tp and ph>=0x08 and ph<=0x20 and Duel.GetTurnPlayer()==tp then |
42 | | - if Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,bt) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then |
43 | | - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) |
44 | | - local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,bt):GetFirst() |
45 | | - local atk1=tg:GetAttack() |
46 | | - local atk2=g:GetAttack() |
| 39 | + Duel.SendtoGrave(c,REASON_EFFECT|REASON_REPLACE) |
| 40 | + if Duel.GetTurnPlayer()==tp and Duel.IsBattlePhase() then |
| 41 | + if Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then |
| 42 | + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) |
| 43 | + local ec=c:GetPreviousEquipTarget() |
| 44 | + local tc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() |
| 45 | + local atk1=ec:GetAttack() |
| 46 | + local atk2=tc:GetAttack() |
47 | 47 | local e1=Effect.CreateEffect(c) |
48 | 48 | e1:SetType(EFFECT_TYPE_SINGLE) |
49 | 49 | e1:SetCode(EFFECT_SET_ATTACK) |
50 | 50 | e1:SetValue(atk2) |
51 | | - e1:SetReset(RESET_EVENT+RESETS_STANDARD) |
52 | | - tg:RegisterEffect(e1) |
| 51 | + e1:SetReset(RESET_EVENT|RESETS_STANDARD) |
| 52 | + ec:RegisterEffect(e1) |
53 | 53 | local e2=Effect.CreateEffect(c) |
54 | 54 | e2:SetType(EFFECT_TYPE_SINGLE) |
55 | 55 | e2:SetCode(EFFECT_SET_ATTACK) |
56 | 56 | e2:SetValue(atk1) |
57 | | - e2:SetReset(RESET_EVENT+RESETS_STANDARD) |
58 | | - g:RegisterEffect(e2) |
| 57 | + e2:SetReset(RESET_EVENT|RESETS_STANDARD) |
| 58 | + tc:RegisterEffect(e2) |
59 | 59 | local e3=Effect.CreateEffect(c) |
60 | 60 | e3:SetType(EFFECT_TYPE_SINGLE) |
61 | 61 | e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) |
62 | 62 | e3:SetCode(EFFECT_EXTRA_ATTACK) |
63 | 63 | e3:SetValue(1) |
64 | | - e3:SetReset(RESET_EVENT+RESETS_STANDARD_DISABLE+RESET_PHASE+PHASE_END) |
65 | | - tg:RegisterEffect(e3) |
| 64 | + e3:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_END) |
| 65 | + ec:RegisterEffect(e3) |
66 | 66 | end |
67 | 67 | end |
68 | 68 | end |
0 commit comments