Commit 6ed45241 authored by mercury233's avatar mercury233 Committed by GitHub

add EFFECT_FLAG_ACTIVATE_CONDITION (#571)

parent 675678a4
...@@ -201,7 +201,7 @@ enum effect_flag : uint32 { ...@@ -201,7 +201,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_CLIENT_HINT = 0x4000000, EFFECT_FLAG_CLIENT_HINT = 0x4000000,
EFFECT_FLAG_CONTINUOUS_TARGET = 0x8000000, EFFECT_FLAG_CONTINUOUS_TARGET = 0x8000000,
EFFECT_FLAG_LIMIT_ZONE = 0x10000000, EFFECT_FLAG_LIMIT_ZONE = 0x10000000,
// EFFECT_FLAG_COF = 0x20000000, EFFECT_FLAG_ACTIVATE_CONDITION = 0x20000000,
// EFFECT_FLAG_CVAL_CHECK = 0x40000000, // EFFECT_FLAG_CVAL_CHECK = 0x40000000,
EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000, EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000,
}; };
......
...@@ -1317,7 +1317,8 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1317,7 +1317,8 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit->set_triggering_state(phandler); clit->set_triggering_state(phandler);
} }
uint8 tp = clit->triggering_player; uint8 tp = clit->triggering_player;
if(check_trigger_effect(*clit) && peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)) { if(check_trigger_effect(*clit) && peffect->is_chainable(tp)
&& peffect->is_activateable(tp, clit->evt, !peffect->is_flag(EFFECT_FLAG_ACTIVATE_CONDITION))) {
if(tp == core.current_player) if(tp == core.current_player)
core.select_chains.push_back(*clit); core.select_chains.push_back(*clit);
} else { } else {
...@@ -1378,8 +1379,8 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1378,8 +1379,8 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit->set_triggering_state(phandler); clit->set_triggering_state(phandler);
} }
uint8 tp = clit->triggering_player; uint8 tp = clit->triggering_player;
if(check_nonpublic_trigger(*clit) && check_trigger_effect(*clit) if(check_nonpublic_trigger(*clit) && check_trigger_effect(*clit) && peffect->is_chainable(tp)
&& peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE) && peffect->is_activateable(tp, clit->evt, !peffect->is_flag(EFFECT_FLAG_ACTIVATE_CONDITION))
&& check_spself_from_hand_trigger(*clit)) { && check_spself_from_hand_trigger(*clit)) {
if(tp == core.current_player) if(tp == core.current_player)
core.select_chains.push_back(*clit); core.select_chains.push_back(*clit);
...@@ -1723,7 +1724,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -1723,7 +1724,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
const tevent& evt = eit->second; const tevent& evt = eit->second;
++eit; ++eit;
peffect->set_activate_location(); peffect->set_activate_location();
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE, FALSE, FALSE)) { if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE)) {
card* phandler = peffect->get_handler(); card* phandler = peffect->get_handler();
newchain.flag = 0; newchain.flag = 0;
newchain.chain_id = infos.field_id++; newchain.chain_id = infos.field_id++;
...@@ -1855,7 +1856,9 @@ int32 field::process_instant_event() { ...@@ -1855,7 +1856,9 @@ int32 field::process_instant_event() {
effect* peffect = eit->second; effect* peffect = eit->second;
++eit; ++eit;
card* phandler = peffect->get_handler(); card* phandler = peffect->get_handler();
if(!phandler->is_status(STATUS_EFFECT_ENABLED) || !peffect->is_condition_check(phandler->current.controler, ev)) if(!phandler->is_status(STATUS_EFFECT_ENABLED))
continue;
if(!peffect->is_flag(EFFECT_FLAG_ACTIVATE_CONDITION) && !peffect->is_condition_check(phandler->current.controler, ev))
continue; continue;
peffect->set_activate_location(); peffect->set_activate_location();
newchain.flag = 0; newchain.flag = 0;
...@@ -1875,7 +1878,8 @@ int32 field::process_instant_event() { ...@@ -1875,7 +1878,8 @@ int32 field::process_instant_event() {
effect* peffect = eit->second; effect* peffect = eit->second;
++eit; ++eit;
card* phandler = peffect->get_handler(); card* phandler = peffect->get_handler();
bool act = phandler->is_status(STATUS_EFFECT_ENABLED) && peffect->is_condition_check(phandler->current.controler, ev); bool act = phandler->is_status(STATUS_EFFECT_ENABLED)
&& (peffect->is_flag(EFFECT_FLAG_ACTIVATE_CONDITION) || peffect->is_condition_check(phandler->current.controler, ev));
if(!act && !(peffect->range & LOCATION_HAND)) if(!act && !(peffect->range & LOCATION_HAND))
continue; continue;
peffect->set_activate_location(); peffect->set_activate_location();
...@@ -2009,7 +2013,7 @@ int32 field::process_single_event(effect* peffect, const tevent& e, chain_list& ...@@ -2009,7 +2013,7 @@ int32 field::process_single_event(effect* peffect, const tevent& e, chain_list&
} }
} else { } else {
card* phandler = peffect->get_handler(); card* phandler = peffect->get_handler();
if(!peffect->is_condition_check(phandler->current.controler, e)) if(!peffect->is_flag(EFFECT_FLAG_ACTIVATE_CONDITION) && !peffect->is_condition_check(phandler->current.controler, e))
return FALSE; return FALSE;
peffect->set_activate_location(); peffect->set_activate_location();
chain newchain; chain newchain;
......
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