Commit e95d9ca2 authored by Argon.Sun's avatar Argon.Sun

chain counter

parent 339c1aa3
...@@ -1440,22 +1440,25 @@ void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid) ...@@ -1440,22 +1440,25 @@ void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid)
} }
} }
} }
void field::check_chain_counter(effect* peffect, int32 playerid, int32 chainid) { void field::check_chain_counter(effect* peffect, int32 playerid, int32 chainid, bool cancel) {
for(auto iter = core.chain_counter.begin();iter != core.chain_counter.end(); ++iter) { for(auto iter = core.chain_counter.begin(); iter != core.chain_counter.end(); ++iter) {
auto& info = iter->second; auto& info = iter->second;
if((playerid == 0) && (info.second & 0xffff) != 0)
continue;
if((playerid == 1) && (info.second & 0xffff0000) != 0)
continue;
if(info.first) { if(info.first) {
pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT); pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(chainid, PARAM_TYPE_INT); pduel->lua->add_param(chainid, PARAM_TYPE_INT);
if(!pduel->lua->check_condition(info.first, 3)) { if(!pduel->lua->check_condition(info.first, 3)) {
if(playerid == 0) if(playerid == 0) {
info.second += 0x1; if(!cancel)
else info.second += 0x1;
info.second += 0x10000; else if(info.second & 0xffff)
info.second -= 0x1;
} else {
if(!cancel)
info.second += 0x10000;
else if(info.second & 0xffff0000)
info.second -= 0x10000;
}
break; break;
} }
} }
......
...@@ -360,7 +360,7 @@ public: ...@@ -360,7 +360,7 @@ public:
effect* check_unique_onfield(card* pcard, uint8 controler); effect* check_unique_onfield(card* pcard, uint8 controler);
int32 check_spsummon_once(card* pcard, uint8 playerid); int32 check_spsummon_once(card* pcard, uint8 playerid);
void check_card_counter(card* pcard, int32 counter_type, int32 playerid); void check_card_counter(card* pcard, int32 counter_type, int32 playerid);
void check_chain_counter(effect* peffect, int32 playerid, int32 chainid); void check_chain_counter(effect* peffect, int32 playerid, int32 chainid, bool cancel = false);
int32 check_lp_cost(uint8 playerid, uint32 cost); int32 check_lp_cost(uint8 playerid, uint32 cost);
void save_lp_cost(); void save_lp_cost();
......
...@@ -4577,6 +4577,7 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4577,6 +4577,7 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
dec_effect_code(peffect->count_code, cait->triggering_player); dec_effect_code(peffect->count_code, cait->triggering_player);
} }
} }
check_chain_counter(peffect, cait->triggering_player, cait->chain_count, true);
raise_event((card*)0, EVENT_CHAIN_NEGATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count); raise_event((card*)0, EVENT_CHAIN_NEGATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
process_instant_event(); process_instant_event();
core.units.begin()->step = 9; core.units.begin()->step = 9;
......
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