Commit 142fa918 authored by DailyShana's avatar DailyShana

add old trigger effect rule in rule<=4

parent c11cf2cb
......@@ -3356,6 +3356,25 @@ int32 field::check_hand_trigger(chain& ch) {
}
return TRUE;
}
int32 field::check_trigger_effect(const chain& ch) const {
effect* peffect = ch.triggering_effect;
card* phandler = peffect->get_handler();
if(core.duel_rule >= 5)
return phandler->is_has_relation(ch);
else {
if(peffect->type & EFFECT_TYPE_FIELD)
return phandler->is_has_relation(ch);
else {
if((ch.triggering_location & (LOCATION_DECK | LOCATION_HAND | LOCATION_EXTRA))
&& (ch.triggering_position & POS_FACEDOWN))
return TRUE;
if(!(phandler->current.location & (LOCATION_DECK | LOCATION_HAND | LOCATION_EXTRA))
|| phandler->is_position(POS_FACEUP))
return TRUE;
return FALSE;
}
}
}
int32 field::check_spself_from_hand_trigger(const chain& ch) const {
effect* peffect = ch.triggering_effect;
uint8 tp = ch.triggering_player;
......
......@@ -482,6 +482,7 @@ public:
int32 get_cteffect_evt(effect* feffect, int32 playerid, const tevent& e, int32 store);
int32 check_cteffect_hint(effect* peffect, uint8 playerid);
int32 check_hand_trigger(chain& ch);
int32 check_trigger_effect(const chain& ch) const;
int32 check_spself_from_hand_trigger(const chain& ch) const;
int32 is_able_to_enter_bp();
......
......@@ -1310,7 +1310,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
if(phandler->is_has_relation(*clit)) //work around: position and control should be refreshed before raising event
clit->set_triggering_state(phandler);
uint8 tp = clit->triggering_player;
if(phandler->is_has_relation(*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, TRUE)) {
if(tp == core.current_player)
core.select_chains.push_back(*clit);
} else {
......@@ -1367,7 +1367,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
clit->set_triggering_state(phandler);
}
uint8 tp = clit->triggering_player;
if(check_hand_trigger(*clit) && phandler->is_has_relation(*clit)
if(check_hand_trigger(*clit) && check_trigger_effect(*clit)
&& peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& check_spself_from_hand_trigger(*clit)) {
if(tp == core.current_player)
......
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