Commit b2795b58 authored by salix5's avatar salix5

Duel.GetBattledCount()

parent b8f08756
......@@ -285,6 +285,7 @@ struct processor {
bool spsummon_rst;
uint8 attack_state_count[2];
uint8 battle_phase_count[2];
uint8 battled_count[2];
uint8 phase_action;
uint32 hint_timing[2];
uint8 current_player;
......
......@@ -496,6 +496,7 @@ static const struct luaL_Reg duellib[] = {
{ "CheckPhaseActivity", scriptlib::duel_check_phase_activity },
{ "AddCustomActivityCounter", scriptlib::duel_add_custom_activity_counter },
{ "GetCustomActivityCount", scriptlib::duel_get_custom_activity_count },
{ "GetBattledCount", scriptlib::duel_get_battled_count },
{ "IsAbleToEnterBP", scriptlib::duel_is_able_to_enter_bp },
{ "VenomSwampCheck", scriptlib::duel_venom_swamp_check },
{ "SwapDeckAndGrave", scriptlib::duel_swap_deck_and_grave },
......
......@@ -3282,6 +3282,16 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) {
lua_pushinteger(L, (val >> 16) & 0xffff);
return 1;
}
int32 scriptlib::duel_get_battled_count(lua_State *L) {
check_param_count(L, 1);
int32 playerid = lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1)
return 0;
duel* pduel = interpreter::get_duel_info(L);
lua_pushinteger(L, pduel->game_field->core.battled_count[playerid]);
return 1;
}
int32 scriptlib::duel_is_able_to_enter_bp(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_able_to_enter_bp());
......
......@@ -3155,6 +3155,7 @@ int32 field::process_battle_command(uint16 step) {
else
core.pre_field[1] = 0;
core.attacker->attacked_count++;
core.battled_count[infos.turn_player]++;
raise_single_event(core.attacker, 0, EVENT_BATTLE_START, 0, 0, 0, 0, 0);
if(core.attack_target)
raise_single_event(core.attack_target, 0, EVENT_BATTLE_START, 0, 0, 0, 0, 1);
......@@ -3619,6 +3620,7 @@ int32 field::process_damage_step(uint16 step, uint32 new_attack) {
}
if(new_attack){
core.attack_state_count[infos.turn_player]++;
core.battled_count[infos.turn_player]++;
check_card_counter(core.attacker, 5, infos.turn_player);
}
attack_all_target_check();
......@@ -3870,6 +3872,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
core.spsummon_state_count_rst[p] = 0;
core.attack_state_count[p] = 0;
core.battle_phase_count[p] = 0;
core.battled_count[p] = 0;
core.summon_count[p] = 0;
core.extra_summon[p] = 0;
core.spsummon_once_map[p].clear();
......
......@@ -497,6 +497,7 @@ public:
static int32 duel_add_custom_activity_counter(lua_State *L);
static int32 duel_get_custom_activity_count(lua_State *L);
static int32 duel_is_able_to_enter_bp(lua_State *L);
static int32 duel_get_battled_count(lua_State *L);
//specific card functions
static int32 duel_venom_swamp_check(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