Commit abd5b23d authored by salix5's avatar salix5 Committed by GitHub

fix ATK calculating (#428)

* add EFFECT_SET_BASE_ATTACK_FINAL

remove EFFECT_FLAG_REPEAT

* add get_base_atk_def(), get_atk_def()

* use get_atk_def()
parent 6dc48e12
This diff is collapsed.
...@@ -232,6 +232,8 @@ public: ...@@ -232,6 +232,8 @@ public:
uint32 get_synchro_type(); uint32 get_synchro_type();
uint32 get_xyz_type(); uint32 get_xyz_type();
uint32 get_link_type(); uint32 get_link_type();
std::pair<int32, int32> get_base_atk_def();
std::pair<int32, int32> get_atk_def();
int32 get_base_attack(); int32 get_base_attack();
int32 get_attack(); int32 get_attack();
int32 get_base_defense(); int32 get_base_defense();
......
...@@ -188,7 +188,7 @@ enum effect_flag : uint32 { ...@@ -188,7 +188,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_UNCOPYABLE = 0x40000, EFFECT_FLAG_UNCOPYABLE = 0x40000,
EFFECT_FLAG_OATH = 0x80000, EFFECT_FLAG_OATH = 0x80000,
EFFECT_FLAG_SPSUM_PARAM = 0x100000, EFFECT_FLAG_SPSUM_PARAM = 0x100000,
EFFECT_FLAG_REPEAT = 0x200000, // EFFECT_FLAG_REPEAT = 0x200000,
EFFECT_FLAG_NO_TURN_RESET = 0x400000, EFFECT_FLAG_NO_TURN_RESET = 0x400000,
EFFECT_FLAG_EVENT_PLAYER = 0x800000, EFFECT_FLAG_EVENT_PLAYER = 0x800000,
EFFECT_FLAG_OWNER_RELATE = 0x1000000, EFFECT_FLAG_OWNER_RELATE = 0x1000000,
...@@ -203,6 +203,8 @@ enum effect_flag : uint32 { ...@@ -203,6 +203,8 @@ enum effect_flag : uint32 {
enum effect_flag2 : uint32 { enum effect_flag2 : uint32 {
EFFECT_FLAG2_MILLENNIUM_RESTRICT = 0x0001, EFFECT_FLAG2_MILLENNIUM_RESTRICT = 0x0001,
EFFECT_FLAG2_COF = 0x0002, EFFECT_FLAG2_COF = 0x0002,
EFFECT_FLAG2_WICKED = 0x0004,
EFFECT_FLAG2_OPTION = 0x0008,
}; };
inline effect_flag operator|(effect_flag flag1, effect_flag flag2) inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
{ {
...@@ -308,8 +310,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -308,8 +310,8 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_REVERSE_UPDATE 108 // #define EFFECT_REVERSE_UPDATE 108 //
#define EFFECT_SWAP_AD 109 // #define EFFECT_SWAP_AD 109 //
#define EFFECT_SWAP_BASE_AD 110 // #define EFFECT_SWAP_BASE_AD 110 //
//#define EFFECT_SWAP_ATTACK_FINAL 111 #define EFFECT_SET_BASE_ATTACK_FINAL 111 //
//#define EFFECT_SWAP_DEFENSE_FINAL 112 #define EFFECT_SET_BASE_DEFENSE_FINAL 112 //
#define EFFECT_ADD_CODE 113 // #define EFFECT_ADD_CODE 113 //
#define EFFECT_CHANGE_CODE 114 // #define EFFECT_CHANGE_CODE 114 //
#define EFFECT_ADD_TYPE 115 // #define EFFECT_ADD_TYPE 115 //
......
...@@ -36,8 +36,9 @@ void chain::set_triggering_state(card* pcard) { ...@@ -36,8 +36,9 @@ void chain::set_triggering_state(card* pcard) {
triggering_state.rank = pcard->get_rank(); triggering_state.rank = pcard->get_rank();
triggering_state.attribute = pcard->get_attribute(); triggering_state.attribute = pcard->get_attribute();
triggering_state.race = pcard->get_race(); triggering_state.race = pcard->get_race();
triggering_state.attack = pcard->get_attack(); std::pair<int32, int32> atk_def = pcard->get_atk_def();
triggering_state.defense = pcard->get_defense(); triggering_state.attack = atk_def.first;
triggering_state.defense = atk_def.second;
} }
bool tevent::operator< (const tevent& v) const { bool tevent::operator< (const tevent& v) const {
return std::memcmp(this, &v, sizeof(tevent)) < 0; return std::memcmp(this, &v, sizeof(tevent)) < 0;
......
...@@ -3822,8 +3822,9 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3822,8 +3822,9 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->previous.rank = pcard->get_rank(); pcard->previous.rank = pcard->get_rank();
pcard->previous.attribute = pcard->get_attribute(); pcard->previous.attribute = pcard->get_attribute();
pcard->previous.race = pcard->get_race(); pcard->previous.race = pcard->get_race();
pcard->previous.attack = pcard->get_attack(); std::pair<int32, int32> atk_def = pcard->get_atk_def();
pcard->previous.defense = pcard->get_defense(); pcard->previous.attack = atk_def.first;
pcard->previous.defense = atk_def.second;
} }
} else { } else {
effect_set eset; effect_set eset;
......
...@@ -2876,7 +2876,8 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2876,7 +2876,8 @@ int32 field::process_battle_command(uint16 step) {
} }
case 26: { case 26: {
// Duel.CalculateDamage() goes here // Duel.CalculateDamage() goes here
uint32 aa = core.attacker->get_attack(), ad = core.attacker->get_defense(); std::pair<int32, int32> atk_def = core.attacker->get_atk_def();
uint32 aa = atk_def.first, ad = atk_def.second;
uint32 da = 0, dd = 0; uint32 da = 0, dd = 0;
uint8 pa = core.attacker->current.controler, pd; uint8 pa = core.attacker->current.controler, pd;
core.attacker->q_cache.attack = aa; core.attacker->q_cache.attack = aa;
...@@ -2884,8 +2885,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2884,8 +2885,9 @@ int32 field::process_battle_command(uint16 step) {
core.attacker->set_status(STATUS_BATTLE_RESULT, FALSE); core.attacker->set_status(STATUS_BATTLE_RESULT, FALSE);
core.attacker->set_status(STATUS_BATTLE_DESTROYED, FALSE); core.attacker->set_status(STATUS_BATTLE_DESTROYED, FALSE);
if(core.attack_target) { if(core.attack_target) {
da = core.attack_target->get_attack(); atk_def = core.attack_target->get_atk_def();
dd = core.attack_target->get_defense(); da = atk_def.first;
dd = atk_def.second;
core.attack_target->q_cache.attack = da; core.attack_target->q_cache.attack = da;
core.attack_target->q_cache.defense = dd; core.attack_target->q_cache.defense = dd;
core.attack_target->set_status(STATUS_BATTLE_RESULT, FALSE); core.attack_target->set_status(STATUS_BATTLE_RESULT, FALSE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment