Commit f1542bbf authored by argon's avatar argon

fix

parent ea547712
...@@ -271,7 +271,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i ...@@ -271,7 +271,7 @@ int32 effect::is_activate_ready(uint8 playerid, tevent& e, int32 neglect_cond, i
return TRUE; return TRUE;
} }
int32 effect::is_condition_check(uint8 playerid, tevent& e) { int32 effect::is_condition_check(uint8 playerid, tevent& e) {
if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) && (!handler->is_position(POS_FACEUP))) if(!(type & EFFECT_TYPE_ACTIVATE) && (handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) && (!handler->is_position(POS_FACEUP)))
return FALSE; return FALSE;
if(!condition) if(!condition)
return TRUE; return TRUE;
......
...@@ -141,6 +141,7 @@ struct processor { ...@@ -141,6 +141,7 @@ struct processor {
typedef std::vector<chain> chain_array; typedef std::vector<chain> chain_array;
typedef std::list<processor_unit> processor_list; typedef std::list<processor_unit> processor_list;
typedef std::set<card*, card_sort> card_set; typedef std::set<card*, card_sort> card_set;
typedef std::set<effect*> effect_collection;
processor_list units; processor_list units;
processor_list subunits; processor_list subunits;
...@@ -177,6 +178,9 @@ struct processor { ...@@ -177,6 +178,9 @@ struct processor {
chain_list flip_chain_b; chain_list flip_chain_b;
chain_list new_ochain_h; chain_list new_ochain_h;
chain_list new_chains; chain_list new_chains;
effect_collection delayed_quick_tmp;
effect_collection delayed_quick_break;
effect_collection delayed_quick;
instant_f_list quick_f_chain; instant_f_list quick_f_chain;
card_set leave_confirmed; card_set leave_confirmed;
card_set special_summoning; card_set special_summoning;
...@@ -535,7 +539,8 @@ public: ...@@ -535,7 +539,8 @@ public:
#define GLOBALFLAG_DECK_REVERSE_CHECK 0x1 #define GLOBALFLAG_DECK_REVERSE_CHECK 0x1
#define GLOBALFLAG_BRAINWASHING_CHECK 0x2 #define GLOBALFLAG_BRAINWASHING_CHECK 0x2
#define GLOBALFLAG_SCRAP_CHIMERA 0x3 #define GLOBALFLAG_SCRAP_CHIMERA 0x4
#define GLOBALFLAG_DELAYED_QUICKEFFECT 0x8
// //
#define PROCESSOR_NONE 0 #define PROCESSOR_NONE 0
......
...@@ -1646,6 +1646,8 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) { ...@@ -1646,6 +1646,8 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
//flip //flip
core.tpchain.clear(); core.tpchain.clear();
core.ntpchain.clear(); core.ntpchain.clear();
core.delayed_quick.clear();
core.delayed_quick_break.swap(core.delayed_quick);
for (auto clit = core.flip_chain.begin(); clit != core.flip_chain.end(); ++clit) { for (auto clit = core.flip_chain.begin(); clit != core.flip_chain.end(); ++clit) {
if(clit->triggering_effect->is_chainable(clit->triggering_player) if(clit->triggering_effect->is_chainable(clit->triggering_player)
&& clit->triggering_effect->is_activateable(clit->triggering_player, clit->evt, TRUE)) { && clit->triggering_effect->is_activateable(clit->triggering_player, clit->evt, TRUE)) {
...@@ -1968,7 +1970,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -1968,7 +1970,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
} }
} }
for(auto clit = core.new_ochain_h.begin(); clit != core.new_ochain_h.end(); ++clit) { for(auto clit = core.new_ochain_h.begin(); clit != core.new_ochain_h.end(); ++clit) {
effect* peffect = clit->triggering_effect; peffect = clit->triggering_effect;
bool act = true; bool act = true;
if(clit->triggering_player == priority && !peffect->handler->is_status(STATUS_CHAINING) if(clit->triggering_player == priority && !peffect->handler->is_status(STATUS_CHAINING)
&& peffect->is_chainable(priority) && peffect->is_activateable(priority, clit->evt, TRUE)) { && peffect->is_chainable(priority) && peffect->is_activateable(priority, clit->evt, TRUE)) {
...@@ -1991,6 +1993,22 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -1991,6 +1993,22 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
if(act) if(act)
core.select_chains.push_back(*clit); core.select_chains.push_back(*clit);
} }
if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) {
for(auto eit = core.delayed_quick.begin(); eit != core.delayed_quick.end(); ++eit) {
peffect = *eit;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, nil_event, TRUE, FALSE, FALSE)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
newchain.evt = nil_event;
newchain.triggering_controler = peffect->handler->current.controler;
newchain.triggering_effect = peffect;
newchain.triggering_location = peffect->handler->current.location;
newchain.triggering_sequence = peffect->handler->current.sequence;
newchain.triggering_player = priority;
core.select_chains.push_back(newchain);
}
}
}
core.spe_effect[priority] = core.select_chains.size(); core.spe_effect[priority] = core.select_chains.size();
if(!special) { if(!special) {
nil_event.event_code = EVENT_FREE_CHAIN; nil_event.event_code = EVENT_FREE_CHAIN;
...@@ -2048,6 +2066,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -2048,6 +2066,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
if(core.select_chains.size() && returns.ivalue[0] != -1) { if(core.select_chains.size() && returns.ivalue[0] != -1) {
chain newchain = core.select_chains[returns.ivalue[0]]; chain newchain = core.select_chains[returns.ivalue[0]];
core.new_chains.push_back(newchain); core.new_chains.push_back(newchain);
core.delayed_quick.erase(newchain.triggering_effect);
newchain.triggering_effect->handler->set_status(STATUS_CHAINING, TRUE); newchain.triggering_effect->handler->set_status(STATUS_CHAINING, TRUE);
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0); add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, FALSE, 1 - priority); add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, FALSE, 1 - priority);
...@@ -2072,7 +2091,6 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) { ...@@ -2072,7 +2091,6 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
int32 field::process_instant_event() { int32 field::process_instant_event() {
if (core.queue_event.size() == 0) if (core.queue_event.size() == 0)
return TRUE; return TRUE;
event_list::iterator elit;
effect* peffect; effect* peffect;
chain newchain; chain newchain;
effect_vector tp; effect_vector tp;
...@@ -2081,10 +2099,9 @@ int32 field::process_instant_event() { ...@@ -2081,10 +2099,9 @@ int32 field::process_instant_event() {
event_list ntev; event_list ntev;
effect_vector::iterator eit; effect_vector::iterator eit;
event_list::iterator evit; event_list::iterator evit;
pair<effect_container::iterator, effect_container::iterator> pr; for(auto elit = core.queue_event.begin(); elit != core.queue_event.end(); ++elit) {
for(elit = core.queue_event.begin(); elit != core.queue_event.end(); ++elit) {
//continuous events //continuous events
pr = effects.continuous_effect.equal_range(elit->event_code); auto pr = effects.continuous_effect.equal_range(elit->event_code);
for(; pr.first != pr.second; ++pr.first) { for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second; peffect = pr.first->second;
uint8 owner_player = peffect->get_handler_player(); uint8 owner_player = peffect->get_handler_player();
...@@ -2172,6 +2189,21 @@ int32 field::process_instant_event() { ...@@ -2172,6 +2189,21 @@ int32 field::process_instant_event() {
core.quick_f_chain[peffect] = newchain; core.quick_f_chain[peffect] = newchain;
} }
} }
if(!(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT))
continue;
//delayed quick effect
pr = effects.activate_effect.equal_range(elit->event_code);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if((peffect->flag & EFFECT_FLAG_DELAY) && peffect->is_condition_check(peffect->handler->current.controler, *elit))
core.delayed_quick_tmp.insert(peffect);
}
pr = effects.quick_o_effect.equal_range(elit->event_code);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if((peffect->flag & EFFECT_FLAG_DELAY) && peffect->is_condition_check(peffect->handler->current.controler, *elit))
core.delayed_quick_tmp.insert(peffect);
}
} }
for(eit = tp.begin(), evit = tev.begin(); eit != tp.end(); ++eit, ++evit) { for(eit = tp.begin(), evit = tev.begin(); eit != tp.end(); ++eit, ++evit) {
core.sub_solving_event.push_back(*evit); core.sub_solving_event.push_back(*evit);
...@@ -4175,9 +4207,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4175,9 +4207,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
core.chain_solving = TRUE; core.chain_solving = TRUE;
if(cait->opinfos.count(0x200)) if(cait->opinfos.count(0x200))
core.spsummon_state[cait->triggering_player] = TRUE; core.spsummon_state[cait->triggering_player] = TRUE;
if((peffect->type & EFFECT_TYPE_ACTIVATE) && peffect->handler->is_has_relation(peffect)) { card* pcard = peffect->handler;
peffect->handler->set_status(STATUS_ACTIVATED, TRUE); if((peffect->type & EFFECT_TYPE_ACTIVATE) && pcard->is_has_relation(peffect)) {
peffect->handler->enable_field_effect(TRUE); pcard->set_status(STATUS_ACTIVATED, TRUE);
pcard->enable_field_effect(TRUE);
if((pcard->data.type & TYPE_FIELD) && player[1 - pcard->current.controler].list_szone[5] && player[1 - pcard->current.controler].list_szone[5]->is_position(POS_FACEUP))
player[1 - pcard->current.controler].list_szone[5]->enable_field_effect(FALSE);
adjust_instant(); adjust_instant();
} }
raise_event((card*)0, EVENT_CHAIN_SOLVING, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count); raise_event((card*)0, EVENT_CHAIN_SOLVING, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
...@@ -4323,6 +4358,10 @@ int32 field::break_effect() { ...@@ -4323,6 +4358,10 @@ int32 field::break_effect() {
core.new_ochain.erase(rm); core.new_ochain.erase(rm);
} }
} }
if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) {
core.delayed_quick_break.insert(core.delayed_quick_tmp.begin(), core.delayed_quick_tmp.end());
core.delayed_quick_tmp.clear();
}
core.used_event.splice(core.used_event.end(), core.instant_event); core.used_event.splice(core.used_event.end(), core.instant_event);
adjust_instant(); adjust_instant();
return 0; return 0;
......
--魔力誘爆 --魔力誘爆
function c22869904.initial_effect(c) function c22869904.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_DELAYED_QUICKEFFECT)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY) e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TO_GRAVE) e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c22869904.condition) e1:SetCondition(c22869904.condition)
e1:SetTarget(c22869904.target) e1:SetTarget(c22869904.target)
......
...@@ -11,7 +11,7 @@ function c38815069.initial_effect(c) ...@@ -11,7 +11,7 @@ function c38815069.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c38815069.filter(c) function c38815069.filter(c)
return c:IsSetCard(0x38) and c:IsAbleToDeck() return c:IsSetCard(0x38) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end end
function c38815069.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c38815069.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c38815069.filter(chkc) end if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c38815069.filter(chkc) end
......
--ドロール&ロックバード --ドロール&ロックバード
function c94145021.initial_effect(c) function c94145021.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_DELAYED_QUICKEFFECT)
--disable --disable
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(94145021,0)) e1:SetDescription(aux.Stringid(94145021,0))
......
...@@ -36,7 +36,7 @@ end ...@@ -36,7 +36,7 @@ end
function c97268402.operation(e,tp,eg,ep,ev,re,r,rp) function c97268402.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsDisabled() then
Duel.NegateRelatedChain(tc,RESET_TURN_SET) Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
......
...@@ -609,7 +609,8 @@ TIMING_EQUIP =0x2000000 ...@@ -609,7 +609,8 @@ TIMING_EQUIP =0x2000000
--Global flag --Global flag
GLOBALFLAG_DECK_REVERSE_CHECK =0x1 GLOBALFLAG_DECK_REVERSE_CHECK =0x1
GLOBALFLAG_BRAINWASHING_CHECK =0x2 GLOBALFLAG_BRAINWASHING_CHECK =0x2
GLOBALFLAG_SCRAP_CHIMERA =0x3 GLOBALFLAG_SCRAP_CHIMERA =0x4
GLOBALFLAG_DELAYED_QUICKEFFECT =0x8
-- --
DUEL_TEST_MODE =0x01 DUEL_TEST_MODE =0x01
DUEL_ATTACK_FIRST_TURN =0x02 DUEL_ATTACK_FIRST_TURN =0x02
......
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