name interference functions appropriately
This commit is contained in:
@@ -470,7 +470,7 @@ void Card::execute_attack(shared_ptr<Card> attacker_card) {
|
|||||||
|
|
||||||
if (!(this->card_flags & 2) &&
|
if (!(this->card_flags & 2) &&
|
||||||
(!attacker_card || !(attacker_card->card_flags & 2))) {
|
(!attacker_card || !(attacker_card->card_flags & 2))) {
|
||||||
this->server()->card_special->unknown_80244E20(
|
this->server()->card_special->check_for_defense_interference(
|
||||||
attacker_card, this->shared_from_this(), &preliminary_damage);
|
attacker_card, this->shared_from_this(), &preliminary_damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1208,7 +1208,7 @@ void Card::unknown_80237734() {
|
|||||||
}
|
}
|
||||||
if (!(this->card_flags & 2)) {
|
if (!(this->card_flags & 2)) {
|
||||||
this->compute_action_chain_results(1, 0);
|
this->compute_action_chain_results(1, 0);
|
||||||
this->server()->card_special->unknown_8024504C(this->shared_from_this());
|
this->server()->card_special->check_for_attack_interference(this->shared_from_this());
|
||||||
}
|
}
|
||||||
this->compute_action_chain_results(1, 0);
|
this->compute_action_chain_results(1, 0);
|
||||||
this->unknown_80236374(this->shared_from_this(), nullptr);
|
this->unknown_80236374(this->shared_from_this(), nullptr);
|
||||||
|
|||||||
+14
-20
@@ -3366,7 +3366,7 @@ void CardSpecial::unknown_80244AA8(shared_ptr<Card> card) {
|
|||||||
this->unknown_8024C2B0(0x13, card->get_card_ref(), as, 0xFFFF);
|
this->unknown_8024C2B0(0x13, card->get_card_ref(), as, 0xFFFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardSpecial::unknown_80244E20(
|
void CardSpecial::check_for_defense_interference(
|
||||||
shared_ptr<const Card> attacker_card,
|
shared_ptr<const Card> attacker_card,
|
||||||
shared_ptr<Card> target_card,
|
shared_ptr<Card> target_card,
|
||||||
int16_t* inout_unknown_p4) {
|
int16_t* inout_unknown_p4) {
|
||||||
@@ -3420,12 +3420,9 @@ void CardSpecial::unknown_80244E20(
|
|||||||
if (target_ps->unknown_a17 >= 1) {
|
if (target_ps->unknown_a17 >= 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto entry = unknown_8024DAFC(target_card_id, ally_sc_card_id, false);
|
auto entry = get_interference_probability_entry(
|
||||||
if (!entry) {
|
target_card_id, ally_sc_card_id, false);
|
||||||
return;
|
if (!entry || (this->server()->get_random(99) >= entry->defense_probability)) {
|
||||||
}
|
|
||||||
uint8_t rand_v = this->server()->get_random(99);
|
|
||||||
if (rand_v >= entry->unknown_v2) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3694,12 +3691,11 @@ void CardSpecial::clear_invalid_conditions_on_card(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const UnknownMatrixEntry* unknown_8024DAFC(
|
const InterferenceProbabilityEntry* get_interference_probability_entry(
|
||||||
uint16_t row_card_id,
|
uint16_t row_card_id,
|
||||||
uint16_t column_card_id,
|
uint16_t column_card_id,
|
||||||
bool use_entry_v1,
|
bool is_attack) {
|
||||||
size_t* out_entry_index) {
|
static const InterferenceProbabilityEntry entries[] = {
|
||||||
static const UnknownMatrixEntry entries[] = {
|
|
||||||
{0x0004, 0xFF, 0xFF},
|
{0x0004, 0xFF, 0xFF},
|
||||||
{0x0002, 0x04, 0x00},
|
{0x0002, 0x04, 0x00},
|
||||||
{0x0002, 0x00, 0x0F},
|
{0x0002, 0x00, 0x0F},
|
||||||
@@ -3849,23 +3845,20 @@ const UnknownMatrixEntry* unknown_8024DAFC(
|
|||||||
};
|
};
|
||||||
constexpr size_t num_entries = sizeof(entries) / sizeof(entries[0]);
|
constexpr size_t num_entries = sizeof(entries) / sizeof(entries[0]);
|
||||||
|
|
||||||
const UnknownMatrixEntry* ret_entry = nullptr;
|
const InterferenceProbabilityEntry* ret_entry = nullptr;
|
||||||
int16_t current_max = -1;
|
int16_t current_max = -1;
|
||||||
size_t logical_index = 0;
|
size_t logical_index = 0;
|
||||||
uint16_t current_row_card_id = 0xFFFF;
|
uint16_t current_row_card_id = 0xFFFF;
|
||||||
for (size_t z = 0; z < num_entries; z++) {
|
for (size_t z = 0; z < num_entries; z++) {
|
||||||
const auto& entry = entries[z];
|
const auto& entry = entries[z];
|
||||||
uint16_t current_column_card_id = entry.card_id;
|
uint16_t current_column_card_id = entry.card_id;
|
||||||
if ((entry.unknown_v1 != 0xFF) || (entry.unknown_v2 != 0xFF)) {
|
if ((entry.attack_probability != 0xFF) || (entry.defense_probability != 0xFF)) {
|
||||||
if ((row_card_id == current_row_card_id) &&
|
if ((row_card_id == current_row_card_id) &&
|
||||||
(column_card_id == current_column_card_id)) {
|
(column_card_id == current_column_card_id)) {
|
||||||
uint8_t v = use_entry_v1 ? entry.unknown_v1 : entry.unknown_v2;
|
uint8_t v = is_attack ? entry.attack_probability : entry.defense_probability;
|
||||||
if (current_max <= v) {
|
if (current_max <= v) {
|
||||||
ret_entry = &entry;
|
ret_entry = &entry;
|
||||||
current_max = v;
|
current_max = v;
|
||||||
if (out_entry_index) {
|
|
||||||
*out_entry_index = logical_index;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logical_index++;
|
logical_index++;
|
||||||
@@ -4325,7 +4318,7 @@ void CardSpecial::unknown_8024A9D8(const ActionState& pa, uint16_t action_card_r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CardSpecial::unknown_8024504C(shared_ptr<Card> unknown_p2) {
|
void CardSpecial::check_for_attack_interference(shared_ptr<Card> unknown_p2) {
|
||||||
if (unknown_p2->action_chain.chain.damage <= 0) {
|
if (unknown_p2->action_chain.chain.damage <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4376,8 +4369,9 @@ void CardSpecial::unknown_8024504C(shared_ptr<Card> unknown_p2) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto* entry = unknown_8024DAFC(row_card_id, ally_sc_card_id, true);
|
const auto* entry = get_interference_probability_entry(
|
||||||
if (!entry || (this->server()->get_random(99) >= entry->unknown_v1)) {
|
row_card_id, ally_sc_card_id, true);
|
||||||
|
if (!entry || (this->server()->get_random(99) >= entry->attack_probability)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,17 +11,16 @@ namespace Episode3 {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct UnknownMatrixEntry {
|
struct InterferenceProbabilityEntry {
|
||||||
uint16_t card_id;
|
uint16_t card_id;
|
||||||
uint8_t unknown_v1;
|
uint8_t attack_probability;
|
||||||
uint8_t unknown_v2;
|
uint8_t defense_probability;
|
||||||
};
|
};
|
||||||
|
|
||||||
const UnknownMatrixEntry* unknown_8024DAFC(
|
const InterferenceProbabilityEntry* get_interference_probability_entry(
|
||||||
uint16_t row_card_id,
|
uint16_t row_card_id,
|
||||||
uint16_t column_card_id,
|
uint16_t column_card_id,
|
||||||
bool use_entry_v1,
|
bool is_attack);
|
||||||
size_t* out_entry_index = nullptr);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -276,7 +275,7 @@ public:
|
|||||||
void update_condition_orders(std::shared_ptr<Card> card);
|
void update_condition_orders(std::shared_ptr<Card> card);
|
||||||
int16_t max_all_attack_bonuses(size_t* out_count) const;
|
int16_t max_all_attack_bonuses(size_t* out_count) const;
|
||||||
void unknown_80244AA8(std::shared_ptr<Card> card);
|
void unknown_80244AA8(std::shared_ptr<Card> card);
|
||||||
void unknown_80244E20(
|
void check_for_defense_interference(
|
||||||
std::shared_ptr<const Card> attacker_card,
|
std::shared_ptr<const Card> attacker_card,
|
||||||
std::shared_ptr<Card> target_card,
|
std::shared_ptr<Card> target_card,
|
||||||
int16_t* inout_unknown_p4);
|
int16_t* inout_unknown_p4);
|
||||||
@@ -324,7 +323,7 @@ public:
|
|||||||
void unknown_8024966C(std::shared_ptr<Card> unknown_p2, const ActionState* existing_as);
|
void unknown_8024966C(std::shared_ptr<Card> unknown_p2, const ActionState* existing_as);
|
||||||
static std::shared_ptr<Card> sc_card_for_card(std::shared_ptr<Card> unknown_p2);
|
static std::shared_ptr<Card> sc_card_for_card(std::shared_ptr<Card> unknown_p2);
|
||||||
void unknown_8024A9D8(const ActionState& pa, uint16_t action_card_ref);
|
void unknown_8024A9D8(const ActionState& pa, uint16_t action_card_ref);
|
||||||
void unknown_8024504C(std::shared_ptr<Card> unknown_p2);
|
void check_for_attack_interference(std::shared_ptr<Card> unknown_p2);
|
||||||
template <uint8_t When1, uint8_t When2, uint8_t When3, uint8_t When4>
|
template <uint8_t When1, uint8_t When2, uint8_t When3, uint8_t When4>
|
||||||
void unknown_t2(std::shared_ptr<Card> unknown_p2);
|
void unknown_t2(std::shared_ptr<Card> unknown_p2);
|
||||||
void unknown_8024997C(std::shared_ptr<Card> card);
|
void unknown_8024997C(std::shared_ptr<Card> card);
|
||||||
|
|||||||
Reference in New Issue
Block a user