replace is_trial with is_nte
This commit is contained in:
+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) {
|
||||
|
||||
Reference in New Issue
Block a user