Commit 3eac2212 authored by salix5's avatar salix5

fix get_attack_target(), remove ReplaceAttackTarget()

get_attack_target()
classified into 2 categories:
1.attacker=pcard
2.otherwise
The main differences are attack counts and EFFECT_ATTACK_ALL counts.

confirm_attack_target()
Now battle step replay rule will use this function instead.
parent 7058e371
This diff is collapsed.
......@@ -385,7 +385,8 @@ public:
uint32 get_field_counter(uint8 self, uint8 s, uint8 o, uint16 countertype);
int32 effect_replace_check(uint32 code, const tevent& e);
int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE, bool choose_target = true);
int32 get_attack_target(card* pcard, card_vector* v, uint8 chain_attack = FALSE);
bool confirm_attack_target();
void attack_all_target_check();
int32 check_synchro_material(card* pcard, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg);
int32 check_tuner_material(card* pcard, card* tuner, int32 findex1, int32 findex2, int32 min, int32 max, card* smat, group* mg);
......
......@@ -380,7 +380,6 @@ static const struct luaL_Reg duellib[] = {
{ "ShuffleSetCard", scriptlib::duel_shuffle_setcard },
{ "ChangeAttacker", scriptlib::duel_change_attacker },
{ "ChangeAttackTarget", scriptlib::duel_change_attack_target },
{ "ReplaceAttackTarget", scriptlib::duel_replace_attack_target },
{ "CalculateDamage", scriptlib::duel_calculate_damage },
{ "GetBattleDamage", scriptlib::duel_get_battle_damage },
{ "ChangeBattleDamage", scriptlib::duel_change_battle_damage },
......
......@@ -2222,7 +2222,10 @@ int32 scriptlib::card_get_attackable_target(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
duel* pduel = pcard->pduel;
field::card_vector targets;
pduel->game_field->get_attack_target(pcard, &targets);
uint8 chain_attack = FALSE;
if(pduel->game_field->core.chain_attacker_id == pcard->fieldid)
chain_attack = TRUE;
pduel->game_field->get_attack_target(pcard, &targets, chain_attack);
group* newgroup = pduel->new_group();
newgroup->container.insert(targets.begin(), targets.end());
interpreter::group2value(L, newgroup);
......
......@@ -1239,9 +1239,6 @@ int32 scriptlib::duel_change_attack_target(lua_State *L) {
lua_pushboolean(L, 0);
return 1;
}
int32 scriptlib::duel_replace_attack_target(lua_State *L) {
return 0;
}
int32 scriptlib::duel_calculate_damage(lua_State *L) {
check_action_permission(L);
check_param_count(L, 2);
......
......@@ -2912,7 +2912,6 @@ int32 field::process_battle_command(uint16 step) {
return FALSE;
}
case 3: {
//Filter Targers
if(core.attacker->current.location != LOCATION_MZONE || core.attacker->fieldid_r != core.pre_field[0]) {
core.chain_attack = FALSE;
core.units.begin()->step = -1;
......@@ -3103,11 +3102,7 @@ int32 field::process_battle_command(uint16 step) {
adjust_all();
return FALSE;
}
core.select_cards.clear();
auto atype = get_attack_target(core.attacker, &core.select_cards, core.chain_attack, false);
if(!core.attack_target && !core.attacker->operation_param
|| core.attack_target && atype <= 3
&& std::find(core.select_cards.begin(), core.select_cards.end(), core.attack_target) == core.select_cards.end())
if(!confirm_attack_target())
rollback = true;
// go to damage step
if(!rollback) {
......
......@@ -377,7 +377,6 @@ public:
static int32 duel_shuffle_setcard(lua_State *L);
static int32 duel_change_attacker(lua_State *L);
static int32 duel_change_attack_target(lua_State *L);
static int32 duel_replace_attack_target(lua_State *L);
static int32 duel_calculate_damage(lua_State *L);
static int32 duel_get_battle_damage(lua_State *L);
static int32 duel_change_battle_damage(lua_State *L);
......
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