Commit 189e3a1b authored by Chen Bill's avatar Chen Bill Committed by GitHub

change effect::type to uint32, fix effect_sort_id (#631)

* change effect::type to uint32

* fix effect_sort_id()
parent 614ee807
...@@ -12,6 +12,10 @@ ...@@ -12,6 +12,10 @@
#include "interpreter.h" #include "interpreter.h"
bool effect_sort_id(const effect* e1, const effect* e2) { bool effect_sort_id(const effect* e1, const effect* e2) {
int32 is_single1 = e1->is_iniital_single();
int32 is_single2 = e2->is_iniital_single();
if (is_single1 != is_single2)
return is_single1 > is_single2;
return e1->id < e2->id; return e1->id < e2->id;
} }
// return: code is an event reserved for EFFECT_TYPE_CONTINUOUS or not // return: code is an event reserved for EFFECT_TYPE_CONTINUOUS or not
...@@ -615,6 +619,9 @@ int32 effect::is_chainable(uint8 tp) { ...@@ -615,6 +619,9 @@ int32 effect::is_chainable(uint8 tp) {
int32 effect::is_hand_trigger() const { int32 effect::is_hand_trigger() const {
return (range & LOCATION_HAND) && (type & EFFECT_TYPE_TRIGGER_O) && get_code_type() != CODE_PHASE; return (range & LOCATION_HAND) && (type & EFFECT_TYPE_TRIGGER_O) && get_code_type() != CODE_PHASE;
} }
int32 effect::is_iniital_single() const {
return (type & EFFECT_TYPE_SINGLE) && is_flag(EFFECT_FLAG_SINGLE_RANGE) && is_flag(EFFECT_FLAG_INITIAL);
}
//return: this can be reset by reset_level or not //return: this can be reset by reset_level or not
//RESET_DISABLE is valid only when owner == handler //RESET_DISABLE is valid only when owner == handler
int32 effect::reset(uint32 reset_level, uint32 reset_type) { int32 effect::reset(uint32 reset_level, uint32 reset_type) {
......
...@@ -36,7 +36,7 @@ public: ...@@ -36,7 +36,7 @@ public:
uint32 code{ 0 }; uint32 code{ 0 };
uint32 flag[2]{}; uint32 flag[2]{};
uint32 id{ 0 }; uint32 id{ 0 };
uint16 type{ 0 }; uint32 type{ 0 };
uint16 copy_id{ 0 }; uint16 copy_id{ 0 };
uint16 range{ 0 }; uint16 range{ 0 };
uint16 s_range{ 0 }; uint16 s_range{ 0 };
...@@ -88,6 +88,7 @@ public: ...@@ -88,6 +88,7 @@ public:
int32 is_immuned(card* pcard); int32 is_immuned(card* pcard);
int32 is_chainable(uint8 tp); int32 is_chainable(uint8 tp);
int32 is_hand_trigger() const; int32 is_hand_trigger() const;
int32 is_iniital_single() const;
int32 reset(uint32 reset_level, uint32 reset_type); int32 reset(uint32 reset_level, uint32 reset_type);
void dec_count(uint8 playerid = PLAYER_NONE); void dec_count(uint8 playerid = PLAYER_NONE);
void recharge(); void recharge();
......
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