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

new

parent 054ce617
......@@ -1367,8 +1367,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
}
if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL))) {
if(pcard->announced_cards.size()) {
card::attacker_map::iterator ait;
for(ait = pcard->announced_cards.begin(); ait != pcard->announced_cards.end(); ++ait) {
for(auto ait = pcard->announced_cards.begin(); ait != pcard->announced_cards.end(); ++ait) {
if(ait->first == 0)
continue;
pduel->lua->add_param(ait->second, PARAM_TYPE_CARD);
......
......@@ -178,6 +178,7 @@ struct processor {
instant_f_list quick_f_chain;
card_set leave_confirmed;
card_set special_summoning;
card_set equiping_cards;
card_set control_adjust_set[2];
card_set release_cards;
card_set release_cards_ex;
......@@ -403,7 +404,7 @@ public:
void remove_overlay_card(uint32 reason, card* pcard, uint32 rplayer, uint32 s, uint32 o, uint16 min, uint16 max);
void get_control(effect* reason_effect, uint32 reason_player, card* pcard, uint32 playerid, uint32 reset_phase, uint32 reset_count);
void swap_control(effect* reason_effect, uint32 reason_player, card* pcard1, card* pcard2, uint32 reset_phase, uint32 reset_count);
void equip(uint32 equip_player, card* equip_card, card* target, uint32 up);
void equip(uint32 equip_player, card* equip_card, card* target, uint32 up, uint32 is_step);
void draw(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 count);
void damage(effect* reason_effect, uint32 reason, uint32 reason_player, card* pcard, uint32 playerid, uint32 amount);
void recover(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 amount);
......@@ -427,7 +428,7 @@ public:
int32 get_control(uint16 step, effect* reason_effect, uint8 reason_player, card* pcard, uint8 playerid, uint8 reset_phase, uint8 reset_count);
int32 swap_control(uint16 step, effect* reason_effect, uint8 reason_player, card* pcard1, card* pcard2, uint8 reset_phase, uint8 reset_count);
int32 control_adjust(uint16 step);
int32 equip(uint16 step, uint8 equip_player, card* equip_card, card* target, uint32 up);
int32 equip(uint16 step, uint8 equip_player, card* equip_card, card* target, uint32 up, uint32 is_step);
int32 draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 playerid, uint32 count);
int32 damage(uint16 step, effect* reason_effect, uint32 reason, uint8 reason_player, card* pcard, uint8 playerid, uint32 amount);
int32 recover(uint16 step, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 playerid, uint32 amount);
......
......@@ -325,6 +325,7 @@ static const struct luaL_Reg duellib[] = {
{ "Damage", scriptlib::duel_damage },
{ "Recover", scriptlib::duel_recover },
{ "Equip", scriptlib::duel_equip },
{ "EquipComplete", scriptlib::duel_equip_complete },
{ "GetControl", scriptlib::duel_get_control },
{ "SwapControl", scriptlib::duel_swap_control },
{ "CheckLPCost", scriptlib::duel_check_lp_cost },
......
......@@ -809,11 +809,35 @@ int32 scriptlib::duel_equip(lua_State *L) {
uint32 up = TRUE;
if(lua_gettop(L) > 3)
up = lua_toboolean(L, 4);
uint32 step = FALSE;
if(lua_gettop(L) > 4)
step = lua_toboolean(L, 5);
duel* pduel = target->pduel;
pduel->game_field->equip(playerid, equip_card, target, up);
pduel->game_field->equip(playerid, equip_card, target, up, step);
pduel->game_field->core.subunits.begin()->type = PROCESSOR_EQUIP_S;
return lua_yield(L, 0);
}
int32 scriptlib::duel_equip_complete(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
field::card_set etargets;
for(auto cit = pduel->game_field->core.equiping_cards.begin(); cit != pduel->game_field->core.equiping_cards.end(); ++cit) {
card* equip_card = *cit;
if(equip_card->is_position(POS_FACEUP))
equip_card->enable_field_effect(TRUE);
etargets.insert(equip_card->equiping_target);
}
pduel->game_field->adjust_instant();
for(auto cit = etargets.begin(); cit != etargets.end(); ++cit)
pduel->game_field->raise_single_event(*cit, &pduel->game_field->core.equiping_cards, EVENT_EQUIP,
pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, PLAYER_NONE, 0);
pduel->game_field->raise_event(&pduel->game_field->core.equiping_cards, EVENT_EQUIP,
pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, PLAYER_NONE, 0);
pduel->game_field->core.hint_timing[0] |= TIMING_EQUIP;
pduel->game_field->core.hint_timing[1] |= TIMING_EQUIP;
pduel->game_field->process_single_event();
pduel->game_field->process_instant_event();
return lua_yield(L, 0);
}
int32 scriptlib::duel_get_control(lua_State *L) {
check_action_permission(L);
check_param_count(L, 2);
......
......@@ -111,8 +111,8 @@ void field::get_control(effect* reason_effect, uint32 reason_player, card* pcard
void field::swap_control(effect* reason_effect, uint32 reason_player, card* pcard1, card* pcard2, uint32 reset_phase, uint32 reset_count) {
add_process(PROCESSOR_SWAP_CONTROL, 0, reason_effect, (group*)pcard1, (ptr)pcard2, (reason_player << 24) + (reset_phase << 8) + reset_count);
}
void field::equip(uint32 equip_player, card* equip_card, card* target, uint32 up) {
add_process(PROCESSOR_EQUIP, 0, 0, (group*)target, (ptr)equip_card, equip_player + (up << 16));
void field::equip(uint32 equip_player, card* equip_card, card* target, uint32 up, uint32 is_step) {
add_process(PROCESSOR_EQUIP, 0, 0, (group*)target, (ptr)equip_card, equip_player + (up << 16) + (is_step << 24));
}
void field::draw(effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 count) {
add_process(PROCESSOR_DRAW, 0, reason_effect, 0, reason, (reason_player << 28) + (playerid << 24) + (count & 0xffffff));
......@@ -993,7 +993,7 @@ int32 field::control_adjust(uint16 step) {
}
return TRUE;
}
int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * target, uint32 up) {
int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * target, uint32 up, uint32 is_step) {
switch(step) {
case 0: {
returns.ivalue[0] = FALSE;
......@@ -1034,19 +1034,25 @@ int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * ta
peffect->reset_flag = RESET_EVENT + 0x1fe0000;
equip_card->add_effect(peffect);
}
if(equip_card->is_position(POS_FACEUP))
equip_card->enable_field_effect(TRUE);
equip_card->effect_target_cards.insert(target);
target->effect_target_owner.insert(equip_card);
adjust_instant();
card_set cset;
cset.insert(equip_card);
raise_single_event(target, &cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
raise_event(&cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
core.hint_timing[target->current.controler] |= TIMING_EQUIP;
process_single_event();
process_instant_event();
return FALSE;
if(!is_step) {
if(equip_card->is_position(POS_FACEUP))
equip_card->enable_field_effect(TRUE);
adjust_instant();
card_set cset;
cset.insert(equip_card);
raise_single_event(target, &cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
raise_event(&cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
core.hint_timing[target->current.controler] |= TIMING_EQUIP;
process_single_event();
process_instant_event();
return FALSE;
} else {
core.equiping_cards.insert(equip_card);
returns.ivalue[0] = TRUE;
return TRUE;
}
}
case 2: {
returns.ivalue[0] = TRUE;
......
......@@ -424,7 +424,7 @@ int32 field::process() {
return pduel->bufferlen;
}
case PROCESSOR_EQUIP: {
if (equip(it->step, it->arg2 & 0xffff, (card*)it->arg1, (card*)it->ptarget, (it->arg2 >> 16)))
if (equip(it->step, it->arg2 & 0xffff, (card*)it->arg1, (card*)it->ptarget, (it->arg2 >> 16) & 0xff, (it->arg2 >> 24) & 0xff))
core.units.pop_front();
else
core.units.begin()->step++;
......@@ -4087,7 +4087,9 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
effect* peffect = cait->triggering_effect;
peffect->operation = (ptr)core.units.begin()->peffect;
if(core.special_summoning.size())
special_summon_complete(peffect, cait->triggering_player);
core.special_summoning.clear();
if(core.equiping_cards.size())
core.equiping_cards.clear();
return FALSE;
}
case 4: {
......
......@@ -321,6 +321,7 @@ public:
static int32 duel_damage(lua_State *L);
static int32 duel_recover(lua_State *L);
static int32 duel_equip(lua_State *L);
static int32 duel_equip_complete(lua_State *L);
static int32 duel_get_control(lua_State *L);
static int32 duel_swap_control(lua_State *L);
static int32 duel_check_lp_cost(lua_State *L);
......
--トライアングルパワー
function c32298781.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c32298781.target)
e1:SetOperation(c32298781.activate)
c:RegisterEffect(e1)
end
function c32298781.filter(c)
local tpe=c:GetType()
return c:IsFaceup() and bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0 and c:GetLevel()==1
end
function c32298781.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c32298781.filter,tp,LOCATION_MZONE,0,1,nil,tp) end
end
function c32298781.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c32298781.filter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(tc:GetBaseAttack()+2000)
e1:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_BASE_DEFENCE)
e2:SetValue(tc:GetBaseDefence()+2000)
e2:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
local de=Effect.CreateEffect(e:GetHandler())
de:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
de:SetCode(EVENT_PHASE+PHASE_END)
de:SetCountLimit(1)
de:SetOperation(c32298781.desop)
de:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(de,tp)
end
function c32298781.dfilter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:GetLevel()==1
end
function c32298781.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c32298781.dfilter,tp,LOCATION_MZONE,0,nil)
Duel.Destroy(g,REASON_EFFECT)
end
--玉砕指令
function c39019325.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c39019325.target)
e1:SetOperation(c39019325.activate)
c:RegisterEffect(e1)
end
function c39019325.rfilter(c,e)
local tpe=c:GetType()
return bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0
and c:IsFaceup() and c:IsLevelBelow(2) and c:IsReleasable() and c:IsReleasableByEffect() and not c:IsImmuneToEffect(e)
end
function c39019325.dfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c39019325.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(c39019325.rfilter,tp,LOCATION_MZONE,0,1,nil,e)
and Duel.IsExistingMatchingCard(c39019325.dfilter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=Duel.SelectTarget(tp,c39019325.rfilter,tp,LOCATION_ONFIELD,0,1,1,nil,e)
local g=Duel.GetMatchingGroup(c39019325.dfilter,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c39019325.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,c39019325.dfilter,tp,0,LOCATION_ONFIELD,1,2,nil)
if dg:GetCount()>0 then
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
--デルタ·アタッカー
function c39719977.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c39719977.target)
e1:SetOperation(c39719977.activate)
c:RegisterEffect(e1)
end
function c39719977.filter(c,tp)
local tpe=c:GetType()
return c:IsFaceup() and bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0
and Duel.IsExistingMatchingCard(c39719977.filter2,tp,LOCATION_MZONE,0,2,c,c:GetCode())
end
function c39719977.filter2(c,code)
local tpe=c:GetType()
return c:IsFaceup() and bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0 and c:GetCode()==code
end
function c39719977.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c39719977.filter,tp,LOCATION_MZONE,0,3,nil,tp) end
end
function c39719977.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c39719977.filter,tp,LOCATION_MZONE,0,nil,tp)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
......@@ -10,14 +10,16 @@ function c423705.initial_effect(c)
e1:SetOperation(c423705.desop)
c:RegisterEffect(e1)
end
function c423705.filter(c,ec)
return c:GetEquipTarget()==ec
end
function c423705.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
eg:GetFirst():CreateEffectRelation(e)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
if chk==0 then return eg:IsExists(c423705.filter,1,nil,e:GetHandler()) end
local dg=eg:Filter(c423705.filter,nil,e:GetHandler())
Duel.SetTargetCard(dg)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,dg:GetCount(),0,0)
end
function c423705.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(tg,REASON_EFFECT)
end
--砂漠の裁き
function c4869446.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
c:RegisterEffect(e2)
end
--サウザンドエナジー
function c5703682.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c5703682.target)
e1:SetOperation(c5703682.activate)
c:RegisterEffect(e1)
end
function c5703682.filter(c)
local tpe=c:GetType()
return c:IsFaceup() and bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0 and c:GetLevel()==2
end
function c5703682.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c5703682.filter,tp,LOCATION_MZONE,0,1,nil,tp) end
end
function c5703682.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c5703682.filter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetValue(tc:GetBaseAttack()+1000)
e1:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_BASE_DEFENCE)
e2:SetValue(tc:GetBaseDefence()+1000)
e2:SetReset(RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
local de=Effect.CreateEffect(e:GetHandler())
de:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
de:SetCode(EVENT_PHASE+PHASE_END)
de:SetCountLimit(1)
de:SetOperation(c5703682.desop)
de:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(de,tp)
end
function c5703682.dfilter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:GetLevel()==2
end
function c5703682.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c5703682.dfilter,tp,LOCATION_MZONE,0,nil)
Duel.Destroy(g,REASON_EFFECT)
end
......@@ -33,7 +33,7 @@ function c57421866.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c57421866.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) or tc:GetLevel()<2 then return end
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:GetLevel()<2 then return end
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -66,8 +66,11 @@ end
function c66066482.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled()
end
function c66066482.eqfilter(c,ec)
return c:IsFaceup() and c:GetEquipTarget()==ec and c:IsSetCard(0x56)
end
function c66066482.cfcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():IsSetCard(0x56)
return eg:IsExists(c66066482.eqfilter,1,nil,e:GetHandler())
end
function c66066482.cftg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) end
......
--弱肉一色
function c66926224.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_HANDES)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c66926224.condition)
e1:SetTarget(c66926224.target)
e1:SetOperation(c66926224.activate)
c:RegisterEffect(e1)
end
function c66926224.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsLevelBelow(2)
end
function c66926224.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c66926224.cfilter,tp,LOCATION_MZONE,0,5,nil)
end
function c66926224.dfilter(c)
return not (c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsLevelBelow(2)) and c:IsDestructable()
end
function c66926224.target(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND,LOCATION_HAND,1,c)
or Duel.IsExistingMatchingCard(c66926224.dfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end
local g=Duel.GetMatchingGroup(c66926224.dfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c)
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,PLAYER_ALL,1)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c66926224.activate(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND)
Duel.SendtoGrave(g1,REASON_EFFECT+REASON_DISCARD)
local g2=Duel.GetMatchingGroup(c66926224.dfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.Destroy(g2,REASON_EFFECT)
end
--7
function c67048711.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c67048711.operation)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(67048711,0))
e2:SetCategory(CATEGORY_DRAW+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(67048711)
e2:SetTarget(c67048711.drtg)
e2:SetOperation(c67048711.drop)
c:RegisterEffect(e2)
--recover
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(67048711,1))
e3:SetCategory(CATEGORY_RECOVER)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c67048711.reccon)
e3:SetTarget(c67048711.rectg)
e3:SetOperation(c67048711.recop)
c:RegisterEffect(e3)
end
function c67048711.filter(c)
return c:IsFaceup() and c:IsCode(67048711)
end
function c67048711.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetMatchingGroupCount(c67048711.filter,tp,LOCATION_SZONE,0,nil)==3 then
Duel.RaiseSingleEvent(e:GetHandler(),67048711,e,0,0,0,0)
end
end
function c67048711.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c67048711.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c67048711.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetMatchingGroupCount(c67048711.filter,tp,LOCATION_SZONE,0,nil)==3 then
Duel.Draw(tp,3,REASON_EFFECT)
end
Duel.BreakEffect()
local g=Duel.GetMatchingGroup(c67048711.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
Duel.Destroy(g,REASON_EFFECT)
end
function c67048711.reccon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c67048711.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(700)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,700)
end
function c67048711.recop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
--運命のドラ
function c67464807.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_ATTACK,0x1e0)
e1:SetCondition(c67464807.condition)
e1:SetTarget(c67464807.target)
e1:SetOperation(c67464807.activate)
c:RegisterEffect(e1)
end
function c67464807.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c67464807.filter(c)
return c:IsFaceup() and c:GetLevel()>1
end
function c67464807.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c67464807.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c67464807.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c67464807.filte,tp,0,LOCATION_MZONE,1,1,nil)
end
function c67464807.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local lv=tc:GetLevel()
if lv>1 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(c67464807.damcon)
e1:SetOperation(c67464807.damop)
e1:SetLabel(lv)
e1:SetReset(RESET_PHASE+PHASE_END,2)
Duel.RegisterEffect(e1,tp)
end
end
end
function c67464807.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and ep==tp and eg:GetFirst():GetLevel()==e:GetLabel()-1
end
function c67464807.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(1-tp,e:GetLabel()*500,REASON_EFFECT)
end
--ギルフォード·ザ·レジェンド
function c69933858.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)
--equip
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(69933858,0))
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(c69933858.target)
e2:SetOperation(c69933858.operation)
c:RegisterEffect(e2)
end
function c69933858.efilter(c)
return c:IsFaceup() and c:IsRace(RACE_WARRIOR)
end
function c69933858.eqfilter(c,g)
return c:IsType(TYPE_EQUIP) and g:IsExists(c69933858.eqcheck,1,nil,c)
end
function c69933858.eqcheck(c,ec)
return ec:CheckEquipTarget(c)
end
function c69933858.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return false end
local g=Duel.GetMatchingGroup(c69933858.efilter,tp,LOCATION_MZONE,0,nil)
return Duel.IsExistingMatchingCard(c69933858.eqfilter,tp,LOCATION_GRAVE,0,1,nil,g)
end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0)
end
function c69933858.operation(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_SZONE)
if ft<=0 then return end
local g=Duel.GetMatchingGroup(c69933858.efilter,tp,LOCATION_MZONE,0,nil)
local eq=Duel.GetMatchingGroup(c69933858.eqfilter,tp,LOCATION_GRAVE,0,nil,g)
if ft>eq:GetCount() then ft=eq:GetCount() end
if ft==0 then return end
for i=1,ft do
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(69933858,1))
local ec=eq:Select(tp,1,1,nil):GetFirst()
eq:RemoveCard(ec)
local tc=g:FilterSelect(tp,c69933858.eqcheck,1,1,nil,ec):GetFirst()
Duel.Equip(tp,ec,tc,true,true)
end
Duel.EquipComplete()
end
......@@ -19,8 +19,7 @@ function c79814787.filter(c)
end
function c79814787.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(c79814787.filter,tp,LOCATION_DECK,0,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c79814787.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
......
--砂漠の光
function c93747864.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c93747864.target)
e1:SetOperation(c93747864.activate)
c:RegisterEffect(e1)
end
function c93747864.filter(c)
return not c:IsPosition(POS_FACEUP_DEFENCE)
end
function c93747864.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c93747864.filter,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.GetMatchingGroup(c93747864.filter,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,g:GetCount(),0,0)
end
function c93747864.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c93747864.filter,tp,LOCATION_MZONE,0,nil)
if g:GetCount()>0 then
Duel.ChangePosition(g,POS_FACEUP_DEFENCE)
end
end
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