replace is_trial with is_nte
This commit is contained in:
@@ -6,7 +6,7 @@ using namespace std;
|
||||
|
||||
namespace Episode3 {
|
||||
|
||||
const vector<uint16_t>& all_assist_card_ids(bool is_trial) {
|
||||
const vector<uint16_t>& all_assist_card_ids(bool is_nte) {
|
||||
// Note: This order matches the order that the cards are defined in the original
|
||||
// code. This is relevant for consistency of results when choosing a random card
|
||||
// (for God Whim).
|
||||
@@ -29,10 +29,10 @@ const vector<uint16_t>& all_assist_card_ids(bool is_trial) {
|
||||
0x013C, 0x013D, 0x013E, 0x013F, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144,
|
||||
0x0145, 0x0146, 0x0148, 0x014A, 0x014B, 0x014C, 0x014D, 0x014E, 0x023F,
|
||||
0x0240, 0x0241, 0x0242};
|
||||
return is_trial ? ALL_ASSIST_CARD_IDS_TRIAL : ALL_ASSIST_CARD_IDS_FINAL;
|
||||
return is_nte ? ALL_ASSIST_CARD_IDS_TRIAL : ALL_ASSIST_CARD_IDS_FINAL;
|
||||
}
|
||||
|
||||
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_trial) {
|
||||
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_nte) {
|
||||
static const unordered_map<uint16_t, AssistEffect> card_id_to_effect_final_only({
|
||||
{0x0018, /* 0x0049 */ AssistEffect::DICE_FEVER_PLUS},
|
||||
{0x0019, /* 0x004A */ AssistEffect::RICH_PLUS},
|
||||
@@ -116,7 +116,7 @@ AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_trial) {
|
||||
return card_id_to_effect.at(card_id);
|
||||
} catch (const out_of_range&) {
|
||||
}
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
try {
|
||||
return card_id_to_effect_final_only.at(card_id);
|
||||
} catch (const out_of_range&) {
|
||||
@@ -244,7 +244,7 @@ AssistEffect AssistServer::get_active_assist_by_index(size_t index) const {
|
||||
}
|
||||
|
||||
void AssistServer::populate_effects() {
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
this->assist_card_defs[z] = nullptr;
|
||||
this->assist_effects[z] = AssistEffect::NONE;
|
||||
@@ -253,7 +253,7 @@ void AssistServer::populate_effects() {
|
||||
uint16_t card_id = hes->assist_card_id == 0xFFFF
|
||||
? this->card_id_for_card_ref(hes->assist_card_ref)
|
||||
: hes->assist_card_id.load();
|
||||
this->assist_effects[z] = assist_effect_number_for_card_id(card_id, is_trial);
|
||||
this->assist_effects[z] = assist_effect_number_for_card_id(card_id, is_nte);
|
||||
if (this->assist_effects[z] != AssistEffect::NONE) {
|
||||
this->assist_card_defs[z] = this->definition_for_card_id(card_id);
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@ namespace Episode3 {
|
||||
|
||||
class Server;
|
||||
|
||||
const std::vector<uint16_t>& all_assist_card_ids(bool is_trial);
|
||||
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_trial);
|
||||
const std::vector<uint16_t>& all_assist_card_ids(bool is_nte);
|
||||
AssistEffect assist_effect_number_for_card_id(uint16_t card_id, bool is_nte);
|
||||
|
||||
class AssistServer {
|
||||
public:
|
||||
|
||||
+50
-50
@@ -49,7 +49,7 @@ void Card::init() {
|
||||
this->sc_def_entry = s->definition_for_card_id(ps->get_sc_card_id());
|
||||
this->sc_card_type = ps->get_sc_card_type();
|
||||
if (this->sc_card_ref == this->card_ref) {
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
if (s->map_and_rules->rules.char_hp) {
|
||||
this->max_hp = s->map_and_rules->rules.char_hp;
|
||||
this->current_hp = s->map_and_rules->rules.char_hp;
|
||||
@@ -77,7 +77,7 @@ void Card::init() {
|
||||
this->loc.direction = ps->start_facing_direction;
|
||||
// Ep3 NTE always sends 6xB4x0A at construction time; final only does for
|
||||
// non-SC cards
|
||||
if (s->options.is_trial() || (this->sc_card_ref != this->card_ref)) {
|
||||
if (s->options.is_nte() || (this->sc_card_ref != this->card_ref)) {
|
||||
this->send_6xB4x4E_4C_4D_if_needed();
|
||||
}
|
||||
}
|
||||
@@ -124,14 +124,14 @@ ssize_t Card::apply_abnormal_condition(
|
||||
int8_t random_percent) {
|
||||
auto s = this->server();
|
||||
auto log = s->log_stack(string_printf("apply_abnormal_condition(%02hhX, @%04X, @%04X, %hd, %hhd, %hhd): ", def_effect_index, target_card_ref, sc_card_ref, value, dice_roll_value, random_percent));
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
ssize_t existing_cond_index;
|
||||
for (size_t z = 0; z < this->action_chain.conditions.size(); z++) {
|
||||
const auto& cond = this->action_chain.conditions[z];
|
||||
if (cond.type == eff.type) {
|
||||
existing_cond_index = z;
|
||||
if ((!is_trial && eff.type == ConditionType::MV_BONUS) ||
|
||||
if ((!is_nte && eff.type == ConditionType::MV_BONUS) ||
|
||||
((cond.card_definition_effect_index == def_effect_index) &&
|
||||
(cond.card_ref == target_card_ref))) {
|
||||
break;
|
||||
@@ -207,7 +207,7 @@ ssize_t Card::apply_abnormal_condition(
|
||||
string cond_str = cond.str();
|
||||
log.debug("wrote condition %zd => %s", cond_index, cond_str.c_str());
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
s->card_special->update_condition_orders(this->shared_from_this());
|
||||
for (size_t z = 0; z < this->action_chain.conditions.size(); z++) {
|
||||
if (this->action_chain.conditions[z].type == ConditionType::NONE) {
|
||||
@@ -227,19 +227,19 @@ void Card::apply_ap_and_tp_adjust_assists_to_attack(
|
||||
int16_t* in_defense_power,
|
||||
int16_t* inout_attacker_tp) const {
|
||||
auto s = this->server();
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
uint8_t client_id = attacker_card->get_client_id();
|
||||
size_t num_assists = s->assist_server->compute_num_assist_effects_for_client(client_id);
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
switch (s->assist_server->get_active_assist_by_index(z)) {
|
||||
case AssistEffect::POWERLESS_RAIN:
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
*inout_attacker_ap = max<int16_t>(*inout_attacker_ap - 2, 0);
|
||||
}
|
||||
break;
|
||||
case AssistEffect::BRAVE_WIND:
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
*inout_attacker_ap = max<int16_t>(*inout_attacker_ap + 2, 0);
|
||||
}
|
||||
break;
|
||||
@@ -249,12 +249,12 @@ void Card::apply_ap_and_tp_adjust_assists_to_attack(
|
||||
}
|
||||
break;
|
||||
case AssistEffect::INFLUENCE:
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
*inout_attacker_ap += attacker_card->player_state()->count_set_cards_for_env_stats_nte();
|
||||
}
|
||||
break;
|
||||
case AssistEffect::FIX:
|
||||
if (!is_trial && attacker_card && !attacker_card->def_entry->def.is_sc()) {
|
||||
if (!is_nte && attacker_card && !attacker_card->def_entry->def.is_sc()) {
|
||||
*inout_attacker_ap = 2;
|
||||
}
|
||||
break;
|
||||
@@ -267,7 +267,7 @@ void Card::apply_ap_and_tp_adjust_assists_to_attack(
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
auto eff = s->assist_server->get_active_assist_by_index(z);
|
||||
if (eff == AssistEffect::AP_ABSORPTION) {
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
if (attacker_card->action_chain.chain.attack_medium == AttackMedium::TECH) {
|
||||
*inout_attacker_ap = *inout_attacker_ap + 2;
|
||||
} else if (attacker_card->action_chain.chain.attack_medium == AttackMedium::PHYSICAL) {
|
||||
@@ -299,7 +299,7 @@ void Card::commit_attack(
|
||||
int16_t* out_effective_damage) {
|
||||
auto s = this->server();
|
||||
auto log = s->log_stack(string_printf("commit_attack(@%04hX #%04hX, @%04hX #%04hX => %hd (str%zu)): ", this->get_card_ref(), this->get_card_id(), attacker_card->get_card_ref(), attacker_card->get_card_id(), damage, strike_number));
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
int16_t effective_damage = damage;
|
||||
s->card_special->adjust_attack_damage_due_to_conditions(
|
||||
@@ -315,7 +315,7 @@ void Card::commit_attack(
|
||||
int16_t exp_amount = clamp<int16_t>(s->team_exp[team_id], 0, effective_damage);
|
||||
s->team_exp[team_id] -= exp_amount;
|
||||
effective_damage -= exp_amount;
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
s->compute_team_dice_bonus(team_id);
|
||||
s->update_battle_state_flags_and_send_6xB4x03_if_needed();
|
||||
if (cmd) {
|
||||
@@ -368,7 +368,7 @@ void Card::commit_attack(
|
||||
|
||||
this->propagate_shared_hp_if_needed();
|
||||
|
||||
if (!is_trial && this->def_entry->def.is_sc()) {
|
||||
if (!is_nte && this->def_entry->def.is_sc()) {
|
||||
this->player_state()->stats.sc_damage_taken += effective_damage;
|
||||
}
|
||||
|
||||
@@ -508,14 +508,14 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
||||
|
||||
auto s = this->server();
|
||||
auto log = s->log_stack(string_printf("execute_attack(@%04X #%04X, @%04X #%04X): ", this->get_card_ref(), this->get_card_id(), attacker_card->get_card_ref(), attacker_card->get_card_id()));
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
this->card_flags &= 0xFFFFFFF3;
|
||||
int16_t attack_ap = this->action_metadata.attack_bonus;
|
||||
int16_t attack_tp = 0;
|
||||
int16_t defense_power = is_trial ? 0 : this->compute_defense_power_for_attacker_card(attacker_card);
|
||||
int16_t defense_power = is_nte ? 0 : this->compute_defense_power_for_attacker_card(attacker_card);
|
||||
log.debug("ap=%hd, tp=%hd", attack_ap, attack_tp);
|
||||
if (!is_trial && (attack_ap == 0) && !this->action_metadata.check_flag(0x20)) {
|
||||
if (!is_nte && (attack_ap == 0) && !this->action_metadata.check_flag(0x20)) {
|
||||
log.debug("ap == 0 and flag 0x20 not set");
|
||||
return;
|
||||
} else {
|
||||
@@ -540,7 +540,7 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
||||
|
||||
} else {
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
defense_power = this->compute_defense_power_for_attacker_card(attacker_card);
|
||||
log.debug("ap=%hd, tp=%hd, defense=%hd", attack_ap, attack_tp, defense_power);
|
||||
attacker_card->compute_action_chain_results(true, false);
|
||||
@@ -573,7 +573,7 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
||||
log.debug("target replaced with @%04hX #%04hX", target->get_card_ref(), target->get_card_id());
|
||||
}
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
if (unknown_a9 != 0) {
|
||||
preliminary_damage = 0;
|
||||
log.debug("a9 nonzero; preliminary_damage = 0");
|
||||
@@ -584,8 +584,8 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
||||
}
|
||||
}
|
||||
|
||||
cmd.effect.current_hp = is_trial ? attack_ap : min<int16_t>(attack_ap, 99);
|
||||
cmd.effect.ap = is_trial ? defense_power : min<int16_t>(defense_power, 99);
|
||||
cmd.effect.current_hp = is_nte ? attack_ap : min<int16_t>(attack_ap, 99);
|
||||
cmd.effect.ap = is_nte ? defense_power : min<int16_t>(defense_power, 99);
|
||||
cmd.effect.tp = attack_tp;
|
||||
|
||||
auto ps = this->player_state();
|
||||
@@ -603,7 +603,7 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
||||
target->commit_attack(0, attacker_card, &cmd, 0, nullptr);
|
||||
}
|
||||
|
||||
if (!is_trial && (this != target.get())) {
|
||||
if (!is_nte && (this != target.get())) {
|
||||
log.debug("target was replaced; committing zero-damage attack on original card");
|
||||
this->commit_attack(0, attacker_card, &cmd, 0, nullptr);
|
||||
}
|
||||
@@ -697,7 +697,7 @@ int32_t Card::move_to_location(const Location& loc) {
|
||||
this->card_flags = this->card_flags | 0x80;
|
||||
|
||||
// On NTE, traps happen now, not after the Move phase
|
||||
if (s->options.is_trial() &&
|
||||
if (s->options.is_nte() &&
|
||||
this->def_entry->def.is_sc() &&
|
||||
((s->overlay_state.tiles[loc.y][loc.x] & 0xF0) == 0x40)) {
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
@@ -785,7 +785,7 @@ void Card::send_6xB4x4E_4C_4D_if_needed(bool always_send) {
|
||||
auto& metadata = ps->set_card_action_metadatas->at(index);
|
||||
|
||||
auto s = this->server();
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
chain = this->action_chain;
|
||||
metadata = this->action_metadata;
|
||||
|
||||
@@ -906,7 +906,7 @@ void Card::clear_action_chain_and_metadata_and_most_flags() {
|
||||
void Card::compute_action_chain_results(bool apply_action_conditions, bool ignore_this_card_ap_tp) {
|
||||
auto s = this->server();
|
||||
auto log = s->log_stack(string_printf("compute_action_chain_results(@%04hX #%04hX): ", this->get_card_ref(), this->get_card_id()));
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
this->action_chain.compute_attack_medium(s);
|
||||
this->action_chain.chain.strike_count = 1;
|
||||
@@ -922,7 +922,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
int16_t effective_ap;
|
||||
int16_t effective_tp;
|
||||
StatSwapType stat_swap_type;
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
effective_ap = this->ap;
|
||||
effective_tp = this->tp;
|
||||
stat_swap_type = StatSwapType::NONE;
|
||||
@@ -934,7 +934,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
}
|
||||
|
||||
// This option doesn't exist in NTE
|
||||
ignore_this_card_ap_tp &= !is_trial;
|
||||
ignore_this_card_ap_tp &= !is_nte;
|
||||
|
||||
for (size_t z = 0; (!ignore_this_card_ap_tp && (z < 8) && (z < this->action_chain.chain.attack_action_card_ref_count)); z++) {
|
||||
auto ce = s->definition_for_card_ref(this->action_chain.chain.attack_action_card_refs[z]);
|
||||
@@ -972,11 +972,11 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
}
|
||||
|
||||
if (!this->action_chain.check_flag(0x10)) {
|
||||
this->action_chain.chain.effective_ap = is_trial ? effective_ap : min<int16_t>(effective_ap, 99);
|
||||
this->action_chain.chain.effective_ap = is_nte ? effective_ap : min<int16_t>(effective_ap, 99);
|
||||
log.debug("set chain effective_ap = %hd", this->action_chain.chain.effective_ap);
|
||||
}
|
||||
if (!this->action_chain.check_flag(0x20)) {
|
||||
this->action_chain.chain.effective_tp = is_trial ? effective_tp : min<int16_t>(effective_tp, 99);
|
||||
this->action_chain.chain.effective_tp = is_nte ? effective_tp : min<int16_t>(effective_tp, 99);
|
||||
log.debug("set chain effective_tp = %hd", this->action_chain.chain.effective_tp);
|
||||
}
|
||||
|
||||
@@ -992,37 +992,37 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
switch (s->assist_server->get_active_assist_by_index(z)) {
|
||||
case AssistEffect::POWERLESS_RAIN:
|
||||
if (!is_trial &&
|
||||
if (!is_nte &&
|
||||
this->card_type_is_sc_or_creature() &&
|
||||
(this->action_chain.chain.attack_medium == AttackMedium::PHYSICAL)) {
|
||||
this->action_chain.chain.ap_effect_bonus -= 2;
|
||||
}
|
||||
break;
|
||||
case AssistEffect::BRAVE_WIND:
|
||||
if (!is_trial &&
|
||||
if (!is_nte &&
|
||||
this->card_type_is_sc_or_creature() &&
|
||||
(this->action_chain.chain.attack_medium == AttackMedium::PHYSICAL)) {
|
||||
this->action_chain.chain.ap_effect_bonus += 2;
|
||||
}
|
||||
break;
|
||||
case AssistEffect::INFLUENCE:
|
||||
if (!is_trial && this->card_type_is_sc_or_creature()) {
|
||||
if (!is_nte && this->card_type_is_sc_or_creature()) {
|
||||
int16_t count = ps->count_set_refs();
|
||||
this->action_chain.chain.ap_effect_bonus += (count >> 1);
|
||||
}
|
||||
break;
|
||||
case AssistEffect::AP_ABSORPTION:
|
||||
if (!is_trial && (this->action_chain.chain.attack_medium == AttackMedium::TECH)) {
|
||||
if (!is_nte && (this->action_chain.chain.attack_medium == AttackMedium::TECH)) {
|
||||
this->action_chain.chain.tp_effect_bonus += 2;
|
||||
}
|
||||
break;
|
||||
case AssistEffect::FIX:
|
||||
if (is_trial && !this->def_entry->def.is_sc()) {
|
||||
if (is_nte && !this->def_entry->def.is_sc()) {
|
||||
this->action_chain.chain.ap_effect_bonus = 2 - this->action_chain.chain.card_ap;
|
||||
}
|
||||
break;
|
||||
case AssistEffect::TECH_FIELD:
|
||||
if (is_trial ? this->def_entry->def.is_sc() : this->card_type_is_sc_or_creature()) {
|
||||
if (is_nte ? this->def_entry->def.is_sc() : this->card_type_is_sc_or_creature()) {
|
||||
this->action_chain.chain.tp_effect_bonus += 2;
|
||||
}
|
||||
break;
|
||||
@@ -1093,7 +1093,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
break;
|
||||
case AssistEffect::VENGEANCE:
|
||||
if (!this->def_entry->def.is_sc()) {
|
||||
size_t denom = is_trial ? 2 : 3;
|
||||
size_t denom = is_nte ? 2 : 3;
|
||||
this->action_chain.chain.ap_effect_bonus += (s->team_num_ally_fcs_destroyed[this->team_id] / denom);
|
||||
}
|
||||
break;
|
||||
@@ -1113,7 +1113,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
log.debug("(unknown attack medium) damage = 0");
|
||||
}
|
||||
|
||||
this->action_chain.chain.damage = is_trial
|
||||
this->action_chain.chain.damage = is_nte
|
||||
? (damage * this->action_chain.chain.damage_multiplier)
|
||||
: min<int16_t>(damage * this->action_chain.chain.damage_multiplier, 99);
|
||||
log.debug("overall chain damage = %hd (base) * %hhd (mult) = %hhd", damage, this->action_chain.chain.damage_multiplier, this->action_chain.chain.damage);
|
||||
@@ -1122,7 +1122,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
auto this_sh = this->shared_from_this();
|
||||
s->card_special->apply_action_conditions(0x03, this_sh, this_sh, 2, nullptr);
|
||||
log.debug("applied action conditions (2)");
|
||||
if (!is_trial && this->action_chain.check_flag(0x100)) {
|
||||
if (!is_nte && this->action_chain.check_flag(0x100)) {
|
||||
this->action_chain.chain.damage = min<int16_t>(this->action_chain.chain.damage + 5, 99);
|
||||
log.debug("(has flag 0x100) chain damage = %hhd", this->action_chain.chain.damage);
|
||||
}
|
||||
@@ -1130,7 +1130,7 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
log.debug("skipped applying action conditions (2)");
|
||||
}
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
num_assists = s->assist_server->compute_num_assist_effects_for_client(this->get_client_id());
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
switch (s->assist_server->get_active_assist_by_index(z)) {
|
||||
@@ -1157,10 +1157,10 @@ void Card::compute_action_chain_results(bool apply_action_conditions, bool ignor
|
||||
}
|
||||
|
||||
void Card::unknown_802380C0() {
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
this->card_flags &= 0xFFFFF7FB;
|
||||
this->action_metadata.clear_flags(is_trial ? 0x10 : 0x30);
|
||||
this->action_chain.clear_flags(is_trial ? 0x40 : 0x140);
|
||||
this->action_metadata.clear_flags(is_nte ? 0x10 : 0x30);
|
||||
this->action_chain.clear_flags(is_nte ? 0x40 : 0x140);
|
||||
this->unknown_80237F98(0);
|
||||
}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ void Card::unknown_80237F98(bool require_condition_20_or_21) {
|
||||
}
|
||||
|
||||
this->compute_action_chain_results(1, false);
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
this->unknown_80236554(nullptr, nullptr);
|
||||
}
|
||||
if (should_send_updates) {
|
||||
@@ -1201,14 +1201,14 @@ void Card::unknown_80237F88() {
|
||||
}
|
||||
|
||||
void Card::draw_phase_before() {
|
||||
if (!this->server()->options.is_trial()) {
|
||||
if (!this->server()->options.is_nte()) {
|
||||
this->facing_direction = Direction::INVALID_FF;
|
||||
}
|
||||
this->server()->card_special->draw_phase_before_for_card(this->shared_from_this());
|
||||
}
|
||||
|
||||
void Card::action_phase_before() {
|
||||
if (!this->server()->options.is_trial()) {
|
||||
if (!this->server()->options.is_nte()) {
|
||||
this->clear_action_chain_and_metadata_and_most_flags();
|
||||
}
|
||||
this->server()->card_special->action_phase_before_for_card(this->shared_from_this());
|
||||
@@ -1280,7 +1280,7 @@ void Card::unknown_80237A90(const ActionState& pa, uint16_t action_card_ref) {
|
||||
this->facing_direction = pa.facing_direction;
|
||||
this->action_chain.add_attack_action_card_ref(action_card_ref, s);
|
||||
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
if (s->ruler_server->count_targets_with_rampage_and_not_pierce_nte(pa)) {
|
||||
this->action_chain.set_flags(0x02);
|
||||
}
|
||||
@@ -1350,7 +1350,7 @@ void Card::dice_phase_before() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
this->clear_action_chain_and_metadata_and_most_flags();
|
||||
}
|
||||
s->card_special->dice_phase_before_for_card(this->shared_from_this());
|
||||
@@ -1437,14 +1437,14 @@ void Card::unknown_802362D8(shared_ptr<Card> other_card) {
|
||||
void Card::apply_attack_result() {
|
||||
auto s = this->server();
|
||||
auto ps = this->player_state();
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
auto log = s->log_stack(string_printf("apply_attack_result(@%04hX #%04hX): ", this->get_card_ref(), this->get_card_id()));
|
||||
if (!this->action_chain.can_apply_attack()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
if (this->action_chain.check_flag(0x02)) {
|
||||
auto first_target_card = s->card_for_set_card_ref(this->action_chain.chain.target_card_refs[0]);
|
||||
if (first_target_card) {
|
||||
@@ -1580,7 +1580,7 @@ void Card::apply_attack_result() {
|
||||
this->action_chain.set_flags(4);
|
||||
this->card_flags |= 0x200;
|
||||
this->action_chain.clear_target_card_refs();
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto ps = s->player_states[client_id];
|
||||
if (ps) {
|
||||
|
||||
+185
-185
File diff suppressed because it is too large
Load Diff
@@ -341,10 +341,10 @@ const char* name_for_direction(Direction d) {
|
||||
}
|
||||
}
|
||||
|
||||
bool card_class_is_tech_like(CardClass cc, bool is_trial) {
|
||||
bool card_class_is_tech_like(CardClass cc, bool is_nte) {
|
||||
// NTE does not consider BOSS_TECH to be a tech-like card class, but that's
|
||||
// probably because that card class just doesn't exist on NTE.
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
return (cc == CardClass::TECH) || (cc == CardClass::PHOTON_BLAST);
|
||||
} else {
|
||||
return (cc == CardClass::TECH) || (cc == CardClass::PHOTON_BLAST) || (cc == CardClass::BOSS_TECH);
|
||||
@@ -2420,8 +2420,8 @@ shared_ptr<const MapDefinitionTrial> MapIndex::VersionedMap::trial() const {
|
||||
return this->trial_map;
|
||||
}
|
||||
|
||||
const std::string& MapIndex::VersionedMap::compressed(bool is_trial) const {
|
||||
if (is_trial) {
|
||||
const std::string& MapIndex::VersionedMap::compressed(bool is_nte) const {
|
||||
if (is_nte) {
|
||||
if (this->compressed_trial_data.empty()) {
|
||||
auto md = this->trial();
|
||||
this->compressed_trial_data = prs_compress(md.get(), sizeof(*md));
|
||||
|
||||
@@ -164,7 +164,7 @@ enum class CardClass : uint16_t {
|
||||
};
|
||||
|
||||
const char* name_for_card_class(CardClass cc);
|
||||
bool card_class_is_tech_like(CardClass cc, bool is_trial);
|
||||
bool card_class_is_tech_like(CardClass cc, bool is_nte);
|
||||
|
||||
enum class TargetMode : uint8_t {
|
||||
NONE = 0x00, // Used for defense cards, mags, shields, etc.
|
||||
@@ -1486,7 +1486,7 @@ public:
|
||||
VersionedMap(std::string&& compressed_data, uint8_t language);
|
||||
|
||||
std::shared_ptr<const MapDefinitionTrial> trial() const;
|
||||
const std::string& compressed(bool is_trial) const;
|
||||
const std::string& compressed(bool is_nte) const;
|
||||
|
||||
private:
|
||||
mutable std::shared_ptr<const MapDefinitionTrial> trial_map;
|
||||
|
||||
@@ -183,7 +183,7 @@ void DeckState::restart() {
|
||||
this->shuffle();
|
||||
}
|
||||
|
||||
void DeckState::do_mulligan(bool is_trial) {
|
||||
void DeckState::do_mulligan(bool is_nte) {
|
||||
for (size_t z = 0; z < this->entries.size(); z++) {
|
||||
if (this->entries[z].state == CardState::DISCARDED) {
|
||||
this->entries[z].state = CardState::DRAWABLE;
|
||||
@@ -191,7 +191,7 @@ void DeckState::do_mulligan(bool is_trial) {
|
||||
}
|
||||
this->draw_index = 1;
|
||||
|
||||
if (is_trial || this->shuffle_enabled) {
|
||||
if (is_nte || this->shuffle_enabled) {
|
||||
// Get the next 5 cards from the deck, and put the previous 5 cards after
|
||||
// them (so they will be shuffled back in).
|
||||
for (uint8_t z = 0; z < 5; z++) {
|
||||
|
||||
@@ -94,7 +94,7 @@ public:
|
||||
|
||||
void restart();
|
||||
void shuffle();
|
||||
void do_mulligan(bool is_trial);
|
||||
void do_mulligan(bool is_nte);
|
||||
|
||||
void print(FILE* stream, std::shared_ptr<const CardIndex> card_index = nullptr) const;
|
||||
|
||||
|
||||
+61
-61
@@ -91,7 +91,7 @@ void PlayerState::init() {
|
||||
this->sc_card = make_shared<Card>(this->deck_state->sc_card_id(), this->sc_card_ref, this->client_id, s);
|
||||
this->sc_card->init();
|
||||
this->draw_initial_hand();
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
this->send_set_card_updates(true);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
assist_card_id = s->card_id_for_card_ref(this->card_refs[6]);
|
||||
}
|
||||
|
||||
auto assist_effect = assist_effect_number_for_card_id(assist_card_id, s->options.is_trial());
|
||||
auto assist_effect = assist_effect_number_for_card_id(assist_card_id, s->options.is_nte());
|
||||
if ((assist_effect == AssistEffect::RESISTANCE) ||
|
||||
(assist_effect == AssistEffect::INDEPENDENT)) {
|
||||
this->assist_card_set_number = 0;
|
||||
@@ -176,7 +176,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
}
|
||||
|
||||
if (hand_index < 6) {
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
if (this->deck_state->draw_card_by_ref(this->discard_log_card_refs[0])) {
|
||||
this->pop_from_discard_log(0);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
|
||||
case AssistEffect::SKIP_SET:
|
||||
case AssistEffect::SKIP_ACT:
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
this->assist_delay_turns = 2;
|
||||
}
|
||||
break;
|
||||
@@ -253,13 +253,13 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
}
|
||||
}
|
||||
|
||||
bool is_trial = s->options.is_trial();
|
||||
if (!is_trial) {
|
||||
bool is_nte = s->options.is_nte();
|
||||
if (!is_nte) {
|
||||
this->on_cards_destroyed();
|
||||
}
|
||||
this->atk_points = min<uint8_t>(9, this->atk_points + (total_cost >> 1));
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
s->send_6xB4x05();
|
||||
}
|
||||
break;
|
||||
@@ -320,7 +320,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
s->update_battle_state_flags_and_send_6xB4x03_if_needed();
|
||||
|
||||
this->num_destroyed_fcs = 0;
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
s->team_num_cards_destroyed[this->team_id] = 0;
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
const auto other_ps = s->get_player_state(client_id);
|
||||
@@ -343,20 +343,20 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
break;
|
||||
|
||||
case AssistEffect::SLOW_TIME: {
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto other_ps = s->get_player_state(client_id);
|
||||
if (!other_ps) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_trial
|
||||
if (is_nte
|
||||
? (other_ps->assist_remaining_turns != 90 && other_ps->assist_remaining_turns != 99)
|
||||
: (other_ps->assist_remaining_turns < 10)) {
|
||||
other_ps->assist_remaining_turns = min<uint8_t>(9, other_ps->assist_remaining_turns << 1);
|
||||
}
|
||||
|
||||
for (ssize_t set_index = is_trial ? 0 : -1; set_index < 8; set_index++) {
|
||||
for (ssize_t set_index = is_nte ? 0 : -1; set_index < 8; set_index++) {
|
||||
auto card = (set_index == -1)
|
||||
? other_ps->get_sc_card()
|
||||
: other_ps->get_set_card(set_index);
|
||||
@@ -366,7 +366,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
if (cond.type == ConditionType::NONE) {
|
||||
continue;
|
||||
}
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
if (cond.remaining_turns < 49) {
|
||||
cond.remaining_turns <<= 1;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
other_ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
other_ps->send_set_card_updates();
|
||||
}
|
||||
@@ -385,33 +385,33 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
}
|
||||
|
||||
case AssistEffect::QUICK_TIME: {
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto other_ps = s->get_player_state(client_id);
|
||||
if (!other_ps) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_trial
|
||||
if (is_nte
|
||||
? (other_ps->assist_remaining_turns != 90 && other_ps->assist_remaining_turns != 99)
|
||||
: (other_ps->assist_remaining_turns < 10)) {
|
||||
other_ps->assist_remaining_turns = ((other_ps->assist_remaining_turns + 1) >> 1);
|
||||
}
|
||||
|
||||
for (ssize_t set_index = is_trial ? 0 : -1; set_index < 8; set_index++) {
|
||||
for (ssize_t set_index = is_nte ? 0 : -1; set_index < 8; set_index++) {
|
||||
auto card = (set_index == -1)
|
||||
? other_ps->get_sc_card()
|
||||
: other_ps->get_set_card(set_index);
|
||||
if (card) {
|
||||
for (size_t cond_index = 0; cond_index < 9; cond_index++) {
|
||||
auto& cond = card->action_chain.conditions[cond_index];
|
||||
if ((cond.type != ConditionType::NONE) && (cond.remaining_turns < (is_trial ? 99 : 10))) {
|
||||
if ((cond.type != ConditionType::NONE) && (cond.remaining_turns < (is_nte ? 99 : 10))) {
|
||||
cond.remaining_turns = (cond.remaining_turns + 1) >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
other_ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
other_ps->send_set_card_updates();
|
||||
}
|
||||
@@ -428,7 +428,7 @@ void PlayerState::apply_assist_card_effect_on_set(
|
||||
break;
|
||||
|
||||
case AssistEffect::SKIP_TURN:
|
||||
if (!s->options.is_trial() && (!setter_ps || (setter_ps->team_id == this->team_id))) {
|
||||
if (!s->options.is_nte() && (!setter_ps || (setter_ps->team_id == this->team_id))) {
|
||||
this->assist_delay_turns = 6;
|
||||
} else {
|
||||
this->assist_delay_turns = 5;
|
||||
@@ -450,7 +450,7 @@ void PlayerState::apply_dice_effects() {
|
||||
case AssistEffect::DICE_FEVER:
|
||||
for (size_t die_index = 0; die_index < 2; die_index++) {
|
||||
if (this->dice_results[die_index] > 0) {
|
||||
this->dice_results[die_index] = s->options.is_trial() ? 6 : 5;
|
||||
this->dice_results[die_index] = s->options.is_nte() ? 6 : 5;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -469,7 +469,7 @@ void PlayerState::apply_dice_effects() {
|
||||
}
|
||||
break;
|
||||
case AssistEffect::DICE_FEVER_PLUS:
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
break;
|
||||
}
|
||||
for (size_t die_index = 0; die_index < 2; die_index++) {
|
||||
@@ -607,7 +607,7 @@ void PlayerState::discard_and_redraw_hand() {
|
||||
this->discard_ref_from_hand(this->card_refs[0]);
|
||||
}
|
||||
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
G_Unknown_Ep3_6xB4x2C cmd;
|
||||
cmd.change_type = 3;
|
||||
cmd.client_id = this->client_id;
|
||||
@@ -631,7 +631,7 @@ bool PlayerState::discard_card_or_add_to_draw_pile(uint16_t card_ref, bool add_t
|
||||
this->card_refs[set_index + 8] = 0xFFFF;
|
||||
auto card = this->set_cards[set_index];
|
||||
if (card) {
|
||||
if (this->server()->options.is_trial()) {
|
||||
if (this->server()->options.is_nte()) {
|
||||
card->update_stats_on_destruction();
|
||||
this->set_cards[set_index].reset();
|
||||
} else {
|
||||
@@ -711,7 +711,7 @@ bool PlayerState::do_mulligan() {
|
||||
this->discard_ref_from_hand(this->card_refs[0]);
|
||||
}
|
||||
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
G_Unknown_Ep3_6xB4x2C cmd;
|
||||
cmd.change_type = 3;
|
||||
cmd.client_id = this->client_id;
|
||||
@@ -720,10 +720,10 @@ bool PlayerState::do_mulligan() {
|
||||
s->send(cmd);
|
||||
}
|
||||
|
||||
this->deck_state->do_mulligan(s->options.is_trial());
|
||||
this->deck_state->do_mulligan(s->options.is_nte());
|
||||
this->draw_hand(5);
|
||||
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
this->discard_log_card_refs.clear(0xFFFF);
|
||||
}
|
||||
return true;
|
||||
@@ -736,7 +736,7 @@ void PlayerState::draw_hand(ssize_t override_count) {
|
||||
size_t num_assists = s->assist_server->compute_num_assist_effects_for_client(this->client_id);
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
auto eff = s->assist_server->get_active_assist_by_index(z);
|
||||
if ((eff == AssistEffect::RICH_PLUS) && !s->options.is_trial()) {
|
||||
if ((eff == AssistEffect::RICH_PLUS) && !s->options.is_nte()) {
|
||||
count = 4 - this->get_hand_size();
|
||||
} else if (eff == AssistEffect::RICH) {
|
||||
count = 6 - this->get_hand_size();
|
||||
@@ -755,7 +755,7 @@ void PlayerState::draw_hand(ssize_t override_count) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!s->options.is_trial() && (s->get_setup_phase() == SetupPhase::MAIN_BATTLE)) {
|
||||
if (!s->options.is_nte() && (s->get_setup_phase() == SetupPhase::MAIN_BATTLE)) {
|
||||
this->stats.num_cards_drawn++;
|
||||
}
|
||||
}
|
||||
@@ -1095,18 +1095,18 @@ void PlayerState::on_cards_destroyed() {
|
||||
void PlayerState::replace_all_set_assists_with_random_assists() {
|
||||
auto s = this->server();
|
||||
|
||||
bool is_trial = s->options.is_trial();
|
||||
const auto& assist_card_ids = all_assist_card_ids(is_trial);
|
||||
bool is_nte = s->options.is_nte();
|
||||
const auto& assist_card_ids = all_assist_card_ids(is_nte);
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto other_ps = s->get_player_state(client_id);
|
||||
if (other_ps &&
|
||||
((other_ps->card_refs[6] != 0xFFFF) || (!is_trial && (other_ps->set_assist_card_id != 0xFFFF)))) {
|
||||
((other_ps->card_refs[6] != 0xFFFF) || (!is_nte && (other_ps->set_assist_card_id != 0xFFFF)))) {
|
||||
uint16_t card_id = 0x0130;
|
||||
while (card_id == 0x0130) { // God Whim
|
||||
size_t index = s->get_random(assist_card_ids.size());
|
||||
card_id = assist_card_ids[index];
|
||||
// In NTE, God Whim can use ANY card, even unobtainable cards.
|
||||
if (!is_trial && !this->god_whim_can_use_hidden_cards) {
|
||||
if (!is_nte && !this->god_whim_can_use_hidden_cards) {
|
||||
auto ce = s->definition_for_card_id(card_id);
|
||||
if (!ce || ce->def.cannot_drop) {
|
||||
continue;
|
||||
@@ -1133,7 +1133,7 @@ bool PlayerState::replace_assist_card_by_id(uint16_t card_id) {
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
s->assist_server->populate_effects();
|
||||
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto other_ps = s->get_player_state(client_id);
|
||||
if (other_ps) {
|
||||
@@ -1193,7 +1193,7 @@ bool PlayerState::return_set_card_to_hand1(uint16_t card_ref) {
|
||||
if (card && (card->get_card_ref() == card_ref)) {
|
||||
uint16_t set_card_ref = this->card_refs[set_index + 8];
|
||||
this->card_refs[set_index + 8] = 0xFFFF;
|
||||
if (this->server()->options.is_trial()) {
|
||||
if (this->server()->options.is_nte()) {
|
||||
card->update_stats_on_destruction();
|
||||
this->set_cards[set_index].reset();
|
||||
} else {
|
||||
@@ -1238,12 +1238,12 @@ uint8_t PlayerState::roll_dice_with_effects(size_t num_dice) {
|
||||
|
||||
void PlayerState::send_set_card_updates(bool always_send) {
|
||||
auto s = this->server();
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
uint16_t mask = 0;
|
||||
if (this->sc_card) {
|
||||
this->sc_card->send_6xB4x4E_4C_4D_if_needed(always_send);
|
||||
} else if (is_trial) {
|
||||
} else if (is_nte) {
|
||||
this->send_6xB4x0A_for_set_card(0);
|
||||
} else {
|
||||
this->set_card_action_chains->at(0).clear();
|
||||
@@ -1255,7 +1255,7 @@ void PlayerState::send_set_card_updates(bool always_send) {
|
||||
auto card = this->set_cards[set_index];
|
||||
if (card) {
|
||||
card->send_6xB4x4E_4C_4D_if_needed(always_send);
|
||||
} else if (is_trial) {
|
||||
} else if (is_nte) {
|
||||
this->send_6xB4x0A_for_set_card(set_index + 1);
|
||||
} else {
|
||||
mask |= 1 << (set_index + 1);
|
||||
@@ -1264,7 +1264,7 @@ void PlayerState::send_set_card_updates(bool always_send) {
|
||||
}
|
||||
}
|
||||
|
||||
// mask will always be 0 here if is_trial is true
|
||||
// mask will always be 0 here if is_nte is true
|
||||
if (mask && !s->get_should_copy_prev_states_to_current_states()) {
|
||||
G_ClearSetCardConditions_Ep3_6xB4x4F cmd;
|
||||
cmd.client_id = this->client_id;
|
||||
@@ -1341,7 +1341,7 @@ bool PlayerState::set_card_from_hand(
|
||||
|
||||
this->deck_state->set_card_ref_in_play(card_ref);
|
||||
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
auto ce = s->definition_for_card_ref(card_ref);
|
||||
if (ce->def.type == CardType::ITEM || ce->def.type == CardType::CREATURE) {
|
||||
if ((card_index < 7) || (card_index >= 15)) {
|
||||
@@ -1379,7 +1379,7 @@ bool PlayerState::set_card_from_hand(
|
||||
target_ps->assist_card_set_number = s->next_assist_card_set_number++;
|
||||
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
target_ps->apply_assist_card_effect_on_set(this->shared_from_this());
|
||||
}
|
||||
target_ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
@@ -1396,7 +1396,7 @@ bool PlayerState::set_card_from_hand(
|
||||
other_ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
}
|
||||
}
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
target_ps->apply_assist_card_effect_on_set(this->shared_from_this());
|
||||
}
|
||||
}
|
||||
@@ -1408,13 +1408,13 @@ bool PlayerState::set_card_from_hand(
|
||||
|
||||
this->compute_total_set_cards_cost();
|
||||
s->card_special->on_card_set(this->shared_from_this(), card_ref);
|
||||
if (!is_trial && (ce->def.type == CardType::ASSIST)) {
|
||||
if (!is_nte && (ce->def.type == CardType::ASSIST)) {
|
||||
s->check_for_destroyed_cards_and_send_6xB4x05_6xB4x02();
|
||||
}
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
s->send_6xB4x05();
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
G_Unknown_Ep3_6xB4x4A cmd;
|
||||
cmd.card_refs.clear(0xFFFF);
|
||||
cmd.card_refs[0] = card_ref;
|
||||
@@ -1596,14 +1596,14 @@ void PlayerState::update_hand_and_equip_state_and_send_6xB4x02_if_needed(
|
||||
|
||||
void PlayerState::set_random_assist_card_from_hand_for_free() {
|
||||
auto s = this->server();
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
vector<uint16_t> candidate_card_refs;
|
||||
for (size_t hand_index = 0; hand_index < 6; hand_index++) {
|
||||
uint16_t card_ref = this->card_refs[hand_index];
|
||||
auto ce = s->definition_for_card_ref(card_ref);
|
||||
if (ce && (ce->def.type == CardType::ASSIST) &&
|
||||
(assist_effect_number_for_card_id(ce->def.card_id, is_trial) != AssistEffect::SQUEEZE)) {
|
||||
(assist_effect_number_for_card_id(ce->def.card_id, is_nte) != AssistEffect::SQUEEZE)) {
|
||||
candidate_card_refs.emplace_back(card_ref);
|
||||
}
|
||||
}
|
||||
@@ -1660,7 +1660,7 @@ void PlayerState::send_6xB4x04_if_needed(bool always_send) {
|
||||
if (always_send || (cmd.card_statuses != *this->card_short_statuses)) {
|
||||
auto s = this->server();
|
||||
*this->card_short_statuses = cmd.card_statuses;
|
||||
if (s->options.is_trial() || !s->get_should_copy_prev_states_to_current_states()) {
|
||||
if (s->options.is_nte() || !s->get_should_copy_prev_states_to_current_states()) {
|
||||
s->send(cmd);
|
||||
}
|
||||
}
|
||||
@@ -1754,7 +1754,7 @@ int16_t PlayerState::get_assist_turns_remaining() {
|
||||
|
||||
bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
auto s = this->server();
|
||||
bool is_trial = s->options.is_trial();
|
||||
bool is_nte = s->options.is_nte();
|
||||
|
||||
auto attacker_card = s->card_for_set_card_ref(pa.attacker_card_ref);
|
||||
if (attacker_card) {
|
||||
@@ -1762,7 +1762,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
}
|
||||
|
||||
auto action_type = s->ruler_server->get_pending_action_type(pa);
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
this->subtract_or_check_atk_or_def_points_for_action(pa, 1);
|
||||
}
|
||||
|
||||
@@ -1780,7 +1780,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
do {
|
||||
card->unknown_80237A90(pa, pa.action_card_refs[z]);
|
||||
card->unknown_802379BC(pa.action_card_refs[z]);
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
if (pa.action_card_refs[z] != 0xFFFF) {
|
||||
cmd.card_refs[z] = pa.action_card_refs[z];
|
||||
cmd.entry_count++;
|
||||
@@ -1788,7 +1788,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
auto ce = s->definition_for_card_ref(pa.action_card_refs[z]);
|
||||
if (ce) {
|
||||
auto card_class = ce->def.card_class();
|
||||
if (card_class_is_tech_like(card_class, is_trial)) {
|
||||
if (card_class_is_tech_like(card_class, is_nte)) {
|
||||
this->stats.num_tech_cards_set++;
|
||||
}
|
||||
if ((card_class == CardClass::ATTACK_ACTION) ||
|
||||
@@ -1812,7 +1812,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
auto target_card = s->card_for_set_card_ref(pa.target_card_refs[z]);
|
||||
if (target_card) {
|
||||
target_card->unknown_802379DC(pa);
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
if (this->client_id == target_card->get_client_id()) {
|
||||
this->stats.defense_actions_set_on_self++;
|
||||
} else {
|
||||
@@ -1822,7 +1822,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
G_Unknown_Ep3_6xB4x4A cmd;
|
||||
cmd.card_refs.clear(0xFFFF);
|
||||
cmd.client_id = this->client_id;
|
||||
@@ -1832,7 +1832,7 @@ bool PlayerState::set_action_cards_for_action_state(const ActionState& pa) {
|
||||
s->send(cmd);
|
||||
}
|
||||
}
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
this->subtract_or_check_atk_or_def_points_for_action(pa, 1);
|
||||
}
|
||||
for (size_t z = 0; (z < pa.action_card_refs.size()) && (pa.action_card_refs[z] != 0xFFFF); z++) {
|
||||
@@ -1872,7 +1872,7 @@ void PlayerState::dice_phase_before() {
|
||||
this->assist_flags &= (AssistFlag::HAS_WON_BATTLE |
|
||||
AssistFlag::WINNER_DECIDED_BY_DEFEAT |
|
||||
AssistFlag::WINNER_DECIDED_BY_RANDOM |
|
||||
(this->server()->options.is_trial() ? AssistFlag::NONE : AssistFlag::ELIGIBLE_FOR_DICE_BOOST));
|
||||
(this->server()->options.is_nte() ? AssistFlag::NONE : AssistFlag::ELIGIBLE_FOR_DICE_BOOST));
|
||||
this->set_assist_flags_from_assist_effects();
|
||||
this->update_hand_and_equip_state_and_send_6xB4x02_if_needed(0);
|
||||
this->send_set_card_updates();
|
||||
@@ -1900,7 +1900,7 @@ void PlayerState::handle_homesick_assist_effect_from_bomb(shared_ptr<Card> card)
|
||||
this->return_set_card_to_hand2(card_ref);
|
||||
this->log_discard(card_ref, 1);
|
||||
// On NTE, the card is destroyed immediately
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
this->set_cards[set_index]->update_stats_on_destruction();
|
||||
this->set_cards[set_index].reset();
|
||||
} else {
|
||||
@@ -1913,7 +1913,7 @@ void PlayerState::handle_homesick_assist_effect_from_bomb(shared_ptr<Card> card)
|
||||
if (this->deck_state->set_card_ref_drawable_next(card_ref)) {
|
||||
this->log_discard(card_ref, 1);
|
||||
// On NTE, the card is destroyed immediately
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
this->set_cards[set_index]->update_stats_on_destruction();
|
||||
this->set_cards[set_index].reset();
|
||||
} else {
|
||||
@@ -1930,7 +1930,7 @@ void PlayerState::apply_main_die_assist_effects(uint8_t* die_value) const {
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
switch (s->assist_server->get_active_assist_by_index(z)) {
|
||||
case AssistEffect::DICE_FEVER:
|
||||
*die_value = s->options.is_trial() ? 6 : 5;
|
||||
*die_value = s->options.is_nte() ? 6 : 5;
|
||||
break;
|
||||
case AssistEffect::DICE_HALF:
|
||||
*die_value = ((*die_value + 1) >> 1);
|
||||
@@ -1939,7 +1939,7 @@ void PlayerState::apply_main_die_assist_effects(uint8_t* die_value) const {
|
||||
(*die_value)++;
|
||||
break;
|
||||
case AssistEffect::DICE_FEVER_PLUS:
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
*die_value = 6;
|
||||
}
|
||||
break;
|
||||
@@ -2027,7 +2027,7 @@ void PlayerState::roll_main_dice_or_apply_after_effects() {
|
||||
this->dice_results[0] = this->atk_points;
|
||||
this->dice_results[1] = this->def_points;
|
||||
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
this->atk_bonuses = this->atk_points - atk_before_bonuses;
|
||||
this->def_bonuses = this->def_points - def_before_bonuses;
|
||||
}
|
||||
@@ -2035,7 +2035,7 @@ void PlayerState::roll_main_dice_or_apply_after_effects() {
|
||||
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);
|
||||
if (!s->options.is_trial()) {
|
||||
if (!s->options.is_nte()) {
|
||||
this->atk_bonuses = this->atk_points - atk_before_bonuses;
|
||||
this->def_bonuses = this->def_points - def_before_bonuses;
|
||||
}
|
||||
@@ -2091,7 +2091,7 @@ void PlayerState::send_6xB4x0A_for_set_card(size_t set_index) {
|
||||
this->set_card_action_chains->at(set_index) = this->unknown_a12;
|
||||
this->set_card_action_metadatas->at(set_index) = this->unknown_a13;
|
||||
|
||||
if (s->options.is_trial()) {
|
||||
if (s->options.is_nte()) {
|
||||
G_UpdateActionChainAndMetadata_Ep3NTE_6xB4x0A cmd;
|
||||
cmd.client_id = this->client_id;
|
||||
cmd.index = set_index;
|
||||
|
||||
@@ -439,7 +439,7 @@ void ActionChainWithConds::compute_attack_medium(shared_ptr<Server> server) {
|
||||
if (!ce) {
|
||||
continue;
|
||||
}
|
||||
if (card_class_is_tech_like(ce->def.card_class(), server->options.is_trial())) {
|
||||
if (card_class_is_tech_like(ce->def.card_class(), server->options.is_nte())) {
|
||||
this->chain.attack_medium = AttackMedium::TECH;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-37
@@ -243,8 +243,8 @@ bool RulerServer::card_has_pierce_or_rampage(
|
||||
*out_has_rampage = false;
|
||||
|
||||
bool ret;
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
if (is_trial) {
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
if (is_nte) {
|
||||
ret = true;
|
||||
} else {
|
||||
if (cond_type == ConditionType::NONE) {
|
||||
@@ -292,7 +292,7 @@ bool RulerServer::card_has_pierce_or_rampage(
|
||||
auto ce = this->definition_for_card_ref(sc_status.card_ref);
|
||||
// This appears to be an NTE bug: Major Pierce doesn't work on Arkz SCs.
|
||||
if (ce &&
|
||||
(!is_trial || (ce->def.type == CardType::HUNTERS_SC)) &&
|
||||
(!is_nte || (ce->def.type == CardType::HUNTERS_SC)) &&
|
||||
(this->get_card_ref_max_hp(sc_status.card_ref) <= sc_status.current_hp * 2)) {
|
||||
return ret;
|
||||
}
|
||||
@@ -382,10 +382,10 @@ bool RulerServer::attack_action_has_pierce_and_not_rampage(const ActionState& pa
|
||||
return false;
|
||||
}
|
||||
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
auto attack_medium = this->get_attack_medium(pa);
|
||||
auto stat = this->short_statuses[client_id];
|
||||
if (!stat || (!is_trial && !this->card_exists_by_status(stat->at(0))) || (stat->at(0).card_ref == 0xFFFF)) {
|
||||
if (!stat || (!is_nte && !this->card_exists_by_status(stat->at(0))) || (stat->at(0).card_ref == 0xFFFF)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ bool RulerServer::attack_action_has_pierce_and_not_rampage(const ActionState& pa
|
||||
return nullopt;
|
||||
};
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
auto res = check_chain();
|
||||
if (res.has_value()) {
|
||||
return res.value();
|
||||
@@ -457,7 +457,7 @@ bool RulerServer::attack_action_has_pierce_and_not_rampage(const ActionState& pa
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
auto res = check_chain();
|
||||
if (res.has_value()) {
|
||||
return res.value();
|
||||
@@ -663,7 +663,7 @@ bool RulerServer::card_ref_has_free_maneuver(uint16_t card_ref) const {
|
||||
}
|
||||
|
||||
bool RulerServer::card_ref_is_aerial(uint16_t card_ref) const {
|
||||
if (!this->server()->options.is_trial()) {
|
||||
if (!this->server()->options.is_nte()) {
|
||||
const auto* stat = this->short_status_for_card_ref(card_ref);
|
||||
if (!stat || !this->card_exists_by_status(*stat)) {
|
||||
return false;
|
||||
@@ -822,13 +822,13 @@ bool RulerServer::check_pierce_and_rampage(
|
||||
uint16_t action_card_ref,
|
||||
uint8_t def_effect_index,
|
||||
AttackMedium attack_medium) const {
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
|
||||
// Note: NTE doesn't set this to zero; it apparently expects the caller to.
|
||||
*out_has_pierce = false;
|
||||
|
||||
const auto* card_short_status = this->short_status_for_card_ref(card_ref);
|
||||
if (!is_trial && (cond_type == ConditionType::NONE)) {
|
||||
if (!is_nte && (cond_type == ConditionType::NONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ bool RulerServer::check_pierce_and_rampage(
|
||||
client_short_statuses = nullptr;
|
||||
}
|
||||
|
||||
bool apply_check_result = (is_trial ||
|
||||
bool apply_check_result = (is_nte ||
|
||||
this->check_usability_or_apply_condition_for_card_refs(
|
||||
action_card_ref, attacker_card_ref, card_ref, def_effect_index, attack_medium));
|
||||
|
||||
@@ -952,7 +952,7 @@ bool RulerServer::check_usability_or_condition_apply(
|
||||
log.debug("ce1 missing");
|
||||
return false;
|
||||
}
|
||||
if (!s->options.is_trial() && (ce1->def.type == CardType::ITEM) && this->card_id_is_boss_sc(card_id2)) {
|
||||
if (!s->options.is_nte() && (ce1->def.type == CardType::ITEM) && this->card_id_is_boss_sc(card_id2)) {
|
||||
log.debug("ce1 is item and card_id2 is boss sc");
|
||||
return false;
|
||||
}
|
||||
@@ -989,7 +989,7 @@ bool RulerServer::check_usability_or_condition_apply(
|
||||
// second should not be given, so we'd return true if the criterion passes. If
|
||||
// neither of these cases apply, we should return false as a failsafe even if
|
||||
// the criterion passes. NTE did not have such a check.
|
||||
bool ret = s->options.is_trial() || (!(def_effect_index & 0x80) || (client_id1 == client_id2)) || (client_id2 == 0xFF);
|
||||
bool ret = s->options.is_nte() || (!(def_effect_index & 0x80) || (client_id1 == client_id2)) || (client_id2 == 0xFF);
|
||||
switch (criterion_code) {
|
||||
case CriterionCode::NONE:
|
||||
return ret;
|
||||
@@ -1397,7 +1397,7 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
|
||||
cost_bias++;
|
||||
}
|
||||
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
if (pa.action_card_refs[0] == 0xFFFF) {
|
||||
total_cost = cost_bias + 1;
|
||||
} else {
|
||||
@@ -1413,14 +1413,14 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
|
||||
return 99;
|
||||
}
|
||||
total_cost += (ce->def.self_cost + cost_bias);
|
||||
if (card_class_is_tech_like(ce->def.card_class(), s->options.is_trial())) {
|
||||
if (card_class_is_tech_like(ce->def.card_class(), s->options.is_nte())) {
|
||||
total_cost += tech_cost_bias;
|
||||
}
|
||||
total_ally_cost += ce->def.ally_cost;
|
||||
if (this->card_has_mighty_knuckle(pa.action_card_refs[z])) {
|
||||
has_mighty_knuckle = true;
|
||||
}
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(pa.client_id);
|
||||
for (size_t w = 0; w < num_assists; w++) {
|
||||
auto assist_effect = this->assist_server->get_active_assist_by_index(w);
|
||||
@@ -1437,9 +1437,9 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
|
||||
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(pa.client_id);
|
||||
for (size_t w = 0; w < num_assists; w++) {
|
||||
auto assist_effect = this->assist_server->get_active_assist_by_index(w);
|
||||
if (is_trial && (assist_effect == AssistEffect::INFLATION)) {
|
||||
if (is_nte && (assist_effect == AssistEffect::INFLATION)) {
|
||||
assist_cost_bias++;
|
||||
} else if (is_trial && (assist_effect == AssistEffect::DEFLATION)) {
|
||||
} else if (is_nte && (assist_effect == AssistEffect::DEFLATION)) {
|
||||
assist_cost_bias--;
|
||||
} else if ((assist_effect == AssistEffect::BATTLE_ROYALE) &&
|
||||
(pa.action_card_refs[0] == 0xFFFF)) {
|
||||
@@ -1450,7 +1450,7 @@ uint16_t RulerServer::compute_attack_or_defense_costs(
|
||||
|
||||
if (has_mighty_knuckle) {
|
||||
if (!allow_mighty_knuckle) {
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
final_cost = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -1495,7 +1495,7 @@ bool RulerServer::compute_effective_range_and_target_mode_for_attack(
|
||||
auto target_mode = ce->def.target_mode;
|
||||
if (this->card_ref_or_sc_has_fixed_range(pa.attacker_card_ref)) {
|
||||
card_id = this->card_id_for_card_ref(pa.attacker_card_ref);
|
||||
if (!this->server()->options.is_trial()) {
|
||||
if (!this->server()->options.is_nte()) {
|
||||
auto sc_ce = this->definition_for_card_id(card_id);
|
||||
if (sc_ce && (static_cast<uint8_t>(target_mode) < 6)) {
|
||||
target_mode = sc_ce->def.target_mode;
|
||||
@@ -1679,8 +1679,8 @@ int32_t RulerServer::error_code_for_client_setting_card(
|
||||
return -0x76;
|
||||
}
|
||||
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
if (!is_trial && !this->is_card_ref_in_hand(card_ref)) {
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
if (!is_nte && !this->is_card_ref_in_hand(card_ref)) {
|
||||
return -0x5E;
|
||||
}
|
||||
|
||||
@@ -1720,8 +1720,8 @@ int32_t RulerServer::error_code_for_client_setting_card(
|
||||
}
|
||||
|
||||
// Check for assists that can only be set on yourself
|
||||
auto eff = assist_effect_number_for_card_id(ce->def.card_id, is_trial);
|
||||
if (((eff == AssistEffect::LEGACY) || (!is_trial && (eff == AssistEffect::EXCHANGE))) &&
|
||||
auto eff = assist_effect_number_for_card_id(ce->def.card_id, is_nte);
|
||||
if (((eff == AssistEffect::LEGACY) || (!is_nte && (eff == AssistEffect::EXCHANGE))) &&
|
||||
(assist_target_client_id != 0xFF) &&
|
||||
(assist_target_client_id != client_id_for_card_ref(card_ref))) {
|
||||
return -0x75;
|
||||
@@ -1760,7 +1760,7 @@ int32_t RulerServer::error_code_for_client_setting_card(
|
||||
|
||||
if ((ce->def.type == CardType::ITEM) || (ce->def.type == CardType::CREATURE)) {
|
||||
int16_t existing_fcs_cost = 0;
|
||||
bool limit_summoning_by_count = !is_trial &&
|
||||
bool limit_summoning_by_count = !is_nte &&
|
||||
this->find_condition_on_card_ref(short_statuses->at(0).card_ref, ConditionType::FC_LIMIT_BY_COUNT);
|
||||
for (size_t z = 7; z < 15; z++) {
|
||||
const auto& this_status = short_statuses->at(z);
|
||||
@@ -1800,7 +1800,7 @@ int32_t RulerServer::error_code_for_client_setting_card(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
// It seems NTE assumes that teams always start on the same ends of the
|
||||
// map; non-NTE removes this restriction.
|
||||
if (team_id == 1) {
|
||||
@@ -2088,7 +2088,7 @@ uint8_t RulerServer::get_card_ref_max_hp(uint16_t card_ref) const {
|
||||
return 0;
|
||||
} else if (((ce->def.type == CardType::HUNTERS_SC) || (ce->def.type == CardType::ARKZ_SC)) &&
|
||||
(this->map_and_rules->rules.char_hp > 0) &&
|
||||
(this->server()->options.is_trial() || !this->card_ref_is_boss_sc(card_ref))) {
|
||||
(this->server()->options.is_nte() || !this->card_ref_is_boss_sc(card_ref))) {
|
||||
return this->map_and_rules->rules.char_hp;
|
||||
} else {
|
||||
return ce->def.hp.stat;
|
||||
@@ -2237,7 +2237,7 @@ bool RulerServer::is_attack_valid(const ActionState& pa) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this->server()->options.is_trial() && (attacker_card_status->card_flags & 2)) {
|
||||
if (!this->server()->options.is_nte() && (attacker_card_status->card_flags & 2)) {
|
||||
this->error_code3 = -0x60;
|
||||
return false;
|
||||
}
|
||||
@@ -2354,8 +2354,8 @@ bool RulerServer::is_attack_or_defense_valid(const ActionState& pa) {
|
||||
}
|
||||
|
||||
// NTE apparently does not check the action's cost here
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
int16_t cost = is_trial ? 0 : this->compute_attack_or_defense_costs(pa, false, nullptr);
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
int16_t cost = is_nte ? 0 : this->compute_attack_or_defense_costs(pa, false, nullptr);
|
||||
|
||||
switch (this->get_pending_action_type(pa)) {
|
||||
case ActionType::ATTACK:
|
||||
@@ -2451,7 +2451,7 @@ bool RulerServer::is_defense_valid(const ActionState& pa) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->server()->options.is_trial() &&
|
||||
if (!this->server()->options.is_nte() &&
|
||||
(this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::HOLD) ||
|
||||
this->find_condition_on_card_ref(pa.target_card_refs[0], ConditionType::CANNOT_DEFEND))) {
|
||||
this->error_code3 = -0x63;
|
||||
@@ -2482,7 +2482,7 @@ size_t RulerServer::max_move_distance_for_card_ref(uint32_t card_ref) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (this->server()->options.is_trial()) {
|
||||
if (this->server()->options.is_nte()) {
|
||||
if (ce->def.type == CardType::ITEM) {
|
||||
return ce->def.mv.stat;
|
||||
}
|
||||
@@ -2612,14 +2612,14 @@ void RulerServer::replace_D1_D2_rank_cards_with_Attack(
|
||||
}
|
||||
|
||||
AttackMedium RulerServer::get_attack_medium(const ActionState& pa) const {
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
for (size_t z = 0; z < 8; z++) {
|
||||
uint16_t card_ref = pa.action_card_refs[z];
|
||||
if (card_ref == 0xFFFF) {
|
||||
return AttackMedium::PHYSICAL;
|
||||
}
|
||||
auto ce = this->definition_for_card_ref(card_ref);
|
||||
if (ce && card_class_is_tech_like(ce->def.card_class(), is_trial)) {
|
||||
if (ce && card_class_is_tech_like(ce->def.card_class(), is_nte)) {
|
||||
return AttackMedium::TECH;
|
||||
}
|
||||
}
|
||||
@@ -2640,10 +2640,10 @@ int32_t RulerServer::set_cost_for_card(uint8_t client_id, uint16_t card_ref) con
|
||||
return -0x7D;
|
||||
}
|
||||
|
||||
bool is_trial = this->server()->options.is_trial();
|
||||
bool is_nte = this->server()->options.is_nte();
|
||||
auto short_statuses = this->short_statuses[client_id];
|
||||
int32_t ret = ce->def.self_cost;
|
||||
if (!is_trial &&
|
||||
if (!is_nte &&
|
||||
short_statuses &&
|
||||
this->card_exists_by_status(short_statuses->at(0)) &&
|
||||
this->find_condition_on_card_ref(short_statuses->at(0).card_ref, ConditionType::UNKNOWN_69)) {
|
||||
@@ -2678,7 +2678,7 @@ int32_t RulerServer::set_cost_for_card(uint8_t client_id, uint16_t card_ref) con
|
||||
auto eff = this->assist_server->get_active_assist_by_index(z);
|
||||
if (eff == AssistEffect::LAND_PRICE) {
|
||||
// In NTE, Land Price is apparently 2x rather than 1.5x
|
||||
ret = is_trial ? (ret << 1) : (ret + (ret >> 1));
|
||||
ret = is_nte ? (ret << 1) : (ret + (ret >> 1));
|
||||
} else if (eff == AssistEffect::DEFLATION) {
|
||||
ret = max<int32_t>(0, ret - 1);
|
||||
} else if (eff == AssistEffect::INFLATION) {
|
||||
|
||||
+65
-65
@@ -205,7 +205,7 @@ void Server::send(const void* data, size_t size, uint8_t command, bool enable_ma
|
||||
|
||||
string masked_data;
|
||||
if (enable_masking &&
|
||||
!this->options.is_trial() &&
|
||||
!this->options.is_nte() &&
|
||||
!(this->options.behavior_flags & BehaviorFlag::DISABLE_MASKING) &&
|
||||
(size >= 8)) {
|
||||
masked_data.assign(reinterpret_cast<const char*>(data), size);
|
||||
@@ -235,7 +235,7 @@ void Server::send(const void* data, size_t size, uint8_t command, bool enable_ma
|
||||
void Server::send_6xB4x46() const {
|
||||
// Note: This function is not part of the original implementation; it was
|
||||
// factored out from its callsites in this file and the strings were changed.
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
G_ServerVersionStrings_Ep3NTE_6xB4x46 cmd;
|
||||
cmd.version_signature.encode(VERSION_SIGNATURE_NTE, 1);
|
||||
cmd.date_str1.encode(format_time(this->options.card_index->definitions_mtime() * 1000000), 1);
|
||||
@@ -256,10 +256,10 @@ void Server::send_6xB4x46() const {
|
||||
}
|
||||
}
|
||||
|
||||
string Server::prepare_6xB6x41_map_definition(shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_trial) {
|
||||
string Server::prepare_6xB6x41_map_definition(shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_nte) {
|
||||
auto vm = map->version(language);
|
||||
|
||||
const auto& compressed = vm->compressed(is_trial);
|
||||
const auto& compressed = vm->compressed(is_nte);
|
||||
|
||||
StringWriter w;
|
||||
uint32_t subcommand_size = (compressed.size() + sizeof(G_MapData_Ep3_6xB6x41) + 3) & (~3);
|
||||
@@ -280,7 +280,7 @@ void Server::send_commands_for_joining_spectator(Channel& ch) const {
|
||||
}
|
||||
|
||||
if (this->last_chosen_map) {
|
||||
string data = this->prepare_6xB6x41_map_definition(this->last_chosen_map, ch.language, this->options.is_trial());
|
||||
string data = this->prepare_6xB6x41_map_definition(this->last_chosen_map, ch.language, this->options.is_nte());
|
||||
this->log().info("Sending %c version of map %08" PRIX32, char_for_language_code(ch.language), this->last_chosen_map->map_number);
|
||||
ch.send(0x6C, 0x00, data);
|
||||
}
|
||||
@@ -516,7 +516,7 @@ bool Server::check_for_battle_end() {
|
||||
}
|
||||
}
|
||||
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
if (teams_defeated[0] || teams_defeated[1]) {
|
||||
ret = true;
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
@@ -548,7 +548,7 @@ bool Server::check_for_battle_end() {
|
||||
|
||||
} else { // Not DEFEAT_TEAM
|
||||
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
uint8_t loser_team_id = 0;
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
@@ -738,7 +738,7 @@ void Server::destroy_cards_with_zero_hp() {
|
||||
for (ssize_t set_index = -1; set_index < 8; set_index++) {
|
||||
auto card = (set_index < 0) ? ps->get_sc_card() : ps->get_set_card(set_index);
|
||||
if (card && !(card->card_flags & 2) && (card->get_current_hp() < 1)) {
|
||||
card->destroy_set_card(this->options.is_trial() ? nullptr : card->w_destroyer_sc_card.lock());
|
||||
card->destroy_set_card(this->options.is_nte() ? nullptr : card->w_destroyer_sc_card.lock());
|
||||
any_card_destroyed = true;
|
||||
}
|
||||
}
|
||||
@@ -784,7 +784,7 @@ void Server::dice_phase_after() {
|
||||
size_t num_assists = this->assist_server->compute_num_assist_effects_for_client(client_id);
|
||||
for (size_t z = 0; z < num_assists; z++) {
|
||||
auto eff = this->assist_server->get_active_assist_by_index(z);
|
||||
if ((eff == AssistEffect::CHARITY) || (!this->options.is_trial() && (eff == AssistEffect::CHARITY_PLUS))) {
|
||||
if ((eff == AssistEffect::CHARITY) || (!this->options.is_nte() && (eff == AssistEffect::CHARITY_PLUS))) {
|
||||
int16_t exp_delta = (eff == AssistEffect::CHARITY_PLUS) ? -1 : 1;
|
||||
for (size_t other_client_id = 0; other_client_id < 4; other_client_id++) {
|
||||
auto other_ps = this->player_states[other_client_id];
|
||||
@@ -843,7 +843,7 @@ void Server::draw_phase_after() {
|
||||
}
|
||||
|
||||
// Apparently the hard limit of 1000 was added after NTE was released
|
||||
if (this->overall_time_expired || (!this->options.is_trial() && (this->round_num >= 1000))) {
|
||||
if (this->overall_time_expired || (!this->options.is_nte() && (this->round_num >= 1000))) {
|
||||
bool no_winner_specified = true;
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
@@ -934,7 +934,7 @@ void Server::end_action_phase() {
|
||||
// that this can only ever be 0 or 2, but we may have to delete the enum if
|
||||
// that turns out to be false.
|
||||
this->action_subphase = static_cast<ActionSubphase>(static_cast<uint8_t>(this->action_subphase) + 2);
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
this->unknown_8023EEF4();
|
||||
this->update_battle_state_flags_and_send_6xB4x03_if_needed(0);
|
||||
this->send_6xB4x02_for_all_players_if_needed();
|
||||
@@ -1059,7 +1059,7 @@ bool Server::is_registration_complete() const {
|
||||
}
|
||||
|
||||
void Server::move_phase_after() {
|
||||
if (!this->options.is_trial()) {
|
||||
if (!this->options.is_nte()) {
|
||||
for (size_t trap_type = 0; trap_type < 5; trap_type++) {
|
||||
uint8_t trap_tile_index = this->chosen_trap_tile_index_of_type[trap_type];
|
||||
if (trap_tile_index == 0xFF) {
|
||||
@@ -1264,7 +1264,7 @@ G_UpdateDecks_Ep3_6xB4x07 Server::prepare_6xB4x07_decks_update() const {
|
||||
void Server::send_all_state_updates() {
|
||||
this->send(this->prepare_6xB4x07_decks_update());
|
||||
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
G_UpdateMap_Ep3NTE_6xB4x05 cmd;
|
||||
cmd.state = *this->map_and_rules;
|
||||
this->send(cmd);
|
||||
@@ -1323,19 +1323,19 @@ void Server::set_client_id_ready_to_advance_phase(uint8_t client_id, BattlePhase
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
auto ps = this->player_states[client_id];
|
||||
if (ps &&
|
||||
(this->current_team_turn1 == ps->get_team_id()) &&
|
||||
(!is_trial || (this->battle_phase == battle_phase)) &&
|
||||
(!is_nte || (this->battle_phase == battle_phase)) &&
|
||||
(this->setup_phase == SetupPhase::MAIN_BATTLE)) {
|
||||
ps->assist_flags |= AssistFlag::READY_TO_END_PHASE;
|
||||
ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
if (this->battle_phase == BattlePhase::DICE) {
|
||||
if (is_trial || !(ps->assist_flags & AssistFlag::ELIGIBLE_FOR_DICE_BOOST) || this->map_and_rules->rules.disable_dice_boost) {
|
||||
if (is_nte || !(ps->assist_flags & AssistFlag::ELIGIBLE_FOR_DICE_BOOST) || this->map_and_rules->rules.disable_dice_boost) {
|
||||
ps->assist_flags &= (~AssistFlag::ELIGIBLE_FOR_DICE_BOOST);
|
||||
ps->roll_main_dice_or_apply_after_effects();
|
||||
if (!is_trial && (ps->get_atk_points() < 3) && (ps->get_def_points() < 3)) {
|
||||
if (!is_nte && (ps->get_atk_points() < 3) && (ps->get_def_points() < 3)) {
|
||||
ps->assist_flags |= AssistFlag::ELIGIBLE_FOR_DICE_BOOST;
|
||||
}
|
||||
} else {
|
||||
@@ -1372,11 +1372,11 @@ void Server::set_client_id_ready_to_advance_phase(uint8_t client_id, BattlePhase
|
||||
}
|
||||
|
||||
if (should_advance_phase) {
|
||||
if (!this->options.is_trial()) {
|
||||
if (!this->options.is_nte()) {
|
||||
this->copy_player_states_to_prev_states();
|
||||
}
|
||||
this->advance_battle_phase();
|
||||
if (!this->options.is_trial()) {
|
||||
if (!this->options.is_nte()) {
|
||||
this->send_set_card_updates_and_6xB4x04_if_needed();
|
||||
}
|
||||
this->clear_player_flags_after_dice_phase();
|
||||
@@ -1387,19 +1387,19 @@ void Server::set_client_id_ready_to_advance_phase(uint8_t client_id, BattlePhase
|
||||
}
|
||||
|
||||
void Server::set_phase_after() {
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
|
||||
for (size_t client_id = 0; client_id < 4; client_id++) {
|
||||
auto ps = this->player_states[client_id];
|
||||
if (ps) {
|
||||
auto card = ps->get_sc_card();
|
||||
if (card) {
|
||||
this->card_special->apply_action_conditions(0x06, nullptr, card, is_trial ? 0x1F : 0x04, nullptr);
|
||||
this->card_special->apply_action_conditions(0x06, nullptr, card, is_nte ? 0x1F : 0x04, nullptr);
|
||||
}
|
||||
for (size_t set_index = 0; set_index < 8; set_index++) {
|
||||
auto card = ps->get_set_card(set_index);
|
||||
if (card) {
|
||||
this->card_special->apply_action_conditions(0x06, nullptr, card, is_trial ? 0x1F : 0x04, nullptr);
|
||||
this->card_special->apply_action_conditions(0x06, nullptr, card, is_nte ? 0x1F : 0x04, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1418,7 +1418,7 @@ void Server::set_phase_after() {
|
||||
switch (this->assist_server->get_active_assist_by_index(z)) {
|
||||
case AssistEffect::SHUFFLE_ALL:
|
||||
case AssistEffect::SHUFFLE_GROUP:
|
||||
if (is_trial ||
|
||||
if (is_nte ||
|
||||
(!this->map_and_rules->rules.disable_deck_shuffle && !this->map_and_rules->rules.disable_deck_loop)) {
|
||||
ps->discard_and_redraw_hand();
|
||||
}
|
||||
@@ -1436,7 +1436,7 @@ void Server::set_phase_after() {
|
||||
ps->discard_all_assist_cards_from_hand();
|
||||
break;
|
||||
case AssistEffect::ASSIST_VANISH:
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
clients_with_assist_vanish[client_id] = true;
|
||||
} else if (ps->get_assist_turns_remaining() != 90) {
|
||||
ps->discard_set_assist_card();
|
||||
@@ -1482,7 +1482,7 @@ void Server::set_player_deck_valid(uint8_t client_id) {
|
||||
}
|
||||
|
||||
void Server::setup_and_start_battle() {
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
|
||||
this->setup_phase = SetupPhase::STARTER_ROLLS;
|
||||
|
||||
@@ -1491,7 +1491,7 @@ void Server::setup_and_start_battle() {
|
||||
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
if (!this->check_presence_entry(z)) {
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
this->name_entries[z].clear();
|
||||
}
|
||||
} else {
|
||||
@@ -1500,7 +1500,7 @@ void Server::setup_and_start_battle() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_trial && (this->map_and_rules->rules.hp_type == HPType::COMMON_HP)) {
|
||||
if (!is_nte && (this->map_and_rules->rules.hp_type == HPType::COMMON_HP)) {
|
||||
int16_t team_hp[2] = {99, 99};
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
@@ -1578,7 +1578,7 @@ void Server::setup_and_start_battle() {
|
||||
}
|
||||
} else if ((tile_type == 0x10) || (tile_type == 0x20) || (tile_type == 0x50)) {
|
||||
this->map_and_rules->map.tiles[y][x] = 0;
|
||||
} else if (is_trial && (tile_type == 0x40) && (this->num_trap_tiles_nte < 0x10)) {
|
||||
} else if (is_nte && (tile_type == 0x40) && (this->num_trap_tiles_nte < 0x10)) {
|
||||
this->trap_tile_locs_nte[this->num_trap_tiles_nte][0] = x;
|
||||
this->trap_tile_locs_nte[this->num_trap_tiles_nte][1] = y;
|
||||
this->num_trap_tiles_nte++;
|
||||
@@ -1586,7 +1586,7 @@ void Server::setup_and_start_battle() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
for (size_t trap_type = 0; trap_type < 5; trap_type++) {
|
||||
this->chosen_trap_tile_index_of_type[trap_type] = 0xFF;
|
||||
|
||||
@@ -1609,7 +1609,7 @@ void Server::setup_and_start_battle() {
|
||||
}
|
||||
}
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
this->send_all_state_updates();
|
||||
this->send_6xB4x02_for_all_players_if_needed();
|
||||
|
||||
@@ -1636,7 +1636,7 @@ void Server::setup_and_start_battle() {
|
||||
this->registration_phase = RegistrationPhase::BATTLE_STARTED;
|
||||
this->update_battle_state_flags_and_send_6xB4x03_if_needed(true);
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
this->send_6xB4x50_trap_tile_locations();
|
||||
G_UpdateMap_Ep3_6xB4x05 cmd;
|
||||
cmd.state = *this->map_and_rules;
|
||||
@@ -1775,7 +1775,7 @@ void Server::on_server_data_input(shared_ptr<Client> sender_c, const string& dat
|
||||
throw runtime_error("unknown CAx subsubcommand");
|
||||
}
|
||||
|
||||
if (this->options.is_trial() || !header.mask_key) {
|
||||
if (this->options.is_nte() || !header.mask_key) {
|
||||
(this->*handler)(sender_c, data);
|
||||
} else {
|
||||
string unmasked_data = data;
|
||||
@@ -1808,7 +1808,7 @@ void Server::handle_CAx0B_mulligan_hand(shared_ptr<Client>, const string& data)
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || (error_code == 0)) {
|
||||
if (!this->options.is_nte() || (error_code == 0)) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num.load();
|
||||
out_cmd.error_code = error_code;
|
||||
@@ -1835,7 +1835,7 @@ void Server::handle_CAx0C_end_mulligan_phase(shared_ptr<Client>, const string& d
|
||||
error_code = -0x78;
|
||||
}
|
||||
|
||||
if (this->options.is_trial() && error_code) {
|
||||
if (this->options.is_nte() && error_code) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1866,7 +1866,7 @@ void Server::handle_CAx0C_end_mulligan_phase(shared_ptr<Client>, const string& d
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || !error_code) {
|
||||
if (!this->options.is_nte() || !error_code) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd_fin;
|
||||
out_cmd_fin.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd_fin.response_phase = 2;
|
||||
@@ -1884,7 +1884,7 @@ void Server::handle_CAx0D_end_non_action_phase(shared_ptr<Client>, const string&
|
||||
throw runtime_error("invalid client ID");
|
||||
}
|
||||
|
||||
if (!this->options.is_trial()) {
|
||||
if (!this->options.is_nte()) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd_ack;
|
||||
out_cmd_ack.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd_ack.response_phase = 1;
|
||||
@@ -1895,7 +1895,7 @@ void Server::handle_CAx0D_end_non_action_phase(shared_ptr<Client>, const string&
|
||||
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd_fin;
|
||||
out_cmd_fin.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd_fin.response_phase = this->options.is_trial() ? 0 : 2;
|
||||
out_cmd_fin.response_phase = this->options.is_nte() ? 0 : 2;
|
||||
this->send(out_cmd_fin);
|
||||
}
|
||||
|
||||
@@ -1930,7 +1930,7 @@ void Server::handle_CAx0E_discard_card_from_hand(shared_ptr<Client>, const strin
|
||||
}
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || (error_code == 0)) {
|
||||
if (!this->options.is_nte() || (error_code == 0)) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd.error_code = error_code;
|
||||
@@ -1975,10 +1975,10 @@ void Server::handle_CAx0F_set_card_from_hand(shared_ptr<Client>, const string& d
|
||||
this->ruler_server->error_code1 = error_code;
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || always_send_response) {
|
||||
if (!this->options.is_nte() || always_send_response) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd.error_code = this->options.is_trial() ? (was_set ? 0 : 1) : this->ruler_server->error_code1;
|
||||
out_cmd.error_code = this->options.is_nte() ? (was_set ? 0 : 1) : this->ruler_server->error_code1;
|
||||
this->send(out_cmd);
|
||||
}
|
||||
|
||||
@@ -2016,10 +2016,10 @@ void Server::handle_CAx10_move_fc_to_location(shared_ptr<Client>, const string&
|
||||
this->ruler_server->error_code2 = error_code;
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || (this->ruler_server->error_code2 == 0)) {
|
||||
if (!this->options.is_nte() || (this->ruler_server->error_code2 == 0)) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd.error_code = this->options.is_trial() ? 0 : this->ruler_server->error_code2;
|
||||
out_cmd.error_code = this->options.is_nte() ? 0 : this->ruler_server->error_code2;
|
||||
this->send(out_cmd);
|
||||
}
|
||||
|
||||
@@ -2054,11 +2054,11 @@ void Server::handle_CAx11_enqueue_attack_or_defense(shared_ptr<Client>, const st
|
||||
this->ruler_server->error_code3 = error_code;
|
||||
}
|
||||
|
||||
bool is_trial = this->options.is_trial();
|
||||
if (!is_trial || (error_code == 0)) {
|
||||
bool is_nte = this->options.is_nte();
|
||||
if (!is_nte || (error_code == 0)) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num;
|
||||
out_cmd.error_code = is_trial ? !!this->ruler_server->error_code3 : this->ruler_server->error_code3;
|
||||
out_cmd.error_code = is_nte ? !!this->ruler_server->error_code3 : this->ruler_server->error_code3;
|
||||
this->send(out_cmd);
|
||||
}
|
||||
|
||||
@@ -2081,7 +2081,7 @@ void Server::handle_CAx12_end_attack_list(shared_ptr<Client>, const string& data
|
||||
this->end_attack_list_for_client(in_cmd.client_id);
|
||||
}
|
||||
|
||||
if (!this->options.is_trial() || (error_code == 0)) {
|
||||
if (!this->options.is_nte() || (error_code == 0)) {
|
||||
G_ActionResult_Ep3_6xB4x1E out_cmd;
|
||||
out_cmd.sequence_num = in_cmd.header.sequence_num;
|
||||
this->send(out_cmd);
|
||||
@@ -2134,7 +2134,7 @@ void Server::handle_CAx13_update_map_during_setup_t(shared_ptr<Client>, const st
|
||||
}
|
||||
|
||||
void Server::handle_CAx13_update_map_during_setup(shared_ptr<Client> c, const string& data) {
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
this->handle_CAx13_update_map_during_setup_t<G_SetMapState_Ep3NTE_CAx13>(c, data);
|
||||
} else {
|
||||
this->handle_CAx13_update_map_during_setup_t<G_SetMapState_Ep3_CAx13>(c, data);
|
||||
@@ -2167,7 +2167,7 @@ void Server::handle_CAx14_update_deck_during_setup(shared_ptr<Client>, const str
|
||||
if (verify_error) {
|
||||
throw runtime_error(string_printf("invalid deck: -0x%" PRIX32, verify_error));
|
||||
}
|
||||
if (!this->options.is_trial() && !(this->options.behavior_flags & BehaviorFlag::SKIP_D1_D2_REPLACE)) {
|
||||
if (!this->options.is_nte() && !(this->options.behavior_flags & BehaviorFlag::SKIP_D1_D2_REPLACE)) {
|
||||
this->ruler_server->replace_D1_D2_rank_cards_with_Attack(entry.card_ids);
|
||||
}
|
||||
*this->deck_entries[in_cmd.client_id] = in_cmd.entry;
|
||||
@@ -2244,10 +2244,10 @@ void Server::handle_CAx1D_start_battle(shared_ptr<Client>, const string& data) {
|
||||
in_cmd.header.subsubcommand, "START BATTLE");
|
||||
|
||||
if (!this->battle_in_progress) {
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
|
||||
bool should_start = false;
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
should_start = (this->registration_phase == RegistrationPhase::REGISTERED);
|
||||
} else if (this->update_registration_phase()) {
|
||||
should_start = true;
|
||||
@@ -2511,7 +2511,7 @@ void Server::send_6xB6x41_to_all_clients() const {
|
||||
}
|
||||
if (map_commands_by_language[c->language()].empty()) {
|
||||
map_commands_by_language[c->language()] = this->prepare_6xB6x41_map_definition(
|
||||
this->last_chosen_map, c->language(), this->options.is_trial());
|
||||
this->last_chosen_map, c->language(), this->options.is_nte());
|
||||
}
|
||||
this->log().info("Sending %c version of map %08" PRIX32, char_for_language_code(c->language()), this->last_chosen_map->map_number);
|
||||
send_command(c, 0x6C, 0x00, map_commands_by_language[c->language()]);
|
||||
@@ -2584,9 +2584,9 @@ void Server::handle_CAx49_card_counts(shared_ptr<Client>, const string& data) {
|
||||
}
|
||||
|
||||
void Server::compute_losing_team_id_and_add_winner_flags(uint32_t flags) {
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
if (ps) {
|
||||
@@ -2602,7 +2602,7 @@ void Server::compute_losing_team_id_and_add_winner_flags(uint32_t flags) {
|
||||
int8_t losing_team_id = -1;
|
||||
array<uint32_t, 2> team_counts = {0, 0};
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
// First, check which team has more dead SCs
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
@@ -2702,7 +2702,7 @@ void Server::compute_losing_team_id_and_add_winner_flags(uint32_t flags) {
|
||||
if (losing_team_id != ps->get_team_id()) {
|
||||
ps->assist_flags |= winner_flags;
|
||||
}
|
||||
if (!is_trial || (losing_team_id != ps->get_team_id())) {
|
||||
if (!is_nte || (losing_team_id != ps->get_team_id())) {
|
||||
ps->update_hand_and_equip_state_and_send_6xB4x02_if_needed();
|
||||
}
|
||||
}
|
||||
@@ -2730,7 +2730,7 @@ void Server::unknown_8023EEF4() {
|
||||
return;
|
||||
}
|
||||
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
while (this->unknown_a14 < this->num_pending_attacks_with_cards) {
|
||||
auto card = this->attack_cards[this->unknown_a14];
|
||||
if (this->get_current_team_turn() == card->get_team_id()) {
|
||||
@@ -2738,7 +2738,7 @@ void Server::unknown_8023EEF4() {
|
||||
log.debug("card @%04hX #%04hX can attack", card->get_card_ref(), card->get_card_id());
|
||||
string as_str = as.str();
|
||||
log.debug("as: %s", as_str.c_str());
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
this->replace_targets_due_to_destruction_nte(&as);
|
||||
} else {
|
||||
this->replace_targets_due_to_destruction_or_conditions(&as);
|
||||
@@ -2764,7 +2764,7 @@ void Server::unknown_8023EEF4() {
|
||||
G_SetActionState_Ep3_6xB4x29 cmd;
|
||||
cmd.unknown_a1 = this->unknown_a14;
|
||||
cmd.state = this->pending_attacks_with_cards[this->unknown_a14];
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
this->replace_targets_due_to_destruction_nte(&cmd.state);
|
||||
} else {
|
||||
this->replace_targets_due_to_destruction_or_conditions(&cmd.state);
|
||||
@@ -2774,7 +2774,7 @@ void Server::unknown_8023EEF4() {
|
||||
|
||||
this->card_special->unknown_8024AAB8(as);
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
this->attack_cards[this->unknown_a14]->compute_action_chain_results(1, 0);
|
||||
this->attack_cards[this->unknown_a14]->unknown_80236374(this->attack_cards[this->unknown_a14], &as);
|
||||
if (!this->attack_cards[this->unknown_a14]->action_chain.check_flag(0x40)) {
|
||||
@@ -2808,7 +2808,7 @@ void Server::unknown_8023EEF4() {
|
||||
this->send_6xB4x02_for_all_players_if_needed();
|
||||
}
|
||||
|
||||
if (!is_trial) {
|
||||
if (!is_nte) {
|
||||
this->update_battle_state_flags_and_send_6xB4x03_if_needed();
|
||||
this->send_6xB4x02_for_all_players_if_needed();
|
||||
}
|
||||
@@ -3047,11 +3047,11 @@ void Server::unknown_8023EE48() {
|
||||
}
|
||||
|
||||
void Server::unknown_8023EE80() {
|
||||
bool is_trial = this->options.is_trial();
|
||||
bool is_nte = this->options.is_nte();
|
||||
|
||||
if (this->unknown_a14 < this->num_pending_attacks_with_cards) {
|
||||
this->attack_cards[this->unknown_a14]->apply_attack_result();
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
auto ps = this->player_states[z];
|
||||
if (ps) {
|
||||
@@ -3064,7 +3064,7 @@ void Server::unknown_8023EE80() {
|
||||
|
||||
this->check_for_battle_end();
|
||||
|
||||
if (is_trial) {
|
||||
if (is_nte) {
|
||||
this->unknown_8023EEF4();
|
||||
this->update_battle_state_flags_and_send_6xB4x03_if_needed();
|
||||
this->send_6xB4x02_for_all_players_if_needed();
|
||||
@@ -3111,7 +3111,7 @@ vector<shared_ptr<Card>> Server::const_cast_set_cards_v(
|
||||
}
|
||||
|
||||
void Server::send_6xB4x39() const {
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
G_UpdateAllPlayerStatistics_Ep3NTE_6xB4x39 cmd;
|
||||
for (size_t z = 0; z < 4; z++) {
|
||||
if (this->player_states[z]) {
|
||||
@@ -3132,7 +3132,7 @@ void Server::send_6xB4x39() const {
|
||||
|
||||
void Server::send_6xB4x05() {
|
||||
this->compute_all_map_occupied_bits();
|
||||
if (this->options.is_trial()) {
|
||||
if (this->options.is_nte()) {
|
||||
G_UpdateMap_Ep3NTE_6xB4x05 cmd;
|
||||
cmd.state = *this->map_and_rules;
|
||||
this->send(cmd);
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
std::shared_ptr<const Tournament> tournament;
|
||||
std::array<std::vector<uint16_t>, 5> trap_card_ids;
|
||||
|
||||
inline bool is_trial() const {
|
||||
inline bool is_nte() const {
|
||||
return (this->behavior_flags & BehaviorFlag::IS_TRIAL_EDITION);
|
||||
}
|
||||
};
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
if (cmd.header.size != sizeof(cmd) / 4) {
|
||||
throw std::logic_error("outbound command size field is incorrect");
|
||||
}
|
||||
if (!this->options.is_trial() && (cmd.header.subsubcommand == 0x06)) {
|
||||
if (!this->options.is_nte() && (cmd.header.subsubcommand == 0x06)) {
|
||||
this->num_6xB4x06_commands_sent++;
|
||||
this->prev_num_6xB4x06_commands_sent = this->num_6xB4x06_commands_sent;
|
||||
if (this->num_6xB4x06_commands_sent > 0x100) {
|
||||
@@ -231,7 +231,7 @@ public:
|
||||
|
||||
G_UpdateDecks_Ep3_6xB4x07 prepare_6xB4x07_decks_update() const;
|
||||
G_SetPlayerNames_Ep3_6xB4x1C prepare_6xB4x1C_names_update() const;
|
||||
static std::string prepare_6xB6x41_map_definition(std::shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_trial);
|
||||
static std::string prepare_6xB6x41_map_definition(std::shared_ptr<const MapIndex::Map> map, uint8_t language, bool is_nte);
|
||||
void send_6xB6x41_to_all_clients() const;
|
||||
G_SetTrapTileLocations_Ep3_6xB4x50 prepare_6xB4x50_trap_tile_locations() const;
|
||||
|
||||
|
||||
+2
-2
@@ -429,9 +429,9 @@ void Lobby::create_ep3_server() {
|
||||
this->log.info("Recreating Episode 3 server state");
|
||||
}
|
||||
auto tourn = this->tournament_match ? this->tournament_match->tournament.lock() : nullptr;
|
||||
bool is_trial = this->base_version == Version::GC_EP3_NTE;
|
||||
bool is_nte = this->base_version == Version::GC_EP3_NTE;
|
||||
Episode3::Server::Options options = {
|
||||
.card_index = is_trial ? s->ep3_card_index_trial : s->ep3_card_index,
|
||||
.card_index = is_nte ? s->ep3_card_index_trial : s->ep3_card_index,
|
||||
.map_index = s->ep3_map_index,
|
||||
.behavior_flags = s->ep3_behavior_flags,
|
||||
.random_crypt = this->random_crypt,
|
||||
|
||||
+2
-2
@@ -112,7 +112,7 @@ Version get_cli_version(Arguments& args, Version default_value = Version::UNKNOW
|
||||
return Version::GC_V3;
|
||||
} else if (args.get<bool>("xb")) {
|
||||
return Version::XB_V3;
|
||||
} else if (args.get<bool>("ep3-trial")) {
|
||||
} else if (args.get<bool>("ep3-nte")) {
|
||||
return Version::GC_EP3_NTE;
|
||||
} else if (args.get<bool>("ep3")) {
|
||||
return Version::GC_EP3;
|
||||
@@ -2461,7 +2461,7 @@ Many versions also accept or require a version option. The version options are:\
|
||||
--gc-nte: GC Episodes 1&2 Trial Edition\n\
|
||||
--gc: GC Episodes 1&2\n\
|
||||
--xb: Xbox Episodes 1&2\n\
|
||||
--ep3-trial: GC Episode 3 Trial Edition\n\
|
||||
--ep3-nte: GC Episode 3 Trial Edition\n\
|
||||
--ep3: GC Episode 3\n\
|
||||
--bb: Blue Burst\n\
|
||||
\n",
|
||||
|
||||
+1
-1
@@ -974,7 +974,7 @@ string decode_gci_data(
|
||||
}
|
||||
|
||||
} else if (header.is_ep3()) {
|
||||
if (header.is_trial()) {
|
||||
if (header.is_nte()) {
|
||||
if (known_seed >= 0) {
|
||||
return decrypt_download_quest_data_section<true>(
|
||||
r.getv(header.data_size), header.data_size, known_seed, true, true);
|
||||
|
||||
@@ -113,7 +113,7 @@ bool PSOGCIFileHeader::is_ep3() const {
|
||||
return (this->game_id[2] == 'S');
|
||||
}
|
||||
|
||||
bool PSOGCIFileHeader::is_trial() const {
|
||||
bool PSOGCIFileHeader::is_nte() const {
|
||||
return (this->game_id[0] == 'D');
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ struct PSOGCIFileHeader {
|
||||
|
||||
bool is_ep12() const;
|
||||
bool is_ep3() const;
|
||||
bool is_trial() const;
|
||||
bool is_nte() const;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PSOGCSystemFile {
|
||||
|
||||
+3
-3
@@ -2789,12 +2789,12 @@ void send_ep3_card_battle_table_state(shared_ptr<Lobby> l, uint16_t table_number
|
||||
throw runtime_error("invalid battle table seat number");
|
||||
}
|
||||
|
||||
bool is_trial = (c->version() == Version::GC_EP3_NTE);
|
||||
auto& e = is_trial ? cmd_nte.entries[c->card_battle_table_seat_number] : cmd_final.entries[c->card_battle_table_seat_number];
|
||||
bool is_nte = (c->version() == Version::GC_EP3_NTE);
|
||||
auto& e = is_nte ? cmd_nte.entries[c->card_battle_table_seat_number] : cmd_final.entries[c->card_battle_table_seat_number];
|
||||
if (e.state == 0) {
|
||||
e.state = c->card_battle_table_seat_state;
|
||||
e.guild_card_number = c->license->serial_number;
|
||||
auto& clients = is_trial ? clients_nte : clients_final;
|
||||
auto& clients = is_nte ? clients_nte : clients_final;
|
||||
clients.emplace(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,10 +24,10 @@ start:
|
||||
cmplwi r0, 0x47 # Check if high byte of game ID is 'G'
|
||||
beq not_trial
|
||||
cmplwi r0, 0x44 # Check if high byte of game ID is 'D'
|
||||
beq is_trial
|
||||
beq is_nte
|
||||
li r3, 0
|
||||
blr
|
||||
is_trial:
|
||||
is_nte:
|
||||
li r3, 0x0054
|
||||
b end_trial_check
|
||||
not_trial:
|
||||
|
||||
Reference in New Issue
Block a user