Commit b9cf0c18 authored by argon.sun's avatar argon.sun

scripts

parent 596f4443
......@@ -1012,14 +1012,15 @@ void card::release_relation(effect* peffect) {
return;
relate_effect.erase(peffect);
}
int32 card::leave_field_redirect() {
int32 card::leave_field_redirect(uint32 reason) {
effect_set es;
uint8 redirect;
if(data.type & TYPE_TOKEN)
return 0;
filter_effect(EFFECT_LEAVE_FIELD_REDIRECT, &es);
for(int32 i = 0; i < es.count; ++i) {
redirect = es[i]->get_value(this);
pduel->lua->add_param(reason, PARAM_TYPE_INT);
redirect = es[i]->get_value(this, 1);
if(redirect & LOCATION_HAND && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return LOCATION_HAND;
else if(redirect & LOCATION_DECK && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
......@@ -1029,7 +1030,7 @@ int32 card::leave_field_redirect() {
}
return 0;
}
int32 card::destination_redirect(uint8 destination) {
int32 card::destination_redirect(uint8 destination, uint32 reason) {
effect_set es;
uint8 redirect;
if(data.type & TYPE_TOKEN)
......@@ -1046,7 +1047,8 @@ int32 card::destination_redirect(uint8 destination) {
filter_effect(EFFECT_REMOVE_REDIRECT, &es);
else return 0;
for(int32 i = 0; i < es.count; ++i) {
redirect = es[i]->get_value(this);
pduel->lua->add_param(reason, PARAM_TYPE_INT);
redirect = es[i]->get_value(this, 1);
if(redirect & LOCATION_HAND && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return LOCATION_HAND;
if(redirect & LOCATION_DECK && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
......@@ -1792,9 +1794,9 @@ int32 card::is_capable_cost_to_grave(uint8 playerid) {
if(!is_capable_send_to_grave(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect();
redirect = leave_field_redirect(REASON_COST);
if(redirect) dest = redirect;
redirect = destination_redirect(dest);
redirect = destination_redirect(dest, REASON_COST);
if(redirect) dest = redirect;
if(dest != LOCATION_GRAVE)
return FALSE;
......@@ -1812,9 +1814,9 @@ int32 card::is_capable_cost_to_hand(uint8 playerid) {
if(!is_capable_send_to_hand(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect();
redirect = leave_field_redirect(REASON_COST);
if(redirect) dest = redirect;
redirect = destination_redirect(dest);
redirect = destination_redirect(dest, REASON_COST);
if(redirect) dest = redirect;
if(dest != LOCATION_HAND)
return FALSE;
......@@ -1832,9 +1834,9 @@ int32 card::is_capable_cost_to_deck(uint8 playerid) {
if(!is_capable_send_to_deck(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect();
redirect = leave_field_redirect(REASON_COST);
if(redirect) dest = redirect;
redirect = destination_redirect(dest);
redirect = destination_redirect(dest, REASON_COST);
if(redirect) dest = redirect;
if(dest != LOCATION_DECK)
return FALSE;
......@@ -1852,9 +1854,9 @@ int32 card::is_capable_cost_to_extra(uint8 playerid) {
if(!is_capable_send_to_deck(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect();
redirect = leave_field_redirect(REASON_COST);
if(redirect) dest = redirect;
redirect = destination_redirect(dest);
redirect = destination_redirect(dest, REASON_COST);
if(redirect) dest = redirect;
if(dest != LOCATION_DECK)
return FALSE;
......
......@@ -166,8 +166,8 @@ public:
int32 is_has_relation(effect* peffect);
void release_relation(card* target);
void release_relation(effect* peffect);
int32 leave_field_redirect();
int32 destination_redirect(uint8 destination);
int32 leave_field_redirect(uint32 reason);
int32 destination_redirect(uint8 destination, uint32 reason);
int32 add_counter(uint16 countertype, uint16 count);
int32 remove_counter(uint16 countertype, uint16 count);
int32 is_can_add_counter(uint16 countertype, uint16 count);
......
......@@ -111,7 +111,7 @@ int32 effect::is_activateable(uint8 playerid, tevent& e, int32 neglect_cond, int
return FALSE;
if((flag & EFFECT_FLAG_COUNT_LIMIT) && (reset_count & 0xf00) == 0)
return FALSE;
if (!(flag & EFFECT_FLAG_FIELD_ONLY) && !neglect_cond) {
if (!(flag & EFFECT_FLAG_FIELD_ONLY)) {
if (type & EFFECT_TYPE_ACTIVATE) {
if(handler->current.controler != playerid)
return FALSE;
......@@ -147,7 +147,7 @@ int32 effect::is_activateable(uint8 playerid, tevent& e, int32 neglect_cond, int
if(handler->is_affected_by_effect(EFFECT_CANNOT_TRIGGER))
return FALSE;
} else if(!(type & EFFECT_TYPE_CONTINUOUS)) {
if((handler->current.location & LOCATION_ONFIELD)
if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED))
&& (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED)))
return FALSE;
if(!(type & (EFFECT_TYPE_FLIP | EFFECT_TYPE_TRIGGER_F))) {
......@@ -258,7 +258,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i
return TRUE;
}
int32 effect::is_condition_check(uint8 playerid, tevent& e) {
if((handler->current.location & LOCATION_ONFIELD) && (type & EFFECT_TYPE_FIELD)
if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED))
&& (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED)))
return FALSE;
if(!condition)
......
......@@ -288,7 +288,7 @@ int32 scriptlib::card_get_leave_field_dest(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->leave_field_redirect());
lua_pushinteger(L, pcard->leave_field_redirect(REASON_EFFECT));
return 1;
}
int32 scriptlib::card_get_turnid(lua_State *L) {
......
......@@ -2232,14 +2232,14 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
dest = (pcard->operation_param >> 8) & 0xff;
redirect = 0;
if((pcard->current.location & LOCATION_ONFIELD) && !pcard->is_status(STATUS_SUMMON_DISABLED))
redirect = pcard->leave_field_redirect();
redirect = pcard->leave_field_redirect(pcard->current.reason);
if(redirect) {
pcard->current.reason &= ~REASON_TEMPORARY;
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) + (redirect << 8) + (redirect >> 16);
dest = redirect;
}
redirect = pcard->destination_redirect(dest);
redirect = pcard->destination_redirect(dest, pcard->current.reason);
if(redirect && pcard->current.location != redirect) {
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) + (redirect << 8) + (redirect >> 16);
......@@ -2471,7 +2471,7 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso
(*cit)->current.reason_effect = core.reason_effect;
(*cit)->current.reason_player = core.reason_player;
(*cit)->current.reason = reason;
redirect = (*cit)->destination_redirect(dest);
redirect = (*cit)->destination_redirect(dest, reason);
if(redirect) {
(*cit)->operation_param = redirect;
dest = redirect;
......
--デステニー·ミラージュ
function c15294090.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c15294090.condition)
e1:SetTarget(c15294090.target)
e1:SetOperation(c15294090.operation)
c:RegisterEffect(e1)
end
function c15294090.cfilter(c,tp)
return c:IsSetCard(0xc008) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousControler()==tp
end
function c15294090.condition(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_EFFECT)~=0 and rp~=tp and eg:IsExists(c15294090.cfilter,1,nil,tp)
end
function c15294090.spfilter(c,e,tp)
return c:IsReason(REASON_DESTROY) and c:GetTurnID()==Duel.GetTurnCount() and c:IsSetCard(0xc008)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c15294090.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and Duel.IsExistingMatchingCard(c15294090.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,PLAYER_ALL,LOCATION_GRAVE)
end
function c15294090.operation(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c15294090.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,ft,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -78,6 +78,7 @@ function c21350571.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c21350571.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
--旋風剣
function c22147147.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c22147147.target)
e1:SetOperation(c22147147.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c22147147.eqlimit)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(22147147,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCategory(CATEGORY_DESTROY)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_DAMAGE_STEP_END)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c22147147.descon)
e3:SetTarget(c22147147.destg)
e3:SetOperation(c22147147.desop)
c:RegisterEffect(e3)
end
function c22147147.eqlimit(e,c)
return c:IsSetCard(0xc008)
end
function c22147147.filter(c)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c22147147.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c22147147.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c22147147.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c22147147.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c22147147.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c22147147.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker()==e:GetHandler():GetEquipTarget()
end
function c22147147.desfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c22147147.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c22147147.desfilter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c22147147.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c22147147.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--D-HERO ダブルガイ
function c28355718.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--multiattack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EXTRA_ATTACK)
e2:SetValue(1)
c:RegisterEffect(e2)
--token
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetOperation(c28355718.regop)
c:RegisterEffect(e3)
end
function c28355718.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsReason(REASON_DESTROY) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(28355718,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCondition(c28355718.spcon)
e1:SetTarget(c28355718.sptg)
e1:SetOperation(c28355718.spop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,1)
c:RegisterEffect(e1)
end
end
function c28355718.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c28355718.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsPlayerCanSpecialSummonMonster(tp,28355719,0,0x4011,1000,1000,4,RACE_WARRIOR,ATTRIBUTE_DARK) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,0,0)
end
function c28355718.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,28355719,0,0x4011,1000,1000,4,RACE_WARRIOR,ATTRIBUTE_DARK) then return end
for i=1,2 do
local token=Duel.CreateToken(tp,28355719)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
end
Duel.SpecialSummonComplete()
end
--デステニー·シグナル
function c35464895.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c35464895.condition)
e1:SetTarget(c35464895.target)
e1:SetOperation(c35464895.operation)
c:RegisterEffect(e1)
end
function c35464895.cfilter(c,tp)
return c:IsReason(REASON_BATTLE) and c:IsLocation(LOCATION_GRAVE) and c:GetPreviousControler()==tp
end
function c35464895.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c35464895.cfilter,1,nil,tp)
end
function c35464895.spfilter(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0xc008) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c35464895.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and Duel.IsExistingMatchingCard(c35464895.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c35464895.operation(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,c35464895.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,1,tp,tp,false,false,POS_FACEUP)
end
end
--D-HERO ドレッドサーヴァント
function c36625827.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(36625827,0))
e1:SetCategory(CATEGORY_COUNTER)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c36625827.addc)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(36625827,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetCondition(c36625827.descon)
e2:SetTarget(c36625827.destg)
e2:SetOperation(c36625827.desop)
c:RegisterEffect(e2)
end
function c36625827.addc(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFieldCard(tp,LOCATION_SZONE,5)
if tc and tc:IsFaceup() and tc:IsCode(75041269) then
tc:AddCounter(0x1b,1)
end
tc=Duel.GetFieldCard(1-tp,LOCATION_SZONE,5)
if tc and tc:IsFaceup() and tc:IsCode(75041269) then
tc:AddCounter(0x1b,1)
end
end
function c36625827.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
end
function c36625827.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c36625827.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and c36625827.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c36625827.filter,tp,LOCATION_ONFIELD,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c36625827.filter,tp,LOCATION_ONFIELD,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c36625827.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--D-HERO ディパーテッドガイ
function c39829561.initial_effect(c)
--Special Summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(39829561,0))
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_REPEAT)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1)
e1:SetCondition(c39829561.condition)
e1:SetTarget(c39829561.target)
e1:SetOperation(c39829561.operation)
c:RegisterEffect(e1)
--redirect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e2:SetCondition(c39829561.recon)
e2:SetValue(c39829561.reval)
c:RegisterEffect(e2)
end
function c39829561.filter(c)
return c:IsFaceup() and c:IsCode(83986578)
end
function c39829561.condition(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(c39829561.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end
function c39829561.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c39829561.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,1-tp,false,false,POS_FACEUP_ATTACK)
end
end
function c39829561.recon(e)
return e:GetHandler():IsLocation(LOCATION_DECK+LOCATION_HAND+LOCATION_ONFIELD)
end
function c39829561.reval(e,c,r)
if e:GetHandler():IsOnField() then
if bit.band(r,REASON_BATTLE)~=0 then return LOCATION_REMOVED
else return LOCATION_GRAVE end
else
if bit.band(r,REASON_EFFECT)~=0 then return LOCATION_REMOVED
else return LOCATION_GRAVE end
end
end
--D-HERO ドレッドガイ
function c40591390.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(40591390,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c40591390.spcon)
e1:SetTarget(c40591390.sptg)
e1:SetOperation(c40591390.spop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetOperation(c40591390.indop)
c:RegisterEffect(e2)
--atk
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_SET_ATTACK)
e3:SetValue(c40591390.val)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_SET_DEFENCE)
c:RegisterEffect(e4)
end
function c40591390.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1
end
function c40591390.desfilter(c)
return c:IsFacedown() or not c:IsSetCard(0xc008)
end
function c40591390.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c40591390.desfilter,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c40591390.spfilter(c,e,tp)
return c:IsSetCard(0xc008) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c40591390.spop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c40591390.desfilter,tp,LOCATION_MZONE,0,nil)
Duel.Destroy(g,REASON_EFFECT)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft==0 then return end
if ft>2 then ft=2 end
g=Duel.GetMatchingGroup(c40591390.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp)
if g:GetCount()~=0 and Duel.SelectYesNo(tp,aux.Stringid(40591390,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,ft,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
function c40591390.filter(e,c)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c40591390.indop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c40591390.filter)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
c:RegisterEffect(e3)
end
function c40591390.vfilter(c)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c40591390.val(e,c)
local g=Duel.GetMatchingGroup(c40591390.vfilter,c:GetControler(),LOCATION_MZONE,0,c)
return g:GetSum(Card.GetBaseAttack)
end
--D-チェーン
function c43405287.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(c43405287.condition)
e1:SetTarget(c43405287.target)
e1:SetOperation(c43405287.operation)
c:RegisterEffect(e1)
end
function c43405287.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c43405287.filter(c)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c43405287.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c43405287.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c43405287.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c43405287.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c43405287.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
c:CancelToGrave()
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(43405287,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetRange(LOCATION_SZONE)
e1:SetCondition(c43405287.damcon)
e1:SetTarget(c43405287.damtg)
e1:SetOperation(c43405287.damop)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
--Atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(c43405287.eqlimit)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3)
end
end
function c43405287.eqlimit(e,c)
return c:GetControler()==e:GetOwnerPlayer() and c:IsSetCard(0xc008)
end
function c43405287.damfilter(c,rc)
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:GetReasonCard()==rc
end
function c43405287.damcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c43405287.damfilter,1,nil,e:GetHandler():GetEquipTarget())
end
function c43405287.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end
function c43405287.damop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
--ダーク·シティ
function c53527835.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DAMAGE_CALCULATE)
e2:SetRange(LOCATION_SZONE)
e2:SetOperation(c53527835.atkup)
c:RegisterEffect(e2)
end
function c53527835.atkup(e,tp,eg,ep,ev,re,r,rp,chk)
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
if not a:IsSetCard(0xc008) or not d or a:GetAttack()>=d:GetAttack() then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_PHASE+RESET_DAMAGE_CAL)
e1:SetValue(1000)
a:RegisterEffect(e1)
end
--D-HERO ダガーガイ
function c55461064.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(55461064,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_DAMAGE_STEP)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(c55461064.atkcon)
e1:SetCost(c55461064.atkcost)
e1:SetTarget(c55461064.atktg)
e1:SetOperation(c55461064.atkop)
c:RegisterEffect(e1)
end
function c55461064.atkcon(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()~=tp and (phase==PHASE_BATTLE or (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()))
end
function c55461064.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c55461064.filter(c)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c55461064.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c55461064.filter,tp,LOCATION_MZONE,0,1,nil) end
end
function c55461064.atkop(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(c55461064.filter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetOwnerPlayer(tp)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(800)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
\ No newline at end of file
--D-シールド
function c62868900.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(c62868900.condition)
e1:SetTarget(c62868900.target)
e1:SetOperation(c62868900.operation)
c:RegisterEffect(e1)
end
function c62868900.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
return tc:IsControler(tp) and tc:IsPosition(POS_FACEUP_ATTACK) and tc:IsSetCard(0xc008)
end
function c62868900.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc==eg:GetFirst() end
if chk==0 then return eg:GetFirst():IsCanBeEffectTarget(e) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c62868900.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE)
Duel.Equip(tp,c,tc)
c:CancelToGrave()
--Atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c62868900.eqlimit)
e2:SetLabelObject(tc)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
end
end
function c62868900.eqlimit(e,c)
return c==e:GetLabelObject()
end
--D-フォーメーション
function c74329404.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c74329404.ctcon)
e2:SetOperation(c74329404.ctop)
c:RegisterEffect(e2)
--search
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(74329404,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_SUMMON_SUCCESS)
e3:SetCondition(c74329404.thcon)
e3:SetCost(c74329404.thcost)
e3:SetTarget(c74329404.thtg)
e3:SetOperation(c74329404.thop)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e4)
end
function c74329404.ctfilter(c,tp)
return c:IsReason(REASON_DESTROY) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousControler()==tp
end
function c74329404.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c74329404.ctfilter,1,nil,tp)
end
function c74329404.ctop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x1c,1)
end
function c74329404.thcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) --and e:GetHandler():GetCounter(0x1c)>=2
end
function c74329404.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c74329404.filter1(c,e,tp)
return c:IsFaceup() and (not e or c:IsRelateToEffect(e))
and Duel.IsExistingMatchingCard(c74329404.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,c:GetCode())
end
function c74329404.filter2(c,code)
return c:IsCode(code) and c:IsAbleToHand() and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c74329404.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c74329404.filter1,1,nil,nil,tp) end
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c74329404.thop(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c74329404.filter1,nil,e,tp)
if g:GetCount()==0 then return end
if g:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
g=g:Select(tp,1,1,nil)
end
local tc=g:GetFirst()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local ag=Duel.SelectMatchingCard(tp,c74329404.filter2,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,2,nil,tc:GetCode())
Duel.SendtoHand(ag,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,ag)
end
--幽獄の時計塔
function c75041269.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(75041269,0))
e2:SetCategory(CATEGORY_COUNTER)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetCondition(c75041269.ctcon)
e2:SetOperation(c75041269.ctop)
c:RegisterEffect(e2)
--avoid battle damage
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(1,0)
e3:SetCondition(c75041269.dcon)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(75041269,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetCondition(c75041269.spcon)
e4:SetTarget(c75041269.sptg)
e4:SetOperation(c75041269.spop)
c:RegisterEffect(e4)
end
function c75041269.dcon(e)
return e:GetHandler():GetCounter(0x1b)>=4
end
function c75041269.ctcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c75041269.ctop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x1b,1)
end
function c75041269.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsLocation(LOCATION_GRAVE) and c:GetCounter(0x1b)>=4
end
function c75041269.spfilter(c,e,tp)
return c:IsCode(40591390) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c75041269.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c75041269.spop(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,c75041269.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,1,tp,tp,false,false,POS_FACEUP)
end
end
--D-HERO ダイハードガイ
function c77608643.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetOperation(c77608643.operation)
c:RegisterEffect(e1)
local g=Group.CreateGroup()
g:KeepAlive()
e1:SetLabelObject(g)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(77608643,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetCondition(c77608643.spcon)
e2:SetTarget(c77608643.sptg)
e2:SetOperation(c77608643.spop)
e2:SetLabelObject(g)
c:RegisterEffect(e2)
end
function c77608643.filter(c,e,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE)
and c:GetPreviousControler()==tp and c:IsSetCard(0xc008)
end
function c77608643.operation(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c77608643.filter,nil,e,tp)
if g:GetCount()==0 then return end
local sg=e:GetLabelObject()
local c=e:GetHandler()
if c:GetFlagEffect(77608643)==0 then
sg:Clear()
c:RegisterFlagEffect(77608643,RESET_EVENT+0x3fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,1)
end
sg:Merge(g)
end
function c77608643.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and e:GetHandler():GetFlagEffect(77608643)~=0
end
function c77608643.spfilter(c,e,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c77608643.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and e:GetLabelObject():IsExists(c77608643.spfilter,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function c77608643.spop(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=e:GetLabelObject():FilterSelect(tp,c77608643.spfilter,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--D-HERO ドゥームガイ
function c80714121.initial_effect(c)
--reg
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetOperation(c80714121.regop)
c:RegisterEffect(e1)
end
function c80714121.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsReason(REASON_BATTLE) and c:IsLocation(LOCATION_GRAVE) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(80714121,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_GRAVE)
e1:SetCountLimit(1)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCondition(c80714121.spcon)
e1:SetTarget(c80714121.sptg)
e1:SetOperation(c80714121.spop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,1)
c:RegisterEffect(e1)
end
end
function c80714121.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c80714121.spfilter(c,e,tp)
return c:IsSetCard(0xc008) and c:GetCode()~=80714121 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c80714121.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c80714121.spfilter(chkc,e,tp) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c80714121.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,g:GetCount(),0,0)
end
function c80714121.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--D-HERO ダッシュガイ
function c81866673.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(81866673,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c81866673.atkcost)
e1:SetOperation(c81866673.atkop)
c:RegisterEffect(e1)
--pos
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_BATTLE)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c81866673.poscon)
e2:SetOperation(c81866673.posop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(80714121,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_NO_TURN_RESET)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1)
e3:SetCode(EVENT_DRAW)
e3:SetCondition(c81866673.spcon)
e3:SetTarget(c81866673.sptg)
e3:SetOperation(c81866673.spop)
c:RegisterEffect(e3)
end
function c81866673.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,nil,1,e:GetHandler()) end
local g=Duel.SelectReleaseGroup(tp,nil,1,1,e:GetHandler())
Duel.Release(g,REASON_COST)
end
function c81866673.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
function c81866673.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetAttackedCount()>0
end
function c81866673.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsAttack() then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c81866673.spcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and Duel.GetCurrentPhase()==PHASE_DRAW
end
function c81866673.spfilter(c,e,tp)
return c:IsLocation(LOCATION_HAND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c81866673.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and eg:IsExists(c81866673.spfilter,1,nil,e,tp) end
if eg:GetCount()==1 then
Duel.ConfirmCards(1-tp,eg)
Duel.ShuffleHand(tp)
Duel.SetTargetCard(eg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,eg,1,0,0)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=eg:FilterSelect(tp,c81866673.spfilter,1,1,nil,e,tp)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
end
function c81866673.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--D-カウンター
function c8698851.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetCondition(c8698851.condition)
e1:SetTarget(c8698851.target)
e1:SetOperation(c8698851.operation)
c:RegisterEffect(e1)
end
function c8698851.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
return tc:IsControler(tp) and tc:IsPosition(POS_FACEUP) and tc:IsSetCard(0xc008)
end
function c8698851.target(e,tp,eg,ep,ev,re,r,rp,chk)
local a=Duel.GetAttacker()
if chk==0 then return a:IsOnField() and a:IsDestructable() end
Duel.SetTargetCard(a)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,a,1,0,0)
end
function c8698851.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsAttackable() and not tc:IsStatus(STATUS_ATTACK_CANCELED) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--D-スピリッツ
function c89899996.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c89899996.condition)
e1:SetTarget(c89899996.target)
e1:SetOperation(c89899996.operation)
c:RegisterEffect(e1)
end
function c89899996.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0xc008)
end
function c89899996.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c89899996.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c89899996.spfilter(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0xc008) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c89899996.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and Duel.IsExistingMatchingCard(c89899996.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c89899996.operation(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,c89899996.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,1,tp,tp,false,false,POS_FACEUP)
end
end
--D-フォーチュン
function c9201964.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c9201964.condition)
e1:SetCost(c9201964.cost)
e1:SetOperation(c9201964.activate)
c:RegisterEffect(e1)
end
function c9201964.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer() and Duel.GetAttackTarget()==nil
end
function c9201964.cfilter(c)
return c:IsSetCard(0xc008) and c:IsAbleToRemoveAsCost()
end
function c9201964.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c9201964.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c9201964.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c9201964.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE+PHASE_BATTLE,1)
end
--D-HERO ダンクガイ
function c93431862.initial_effect(c)
--damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(93431862,0))
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c93431862.damcost)
e1:SetTarget(c93431862.damtg)
e1:SetOperation(c93431862.damop)
c:RegisterEffect(e1)
end
function c93431862.cfilter(c)
return c:IsSetCard(0xc008) and c:IsAbleToGraveAsCost()
end
function c93431862.damcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c93431862.cfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c93431862.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c93431862.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end
function c93431862.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
--D-タイム
function c99075257.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetCode(EVENT_LEAVE_FIELD)
e1:SetCondition(c99075257.condition)
e1:SetTarget(c99075257.target)
e1:SetOperation(c99075257.operation)
c:RegisterEffect(e1)
end
function c99075257.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local lv=tc:GetLevel()
return eg:GetCount()==1 and tc:IsSetCard(0x3008) and tc:IsPreviousPosition(POS_FACEUP) and tc:GetPreviousControler()==tp
end
function c99075257.filter(c,lv)
return c:IsLevelBelow(lv) and c:IsSetCard(0xc008) and c:IsAbleToHand()
end
function c99075257.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c99075257.filter,tp,LOCATION_DECK,0,1,nil,eg:GetFirst():GetLevel()) end
e:SetLabel(eg:GetFirst():GetLevel())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c99075257.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c99075257.filter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel())
if g:GetCount()~=0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -387,4 +387,5 @@
!counter 0x18 花指示物
!counter 0x19 雾指示物
!counter 0x1a 倍倍指示物
!counter 0x1b 时计指示物
!counter 0x1c D指示物
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