Commit 6b9b2419 authored by Chen Bill's avatar Chen Bill Committed by GitHub

effect: add enum code_type (#670)

parent 3135a105
...@@ -863,7 +863,7 @@ uint32 effect::get_active_type(uint8 uselast) { ...@@ -863,7 +863,7 @@ uint32 effect::get_active_type(uint8 uselast) {
} else } else
return owner->get_type(); return owner->get_type();
} }
int32 effect::get_code_type() const { code_type effect::get_code_type() const {
// start from the highest bit // start from the highest bit
if (code & 0xf0000000) if (code & 0xf0000000)
return CODE_CUSTOM; return CODE_CUSTOM;
......
...@@ -22,6 +22,9 @@ struct effect_set; ...@@ -22,6 +22,9 @@ struct effect_set;
struct effect_set_v; struct effect_set_v;
enum effect_flag : uint64; enum effect_flag : uint64;
enum effect_flag2 : uint64; enum effect_flag2 : uint64;
enum code_type : int32;
bool is_continuous_event(uint32 code);
class effect { class effect {
public: public:
...@@ -112,7 +115,7 @@ public: ...@@ -112,7 +115,7 @@ public:
void set_activate_location(); void set_activate_location();
void set_active_type(); void set_active_type();
uint32 get_active_type(uint8 uselast = TRUE); uint32 get_active_type(uint8 uselast = TRUE);
int32 get_code_type() const; code_type get_code_type() const;
bool is_flag(effect_flag x) const { bool is_flag(effect_flag x) const {
return !!(flag[0] & x); return !!(flag[0] & x);
...@@ -564,10 +567,12 @@ constexpr int32 HALF_DAMAGE = 0x80000001; ...@@ -564,10 +567,12 @@ constexpr int32 HALF_DAMAGE = 0x80000001;
#define MAX_CARD_ID 0xfffffff #define MAX_CARD_ID 0xfffffff
// The type of effect code // The type of effect code
#define CODE_CUSTOM 1 // header + id (28 bits) enum code_type : int32 {
#define CODE_COUNTER 2 // header + counter_id (16 bits) CODE_CUSTOM = 1, // header + id (28 bits)
#define CODE_PHASE 3 // header + phase_id (12 bits) CODE_COUNTER, // header + counter_id (16 bits)
#define CODE_VALUE 4 // numeric value, max = 4095 CODE_PHASE, // header + phase_id (12 bits)
CODE_VALUE, // numeric value, max = 4095
};
const std::unordered_set<uint32> continuous_event{ const std::unordered_set<uint32> continuous_event{
EVENT_ADJUST, EVENT_ADJUST,
...@@ -576,7 +581,6 @@ const std::unordered_set<uint32> continuous_event{ ...@@ -576,7 +581,6 @@ const std::unordered_set<uint32> continuous_event{
EVENT_PRE_BATTLE_DAMAGE, EVENT_PRE_BATTLE_DAMAGE,
EVENT_SPSUMMON_SUCCESS_G_P, EVENT_SPSUMMON_SUCCESS_G_P,
}; };
bool is_continuous_event(uint32 code);
const std::unordered_set<uint32> affect_summoning_effect{ const std::unordered_set<uint32> affect_summoning_effect{
EFFECT_CANNOT_DISABLE_SUMMON, EFFECT_CANNOT_DISABLE_SUMMON,
......
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