Commit 4d712820 authored by argon.sun's avatar argon.sun

fix

parent 3385a07e
......@@ -13,7 +13,7 @@
#include <dirent.h>
#endif
const unsigned short PRO_VERSION = 0x1260;
const unsigned short PRO_VERSION = 0x1270;
namespace ygo {
......
......@@ -609,10 +609,18 @@ int ReplayMode::MessageHandler(long fduel, int type) {
if(!enable_log)
return 0;
char msgbuf[1024];
wchar_t wbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2){
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
return 0;
}
......
......@@ -1431,10 +1431,18 @@ int SingleDuel::MessageHandler(long fduel, int type) {
if(!enable_log)
return 0;
char msgbuf[1024];
wchar_t wbuf[1024];
get_log_message(fduel, (byte*)msgbuf);
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
if(enable_log == 1) {
wchar_t wbuf[1024];
BufferIO::DecodeUTF8(msgbuf, wbuf);
mainGame->AddChatMsg(wbuf, 9);
} else if(enable_log == 2){
FILE* fp = fopen("error.log", "at");
if(!fp)
return 0;
fprintf(fp, "[Script error:] %s\n", msgbuf);
fclose(fp);
}
return 0;
}
void SingleDuel::SingleTimer(evutil_socket_t fd, short events, void* arg) {
......
......@@ -54,7 +54,7 @@ end
function c11662742.dmop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetControler()~=ep then return end
if bit.band(r,REASON_BATTLE) then
if bit.band(r,REASON_BATTLE)~=0 then
c:RegisterFlagEffect(11662742,RESET_PHASE+RESET_DAMAGE,0,0)
elseif Duel.GetCurrentPhase()==PHASE_DAMAGE and not Duel.IsDamageCalculated() then
c:RegisterFlagEffect(11662743,RESET_PHASE+RESET_DAMAGE,0,1)
......
......@@ -52,7 +52,7 @@ function c1412158.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsAbleToExtra()
and Duel.IsExistingMatchingCard(c1412158.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORU_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c1412158.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -14,9 +14,9 @@ function c14344682.initial_effect(c)
end
function c14344682.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENCE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c14344682.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -15,7 +15,7 @@ function c15658249.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsDefencePos() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c15658249.posop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -34,7 +34,7 @@ end
function c16480084.schop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c16480084.sfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount() then
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
--人造天使
function c16946849.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--token
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_CHAIN_SOLVED)
e2:SetCondition(c16946849.tokencon)
e2:SetOperation(c16946849.tokenop)
c:RegisterEffect(e2)
end
function c16946849.tokencon(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_COUNTER) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,16946850,0,0x4011,300,300,1,RACE_FAIRY,ATTRIBUTE_LIGHT)
end
function c16946849.tokenop(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,16946850)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
......@@ -22,11 +22,11 @@ function c1804528.desop(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
local g2=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_MZONE,nil)
local opt=0
if g1:GetCount() and g2:GetCount() then
if g1:GetCount()>0 and g2:GetCount()>0 then
opt=Duel.SelectOption(tp,aux.Stringid(1804528,1),aux.Stringid(1804528,2))
elseif g1:GetCount() then
elseif g1:GetCount()>0 then
opt=Duel.SelectOption(tp,aux.Stringid(1804528,1))
elseif g2:GetCount() then
elseif g2:GetCount()>0 then
opt=Duel.SelectOption(tp,aux.Stringid(1804528,2))+1
else return end
if opt==0 then
......
......@@ -19,11 +19,11 @@ function c19733961.filter(c)
end
function c19733961.atkval(e,c)
local g=Duel.GetMatchingGroup(c19733961.filter,c:GetControler(),LOCATION_MZONE,0,nil)
if g:IsExists(Card.IsDefence,1,nil) then return 0 end
if g:IsExists(Card.IsDefencePos,1,nil) then return 0 end
return 500
end
function c19733961.defval(e,c)
local g=Duel.GetMatchingGroup(c19733961.filter,c:GetControler(),LOCATION_MZONE,0,nil)
if g:IsExists(Card.IsAttack,1,nil) then return 0 end
if g:IsExists(Card.IsAttackPos,1,nil) then return 0 end
return 500
end
......@@ -11,8 +11,8 @@ function c20450925.initial_effect(c)
c:RegisterEffect(e1)
end
function c20450925.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
if chk==0 then return e:GetHandler():IsDiscardable() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD)
end
function c20450925.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
......@@ -25,6 +25,6 @@ function c20450925.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e1,tp)
end
function c20450925.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT) then return 0
if bit.band(r,REASON_EFFECT)~=0 then return 0
else return val end
end
......@@ -8,5 +8,5 @@ function c20939559.initial_effect(c)
c:RegisterEffect(e1)
end
function c20939559.con(e)
return not Duel.IsExistingMatchingCard(Card.IsAttack,e:GetHandler():GetControler(),0,LOCATION_MZONE,1,nil)
return not Duel.IsExistingMatchingCard(Card.IsAttackPos,e:GetHandler():GetControler(),0,LOCATION_MZONE,1,nil)
end
--隼の騎士
function c21015833.initial_effect(c)
--double attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetValue(1)
c:RegisterEffect(e1)
end
--破壊指輪
function c21219755.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c21219755.target)
e1:SetOperation(c21219755.activate)
c:RegisterEffect(e1)
end
function c21219755.filter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c21219755.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c21219755.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c21219755.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c21219755.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,1000)
end
function c21219755.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
if Duel.Destroy(tc,REASON_EFFECT)>0 then
Duel.Damage(1-tp,1000,REASON_EFFECT)
Duel.Damage(tp,1000,REASON_EFFECT)
end
end
end
......@@ -41,7 +41,7 @@ end
function c2619149.sop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c2619149.sfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount() then
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -9,7 +9,7 @@ function c26640671.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(26640671,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetTarget(c26640671.target)
......
......@@ -10,7 +10,7 @@ function c27191436.initial_effect(c)
e1:SetOperation(c27191436.activate)
c:RegisterEffect(e1)
end
function c27191436.filter(c)
function c27191436.cfilter(c)
return c:IsFaceup() and c:IsCode(58932615)
end
function c27191436.condition(e,tp,eg,ep,ev,re,r,rp)
......
--暗黒の扉
function c30606547.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--cannot attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetCondition(c30606547.atkcon)
e2:SetTarget(c30606547.atktg)
c:RegisterEffect(e2)
--check
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_ATTACK_ANNOUNCE)
e3:SetRange(LOCATION_SZONE)
e3:SetOperation(c30606547.checkop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c30606547.atkcon(e)
return e:GetHandler():GetFlagEffect(30606547)~=0
end
function c30606547.atktg(e,c)
return c:GetFieldID()~=e:GetLabel()
end
function c30606547.checkop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():GetFlagEffect(30606547)~=0 then return end
local fid=eg:GetFirst():GetFieldID()
e:GetHandler():RegisterFlagEffect(30606547,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
e:GetLabelObject():SetLabel(fid)
end
......@@ -12,7 +12,7 @@ function c32065885.initial_effect(c)
c:RegisterEffect(e1)
end
function c32065885.ctlcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and bit.band(r,REASON_BATTLE) and Duel.GetAttackTarget()==nil and Duel.GetAttacker():IsControler(1-tp)
return ep==tp and bit.band(r,REASON_BATTLE)~=0 and Duel.GetAttackTarget()==nil and Duel.GetAttacker():IsControler(1-tp)
end
function c32065885.ctltg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) end
......
......@@ -55,7 +55,7 @@ function c32391631.recop(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(p,d,REASON_EFFECT)
end
function c32391631.becon(e)
return Duel.IsExistingMatchingCard(Card.IsAttackable,Duel.GetTurnPlayer(),LOCATION_MZONE,0,1,nil)
return Duel.IsExistingMatchingCard(Card.IsAttackPosable,Duel.GetTurnPlayer(),LOCATION_MZONE,0,1,nil)
end
function c32391631.desfilter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:GetAttackedCount()==0 and c:IsDestructable()
......
......@@ -18,7 +18,7 @@ function c33066139.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c33066139.filter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,e:GetHandler())
if g:GetCOunt()>0 and g:GetFirst():IsFaceup() then
if g:GetCount()>0 and g:GetFirst():IsFaceup() then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
end
......
......@@ -14,7 +14,7 @@ function c33455338.initial_effect(c)
c:RegisterEffect(e1)
end
function c33455338.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel:GetTurnPlayer()~=tp
return Duel.GetTurnPlayer()~=tp
end
function c33455338.filter(c)
return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
......
......@@ -85,16 +85,17 @@ function c3429238.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetFlagEffect(3429238)~=0 end
e:GetHandler():ResetFlagEffect(3429238)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function c3429238.filter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end
function c3429238.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)>0 then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c3429238.filter,tp,LOCATION_GRAVE,0,1,1,nil)
if g:GetCount()>0 then
Duel.BreakEffect()
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
......
......@@ -10,8 +10,7 @@ function c35563539.initial_effect(c)
c:RegisterEffect(e1)
end
function c35563539.condition(e,tp,eg,ep,ev,re,r,rp)
local te=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT)
return te:IsHasType(EFFECT_TYPE_ACTIVATE) and te:IsHasProperty(EFFECT_FLAG_PLAYER_TARGET)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and re:IsHasProperty(EFFECT_FLAG_PLAYER_TARGET)
end
function c35563539.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
......
--グランドクロス
function c38430673.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c38430673.condition)
e1:SetTarget(c38430673.target)
e1:SetOperation(c38430673.activate)
c:RegisterEffect(e1)
end
function c38430673.filter(c)
return c:IsFaceup() and c:IsCode(30241314)
end
function c38430673.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c38430673.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c38430673.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,300)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c38430673.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(1-tp,300,REASON_EFFECT)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.Destroy(g,REASON_EFFECT)
end
......@@ -10,5 +10,5 @@ end
function c38670435.dircon(e)
local tp=e:GetHandler():GetControler()
return Duel.GetFieldGroupCount(tp,0,LOCATION_SZONE)==0
and not Duel.IsExistingMatchingCard(Card.IsAttack,tp,0,LOCATION_MZONE,1,nil)
and not Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil)
end
......@@ -49,11 +49,11 @@ function c40044918.op(e,tp,eg,ep,ev,re,r,rp)
local sel=e:GetLabel()
if sel==1 then
local ct=Duel.GetMatchingGroupCount(c40044918.ctfilter,tp,LOCATION_MZONE,0,c)
if ct==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,c40044918.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
local g=Duel.GetMatchingGroup(c40044918.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if ct>0 and g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(40044918,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=g:Select(tp,1,ct,nil)
Duel.Destroy(dg,REASON_EFFECT)
end
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
......
......@@ -13,12 +13,12 @@ function c4081825.spfilter(c,e,tp)
return c:IsSetCard(0x13) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c4081825.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefence,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c4081825.spfilter,tp,0x11,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function c4081825.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()==0 then return end
Duel.ChangePosition(g,POS_FACEUP_ATTACK)
if Duel.GetLocationCount(tp,LOCATION_MZONE,0)==0 then return end
......
......@@ -5,6 +5,7 @@ function c40884383.initial_effect(c)
e1:SetDescription(aux.Stringid(40884383,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
e1:SetTarget(c40884383.eqtg)
e1:SetOperation(c40884383.eqop)
......
......@@ -20,7 +20,7 @@ function c43642620.initial_effect(c)
c:RegisterEffect(e2)
end
function c43642620.sdcon(e)
return not Duel.IsExistingMatchingCard(Card.IsRace,0,LOCATION_GRAVE,0,1,nil,RACE_ZOMBIE)
return not Duel.IsExistingMatchingCard(Card.IsRace,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil,RACE_ZOMBIE)
end
function c43642620.dmcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -53,7 +53,7 @@ function c43889633.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then
tc:RegisterFlagEffect(43889634,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
tc:RegisterFlagEffect(43889634,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(43889633,2))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
......@@ -65,7 +65,7 @@ function c43889633.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetCondition(c43889633.spcon)
e1:SetTarget(c43889633.sptg)
e1:SetOperation(c43889633.spop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END+RESET_SELF_TURN)
e:GetHandler():RegisterEffect(e1)
end
end
......@@ -78,9 +78,9 @@ function c43889633.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
e:GetHandler():RegisterFlagEffect(43889633,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
end
function c43889633.spcon(e,tp,eg,ep,ev,re,r,rp,chk)
function c43889633.spcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
return tc and tc:GetFlagEffect(43889634)~=0
return tc and tc:GetFlagEffect(43889634)~=0 and Duel.GetTurnPlayer()==tp
end
function c43889633.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -45,9 +45,9 @@ function c44035031.poscon(e,tp,eg,ep,ev,re,r,rp)
end
function c44035031.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c44035031.posop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -26,7 +26,7 @@ end
function c45593005.cona(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttackPos()
and Duel.GetMatchingGroupCount(c45593005.cfilter,tp,LOCATION_MZONE,0,e:GetHandler())==2
and not Duel.IsExistingMatchingCard(Card.IsDefence,tp,LOCATION_MZONE,0,1,e:GetHandler())
and not Duel.IsExistingMatchingCard(Card.IsDefencePos,tp,LOCATION_MZONE,0,1,e:GetHandler())
end
function c45593005.tga(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -41,13 +41,25 @@ function c47355498.initial_effect(c)
e7:SetTargetRange(0,LOCATION_GRAVE)
e7:SetCondition(c47355498.conntp)
c:RegisterEffect(e7)
--disable
local e8=Effect.CreateEffect(c)
e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e8:SetCode(EVENT_CHAIN_SOLVING)
e8:SetType(EFFECT_TYPE_FIELD)
e8:SetCode(EFFECT_NECRO_VALLEY)
e8:SetRange(LOCATION_SZONE)
e8:SetOperation(c47355498.disop)
e8:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e8:SetTargetRange(1,0)
e8:SetCondition(c47355498.contp)
c:RegisterEffect(e8)
local e9=e8:Clone()
e9:SetTargetRange(0,1)
e9:SetCondition(c47355498.conntp)
c:RegisterEffect(e9)
--disable
local e10=Effect.CreateEffect(c)
e10:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e10:SetCode(EVENT_CHAIN_SOLVING)
e10:SetRange(LOCATION_SZONE)
e10:SetOperation(c47355498.disop)
c:RegisterEffect(e10)
end
function c47355498.contp(e)
return not Duel.IsPlayerAffectedByEffect(e:GetHandler():GetControler(),EFFECT_NECRO_VALLEY_IM)
......
......@@ -15,7 +15,7 @@ end
function c4906301.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()~=tp and ph~=PHASE_MAIN2 and ph~=PHASE_END
and Duel.IsExistingMatchingCard(Card.IsAttackable,tp,0,LOCATION_MZONE,1,nil)
and Duel.IsExistingMatchingCard(Card.IsAttackPosable,tp,0,LOCATION_MZONE,1,nil)
end
function c4906301.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
......
--無敗将軍 フリード
function c49681811.initial_effect(c)
--disable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e1:SetTarget(c49681811.distg)
c:RegisterEffect(e1)
--disable effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_MZONE)
e2:SetOperation(c49681811.disop)
c:RegisterEffect(e2)
--self destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_SELF_DESTROY)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e3:SetTarget(c49681811.distg)
c:RegisterEffect(e3)
--search
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(49681811,0))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_PREDRAW)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c49681811.condition)
e4:SetTarget(c49681811.target)
e4:SetOperation(c49681811.operation)
c:RegisterEffect(e4)
end
function c49681811.distg(e,c)
if c:GetCardTargetCount()==0 then return false end
return c:GetCardTarget():IsContains(e:GetHandler())
end
function c49681811.disop(e,tp,eg,ep,ev,re,r,rp)
if not re:IsActiveType(TYPE_SPELL) then return end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not g or g:GetCount()==0 then return end
if g:IsContains(e:GetHandler()) then
Duel.NegateEffect(ev)
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(re:GetHandler(),REASON_EFFECT)
end
end
end
function c49681811.condition(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0
and Duel.GetDrawCount(tp)>0
end
function c49681811.filter(c)
return c:GetLevel()==4 and c:IsRace(RACE_WARRIOR) and c:IsAbleToHand()
end
function c49681811.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c49681811.filter,tp,LOCATION_DECK,0,1,nil) end
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
_replace_count=0
_replace_max=dt
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_DRAW_COUNT)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE+PHASE_DRAW)
e1:SetValue(0)
Duel.RegisterEffect(e1,tp)
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c49681811.operation(e,tp,eg,ep,ev,re,r,rp)
_replace_count=_replace_count+1
if _replace_count>_replace_max or not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c49681811.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()~=0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -4,7 +4,7 @@ function c51402177.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_GRAEV)
e1:SetRange(LOCATION_GRAVE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--special summon
......
......@@ -28,7 +28,7 @@ function c5183693.initial_effect(c)
e4:SetDescription(aux.Stringid(5183693,0))
e4:SetCategory(CATEGORY_TODECK)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:Setproperty(EFFECT_FLAG_DAMAGE_STEP)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetTarget(c5183693.tdtg)
e4:SetOperation(c5183693.tdop)
......
......@@ -3,6 +3,7 @@ function c52098461.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_DESTROY)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c52098461.target)
......
......@@ -26,7 +26,7 @@ function c5285665.initial_effect(c)
c:RegisterEffect(e3)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(74641045,0))
e4:SetDescription(aux.Stringid(5285665,0))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
......
......@@ -10,5 +10,5 @@ end
function c53890795.dircon(e)
local tp=e:GetHandler():GetControler()
return Duel.GetFieldGroupCount(tp,0,LOCATION_SZONE)==0
and not Duel.IsExistingMatchingCard(Card.IsAttack,tp,0,LOCATION_MZONE,1,nil)
and not Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil)
end
......@@ -57,6 +57,6 @@ function c56641453.activate(e,tp,eg,ep,ev,re,r,rp)
end
end
function c56641453.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT) then return 0
if bit.band(r,REASON_EFFECT)~=0 then return 0
else return val end
end
......@@ -16,7 +16,7 @@ end
function c56840658.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsPreviousLocation(LOCATION_ONFIELD) then return false end
if bit.band(r,REASON_BATTLE) then return bit.band(c:GetBattlePosition(),POS_FACEUP)~=0
if bit.band(r,REASON_BATTLE)~=0 then return bit.band(c:GetBattlePosition(),POS_FACEUP)~=0
else return bit.band(c:GetPreviousPosition(),POS_FACEUP)~=0 end
end
function c56840658.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -48,11 +48,11 @@ function c58332301.atkop(e,tp,eg,ep,ev,re,r,rp)
c:RegisterEffect(e1)
end
function c58332301.postg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,0,LOCATION_MZONE,nil)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c58332301.posop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,0,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,0,LOCATION_MZONE,nil)
Duel.ChangePosition(g,0,0,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,true)
end
......@@ -74,7 +74,7 @@ function c60953118.rdcon2(e)
return e:GetHandler():GetFlagEffectLabel(36690018)==0
end
function c60953118.rdval(e,re,val,r,rp,rc)
if bit.band(r,REASON_BATTLE) then
if bit.band(r,REASON_BATTLE)~=0 then
return val/2
else
return val
......
......@@ -32,7 +32,7 @@ function c61968753.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g2=Duel.SelectTarget(tp,c61968753.filter2,tp,0,LOCATION_MZONE,1,1,nil)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g1,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL,nil,1,tp,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c61968753.pfilter(c,e)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsRelateToEffect(e)
......
......@@ -12,9 +12,9 @@ function c63102017.initial_effect(c)
end
function c63102017.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chks:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c63102017.activate(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -18,11 +18,11 @@ function c63142001.filter(c)
end
function c63142001.atkval(e,c)
local g=Duel.GetMatchingGroup(c63142001.filter,c:GetControler(),LOCATION_MZONE,0,nil)
if g:IsExists(Card.IsDefence,1,nil) then return 0 end
if g:IsExists(Card.IsDefencePos,1,nil) then return 0 end
return g:GetCount()*1000
end
function c63142001.defval(e,c)
local g=Duel.GetMatchingGroup(c63142001.filter,c:GetControler(),LOCATION_MZONE,0,nil)
if g:IsExists(Card.IsAttack,1,nil) then return 0 end
if g:IsExists(Card.IsAttackPos,1,nil) then return 0 end
return g:GetCount()*1000
end
--終焉の精霊
function c64379430.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(c64379430.value)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_SET_DEFENCE)
e2:SetValue(c64379430.value)
c:RegisterEffect(e2)
--return
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(64379430,0))
e3:SetCategory(CATEGORY_TOGRAVE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c64379430.retcon)
e3:SetTarget(c64379430.rettg)
e3:SetOperation(c64379430.retop)
c:RegisterEffect(e3)
end
function c64379430.value(e,c)
return Duel.GetMatchingGroupCount(Card.IsAttribute,0,LOCATION_REMOVED,LOCATION_REMOVED,nil,ATTRIBUTE_DARK)*300
end
function c64379430.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_DESTROY)
end
function c64379430.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsAttribute,0,LOCATION_REMOVED,LOCATION_REMOVED,nil,ATTRIBUTE_DARK)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
end
function c64379430.retop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAttribute,0,LOCATION_REMOVED,LOCATION_REMOVED,nil,ATTRIBUTE_DARK)
Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN)
end
......@@ -30,6 +30,7 @@ function c65282484.initial_effect(c)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(65282484,1))
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetCondition(c65282484.descon)
......
--エンド·オブ·アヌビス
function c65403020.initial_effect(c)
--negate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCondition(c65403020.condition)
e1:SetOperation(c65403020.operation)
c:RegisterEffect(e1)
end
function c65403020.gfilter(c)
return c:IsLocation(LOCATION_GRAVE) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c65403020.condition(e,tp,eg,ep,ev,re,r,rp)
local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
if loc==LOCATION_GRAVE and not Duel.IsPlayerAffectedByEffect(rp,EFFECT_NECRO_VALLEY) then return true end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return g and g:IsExists(c65403020.gfilter,1,nil)
end
function c65403020.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateEffect(ev)
end
--限定解除
function c65450690.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c65450690.cost)
e1:SetTarget(c65450690.target)
e1:SetOperation(c65450690.activate)
c:RegisterEffect(e1)
end
function c65450690.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) and Duel.GetFlagEffect(tp,65450690)==0 end
Duel.PayLPCost(tp,1000)
Duel.RegisterFlagEffect(tp,65450690,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c65450690.filter(c,e,tp)
return bit.band(c:GetType(),0x81)==0x81 and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function c65450690.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c65450690.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_HAND)
end
function c65450690.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c65450690.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetOperation(c65450690.desop)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e2:SetCountLimit(1)
tc:RegisterEffect(e2,true)
end
end
function c65450690.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),nil,REASON_EFFECT)
end
......@@ -22,9 +22,9 @@ function c67779172.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c67779172.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0)
end
function c67779172.activate(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -33,7 +33,7 @@ function c68396778.activate(e,tp,eg,ep,ev,re,r,rp)
if tc:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c68396778.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount() then
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
......
......@@ -14,13 +14,13 @@ function c71417170.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_BATTLE
end
function c71417170.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,0,LOCATION_MZONE,nil)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c71417170.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,0,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,0,LOCATION_MZONE,nil)
Duel.ChangePosition(g,0,0,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
local tc=g:GetFirst()
while tc do
......
......@@ -23,7 +23,7 @@ function c73417207.target(e,syncard,f,minc,maxc)
end
function c73417207.operation(e,tp,eg,ep,ev,re,r,rp,syncard,f,minc,maxc)
local lv=syncard:GetLevel()-e:GetHandler():GetLevel()
local g=Duel.GetMatchingGroup(c73417207.synfilter,syncard:GetControler(),LOCATION_MZONE,LOCATION_MZONE,c,syncard,f)
local g=Duel.GetMatchingGroup(c73417207.synfilter,syncard:GetControler(),LOCATION_HAND,LOCATION_HAND,c,syncard,f)
local sg=g:SelectWithSumEqual(tp,Card.GetSynchroLevel,lv,2,2,syncard)
Duel.SetSynchroMaterial(sg)
end
......@@ -51,9 +51,9 @@ function c73580471.poscost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c73580471.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENCE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c73580471.posop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -19,6 +19,6 @@ function c74270067.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e1,tp)
end
function c74270067.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT) then return 0
if bit.band(r,REASON_EFFECT)~=0 then return 0
else return val end
end
......@@ -19,8 +19,7 @@ function c75081613.initial_effect(c)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(75081613,0))
e3:SetCategory(CATEGORY_DECKDES)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetRange(LOCATION_MZONE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_BATTLE_DAMAGE)
e3:SetCondition(c75081613.condition)
e3:SetTarget(c75081613.target)
......
......@@ -52,7 +52,7 @@ function c75923050.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsAbleToExtra()
and Duel.IsExistingMatchingCard(c75923050.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORU_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c75923050.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -13,8 +13,7 @@ function c76039636.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(76039636,0))
e2:SetCategory(CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_MZONE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetCondition(c76039636.condition)
e2:SetTarget(c76039636.target)
......
--サイバー·ジラフ
function c76986005.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(76986005,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c76986005.cost)
e1:SetOperation(c76986005.operation)
c:RegisterEffect(e1)
end
function c76986005.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleaseable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c76986005.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetValue(c76986005.damval)
e1:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e1,tp)
end
function c76986005.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT)~=0 then return 0
else return val end
end
......@@ -12,7 +12,7 @@ function c78613627.initial_effect(c)
c:RegisterEffect(e1)
end
function c78613627.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()==e:GetHandler() and e:Gethandler():IsDefencePos()
return Duel.GetAttackTarget()==e:GetHandler() and e:GetHandler():IsDefencePos()
and Duel.GetAttacker():GetAttack()<e:GetHandler():GetDefence()
end
function c78613627.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -77,7 +77,7 @@ function c8487449.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local sp=c:GetSummonPlayer()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,c8487449.filter,sp,0,LOCATION_MZONE,1,1,e:GetHandler())
if g:GetCount() then
if g:GetCount()>0 then
g:AddCard(e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,2,0,0)
end
......
......@@ -43,7 +43,7 @@ function c86197239.spop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<sg:GetCount() then return end
if sg:GetCount() then
if sg:GetCount()>0 then
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -23,11 +23,11 @@ function c87624166.initial_effect(c)
end
function c87624166.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c87624166.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDefence,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if g:GetCount()>0 then
Duel.ChangePosition(g,0,0,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,true)
end
......
......@@ -19,9 +19,9 @@ function c90576781.condition(e,tp,eg,ep,ev,re,r,rp)
end
function c90576781.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocaion(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefence,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENCE)
local g=Duel.SelectTarget(tp,Card.IsDefence,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsDefencePos,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c90576781.activate(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -24,7 +24,7 @@ function c9109991.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()~=tp and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAttackPos() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACK)
local g=Duel.SelectTarget(tp,Card.IsAttack,tp,0,LOCATION_MZONE,1,1,nil)
local g=Duel.SelectTarget(tp,Card.IsAttackPos,tp,0,LOCATION_MZONE,1,1,nil)
if g:GetCount()>0 then
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
......
--蘇りし魂
function c92924317.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c92924317.target)
e1:SetOperation(c92924317.operation)
c:RegisterEffect(e1)
--Destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetOperation(c92924317.desop)
c:RegisterEffect(e2)
--Destroy2
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c92924317.descon2)
e3:SetOperation(c92924317.desop2)
c:RegisterEffect(e3)
end
function c92924317.filter(c,e,tp)
return c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c92924317.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c92924317.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c92924317.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c92924317.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c92924317.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENCE)==0 then return end
c:SetCardTarget(tc)
end
end
function c92924317.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
if tc and tc:IsLocation(LOCATION_MZONE) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c92924317.descon2(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY)
end
function c92924317.desop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
......@@ -24,10 +24,10 @@ function c93717133.initial_effect(c)
end
function c93717133.spcon(e,c)
if c==nil then return true end
return Duel.CheckReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,nil,2000)
return Duel.CheckReleaseGroup(c:GetControler(),Card.IsAttackPosAbove,2,nil,2000)
end
function c93717133.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsAttackAbove,2,2,nil,2000)
local g=Duel.SelectReleaseGroup(c:GetControler(),Card.IsAttackPosAbove,2,2,nil,2000)
Duel.Release(g,REASON_COST)
end
function c93717133.rmcon(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -15,6 +15,7 @@ function c94243005.initial_effect(c)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetDescription(aux.Stringid(94243005,0))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1)
......
......@@ -46,7 +46,7 @@ function c95637655.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return c95637655[tp] and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0,nil)==2
and not Duel.IsExistingMatchingCard(Card.IsAttack,tp,LOCATION_MZONE,0,1,nil)
and not Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
end
function c95637655.spcost(e,c,tp)
......
......@@ -22,7 +22,7 @@ function c96700602.cfilter(c,lv)
return c:IsLevelBelow(lv) and c:IsType(TYPE_SYNCHRO) and c:IsStatus(STATUS_PROC_COMPLETE)
end
function c96700602.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttack,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil) end
local tc=eg:GetFirst()
if tc:IsLocation(LOCATION_MZONE) then
Duel.SetTargetCard(tc)
......@@ -31,7 +31,7 @@ function c96700602.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c96700602.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local g=Duel.GetMatchingGroup(Card.IsAttack,tp,0,LOCATION_MZONE,nil)
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
if Duel.ChangePosition(g,POS_FACEUP_DEFENCE,POS_FACEDOWN_DEFENCE,0,0)~=0 then
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Damage(1-tp,tc:GetDefence(),REASON_EFFECT)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment