Commit ff51e934 authored by mercury233's avatar mercury233
parents ce89e6b1 2044525c
...@@ -3112,6 +3112,8 @@ int32 card::is_special_summonable(uint8 playerid, uint32 summon_type) { ...@@ -3112,6 +3112,8 @@ int32 card::is_special_summonable(uint8 playerid, uint32 summon_type) {
return eset.size(); return eset.size();
} }
int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, uint8 sumpos, uint8 sumplayer, uint8 toplayer, uint8 nocheck, uint8 nolimit, uint32 zone) { int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, uint8 sumpos, uint8 sumplayer, uint8 toplayer, uint8 nocheck, uint8 nolimit, uint32 zone) {
if(reason_effect->get_handler() == this)
reason_effect->status |= EFFECT_STATUS_SPSELF;
if(current.location == LOCATION_MZONE) if(current.location == LOCATION_MZONE)
return FALSE; return FALSE;
if(current.location == LOCATION_REMOVED && (current.position & POS_FACEDOWN)) if(current.location == LOCATION_REMOVED && (current.position & POS_FACEDOWN))
...@@ -3361,17 +3363,6 @@ int32 card::is_releasable_by_nonsummon(uint8 playerid) { ...@@ -3361,17 +3363,6 @@ int32 card::is_releasable_by_nonsummon(uint8 playerid) {
int32 card::is_releasable_by_effect(uint8 playerid, effect* peffect) { int32 card::is_releasable_by_effect(uint8 playerid, effect* peffect) {
if(!peffect) if(!peffect)
return TRUE; return TRUE;
if(current.controler != playerid && !is_affected_by_effect(EFFECT_EXTRA_RELEASE)) {
effect_set eset;
filter_effect(EFFECT_EXTRA_RELEASE_NONSUM, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(REASON_EFFECT, PARAM_TYPE_INT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
if(!eset[i]->check_value_condition(3))
return FALSE;
}
}
effect_set eset; effect_set eset;
filter_effect(EFFECT_UNRELEASABLE_EFFECT, &eset); filter_effect(EFFECT_UNRELEASABLE_EFFECT, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
......
...@@ -111,6 +111,7 @@ public: ...@@ -111,6 +111,7 @@ public:
//status //status
#define EFFECT_STATUS_AVAILABLE 0x0001 #define EFFECT_STATUS_AVAILABLE 0x0001
//#define EFFECT_STATUS_ACTIVATED 0x0002 //#define EFFECT_STATUS_ACTIVATED 0x0002
#define EFFECT_STATUS_SPSELF 0x0004
#define EFFECT_COUNT_CODE_OATH 0x10000000 #define EFFECT_COUNT_CODE_OATH 0x10000000
#define EFFECT_COUNT_CODE_DUEL 0x20000000 #define EFFECT_COUNT_CODE_DUEL 0x20000000
......
...@@ -227,7 +227,7 @@ struct processor { ...@@ -227,7 +227,7 @@ struct processor {
card_set discarded_set; card_set discarded_set;
card_set destroy_canceled; card_set destroy_canceled;
card_set delayed_enable_set; card_set delayed_enable_set;
card_set temp_set; card_set set_group_set;
effect_set_v disfield_effects; effect_set_v disfield_effects;
effect_set_v extram_effects; effect_set_v extram_effects;
effect_set_v extras_effects; effect_set_v extras_effects;
...@@ -278,6 +278,8 @@ struct processor { ...@@ -278,6 +278,8 @@ struct processor {
uint32 copy_reset; uint32 copy_reset;
uint8 copy_reset_count; uint8 copy_reset_count;
uint32 last_control_changed_id; uint32 last_control_changed_id;
uint32 set_group_used_zones;
uint8 set_group_seq[7];
uint8 dice_result[5]; uint8 dice_result[5];
uint8 coin_result[5]; uint8 coin_result[5];
uint8 to_bp; uint8 to_bp;
...@@ -554,7 +556,7 @@ public: ...@@ -554,7 +556,7 @@ public:
int32 flip_summon(uint16 step, uint8 sumplayer, card* target); int32 flip_summon(uint16 step, uint8 sumplayer, card* target);
int32 mset(uint16 step, uint8 setplayer, card* ptarget, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone); int32 mset(uint16 step, uint8 setplayer, card* ptarget, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone);
int32 sset(uint16 step, uint8 setplayer, uint8 toplayer, card* ptarget); int32 sset(uint16 step, uint8 setplayer, uint8 toplayer, card* ptarget);
int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget); int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm);
int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type); int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type);
int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone); int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone);
int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone); int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone);
......
...@@ -377,6 +377,9 @@ int32 scriptlib::duel_sets(lua_State *L) { ...@@ -377,6 +377,9 @@ int32 scriptlib::duel_sets(lua_State *L) {
toplayer = lua_tointeger(L, 3); toplayer = lua_tointeger(L, 3);
if(toplayer != 0 && toplayer != 1) if(toplayer != 0 && toplayer != 1)
toplayer = playerid; toplayer = playerid;
uint32 confirm = TRUE;
if(lua_gettop(L) > 3)
confirm = lua_toboolean(L, 4);
card* pcard = 0; card* pcard = 0;
group* pgroup = 0; group* pgroup = 0;
duel* pduel = 0; duel* pduel = 0;
...@@ -385,13 +388,20 @@ int32 scriptlib::duel_sets(lua_State *L) { ...@@ -385,13 +388,20 @@ int32 scriptlib::duel_sets(lua_State *L) {
pduel = pcard->pduel; pduel = pcard->pduel;
} else if(check_param(L, PARAM_TYPE_GROUP, 2, TRUE)) { } else if(check_param(L, PARAM_TYPE_GROUP, 2, TRUE)) {
pgroup = *(group**) lua_touserdata(L, 2); pgroup = *(group**) lua_touserdata(L, 2);
pduel = pgroup->pduel; if(pgroup->container.empty()) {
return 0;
} else if(pgroup->container.size() == 1) {
pcard = *pgroup->container.begin();
pduel = pcard->pduel;
} else {
pduel = pgroup->pduel;
}
} else } else
luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2); luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2);
if(pcard) if(pcard)
pduel->game_field->add_process(PROCESSOR_SSET, 0, 0, (group*)pcard, playerid, toplayer); pduel->game_field->add_process(PROCESSOR_SSET, 0, 0, (group*)pcard, playerid, toplayer);
else else
pduel->game_field->add_process(PROCESSOR_SSET_G, 0, 0, pgroup, playerid, toplayer); pduel->game_field->add_process(PROCESSOR_SSET_G, 0, 0, pgroup, playerid, toplayer, confirm);
return lua_yield(L, 0); return lua_yield(L, 0);
} }
int32 scriptlib::duel_create_token(lua_State *L) { int32 scriptlib::duel_create_token(lua_State *L) {
...@@ -435,9 +445,9 @@ int32 scriptlib::duel_special_summon(lua_State *L) { ...@@ -435,9 +445,9 @@ int32 scriptlib::duel_special_summon(lua_State *L) {
if(lua_gettop(L) >= 8) if(lua_gettop(L) >= 8)
zone = lua_tointeger(L, 8); zone = lua_tointeger(L, 8);
if(pcard) { if(pcard) {
pduel->game_field->core.temp_set.clear(); field::card_set cset;
pduel->game_field->core.temp_set.insert(pcard); cset.insert(pcard);
pduel->game_field->special_summon(&pduel->game_field->core.temp_set, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone); pduel->game_field->special_summon(&cset, sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
} else } else
pduel->game_field->special_summon(&(pgroup->container), sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone); pduel->game_field->special_summon(&(pgroup->container), sumtype, sumplayer, playerid, nocheck, nolimit, positions, zone);
pduel->game_field->core.subunits.back().type = PROCESSOR_SPSUMMON_S; pduel->game_field->core.subunits.back().type = PROCESSOR_SPSUMMON_S;
...@@ -629,9 +639,9 @@ int32 scriptlib::duel_change_form(lua_State *L) { ...@@ -629,9 +639,9 @@ int32 scriptlib::duel_change_form(lua_State *L) {
if(top > 5 && lua_toboolean(L, 6)) flag |= NO_FLIP_EFFECT; if(top > 5 && lua_toboolean(L, 6)) flag |= NO_FLIP_EFFECT;
if(top > 6 && lua_toboolean(L, 7)) flag |= FLIP_SET_AVAILABLE; if(top > 6 && lua_toboolean(L, 7)) flag |= FLIP_SET_AVAILABLE;
if(pcard) { if(pcard) {
pduel->game_field->core.temp_set.clear(); field::card_set cset;
pduel->game_field->core.temp_set.insert(pcard); cset.insert(pcard);
pduel->game_field->change_position(&pduel->game_field->core.temp_set, pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE); pduel->game_field->change_position(&cset, pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE);
} else } else
pduel->game_field->change_position(&(pgroup->container), pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE); pduel->game_field->change_position(&(pgroup->container), pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE);
pduel->game_field->core.subunits.back().type = PROCESSOR_CHANGEPOS_S; pduel->game_field->core.subunits.back().type = PROCESSOR_CHANGEPOS_S;
......
This diff is collapsed.
...@@ -417,7 +417,7 @@ int32 field::process() { ...@@ -417,7 +417,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_SSET_G: { case PROCESSOR_SSET_G: {
if (sset_g(it->step, it->arg1, it->arg2, it->ptarget)) { if (sset_g(it->step, it->arg1, it->arg2, it->ptarget, it->arg3)) {
pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT); pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT);
core.units.pop_front(); core.units.pop_front();
} else } else
...@@ -2106,7 +2106,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -2106,7 +2106,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
&& peffect->is_chainable(priority) && peffect->is_activateable(priority, clit->evt, TRUE)) { && peffect->is_chainable(priority) && peffect->is_activateable(priority, clit->evt, TRUE)) {
for(auto cait = core.current_chain.begin(); cait != core.current_chain.end(); ++cait) { for(auto cait = core.current_chain.begin(); cait != core.current_chain.end(); ++cait) {
if(cait->triggering_player == priority) { if(cait->triggering_player == priority) {
if(std::any_of(core.new_ochain_h.begin(), core.new_ochain_h.end(), [=](chain ch) { return ch.chain_id == cait->chain_id; })) { if((peffect->status & EFFECT_STATUS_SPSELF) && (cait->triggering_effect->status & EFFECT_STATUS_SPSELF)
&& std::any_of(core.new_ochain_h.begin(), core.new_ochain_h.end(), [=](chain ch) { return ch.chain_id == cait->chain_id; })) {
act = false; act = false;
break; break;
} }
......
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