Commit 2ec2856b authored by salix5's avatar salix5

release_param, sum_param

parent b2d98347
......@@ -111,6 +111,8 @@ public:
uint32 summon_info;
uint32 status;
uint32 operation_param;
uint32 release_param;
uint32 sum_param;
uint8 announce_count;
uint8 attacked_count;
uint8 attack_all_target;
......
......@@ -1182,7 +1182,7 @@ int32 field::get_release_list(uint8 playerid, card_set* release_list, card_set*
&& (!use_con || pduel->lua->check_matching(pcard, fun, exarg))) {
if(release_list)
release_list->insert(pcard);
pcard->operation_param = 1;
pcard->release_param = 1;
rcount++;
}
}
......@@ -1193,7 +1193,7 @@ int32 field::get_release_list(uint8 playerid, card_set* release_list, card_set*
&& (!use_con || pduel->lua->check_matching(pcard, fun, exarg))) {
if(release_list)
release_list->insert(pcard);
pcard->operation_param = 1;
pcard->release_param = 1;
rcount++;
}
}
......@@ -1204,7 +1204,7 @@ int32 field::get_release_list(uint8 playerid, card_set* release_list, card_set*
&& pcard->is_releasable_by_nonsummon(playerid) && (!use_con || pduel->lua->check_matching(pcard, fun, exarg))) {
if(ex_list)
ex_list->insert(pcard);
pcard->operation_param = 1;
pcard->release_param = 1;
rcount++;
}
}
......@@ -1255,12 +1255,12 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
if(release_list)
release_list->insert(pcard);
if(pcard->is_affected_by_effect(EFFECT_TRIPLE_TRIBUTE, target))
pcard->operation_param = 3;
pcard->release_param = 3;
else if(pcard->is_affected_by_effect(EFFECT_DOUBLE_TRIBUTE, target))
pcard->operation_param = 2;
pcard->release_param = 2;
else
pcard->operation_param = 1;
rcount += pcard->operation_param;
pcard->release_param = 1;
rcount += pcard->release_param;
}
}
uint32 ex_sum_max = 0;
......@@ -1274,12 +1274,12 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
if(ex_list)
ex_list->insert(pcard);
if(pcard->is_affected_by_effect(EFFECT_TRIPLE_TRIBUTE, target))
pcard->operation_param = 3;
pcard->release_param = 3;
else if(pcard->is_affected_by_effect(EFFECT_DOUBLE_TRIBUTE, target))
pcard->operation_param = 2;
pcard->release_param = 2;
else
pcard->operation_param = 1;
rcount += pcard->operation_param;
pcard->release_param = 1;
rcount += pcard->release_param;
} else {
effect* peffect = pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE_SUM);
if(!peffect || (peffect->is_flag(EFFECT_FLAG_COUNT_LIMIT) && (peffect->reset_count & 0xf00) == 0))
......@@ -1287,13 +1287,13 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
if(ex_list_sum)
ex_list_sum->insert(pcard);
if(pcard->is_affected_by_effect(EFFECT_TRIPLE_TRIBUTE, target))
pcard->operation_param = 3;
pcard->release_param = 3;
else if(pcard->is_affected_by_effect(EFFECT_DOUBLE_TRIBUTE, target))
pcard->operation_param = 2;
pcard->release_param = 2;
else
pcard->operation_param = 1;
if(ex_sum_max < pcard->operation_param)
ex_sum_max = pcard->operation_param;
pcard->release_param = 1;
if(ex_sum_max < pcard->release_param)
ex_sum_max = pcard->release_param;
}
}
return rcount + ex_sum_max;
......@@ -2053,7 +2053,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
card_vector nsyn;
int32 mcount = 1;
nsyn.push_back(tuner);
tuner->operation_param = tuner->get_synchro_level(pcard);
tuner->sum_param = tuner->get_synchro_level(pcard);
if(smat) {
if(pcheck)
pcheck->get_value(smat);
......@@ -2064,7 +2064,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
min--;
max--;
nsyn.push_back(smat);
smat->operation_param = smat->get_synchro_level(pcard);
smat->sum_param = smat->get_synchro_level(pcard);
mcount++;
if(min == 0) {
if(check_with_sum_limit_m(nsyn, lv, 0, 0, 0, 2)) {
......@@ -2088,7 +2088,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
if(!pduel->lua->check_matching(pm, findex2, 0))
continue;
nsyn.push_back(pm);
pm->operation_param = pm->get_synchro_level(pcard);
pm->sum_param = pm->get_synchro_level(pcard);
}
}
} else {
......@@ -2101,7 +2101,7 @@ int32 field::check_tuner_material(card* pcard, card* tuner, int32 findex1, int32
if(!pduel->lua->check_matching(pm, findex2, 0))
continue;
nsyn.push_back(pm);
pm->operation_param = pm->get_synchro_level(pcard);
pm->sum_param = pm->get_synchro_level(pcard);
}
}
}
......@@ -2171,8 +2171,8 @@ int32 field::check_with_sum_limit(const card_vector& mats, int32 acc, int32 inde
if(count > max)
return FALSE;
while(index < (int32)mats.size()) {
int32 op1 = mats[index]->operation_param & 0xffff;
int32 op2 = (mats[index]->operation_param >> 16) & 0xffff;
int32 op1 = mats[index]->sum_param & 0xffff;
int32 op2 = (mats[index]->sum_param >> 16) & 0xffff;
if((op1 == acc || op2 == acc) && count >= min)
return TRUE;
index++;
......@@ -2190,8 +2190,8 @@ int32 field::check_with_sum_limit_m(const card_vector& mats, int32 acc, int32 in
return check_with_sum_limit(mats, acc, index, 1, min, max);
if(index >= (int32)mats.size())
return FALSE;
int32 op1 = mats[index]->operation_param & 0xffff;
int32 op2 = (mats[index]->operation_param >> 16) & 0xffff;
int32 op1 = mats[index]->sum_param & 0xffff;
int32 op2 = (mats[index]->sum_param >> 16) & 0xffff;
if(acc >= op1 && check_with_sum_limit_m(mats, acc - op1, index + 1, min, max, must_count))
return TRUE;
if(op2 && acc >= op2 && check_with_sum_limit_m(mats, acc - op2, index + 1, min, max, must_count))
......@@ -2200,8 +2200,8 @@ int32 field::check_with_sum_limit_m(const card_vector& mats, int32 acc, int32 in
}
int32 field::check_with_sum_greater_limit(const card_vector& mats, int32 acc, int32 index, int32 opmin) {
while(index < (int32)mats.size()) {
int32 op1 = mats[index]->operation_param & 0xffff;
int32 op2 = (mats[index]->operation_param >> 16) & 0xffff;
int32 op1 = mats[index]->sum_param & 0xffff;
int32 op2 = (mats[index]->sum_param >> 16) & 0xffff;
if((acc <= op1 && acc + opmin > op1) || (op2 && acc <= op2 && acc + opmin > op2))
return TRUE;
index++;
......@@ -2219,8 +2219,8 @@ int32 field::check_with_sum_greater_limit_m(const card_vector& mats, int32 acc,
return check_with_sum_greater_limit(mats, acc, index, opmin);
if(index >= (int32)mats.size())
return FALSE;
int32 op1 = mats[index]->operation_param & 0xffff;
int32 op2 = (mats[index]->operation_param >> 16) & 0xffff;
int32 op1 = mats[index]->sum_param & 0xffff;
int32 op2 = (mats[index]->sum_param >> 16) & 0xffff;
if(check_with_sum_greater_limit_m(mats, acc - op1, index + 1, std::min(opmin, op1), must_count))
return TRUE;
if(op2 && check_with_sum_greater_limit_m(mats, acc - op2, index + 1, std::min(opmin, op2), must_count))
......
......@@ -290,7 +290,7 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
}
pduel->game_field->core.must_select_cards.clear();
for(auto cit = cv.begin(); cit != cv.end(); ++cit)
(*cit)->operation_param = pduel->lua->get_operation_value(*cit, 2, extraargs);
(*cit)->sum_param = pduel->lua->get_operation_value(*cit, 2, extraargs);
lua_pushboolean(L, field::check_with_sum_limit_m(cv, acc, 0, min, max, mcount));
return 1;
}
......@@ -321,7 +321,7 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
int32 mcount = cv.size();
cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end());
for(auto cit = cv.begin(); cit != cv.end(); ++cit)
(*cit)->operation_param = pduel->lua->get_operation_value(*cit, 3, extraargs);
(*cit)->sum_param = pduel->lua->get_operation_value(*cit, 3, extraargs);
if(!field::check_with_sum_limit_m(cv, acc, 0, min, max, mcount)) {
pduel->game_field->core.must_select_cards.clear();
return 0;
......@@ -346,7 +346,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
}
pduel->game_field->core.must_select_cards.clear();
for(auto cit = cv.begin(); cit != cv.end(); ++cit)
(*cit)->operation_param = pduel->lua->get_operation_value(*cit, 2, extraargs);
(*cit)->sum_param = pduel->lua->get_operation_value(*cit, 2, extraargs);
lua_pushboolean(L, field::check_with_sum_greater_limit_m(cv, acc, 0, 0xffff, mcount));
return 1;
}
......@@ -371,7 +371,7 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
int32 mcount = cv.size();
cv.insert(cv.end(), pduel->game_field->core.select_cards.begin(), pduel->game_field->core.select_cards.end());
for(auto cit = cv.begin(); cit != cv.end(); ++cit)
(*cit)->operation_param = pduel->lua->get_operation_value(*cit, 3, extraargs);
(*cit)->sum_param = pduel->lua->get_operation_value(*cit, 3, extraargs);
if(!field::check_with_sum_greater_limit_m(cv, acc, 0, 0xffff, mcount)) {
pduel->game_field->core.must_select_cards.clear();
return 0;
......
......@@ -295,10 +295,14 @@ void field::change_position(card_set* targets, effect* reason_effect, uint32 rea
ng->is_readonly = TRUE;
for(auto cit = targets->begin(); cit != targets->end(); ++cit) {
card* pcard = *cit;
if(pcard->current.position == POS_FACEUP_ATTACK) pcard->operation_param = au;
else if(pcard->current.position == POS_FACEDOWN_DEFENSE) pcard->operation_param = dd;
else if(pcard->current.position == POS_FACEUP_DEFENSE) pcard->operation_param = du;
else pcard->operation_param = ad;
if(pcard->current.position == POS_FACEUP_ATTACK)
pcard->operation_param = au;
else if(pcard->current.position == POS_FACEDOWN_DEFENSE)
pcard->operation_param = dd;
else if(pcard->current.position == POS_FACEUP_DEFENSE)
pcard->operation_param = du;
else
pcard->operation_param = ad;
pcard->operation_param |= flag;
}
add_process(PROCESSOR_CHANGEPOS, 0, reason_effect, ng, reason_player, enable);
......@@ -4384,8 +4388,8 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
card_vector nsyn;
nsyn.push_back(tuner);
nsyn.push_back(smat);
tuner->operation_param = tuner->get_synchro_level(pcard);
smat->operation_param = smat->get_synchro_level(pcard);
tuner->sum_param = tuner->get_synchro_level(pcard);
smat->sum_param = smat->get_synchro_level(pcard);
if(check_with_sum_limit_m(nsyn, lv, 0, 0, 0, 2))
core.units.begin()->step = 5;
}
......@@ -4398,12 +4402,12 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
effect* pcheck = tuner->is_affected_by_effect(EFFECT_SYNCHRO_CHECK);
core.must_select_cards.clear();
core.must_select_cards.push_back(tuner);
tuner->operation_param = tuner->get_synchro_level(pcard);
tuner->sum_param = tuner->get_synchro_level(pcard);
if(smat) {
min--;
max--;
core.must_select_cards.push_back(smat);
smat->operation_param = smat->get_synchro_level(pcard);
smat->sum_param = smat->get_synchro_level(pcard);
mcount++;
}
core.select_cards.clear();
......@@ -4418,7 +4422,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
if(!pduel->lua->check_matching(pm, -1, 0))
continue;
core.select_cards.push_back(pm);
pm->operation_param = pm->get_synchro_level(pcard);
pm->sum_param = pm->get_synchro_level(pcard);
}
}
} else {
......@@ -4431,7 +4435,7 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card* pcard, in
if(!pduel->lua->check_matching(pm, -1, 0))
continue;
core.select_cards.push_back(pm);
pm->operation_param = pm->get_synchro_level(pcard);
pm->sum_param = pm->get_synchro_level(pcard);
}
}
}
......@@ -4759,9 +4763,9 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
core.select_cards.clear();
int32 rmax = 0;
for(auto cit = core.release_cards.begin(); cit != core.release_cards.end(); ++cit)
rmax += (*cit)->operation_param;
rmax += (*cit)->release_param;
for(auto cit = core.release_cards_ex.begin(); cit != core.release_cards_ex.end(); ++cit)
rmax += (*cit)->operation_param;
rmax += (*cit)->release_param;
core.temp_var[0] = 0;
if(rmax < min) {
returns.ivalue[0] = TRUE;
......@@ -4783,7 +4787,7 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
core.select_cards.push_back(*cit);
else
for(auto cit = core.release_cards_ex_sum.begin(); cit != core.release_cards_ex_sum.end(); ++cit)
if((*cit)->operation_param == 2)
if((*cit)->release_param == 2)
core.select_cards.push_back(*cit);
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
......@@ -4820,7 +4824,7 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
uint32 rmin = core.operated_set.size();
uint32 rmax = 0;
for(auto cit = core.operated_set.begin(); cit != core.operated_set.end(); ++cit)
rmax += (*cit)->operation_param;
rmax += (*cit)->release_param;
min -= rmax;
max -= rmin;
core.units.begin()->arg2 = (max << 16) + min;
......
......@@ -443,7 +443,7 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
return TRUE;
uint8 tm = 0;
for(uint32 i = 0; i < core.select_cards.size(); ++i)
tm += core.select_cards[i]->operation_param;
tm += core.select_cards[i]->release_param;
if(max > 5)
max = 5;
if(max > tm)
......@@ -465,7 +465,7 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
pduel->write_buffer8(pcard->current.controler);
pduel->write_buffer8(pcard->current.location);
pduel->write_buffer8(pcard->current.sequence);
pduel->write_buffer8(pcard->operation_param);
pduel->write_buffer8(pcard->release_param);
}
return FALSE;
} else {
......@@ -485,7 +485,7 @@ int32 field::select_tribute(uint16 step, uint8 playerid, uint8 cancelable, uint8
return FALSE;
}
c[v] = 1;
tt += core.select_cards[v]->operation_param;
tt += core.select_cards[v]->release_param;
}
if(tt < min) {
pduel->write_buffer8(MSG_RETRY);
......@@ -570,7 +570,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
pduel->write_buffer8(pcard->current.controler);
pduel->write_buffer8(pcard->current.location);
pduel->write_buffer8(pcard->current.sequence);
pduel->write_buffer32(pcard->operation_param);
pduel->write_buffer32(pcard->sum_param);
}
pduel->write_buffer8(core.select_cards.size());
std::sort(core.select_cards.begin(), core.select_cards.end(), card::card_operation_sort);
......@@ -580,7 +580,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
pduel->write_buffer8(pcard->current.controler);
pduel->write_buffer8(pcard->current.location);
pduel->write_buffer8(pcard->current.sequence);
pduel->write_buffer32(pcard->operation_param);
pduel->write_buffer32(pcard->sum_param);
}
return FALSE;
} else {
......@@ -594,7 +594,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
return FALSE;
}
for(int32 i = 0; i < mcount; ++i)
oparam[i] = core.must_select_cards[i]->operation_param;
oparam[i] = core.must_select_cards[i]->sum_param;
int32 m = core.select_cards.size();
for(int32 i = mcount; i < returns.bvalue[0]; ++i) {
int32 v = returns.bvalue[i + 1];
......@@ -603,7 +603,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
return FALSE;
}
c[v] = 1;
oparam[i] = core.select_cards[v]->operation_param;
oparam[i] = core.select_cards[v]->sum_param;
}
if(!select_sum_check1(oparam, returns.bvalue[0], 0, acc)) {
pduel->write_buffer8(MSG_RETRY);
......@@ -614,7 +614,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
int32 mcount = core.must_select_cards.size();
int32 sum = 0, mx = 0, mn = 0x7fffffff;
for(int32 i = 0; i < mcount; ++i) {
int32 op = core.must_select_cards[i]->operation_param;
int32 op = core.must_select_cards[i]->sum_param;
int32 o1 = op & 0xffff;
int32 o2 = op >> 16;
int32 ms = (o2 && o2 < o1) ? o2 : o1;
......@@ -631,7 +631,7 @@ int32 field::select_with_sum_limit(int16 step, uint8 playerid, int32 acc, int32
return FALSE;
}
c[v] = 1;
int32 op = core.select_cards[v]->operation_param;
int32 op = core.select_cards[v]->sum_param;
int32 o1 = op & 0xffff;
int32 o2 = op >> 16;
int32 ms = (o2 && o2 < o1) ? o2 : o1;
......
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