fix team_dice_bonus variable names

This commit is contained in:
Martin Michelsen
2024-01-16 21:11:56 -08:00
parent 86e98fbfe5
commit 408bc1befc
10 changed files with 34 additions and 35 deletions
+1 -1
View File
@@ -264,7 +264,7 @@ void Card::commit_attack(
int16_t exp_amount = clamp<int16_t>(this->server()->team_exp[team_id], 0, effective_damage);
this->server()->team_exp[team_id] -= exp_amount;
effective_damage -= exp_amount;
this->server()->compute_team_dice_boost(team_id);
this->server()->compute_team_dice_bonus(team_id);
this->server()->update_battle_state_flags_and_send_6xB4x03_if_needed();
if (cmd) {
cmd->effect.ap += exp_amount;
+10 -10
View File
@@ -72,7 +72,7 @@ void CardSpecial::AttackEnvStats::clear() {
this->num_gun_type_items = 0;
this->num_cane_type_items = 0;
this->effective_ap_if_not_tech2 = 0;
this->team_dice_boost = 0;
this->team_dice_bonus = 0;
this->sc_effective_ap = 0;
this->attack_bonus = 0;
this->num_sword_type_items_on_team = 0;
@@ -115,7 +115,7 @@ void CardSpecial::AttackEnvStats::print(FILE* stream) const {
fprintf(stream, "(kap) action_cards_ap = %" PRIu32 "\n", this->action_cards_ap);
fprintf(stream, "(ktp) action_cards_tp = %" PRIu32 "\n", this->action_cards_tp);
fprintf(stream, "(ldm) last_attack_preliminary_damage = %" PRIu32 "\n", this->last_attack_preliminary_damage);
fprintf(stream, "(lv) team_dice_boost = %" PRIu32 "\n", this->team_dice_boost);
fprintf(stream, "(lv) team_dice_bonus = %" PRIu32 "\n", this->team_dice_bonus);
fprintf(stream, "(mc) num_machine_creatures = %" PRIu32 "\n", this->num_machine_creatures);
fprintf(stream, "(mhp) max_hp = %" PRIu32 "\n", this->max_hp);
fprintf(stream, "(ndm) last_attack_damage_count = %" PRIu32 "\n", this->last_attack_damage_count);
@@ -195,7 +195,7 @@ void CardSpecial::adjust_attack_damage_due_to_conditions(
}
this->send_6xB4x06_for_exp_change(
target_card, attacker_card_ref, -exp_deduction, true);
this->compute_team_dice_boost(target_team_id);
this->compute_team_dice_bonus(target_team_id);
}
break;
}
@@ -753,7 +753,7 @@ CardSpecial::AttackEnvStats CardSpecial::compute_attack_env_stats(
ast.effective_tp = card->action_chain.chain.effective_tp;
ast.current_hp = card->get_current_hp();
ast.max_hp = card->get_max_hp();
ast.team_dice_boost = card ? this->server()->team_dice_boost[card->get_team_id()] : 0;
ast.team_dice_bonus = card ? this->server()->team_dice_bonus[card->get_team_id()] : 0;
ast.effective_ap_if_not_tech = (!attacker_card || (attacker_card->action_chain.chain.attack_medium == AttackMedium::TECH))
? 0
@@ -1180,10 +1180,10 @@ StatSwapType CardSpecial::compute_stat_swap_type(shared_ptr<const Card> card) co
return ret;
}
void CardSpecial::compute_team_dice_boost(uint8_t team_id) {
void CardSpecial::compute_team_dice_bonus(uint8_t team_id) {
uint8_t value = this->server()->team_exp[team_id] / (this->server()->team_client_count[team_id] * 12);
this->adjust_dice_boost_if_team_has_condition_52(team_id, &value, 0);
this->server()->team_dice_boost[team_id] = min<uint8_t>(value, 8);
this->server()->team_dice_bonus[team_id] = min<uint8_t>(value, 8);
}
bool CardSpecial::condition_has_when_20_or_21(const Condition& cond) const {
@@ -2047,8 +2047,8 @@ bool CardSpecial::execute_effect(
this->server()->team_exp[attacker_team_id] += this->server()->team_exp[target_team_id];
this->server()->team_exp[target_team_id] = 0;
}
this->compute_team_dice_boost(attacker_team_id);
this->compute_team_dice_boost(target_team_id);
this->compute_team_dice_bonus(attacker_team_id);
this->compute_team_dice_bonus(target_team_id);
this->send_6xB4x06_for_exp_change(card, attacker_card_ref, -positive_expr_value, 1);
this->server()->update_battle_state_flags_and_send_6xB4x03_if_needed();
}
@@ -2090,7 +2090,7 @@ bool CardSpecial::execute_effect(
delta = -3;
this->server()->team_exp[team_id] -= 3;
}
this->compute_team_dice_boost(team_id);
this->compute_team_dice_bonus(team_id);
this->send_6xB4x06_for_exp_change(card, attacker_card_ref, delta, 1);
}
}
@@ -2167,7 +2167,7 @@ bool CardSpecial::execute_effect(
this->server()->team_exp[team_id] = existing_exp + clamped_expr_value;
}
this->send_6xB4x06_for_exp_change(card, attacker_card_ref, clamped_expr_value, 1);
this->compute_team_dice_boost(team_id);
this->compute_team_dice_bonus(team_id);
this->server()->update_battle_state_flags_and_send_6xB4x03_if_needed();
}
}
+2 -2
View File
@@ -74,7 +74,7 @@ public:
uint32_t num_gun_type_items; // "gn" in expr
uint32_t num_cane_type_items; // "wd" in expr
uint32_t effective_ap_if_not_tech2; // "tt" in expr
uint32_t team_dice_boost; // "lv" in expr
uint32_t team_dice_bonus; // "lv" in expr
uint32_t sc_effective_ap; // "adm" in expr
uint32_t attack_bonus; // "ddm" in expr
uint32_t num_sword_type_items_on_team; // "sat" in expr
@@ -159,7 +159,7 @@ public:
uint32_t* unknown_p11,
uint16_t sc_card_ref);
StatSwapType compute_stat_swap_type(std::shared_ptr<const Card> card) const;
void compute_team_dice_boost(uint8_t team_id);
void compute_team_dice_bonus(uint8_t team_id);
bool condition_has_when_20_or_21(const Condition& cond) const;
size_t count_action_cards_with_condition_for_all_current_attacks(
ConditionType cond_type, uint16_t card_ref) const;
+3 -3
View File
@@ -1498,7 +1498,7 @@ bool StateFlags::operator==(const StateFlags& other) const {
(this->setup_phase == other.setup_phase) &&
(this->registration_phase == other.registration_phase) &&
(this->team_exp == other.team_exp) &&
(this->team_dice_boost == other.team_dice_boost) &&
(this->team_dice_bonus == other.team_dice_bonus) &&
(this->first_team_turn == other.first_team_turn) &&
(this->tournament_flag == other.tournament_flag) &&
(this->client_sc_card_types == other.client_sc_card_types);
@@ -1516,7 +1516,7 @@ void StateFlags::clear() {
this->setup_phase = SetupPhase::REGISTRATION;
this->registration_phase = RegistrationPhase::AWAITING_NUM_PLAYERS;
this->team_exp.clear(0);
this->team_dice_boost.clear(0);
this->team_dice_bonus.clear(0);
this->first_team_turn = 0;
this->tournament_flag = 0;
this->client_sc_card_types.clear(CardType::HUNTERS_SC);
@@ -1531,7 +1531,7 @@ void StateFlags::clear_FF() {
this->setup_phase = SetupPhase::INVALID_FF;
this->registration_phase = RegistrationPhase::INVALID_FF;
this->team_exp.clear(0xFFFFFFFF);
this->team_dice_boost.clear(0xFF);
this->team_dice_bonus.clear(0xFF);
this->first_team_turn = 0xFF;
this->tournament_flag = 0xFF;
this->client_sc_card_types.clear(CardType::INVALID_FF);
+3 -4
View File
@@ -979,12 +979,11 @@ struct Rules {
} __attribute__((packed));
struct RulesTrial {
// The fields here have the same meaning as in the final version. The only
// difference is that Dice Boost does not exist in the trial version.
// Most fields here have the same meanings as in the final version.
/* 00 */ uint8_t overall_time_limit = 0;
/* 01 */ uint8_t phase_time_limit = 0;
/* 02 */ AllowedCards allowed_cards = AllowedCards::ALL;
/* 03 */ uint8_t atk_dice_max = 1;
/* 03 */ uint8_t atk_dice_max = 1; // TODO: Are these actually maxes? Look at the dice roll function
/* 04 */ uint8_t def_dice_max = 6;
/* 05 */ uint8_t disable_deck_shuffle = 0;
/* 06 */ uint8_t disable_deck_loop = 0;
@@ -1009,7 +1008,7 @@ struct StateFlags {
/* 06 */ SetupPhase setup_phase;
/* 07 */ RegistrationPhase registration_phase;
/* 08 */ parray<le_uint32_t, 2> team_exp;
/* 10 */ parray<uint8_t, 2> team_dice_boost;
/* 10 */ parray<uint8_t, 2> team_dice_bonus;
/* 12 */ uint8_t first_team_turn;
/* 13 */ uint8_t tournament_flag;
/* 14 */ parray<CardType, 4> client_sc_card_types;
+4 -4
View File
@@ -1884,8 +1884,8 @@ void PlayerState::roll_main_dice() {
this->dice_results[0] = this->atk_points;
this->dice_results[1] = this->def_points;
this->atk_points += s->team_dice_boost[this->team_id];
this->def_points += s->team_dice_boost[this->team_id];
this->atk_points += s->team_dice_bonus[this->team_id];
this->def_points += s->team_dice_bonus[this->team_id];
this->atk_points = clamp<uint8_t>(this->atk_points, 1, 9);
this->def_points = clamp<uint8_t>(this->def_points, 1, 9);
this->atk_bonuses = this->atk_points - atk_before_bonuses;
@@ -1906,7 +1906,7 @@ void PlayerState::unknown_8023C110() {
}
}
void PlayerState::compute_team_dice_boost_after_draw_phase() {
void PlayerState::compute_team_dice_bonus_after_draw_phase() {
auto s = this->server();
if (this->sc_card) {
@@ -1924,7 +1924,7 @@ void PlayerState::compute_team_dice_boost_after_draw_phase() {
(s->team_client_count[current_team_turn] * 12);
s->card_special->adjust_dice_boost_if_team_has_condition_52(
current_team_turn, &dice_boost, 0);
s->team_dice_boost[current_team_turn] = clamp<int16_t>(dice_boost, 0, 8);
s->team_dice_bonus[current_team_turn] = clamp<int16_t>(dice_boost, 0, 8);
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
}
+1 -1
View File
@@ -143,7 +143,7 @@ public:
void apply_main_die_assist_effects(uint8_t* die_value) const;
void roll_main_dice();
void unknown_8023C110();
void compute_team_dice_boost_after_draw_phase();
void compute_team_dice_bonus_after_draw_phase();
private:
std::weak_ptr<Server> w_server;
+7 -7
View File
@@ -57,7 +57,7 @@ Server::Server(shared_ptr<Lobby> lobby, Options&& options)
defense_list_ended_for_client(false),
next_assist_card_set_number(1),
team_exp(0),
team_dice_boost(0),
team_dice_bonus(0),
team_client_count(0),
team_num_ally_fcs_destroyed(0),
team_num_cards_destroyed(0),
@@ -362,7 +362,7 @@ void Server::add_team_exp(uint8_t team_id, int32_t exp) {
uint8_t dice_boost = this->team_exp[team_id] / (this->team_client_count[team_id] * 12);
this->card_special->adjust_dice_boost_if_team_has_condition_52(team_id, &dice_boost, 0);
this->team_dice_boost[team_id] = min<uint8_t>(dice_boost, 8);
this->team_dice_bonus[team_id] = min<uint8_t>(dice_boost, 8);
}
bool Server::advance_battle_phase() {
@@ -657,8 +657,8 @@ void Server::compute_all_map_occupied_bits() {
}
}
void Server::compute_team_dice_boost(uint8_t team_id) {
this->team_dice_boost[team_id] = clamp<int16_t>(
void Server::compute_team_dice_bonus(uint8_t team_id) {
this->team_dice_bonus[team_id] = clamp<int16_t>(
this->team_exp[team_id] / (this->team_client_count[team_id] * 12), 0, 8);
}
@@ -775,7 +775,7 @@ void Server::draw_phase_after() {
ps->draw_hand(0);
}
if (ps->is_team_turn()) {
ps->compute_team_dice_boost_after_draw_phase();
ps->compute_team_dice_bonus_after_draw_phase();
}
}
}
@@ -1562,8 +1562,8 @@ G_SetStateFlags_GC_Ep3_6xB4x03 Server::prepare_6xB4x03() const {
cmd.state.registration_phase = this->registration_phase;
cmd.state.team_exp[0] = this->team_exp[0];
cmd.state.team_exp[1] = this->team_exp[1];
cmd.state.team_dice_boost[0] = this->team_dice_boost[0];
cmd.state.team_dice_boost[1] = this->team_dice_boost[1];
cmd.state.team_dice_bonus[0] = this->team_dice_bonus[0];
cmd.state.team_dice_bonus[1] = this->team_dice_bonus[1];
cmd.state.first_team_turn = this->first_team_turn;
cmd.state.tournament_flag = this->options.tournament ? 1 : 0;
for (size_t z = 0; z < 4; z++) {
+2 -2
View File
@@ -143,7 +143,7 @@ public:
bool check_presence_entry(uint8_t client_id) const;
void clear_player_flags_after_dice_phase();
void compute_all_map_occupied_bits();
void compute_team_dice_boost(uint8_t team_id);
void compute_team_dice_bonus(uint8_t team_id);
void copy_player_states_to_prev_states();
std::shared_ptr<const CardIndex::CardEntry> definition_for_card_id(uint16_t card_id) const;
void destroy_cards_with_zero_hp();
@@ -303,7 +303,7 @@ public:
std::shared_ptr<RulerServer> ruler_server;
parray<parray<parray<uint8_t, 2>, 2>, 5> warp_positions; // Array indexes are (type, end, x/y)
parray<int16_t, 2> team_exp;
parray<int16_t, 2> team_dice_boost;
parray<int16_t, 2> team_dice_bonus;
parray<uint32_t, 2> team_client_count;
parray<uint32_t, 2> team_num_ally_fcs_destroyed;
parray<uint32_t, 2> team_num_cards_destroyed;
+1 -1
View File
@@ -1287,7 +1287,7 @@ static bool add_next_game_client(shared_ptr<Lobby> l) {
state_cmd.state.setup_phase = Episode3::SetupPhase::REGISTRATION;
state_cmd.state.registration_phase = Episode3::RegistrationPhase::AWAITING_NUM_PLAYERS;
state_cmd.state.team_exp.clear(0);
state_cmd.state.team_dice_boost.clear(0);
state_cmd.state.team_dice_bonus.clear(0);
state_cmd.state.first_team_turn = 0xFF;
state_cmd.state.tournament_flag = 0x01;
state_cmd.state.client_sc_card_types.clear(Episode3::CardType::INVALID_FF);