Commit c4c87b0b authored by mercury233's avatar mercury233

update

parent e4385b59
...@@ -2887,7 +2887,7 @@ int32_t field::check_tribute(card* pcard, int32_t min, int32_t max, group* mg, u ...@@ -2887,7 +2887,7 @@ int32_t field::check_tribute(card* pcard, int32_t min, int32_t max, group* mg, u
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
static void get_sum_params(uint32_t sum_param, int32_t& op1, int32_t& op2) { void field::get_sum_params(uint32_t sum_param, int32_t& op1, int32_t& op2) {
op1 = sum_param & 0xffff; op1 = sum_param & 0xffff;
op2 = (sum_param >> 16) & 0xffff; op2 = (sum_param >> 16) & 0xffff;
if(op2 & 0x8000) { if(op2 & 0x8000) {
......
...@@ -474,6 +474,7 @@ public: ...@@ -474,6 +474,7 @@ public:
int32_t check_tuner_material(lua_State* L, card* pcard, card* tuner, int32_t findex1, int32_t findex2, int32_t min, int32_t max, card* smat, group* mg); int32_t check_tuner_material(lua_State* L, card* pcard, card* tuner, int32_t findex1, int32_t findex2, int32_t min, int32_t max, card* smat, group* mg);
int32_t check_other_synchro_material(const card_vector& nsyn, int32_t lv, int32_t min, int32_t max, int32_t mcount); int32_t check_other_synchro_material(const card_vector& nsyn, int32_t lv, int32_t min, int32_t max, int32_t mcount);
int32_t check_tribute(card* pcard, int32_t min, int32_t max, group* mg, uint8_t toplayer, uint32_t zone = 0x1f, uint32_t releasable = 0xff00ff, uint32_t pos = 0x1); int32_t check_tribute(card* pcard, int32_t min, int32_t max, group* mg, uint8_t toplayer, uint32_t zone = 0x1f, uint32_t releasable = 0xff00ff, uint32_t pos = 0x1);
static void get_sum_params(uint32_t sum_param, int32_t& op1, int32_t& op2);
static int32_t check_with_sum_limit(const card_vector& mats, int32_t acc, int32_t index, int32_t count, int32_t min, int32_t max, int32_t opmin); static int32_t check_with_sum_limit(const card_vector& mats, int32_t acc, int32_t index, int32_t count, int32_t min, int32_t max, int32_t opmin);
static int32_t check_with_sum_limit_m(const card_vector& mats, int32_t acc, int32_t index, int32_t min, int32_t max, int32_t opmin, int32_t must_count); static int32_t check_with_sum_limit_m(const card_vector& mats, int32_t acc, int32_t index, int32_t min, int32_t max, int32_t opmin, int32_t must_count);
static int32_t check_with_sum_greater_limit(const card_vector& mats, int32_t acc, int32_t index, int32_t opmin); static int32_t check_with_sum_greater_limit(const card_vector& mats, int32_t acc, int32_t index, int32_t opmin);
......
...@@ -630,19 +630,11 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert ...@@ -630,19 +630,11 @@ int32_t field::select_counter(uint16_t step, uint8_t playerid, uint16_t countert
} }
return TRUE; return TRUE;
} }
static void get_sum_params(uint32_t sum_param, int32_t& op1, int32_t& op2) {
op1 = sum_param & 0xffff;
op2 = (sum_param >> 16) & 0xffff;
if(op2 & 0x8000) {
op1 = sum_param & 0x7fffffff;
op2 = 0;
}
}
static int32_t select_sum_check1(const uint32_t* oparam, int32_t size, int32_t index, int32_t acc, int32_t opmin) { static int32_t select_sum_check1(const uint32_t* oparam, int32_t size, int32_t index, int32_t acc, int32_t opmin) {
if(acc == 0 || index == size) if(acc == 0 || index == size)
return FALSE; return FALSE;
int32_t o1, o2; int32_t o1, o2;
get_sum_params(oparam[index], o1, o2); field::get_sum_params(oparam[index], o1, o2);
if(index == size - 1) if(index == size - 1)
return (acc == o1 && acc + opmin > o1) || (o2 && acc == o2 && acc + opmin > o2); return (acc == o1 && acc + opmin > o1) || (o2 && acc == o2 && acc + opmin > o2);
return (acc > o1 && select_sum_check1(oparam, size, index + 1, acc - o1, std::min(o1, opmin))) return (acc > o1 && select_sum_check1(oparam, size, index + 1, acc - o1, std::min(o1, opmin)))
...@@ -720,7 +712,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc ...@@ -720,7 +712,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
int32_t sum = 0, mx = 0, mn = 0x7fffffff; int32_t sum = 0, mx = 0, mn = 0x7fffffff;
for(int32_t i = 0; i < mcount; ++i) { for(int32_t i = 0; i < mcount; ++i) {
int32_t o1, o2; int32_t o1, o2;
get_sum_params(core.must_select_cards[i]->sum_param, o1, o2); field::get_sum_params(core.must_select_cards[i]->sum_param, o1, o2);
int32_t ms = (o2 && o2 < o1) ? o2 : o1; int32_t ms = (o2 && o2 < o1) ? o2 : o1;
sum += ms; sum += ms;
mx += std::max(o1, o2); mx += std::max(o1, o2);
...@@ -736,7 +728,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc ...@@ -736,7 +728,7 @@ int32_t field::select_with_sum_limit(int16_t step, uint8_t playerid, int32_t acc
} }
c.insert(v); c.insert(v);
int32_t o1, o2; int32_t o1, o2;
get_sum_params(core.select_cards[v]->sum_param, o1, o2); field::get_sum_params(core.select_cards[v]->sum_param, o1, o2);
int32_t ms = (o2 && o2 < o1) ? o2 : o1; int32_t ms = (o2 && o2 < o1) ? o2 : o1;
sum += ms; sum += ms;
mx += std::max(o1, o2); mx += std::max(o1, o2);
......
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