Commit d440644e authored by mercury233's avatar mercury233
parents c7422bb8 38c90a15
...@@ -388,6 +388,8 @@ int32 card::is_pre_set_card(uint32 set_code) { ...@@ -388,6 +388,8 @@ int32 card::is_pre_set_card(uint32 set_code) {
int32 card::is_fusion_set_card(uint32 set_code) { int32 card::is_fusion_set_card(uint32 set_code) {
if(is_set_card(set_code)) if(is_set_card(set_code))
return TRUE; return TRUE;
if(pduel->game_field->core.not_material)
return FALSE;
uint32 settype = set_code & 0xfff; uint32 settype = set_code & 0xfff;
uint32 setsubtype = set_code & 0xf000; uint32 setsubtype = set_code & 0xf000;
effect_set eset; effect_set eset;
...@@ -460,7 +462,7 @@ uint32 card::get_type() { ...@@ -460,7 +462,7 @@ uint32 card::get_type() {
return type; return type;
} }
uint32 card::get_fusion_type() { uint32 card::get_fusion_type() {
if(current.location == LOCATION_SZONE && (data.type & TYPE_MONSTER)) if(current.location == LOCATION_SZONE && (data.type & TYPE_MONSTER) && !pduel->game_field->core.not_material)
return data.type; return data.type;
return get_type(); return get_type();
} }
...@@ -1028,7 +1030,7 @@ uint32 card::get_attribute() { ...@@ -1028,7 +1030,7 @@ uint32 card::get_attribute() {
uint32 card::get_fusion_attribute(uint8 playerid) { uint32 card::get_fusion_attribute(uint8 playerid) {
effect_set effects; effect_set effects;
filter_effect(EFFECT_CHANGE_FUSION_ATTRIBUTE, &effects); filter_effect(EFFECT_CHANGE_FUSION_ATTRIBUTE, &effects);
if(!effects.size()) if(!effects.size() || pduel->game_field->core.not_material)
return get_attribute(); return get_attribute();
uint32 attribute = 0; uint32 attribute = 0;
for(int32 i = 0; i < effects.size(); ++i) { for(int32 i = 0; i < effects.size(); ++i) {
...@@ -2785,7 +2787,24 @@ effect* card::check_control_effect() { ...@@ -2785,7 +2787,24 @@ effect* card::check_control_effect() {
*/ */
return ret_effect; return ret_effect;
} }
int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf) { int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material) {
if(fusion_m && !not_material) {
uint32 summon_type = SUMMON_TYPE_FUSION;
if((chkf & 0x200) > 0)
summon_type = SUMMON_TYPE_SPECIAL;
effect_set eset;
filter_effect(EFFECT_MATERIAL_LIMIT, &eset);
for(auto cit = fusion_m->container.begin(); cit != fusion_m->container.end();) {
card* pcard = *cit++;
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->add_param(summon_type, PARAM_TYPE_INT);
if(!eset[i]->check_value_condition(3))
fusion_m->container.erase(pcard);
}
}
}
auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL); auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
if(ecit == single_effect.end()) if(ecit == single_effect.end())
return FALSE; return FALSE;
...@@ -2800,17 +2819,36 @@ int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf) { ...@@ -2800,17 +2819,36 @@ int32 card::fusion_check(group* fusion_m, card* cg, uint32 chkf) {
uint8 op = pduel->game_field->core.reason_player; uint8 op = pduel->game_field->core.reason_player;
pduel->game_field->core.reason_effect = peffect; pduel->game_field->core.reason_effect = peffect;
pduel->game_field->core.reason_player = peffect->get_handler_player(); pduel->game_field->core.reason_player = peffect->get_handler_player();
pduel->game_field->core.not_material = not_material;
int32 res = pduel->lua->check_condition(peffect->condition, 4); int32 res = pduel->lua->check_condition(peffect->condition, 4);
pduel->game_field->core.reason_effect = oreason; pduel->game_field->core.reason_effect = oreason;
pduel->game_field->core.reason_player = op; pduel->game_field->core.reason_player = op;
pduel->game_field->core.not_material = 0;
return res; return res;
} }
void card::fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf) { void card::fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf, uint8 not_material) {
if(fusion_m && !not_material) {
uint32 summon_type = SUMMON_TYPE_FUSION;
if((chkf & 0x200) > 0)
summon_type = SUMMON_TYPE_SPECIAL;
effect_set eset;
filter_effect(EFFECT_MATERIAL_LIMIT, &eset);
for(auto cit = fusion_m->container.begin(); cit != fusion_m->container.end();) {
card* pcard = *cit++;
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->add_param(summon_type, PARAM_TYPE_INT);
if(!eset[i]->check_value_condition(3))
fusion_m->container.erase(pcard);
}
}
}
effect* peffect = 0; effect* peffect = 0;
auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL); auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
if(ecit != single_effect.end()) if(ecit != single_effect.end())
peffect = ecit->second; peffect = ecit->second;
pduel->game_field->add_process(PROCESSOR_SELECT_FUSION, 0, peffect, fusion_m, playerid + (chkf << 16), 0, 0, 0, cg); pduel->game_field->add_process(PROCESSOR_SELECT_FUSION, 0, peffect, fusion_m, playerid + (chkf << 16), not_material, 0, 0, cg);
} }
int32 card::check_fusion_substitute(card* fcard) { int32 card::check_fusion_substitute(card* fcard) {
effect_set eset; effect_set eset;
...@@ -3648,6 +3686,8 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) { ...@@ -3648,6 +3686,8 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) {
int32 card::is_can_be_fusion_material(card* fcard, uint32 summon_type) { int32 card::is_can_be_fusion_material(card* fcard, uint32 summon_type) {
if(is_status(STATUS_FORBIDDEN)) if(is_status(STATUS_FORBIDDEN))
return FALSE; return FALSE;
if(pduel->game_field->core.not_material)
return TRUE;
effect_set eset; effect_set eset;
filter_effect(EFFECT_CANNOT_BE_FUSION_MATERIAL, &eset); filter_effect(EFFECT_CANNOT_BE_FUSION_MATERIAL, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
......
...@@ -294,8 +294,8 @@ public: ...@@ -294,8 +294,8 @@ public:
effect* is_affected_by_effect(int32 code); effect* is_affected_by_effect(int32 code);
effect* is_affected_by_effect(int32 code, card* target); effect* is_affected_by_effect(int32 code, card* target);
effect* check_control_effect(); effect* check_control_effect();
int32 fusion_check(group* fusion_m, card* cg, uint32 chkf); int32 fusion_check(group* fusion_m, card* cg, uint32 chkf, uint8 not_material);
void fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf); void fusion_select(uint8 playerid, group* fusion_m, card* cg, uint32 chkf, uint8 not_material);
int32 check_fusion_substitute(card* fcard); int32 check_fusion_substitute(card* fcard);
int32 is_not_tuner(card* scard); int32 is_not_tuner(card* scard);
......
...@@ -443,7 +443,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -443,7 +443,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_EXTRA_LINK_MATERIAL 358 #define EFFECT_EXTRA_LINK_MATERIAL 358
#define EFFECT_QP_ACT_IN_SET_TURN 359 #define EFFECT_QP_ACT_IN_SET_TURN 359
#define EFFECT_EXTRA_PENDULUM_SUMMON 360 #define EFFECT_EXTRA_PENDULUM_SUMMON 360
#define EFFECT_IRON_WALL 361 #define EFFECT_MATERIAL_LIMIT 361
#define EVENT_STARTUP 1000 #define EVENT_STARTUP 1000
#define EVENT_FLIP 1001 #define EVENT_FLIP 1001
......
...@@ -273,6 +273,7 @@ struct processor { ...@@ -273,6 +273,7 @@ struct processor {
card* limit_link_card; card* limit_link_card;
int32 limit_link_minc; int32 limit_link_minc;
int32 limit_link_maxc; int32 limit_link_maxc;
uint8 not_material;
uint8 attack_cancelable; uint8 attack_cancelable;
uint8 attack_rollback; uint8 attack_rollback;
uint8 effect_damage_step; uint8 effect_damage_step;
......
...@@ -71,6 +71,8 @@ int32 scriptlib::card_get_fusion_code(lua_State *L) { ...@@ -71,6 +71,8 @@ int32 scriptlib::card_get_fusion_code(lua_State *L) {
lua_pushinteger(L, otcode); lua_pushinteger(L, otcode);
count++; count++;
} }
if(pcard->pduel->game_field->core.not_material)
return count;
effect_set eset; effect_set eset;
pcard->filter_effect(EFFECT_ADD_FUSION_CODE, &eset); pcard->filter_effect(EFFECT_ADD_FUSION_CODE, &eset);
for(int32 i = 0; i < eset.size(); ++i) for(int32 i = 0; i < eset.size(); ++i)
...@@ -100,7 +102,7 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) { ...@@ -100,7 +102,7 @@ int32 scriptlib::card_is_fusion_code(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
effect_set eset; effect_set eset;
pcard->filter_effect(EFFECT_ADD_FUSION_CODE, &eset); pcard->filter_effect(EFFECT_ADD_FUSION_CODE, &eset);
if(!eset.size()) if(!eset.size() || pcard->pduel->game_field->core.not_material)
return card_is_code(L); return card_is_code(L);
uint32 code1 = pcard->get_code(); uint32 code1 = pcard->get_code();
uint32 code2 = pcard->get_another_code(); uint32 code2 = pcard->get_another_code();
...@@ -2799,7 +2801,10 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) { ...@@ -2799,7 +2801,10 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) {
} }
if(lua_gettop(L) > 3) if(lua_gettop(L) > 3)
chkf = lua_tointeger(L, 4); chkf = lua_tointeger(L, 4);
lua_pushboolean(L, pcard->fusion_check(pgroup, cg, chkf)); uint8 not_material = FALSE;
if(lua_gettop(L) > 4)
not_material = lua_toboolean(L, 5);
lua_pushboolean(L, pcard->fusion_check(pgroup, cg, chkf, not_material));
return 1; return 1;
} }
int32 scriptlib::card_check_fusion_substitute(lua_State *L) { int32 scriptlib::card_check_fusion_substitute(lua_State *L) {
......
...@@ -2826,15 +2826,18 @@ int32 scriptlib::duel_select_fusion_material(lua_State *L) { ...@@ -2826,15 +2826,18 @@ int32 scriptlib::duel_select_fusion_material(lua_State *L) {
check_param(L, PARAM_TYPE_GROUP, 3); check_param(L, PARAM_TYPE_GROUP, 3);
card* cg = 0; card* cg = 0;
uint32 chkf = PLAYER_NONE; uint32 chkf = PLAYER_NONE;
uint8 not_material = FALSE;
if(lua_gettop(L) > 3 && !lua_isnil(L, 4)) { if(lua_gettop(L) > 3 && !lua_isnil(L, 4)) {
check_param(L, PARAM_TYPE_CARD, 4); check_param(L, PARAM_TYPE_CARD, 4);
cg = *(card**) lua_touserdata(L, 4); cg = *(card**) lua_touserdata(L, 4);
} }
if(lua_gettop(L) > 4) if(lua_gettop(L) > 4)
chkf = lua_tointeger(L, 5); chkf = lua_tointeger(L, 5);
if(lua_gettop(L) > 5)
not_material = lua_toboolean(L, 6);
card* pcard = *(card**) lua_touserdata(L, 2); card* pcard = *(card**) lua_touserdata(L, 2);
group* pgroup = *(group**) lua_touserdata(L, 3); group* pgroup = *(group**) lua_touserdata(L, 3);
pcard->fusion_select(playerid, pgroup, cg, chkf); pcard->fusion_select(playerid, pgroup, cg, chkf, not_material);
duel* pduel = pcard->pduel; duel* pduel = pcard->pduel;
return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) { return lua_yieldk(L, 0, (lua_KContext)pduel, [](lua_State *L, int32 status, lua_KContext ctx) {
duel* pduel = (duel*)ctx; duel* pduel = (duel*)ctx;
......
...@@ -590,12 +590,14 @@ int32 field::process() { ...@@ -590,12 +590,14 @@ int32 field::process() {
core.units.pop_front(); core.units.pop_front();
return pduel->bufferlen; return pduel->bufferlen;
} }
core.not_material = it->arg2;
core.sub_solving_event.push_back(e); core.sub_solving_event.push_back(e);
pduel->lua->add_param(it->ptr1, PARAM_TYPE_CARD); pduel->lua->add_param(it->ptr1, PARAM_TYPE_CARD);
pduel->lua->add_param(it->arg1 >> 16, PARAM_TYPE_INT); pduel->lua->add_param(it->arg1 >> 16, PARAM_TYPE_INT);
add_process(PROCESSOR_EXECUTE_OPERATION, 0, it->peffect, 0, it->arg1 & 0xffff, 0); add_process(PROCESSOR_EXECUTE_OPERATION, 0, it->peffect, 0, it->arg1 & 0xffff, 0);
it->step++; it->step++;
} else { } else {
core.not_material = 0;
core.units.pop_front(); core.units.pop_front();
} }
return pduel->bufferlen; return pduel->bufferlen;
......
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