fix Ep3 NTE target replacement function
This commit is contained in:
@@ -6,22 +6,6 @@ using namespace std;
|
||||
|
||||
namespace Episode3 {
|
||||
|
||||
template <size_t Count>
|
||||
std::string string_for_refs(const parray<le_uint16_t, Count>& card_refs) {
|
||||
string ret = "[";
|
||||
for (size_t z = 0; z < Count; z++) {
|
||||
if (card_refs[z] != 0xFFFF) {
|
||||
ret += string_printf("%zu:@$%04X ", z, card_refs[z].load());
|
||||
}
|
||||
}
|
||||
if (!ret.empty()) {
|
||||
ret.back() = ']'; // Replace the ' ' from the last added item
|
||||
} else {
|
||||
ret.push_back(']');
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
Condition::Condition() {
|
||||
this->clear();
|
||||
}
|
||||
@@ -77,10 +61,12 @@ void Condition::clear_FF() {
|
||||
this->unknown_a8 = 0xFF;
|
||||
}
|
||||
|
||||
std::string Condition::str() const {
|
||||
std::string Condition::str(shared_ptr<const Server> s) const {
|
||||
auto card_ref_str = s->debug_str_for_card_ref(this->card_ref);
|
||||
auto giver_ref_str = s->debug_str_for_card_ref(this->condition_giver_card_ref);
|
||||
return string_printf(
|
||||
"Condition[type=%s, turns=%hhu, a_arg=%hhd, dice=%hhu, flags=%02hhX, "
|
||||
"def_eff_index=%hhu, ref=@%04hX, value=%hd, giver_ref=@%04hX "
|
||||
"def_eff_index=%hhu, ref=%s, value=%hd, giver_ref=%s "
|
||||
"percent=%hhu value8=%hd order=%hu a8=%hu]",
|
||||
name_for_condition_type(this->type),
|
||||
this->remaining_turns,
|
||||
@@ -88,9 +74,9 @@ std::string Condition::str() const {
|
||||
this->dice_roll_value,
|
||||
this->flags,
|
||||
this->card_definition_effect_index,
|
||||
this->card_ref.load(),
|
||||
card_ref_str.c_str(),
|
||||
this->value.load(),
|
||||
this->condition_giver_card_ref.load(),
|
||||
giver_ref_str.c_str(),
|
||||
this->random_percent,
|
||||
this->value8,
|
||||
this->order,
|
||||
@@ -114,13 +100,15 @@ void EffectResult::clear() {
|
||||
this->dice_roll_value = 0;
|
||||
}
|
||||
|
||||
std::string EffectResult::str() const {
|
||||
std::string EffectResult::str(shared_ptr<const Server> s) const {
|
||||
string attacker_ref_str = s->debug_str_for_card_ref(this->attacker_card_ref);
|
||||
string target_ref_str = s->debug_str_for_card_ref(this->target_card_ref);
|
||||
return string_printf(
|
||||
"EffectResult[att_ref=@%04hX, target_ref=@%04hX, value=%hhd, "
|
||||
"EffectResult[att_ref=%s, target_ref=%s, value=%hhd, "
|
||||
"cur_hp=%hhd, ap=%hhd, tp=%hhd, flags=%02hhX, op=%hhd, "
|
||||
"cond_index=%hhu, dice=%hhu]",
|
||||
this->attacker_card_ref.load(),
|
||||
this->target_card_ref.load(),
|
||||
attacker_ref_str.c_str(),
|
||||
target_ref_str.c_str(),
|
||||
this->value,
|
||||
this->current_hp,
|
||||
this->ap,
|
||||
@@ -148,12 +136,13 @@ bool CardShortStatus::operator!=(const CardShortStatus& other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
std::string CardShortStatus::str() const {
|
||||
std::string CardShortStatus::str(shared_ptr<const Server> s) const {
|
||||
string loc_s = this->loc.str();
|
||||
string ref_str = s->debug_str_for_card_ref(this->card_ref);
|
||||
return string_printf(
|
||||
"CardShortStatus[ref=@%04hX, cur_hp=%hd, flags=%08" PRIX32 ", loc=%s, "
|
||||
"CardShortStatus[ref=%s, cur_hp=%hd, flags=%08" PRIX32 ", loc=%s, "
|
||||
"u1=%04hX, max_hp=%hhd, u2=%hhu]",
|
||||
this->card_ref.load(),
|
||||
ref_str.c_str(),
|
||||
this->current_hp.load(),
|
||||
this->card_flags.load(),
|
||||
loc_s.c_str(),
|
||||
@@ -195,23 +184,27 @@ void ActionState::clear() {
|
||||
this->original_attacker_card_ref = 0xFFFF;
|
||||
this->target_card_refs.clear(0xFFFF);
|
||||
this->action_card_refs.clear(0xFFFF);
|
||||
this->unused2 = 0xFFFF;
|
||||
}
|
||||
|
||||
std::string ActionState::str() const {
|
||||
string target_refs_s = string_for_refs(this->target_card_refs);
|
||||
string action_refs_s = string_for_refs(this->action_card_refs);
|
||||
std::string ActionState::str(shared_ptr<const Server> s) const {
|
||||
string attacker_ref_s = s->debug_str_for_card_ref(this->attacker_card_ref);
|
||||
string defense_ref_s = s->debug_str_for_card_ref(this->defense_card_ref);
|
||||
string original_attacker_ref_s = s->debug_str_for_card_ref(this->original_attacker_card_ref);
|
||||
string target_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
|
||||
string action_refs_s = s->debug_str_for_card_refs(this->action_card_refs);
|
||||
return string_printf(
|
||||
"ActionState[client=%hu, u=%hhu, facing=%s, attacker_ref=@%04hX, "
|
||||
"def_ref=@%04hX, target_refs=%s, action_refs=%s, "
|
||||
"orig_attacker_ref=@%04hX]",
|
||||
"ActionState[client=%hu, u=%hhu, facing=%s, attacker_ref=%s, "
|
||||
"def_ref=%s, target_refs=%s, action_refs=%s, "
|
||||
"orig_attacker_ref=%s]",
|
||||
this->client_id.load(),
|
||||
this->unused,
|
||||
name_for_direction(this->facing_direction),
|
||||
this->attacker_card_ref.load(),
|
||||
this->defense_card_ref.load(),
|
||||
attacker_ref_s.c_str(),
|
||||
defense_ref_s.c_str(),
|
||||
target_refs_s.c_str(),
|
||||
action_refs_s.c_str(),
|
||||
this->original_attacker_card_ref.load());
|
||||
original_attacker_ref_s.c_str());
|
||||
}
|
||||
|
||||
ActionChain::ActionChain() {
|
||||
@@ -245,23 +238,24 @@ bool ActionChain::operator!=(const ActionChain& other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
std::string ActionChain::str() const {
|
||||
string attack_action_card_refs_s = string_for_refs(this->attack_action_card_refs);
|
||||
string target_card_refs_s = string_for_refs(this->target_card_refs);
|
||||
std::string ActionChain::str(shared_ptr<const Server> s) const {
|
||||
string acting_card_ref_s = s->debug_str_for_card_ref(this->acting_card_ref);
|
||||
string unknown_card_ref_a3_s = s->debug_str_for_card_ref(this->unknown_card_ref_a3);
|
||||
string attack_action_card_refs_s = s->debug_str_for_card_refs(this->attack_action_card_refs);
|
||||
string target_card_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
|
||||
return string_printf(
|
||||
"ActionChain[eff_ap=%hhd, eff_tp=%hhd, ap_bonus=%hhd, damage=%hhd, "
|
||||
"acting_ref=@%04hX, unknown_ref_a3=@%04hX, "
|
||||
"attack_action_refs=%s, attack_action_ref_count=%hhu, "
|
||||
"medium=%s, target_ref_count=%hhu, subphase=%s, "
|
||||
"strikes=%hhu, damage_mult=%hhd, attack_num=%hhu, "
|
||||
"acting_ref=%s, unknown_ref_a3=%s, attack_action_refs=%s, "
|
||||
"attack_action_ref_count=%hhu, medium=%s, target_ref_count=%hhu, "
|
||||
"subphase=%s, strikes=%hhu, damage_mult=%hhd, attack_num=%hhu, "
|
||||
"tp_bonus=%hhd, phys_bonus_nte=%hhu, tech_bonus_nte=%hhu, card_ap=%hhd, "
|
||||
"card_tp=%hhd, flags=%08" PRIX32 ", target_refs=%s]",
|
||||
this->effective_ap,
|
||||
this->effective_tp,
|
||||
this->ap_effect_bonus,
|
||||
this->damage,
|
||||
this->acting_card_ref.load(),
|
||||
this->unknown_card_ref_a3.load(),
|
||||
acting_card_ref_s.c_str(),
|
||||
unknown_card_ref_a3_s.c_str(),
|
||||
attack_action_card_refs_s.c_str(),
|
||||
this->attack_action_card_ref_count,
|
||||
name_for_attack_medium(this->attack_medium),
|
||||
@@ -338,17 +332,17 @@ bool ActionChainWithConds::operator!=(const ActionChainWithConds& other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
std::string ActionChainWithConds::str() const {
|
||||
std::string ActionChainWithConds::str(shared_ptr<const Server> s) const {
|
||||
string ret = "ActionChainWithConds[chain=";
|
||||
ret += this->chain.str();
|
||||
ret += this->chain.str(s);
|
||||
ret += ", conds=[";
|
||||
for (size_t z = 0; z < this->conditions.size(); z++) {
|
||||
if (this->conditions[z].type != ConditionType::NONE) {
|
||||
if (ret.back() != '=') {
|
||||
if (ret.back() != '[') {
|
||||
ret += ", ";
|
||||
}
|
||||
ret += string_printf("%zu:", z);
|
||||
ret += this->conditions[z].str();
|
||||
ret += this->conditions[z].str(s);
|
||||
}
|
||||
}
|
||||
ret += "]]";
|
||||
@@ -581,16 +575,17 @@ bool ActionMetadata::operator!=(const ActionMetadata& other) const {
|
||||
return !this->operator==(other);
|
||||
}
|
||||
|
||||
std::string ActionMetadata::str() const {
|
||||
string target_card_refs_s = string_for_refs(this->target_card_refs);
|
||||
string defense_card_refs_s = string_for_refs(this->defense_card_refs);
|
||||
string original_attacker_card_refs_s = string_for_refs(this->original_attacker_card_refs);
|
||||
std::string ActionMetadata::str(shared_ptr<const Server> s) const {
|
||||
string card_ref_s = s->debug_str_for_card_ref(this->card_ref);
|
||||
string target_card_refs_s = s->debug_str_for_card_refs(this->target_card_refs);
|
||||
string defense_card_refs_s = s->debug_str_for_card_refs(this->defense_card_refs);
|
||||
string original_attacker_card_refs_s = s->debug_str_for_card_refs(this->original_attacker_card_refs);
|
||||
return string_printf(
|
||||
"ActionMetadata[ref=@%04hX, target_ref_count=%hhu, def_ref_count=%hhu, "
|
||||
"ActionMetadata[ref=%s, target_ref_count=%hhu, def_ref_count=%hhu, "
|
||||
"subphase=%s, def_power=%hhd, def_bonus=%hhd, "
|
||||
"att_bonus=%hhd, flags=%08" PRIX32 ", target_refs=%s, "
|
||||
"defense_refs=%s, original_attacker_refs=%s]",
|
||||
this->card_ref.load(),
|
||||
card_ref_s.c_str(),
|
||||
this->target_card_ref_count,
|
||||
this->defense_card_ref_count,
|
||||
name_for_action_subphase(this->action_subphase),
|
||||
@@ -679,20 +674,22 @@ HandAndEquipState::HandAndEquipState() {
|
||||
this->clear();
|
||||
}
|
||||
|
||||
std::string HandAndEquipState::str() const {
|
||||
string hand_card_refs_s = string_for_refs(this->hand_card_refs);
|
||||
string set_card_refs_s = string_for_refs(this->set_card_refs);
|
||||
string hand_card_refs2_s = string_for_refs(this->hand_card_refs2);
|
||||
string set_card_refs2_s = string_for_refs(this->set_card_refs2);
|
||||
std::string HandAndEquipState::str(shared_ptr<const Server> s) const {
|
||||
string assist_card_ref_s = s->debug_str_for_card_ref(this->assist_card_ref);
|
||||
string assist_card_ref2_s = s->debug_str_for_card_ref(this->assist_card_ref2);
|
||||
string assist_card_id_s = s->debug_str_for_card_id(this->assist_card_id);
|
||||
string sc_card_ref_s = s->debug_str_for_card_ref(this->sc_card_ref);
|
||||
string hand_card_refs_s = s->debug_str_for_card_refs(this->hand_card_refs);
|
||||
string set_card_refs_s = s->debug_str_for_card_refs(this->set_card_refs);
|
||||
string hand_card_refs2_s = s->debug_str_for_card_refs(this->hand_card_refs2);
|
||||
string set_card_refs2_s = s->debug_str_for_card_refs(this->set_card_refs2);
|
||||
return string_printf(
|
||||
"HandAndEquipState[dice=[%hhu, %hhu], atk=%hhu, def=%hhu, atk2=%hhu, "
|
||||
"a1=%hhu, total_set_cost=%hhu, is_cpu=%hhu, "
|
||||
"assist_flags=%08" PRIX32 ", hand_refs=%s, "
|
||||
"assist_ref=@%04hX, set_refs=%s, sc_ref=@%04hX, "
|
||||
"hand_refs2=%s, set_refs2=%s, assist_ref2=@%04hX, "
|
||||
"assist_set_num=%hu, assist_card_id=#%04hX, "
|
||||
"assist_turns=%hhu, assit_dely=%hhu, atk_bonus=%hhu, "
|
||||
"def_bonus=%hhu, u2=[%hhu, %hhu]]",
|
||||
"a1=%hhu, total_set_cost=%hhu, is_cpu=%hhu, assist_flags=%08" PRIX32 ", "
|
||||
"hand_refs=%s, assist_ref=%s, set_refs=%s, sc_ref=%s, hand_refs2=%s, "
|
||||
"set_refs2=%s, assist_ref2=%s, assist_set_num=%hu, assist_card_id=%s, "
|
||||
"assist_turns=%hhu, assist_delay=%hhu, atk_bonus=%hhu, def_bonus=%hhu, "
|
||||
"u2=[%hhu, %hhu]]",
|
||||
this->dice_results[0],
|
||||
this->dice_results[1],
|
||||
this->atk_points,
|
||||
@@ -703,14 +700,14 @@ std::string HandAndEquipState::str() const {
|
||||
this->is_cpu_player,
|
||||
this->assist_flags.load(),
|
||||
hand_card_refs_s.c_str(),
|
||||
this->assist_card_ref.load(),
|
||||
assist_card_ref_s.c_str(),
|
||||
set_card_refs_s.c_str(),
|
||||
this->sc_card_ref.load(),
|
||||
sc_card_ref_s.c_str(),
|
||||
hand_card_refs2_s.c_str(),
|
||||
set_card_refs2_s.c_str(),
|
||||
this->assist_card_ref2.load(),
|
||||
assist_card_ref2_s.c_str(),
|
||||
this->assist_card_set_number.load(),
|
||||
this->assist_card_id.load(),
|
||||
assist_card_id_s.c_str(),
|
||||
this->assist_remaining_turns,
|
||||
this->assist_delay_turns,
|
||||
this->atk_bonuses,
|
||||
|
||||
Reference in New Issue
Block a user