Commit 0131b0b8 authored by DailyShana's avatar DailyShana

format

parent 4e1021b9
...@@ -1719,7 +1719,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1719,7 +1719,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
pcard->operation_param = 0; pcard->operation_param = 0;
for(uint32 i = 0; i < 5; ++i) { for(uint32 i = 0; i < 5; ++i) {
card* atarget = player[1 - p].list_mzone[i]; card* atarget = player[1 - p].list_mzone[i];
if(atarget){ if(atarget) {
if(atarget->is_affected_by_effect(EFFECT_MUST_BE_ATTACKED, pcard)) if(atarget->is_affected_by_effect(EFFECT_MUST_BE_ATTACKED, pcard))
must_be_attack.push_back(atarget); must_be_attack.push_back(atarget);
if(atarget->is_affected_by_effect(EFFECT_ONLY_BE_ATTACKED)) if(atarget->is_affected_by_effect(EFFECT_ONLY_BE_ATTACKED))
...@@ -1727,7 +1727,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1727,7 +1727,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
} }
} }
pcard->filter_effect(EFFECT_RISE_TO_FULL_HEIGHT, &eset); pcard->filter_effect(EFFECT_RISE_TO_FULL_HEIGHT, &eset);
if(eset.size()){ if(eset.size()) {
atype = 1; atype = 1;
std::set<uint32> idset; std::set<uint32> idset;
for(int32 i = 0; i < eset.size(); ++i) for(int32 i = 0; i < eset.size(); ++i)
...@@ -1737,21 +1737,19 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1737,21 +1737,19 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
else else
return atype; return atype;
} }
else if(pcard->is_affected_by_effect(EFFECT_ONLY_ATTACK_MONSTER)){ else if(pcard->is_affected_by_effect(EFFECT_ONLY_ATTACK_MONSTER)) {
atype = 2; atype = 2;
if(only_be_attack.size() == 1) if(only_be_attack.size() == 1)
pv = &only_be_attack; pv = &only_be_attack;
else else
return atype; return atype;
} } else if(pcard->is_affected_by_effect(EFFECT_MUST_ATTACK_MONSTER)) {
else if(pcard->is_affected_by_effect(EFFECT_MUST_ATTACK_MONSTER)){
atype = 3; atype = 3;
if(must_be_attack.size()) if(must_be_attack.size())
pv = &must_be_attack; pv = &must_be_attack;
else else
return atype; return atype;
} } else {
else{
atype = 4; atype = 4;
pv = &player[1 - p].list_mzone; pv = &player[1 - p].list_mzone;
} }
...@@ -1761,18 +1759,18 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1761,18 +1759,18 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
effect_set exts1, exts2; effect_set exts1, exts2;
bool dir = true; bool dir = true;
pcard->filter_effect(EFFECT_EXTRA_ATTACK, &exts1); pcard->filter_effect(EFFECT_EXTRA_ATTACK, &exts1);
for(int32 i = 0; i < exts1.size(); ++i){ for(int32 i = 0; i < exts1.size(); ++i) {
tmp = exts1[i]->get_value(pcard); tmp = exts1[i]->get_value(pcard);
if(tmp > ct1) if(tmp > ct1)
ct1 = tmp; ct1 = tmp;
} }
pcard->filter_effect(EFFECT_EXTRA_ATTACK_MONSTER, &exts2); pcard->filter_effect(EFFECT_EXTRA_ATTACK_MONSTER, &exts2);
for(int32 i = 0; i < exts2.size(); ++i){ for(int32 i = 0; i < exts2.size(); ++i) {
tmp = exts2[i]->get_value(pcard); tmp = exts2[i]->get_value(pcard);
if(tmp > ct2) if(tmp > ct2)
ct2 = tmp; ct2 = tmp;
} }
if(pcard != core.attacker){ if(pcard != core.attacker) {
if(pcard->announce_count < ct1 + 1) if(pcard->announce_count < ct1 + 1)
dir = true; dir = true;
else if(chain_attack && !core.chain_attack_target) else if(chain_attack && !core.chain_attack_target)
...@@ -1780,7 +1778,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1780,7 +1778,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
else if(ct2 && pcard->announce_count < ct2 + 1 else if(ct2 && pcard->announce_count < ct2 + 1
&& pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end()) && pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end())
dir = false; dir = false;
else{ else {
// effects with target limit // effects with target limit
if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL)) if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL))
&& pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end() && pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end()
...@@ -1814,8 +1812,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1814,8 +1812,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
} }
return atype; return atype;
} }
} } else {
else {
if(pcard->announce_count <= ct1 + 1) if(pcard->announce_count <= ct1 + 1)
dir = true; dir = true;
else if(chain_attack && !core.chain_attack_target) else if(chain_attack && !core.chain_attack_target)
...@@ -1823,7 +1820,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack) ...@@ -1823,7 +1820,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
else if(ct2 && pcard->announce_count <= ct2 + 1 else if(ct2 && pcard->announce_count <= ct2 + 1
&& pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end()) && pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end())
dir = false; dir = false;
else{ else {
// effects with target limit // effects with target limit
if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL)) && pcard->attack_all_target) { if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL)) && pcard->attack_all_target) {
for(auto cit = pv->begin(); cit != pv->end(); ++cit) { for(auto cit = pv->begin(); cit != pv->end(); ++cit) {
...@@ -1896,7 +1893,7 @@ bool field::confirm_attack_target() { ...@@ -1896,7 +1893,7 @@ bool field::confirm_attack_target() {
// find the universal set // find the universal set
for(uint32 i = 0; i < 5; ++i) { for(uint32 i = 0; i < 5; ++i) {
card* atarget = player[1 - p].list_mzone[i]; card* atarget = player[1 - p].list_mzone[i];
if(atarget){ if(atarget) {
if(atarget->is_affected_by_effect(EFFECT_MUST_BE_ATTACKED, pcard)) if(atarget->is_affected_by_effect(EFFECT_MUST_BE_ATTACKED, pcard))
must_be_attack.push_back(atarget); must_be_attack.push_back(atarget);
if(atarget->is_affected_by_effect(EFFECT_ONLY_BE_ATTACKED)) if(atarget->is_affected_by_effect(EFFECT_ONLY_BE_ATTACKED))
...@@ -1904,7 +1901,7 @@ bool field::confirm_attack_target() { ...@@ -1904,7 +1901,7 @@ bool field::confirm_attack_target() {
} }
} }
pcard->filter_effect(EFFECT_RISE_TO_FULL_HEIGHT, &eset); pcard->filter_effect(EFFECT_RISE_TO_FULL_HEIGHT, &eset);
if(eset.size()){ if(eset.size()) {
atype = 1; atype = 1;
std::set<uint32> idset; std::set<uint32> idset;
for(int32 i = 0; i < eset.size(); ++i) for(int32 i = 0; i < eset.size(); ++i)
...@@ -1913,22 +1910,19 @@ bool field::confirm_attack_target() { ...@@ -1913,22 +1910,19 @@ bool field::confirm_attack_target() {
pv = &only_be_attack; pv = &only_be_attack;
else else
return false; return false;
} } else if(pcard->is_affected_by_effect(EFFECT_ONLY_ATTACK_MONSTER)) {
else if(pcard->is_affected_by_effect(EFFECT_ONLY_ATTACK_MONSTER)){
atype = 2; atype = 2;
if(only_be_attack.size() == 1) if(only_be_attack.size() == 1)
pv = &only_be_attack; pv = &only_be_attack;
else else
return false; return false;
} } else if(pcard->is_affected_by_effect(EFFECT_MUST_ATTACK_MONSTER)) {
else if(pcard->is_affected_by_effect(EFFECT_MUST_ATTACK_MONSTER)){
atype = 3; atype = 3;
if(must_be_attack.size()) if(must_be_attack.size())
pv = &must_be_attack; pv = &must_be_attack;
else else
return false; return false;
} } else {
else{
atype = 4; atype = 4;
pv = &player[1 - p].list_mzone; pv = &player[1 - p].list_mzone;
} }
...@@ -1938,13 +1932,13 @@ bool field::confirm_attack_target() { ...@@ -1938,13 +1932,13 @@ bool field::confirm_attack_target() {
effect_set exts1, exts2; effect_set exts1, exts2;
bool dir = true; bool dir = true;
pcard->filter_effect(EFFECT_EXTRA_ATTACK, &exts1); pcard->filter_effect(EFFECT_EXTRA_ATTACK, &exts1);
for(int32 i = 0; i < exts1.size(); ++i){ for(int32 i = 0; i < exts1.size(); ++i) {
tmp = exts1[i]->get_value(pcard); tmp = exts1[i]->get_value(pcard);
if(tmp > ct1) if(tmp > ct1)
ct1 = tmp; ct1 = tmp;
} }
pcard->filter_effect(EFFECT_EXTRA_ATTACK_MONSTER, &exts2); pcard->filter_effect(EFFECT_EXTRA_ATTACK_MONSTER, &exts2);
for(int32 i = 0; i < exts2.size(); ++i){ for(int32 i = 0; i < exts2.size(); ++i) {
tmp = exts2[i]->get_value(pcard); tmp = exts2[i]->get_value(pcard);
if(tmp > ct2) if(tmp > ct2)
ct2 = tmp; ct2 = tmp;
...@@ -1956,7 +1950,7 @@ bool field::confirm_attack_target() { ...@@ -1956,7 +1950,7 @@ bool field::confirm_attack_target() {
else if(ct2 && pcard->announce_count <= ct2 + 1 else if(ct2 && pcard->announce_count <= ct2 + 1
&& pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end()) && pcard->announced_cards.find(0) == pcard->announced_cards.end() && pcard->battled_cards.find(0) == pcard->battled_cards.end())
dir = false; dir = false;
else{ else {
// effects with target limit // effects with target limit
if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL)) && pcard->attack_all_target && core.attack_target) { if((peffect = pcard->is_affected_by_effect(EFFECT_ATTACK_ALL)) && pcard->attack_all_target && core.attack_target) {
// valid target // valid target
......
...@@ -1692,7 +1692,7 @@ int32 scriptlib::card_is_location(lua_State *L) { ...@@ -1692,7 +1692,7 @@ int32 scriptlib::card_is_location(lua_State *L) {
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
} else if(pcard->current.location == LOCATION_SZONE){ } else if(pcard->current.location == LOCATION_SZONE) {
if((loc & LOCATION_SZONE) && !pcard->is_status(STATUS_ACTIVATE_DISABLED)) if((loc & LOCATION_SZONE) && !pcard->is_status(STATUS_ACTIVATE_DISABLED))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
......
...@@ -1231,8 +1231,7 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) { ...@@ -1231,8 +1231,7 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) {
pduel->game_field->raise_event(target, EVENT_BE_BATTLE_TARGET, 0, REASON_REPLACE, 0, 1 - turnp, 0); pduel->game_field->raise_event(target, EVENT_BE_BATTLE_TARGET, 0, REASON_REPLACE, 0, 1 - turnp, 0);
pduel->game_field->process_single_event(); pduel->game_field->process_single_event();
pduel->game_field->process_instant_event(); pduel->game_field->process_instant_event();
} } else
else
pduel->game_field->core.attack_player = TRUE; pduel->game_field->core.attack_player = TRUE;
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
} else } else
......
...@@ -2693,8 +2693,7 @@ int32 field::destroy(uint16 step, group * targets, card * target, uint8 battle) ...@@ -2693,8 +2693,7 @@ int32 field::destroy(uint16 step, group * targets, card * target, uint8 battle)
if(!battle) { if(!battle) {
for (int32 i = 0; i < eset.size(); ++i) for (int32 i = 0; i < eset.size(); ++i)
add_process(PROCESSOR_OPERATION_REPLACE, 0, eset[i], targets, 0, 1, 0, 0, target); add_process(PROCESSOR_OPERATION_REPLACE, 0, eset[i], targets, 0, 1, 0, 0, target);
} } else {
else {
for (int32 i = 0; i < eset.size(); ++i) for (int32 i = 0; i < eset.size(); ++i)
add_process(PROCESSOR_OPERATION_REPLACE, 10, eset[i], targets, 0, 1, 0, 0, target); add_process(PROCESSOR_OPERATION_REPLACE, 10, eset[i], targets, 0, 1, 0, 0, target);
} }
...@@ -3018,7 +3017,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3018,7 +3017,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
} }
} }
if(targets->container.size()){ if(targets->container.size()) {
auto pr = effects.continuous_effect.equal_range(EFFECT_DESTROY_REPLACE); auto pr = effects.continuous_effect.equal_range(EFFECT_DESTROY_REPLACE);
for (; pr.first != pr.second; ++pr.first) for (; pr.first != pr.second; ++pr.first)
add_process(PROCESSOR_OPERATION_REPLACE, 12, pr.first->second, targets, 0, 1); add_process(PROCESSOR_OPERATION_REPLACE, 12, pr.first->second, targets, 0, 1);
......
...@@ -2780,7 +2780,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2780,7 +2780,7 @@ int32 field::process_battle_command(uint16 step) {
if(is_player_affected_by_effect(infos.turn_player, EFFECT_BP_TWICE)) if(is_player_affected_by_effect(infos.turn_player, EFFECT_BP_TWICE))
core.units.begin()->arg2 = 1; core.units.begin()->arg2 = 1;
else core.units.begin()->arg2 = 0; else core.units.begin()->arg2 = 0;
if(!peffect->value){ if(!peffect->value) {
infos.phase = PHASE_BATTLE; infos.phase = PHASE_BATTLE;
add_process(PROCESSOR_PHASE_EVENT, 0, 0, 0, PHASE_BATTLE, 0); add_process(PROCESSOR_PHASE_EVENT, 0, 0, 0, PHASE_BATTLE, 0);
} else { } else {
...@@ -2970,11 +2970,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2970,11 +2970,9 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer32(core.attacker->get_info_location()); pduel->write_buffer32(core.attacker->get_info_location());
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, 1 - infos.turn_player, 0x10001); add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, 1 - infos.turn_player, 0x10001);
} }
} } else if(core.units.begin()->arg1) {
else if(core.units.begin()->arg1) {
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player + 0x20000, 0x10001); add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player + 0x20000, 0x10001);
} } else
else
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player, 0x10001); add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, infos.turn_player, 0x10001);
core.units.begin()->step = 5; core.units.begin()->step = 5;
return FALSE; return FALSE;
...@@ -2998,8 +2996,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2998,8 +2996,7 @@ int32 field::process_battle_command(uint16 step) {
core.chain_attack = FALSE; core.chain_attack = FALSE;
core.units.begin()->step = -1; core.units.begin()->step = -1;
return FALSE; return FALSE;
} } else if(returns.ivalue[0] == -2)
else if(returns.ivalue[0] == -2)
core.attack_target = 0; core.attack_target = 0;
else else
core.attack_target = core.select_cards[returns.bvalue[1]]; core.attack_target = core.select_cards[returns.bvalue[1]];
...@@ -3634,7 +3631,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) { ...@@ -3634,7 +3631,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) {
core.units.begin()->step = 2; core.units.begin()->step = 2;
return FALSE; return FALSE;
} }
if(new_attack){ if(new_attack) {
core.attack_state_count[infos.turn_player]++; core.attack_state_count[infos.turn_player]++;
core.battled_count[infos.turn_player]++; core.battled_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player); check_card_counter(core.attacker, 5, infos.turn_player);
...@@ -4719,7 +4716,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4719,7 +4716,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
case 13: { case 13: {
raise_event((card*)0, EVENT_CHAIN_END, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_CHAIN_END, 0, 0, 0, 0, 0);
process_instant_event(); process_instant_event();
if(chainend_arg1 != 0x101 || chainend_arg2 != TRUE){ if(chainend_arg1 != 0x101 || chainend_arg2 != TRUE) {
core.hint_timing[0] |= TIMING_CHAIN_END; core.hint_timing[0] |= TIMING_CHAIN_END;
core.hint_timing[1] |= TIMING_CHAIN_END; core.hint_timing[1] |= TIMING_CHAIN_END;
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, chainend_arg1, chainend_arg2); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, chainend_arg1, chainend_arg2);
......
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