Commit bbc8e973 authored by nanahira's avatar nanahira

Merge branch 'master' of https://github.com/purerosefallen/ygopro-core into 2pick

parents 98fb79f3 cf3a323b
...@@ -124,6 +124,7 @@ public: ...@@ -124,6 +124,7 @@ public:
#define EFFECT_CHANGE_SUMMON_TYPE_KOISHI 37564160 #define EFFECT_CHANGE_SUMMON_TYPE_KOISHI 37564160
#define EFFECT_CHANGE_SUMMON_LOCATION_KOISHI 37564161 #define EFFECT_CHANGE_SUMMON_LOCATION_KOISHI 37564161
#define EFFECT_LINK_SPELL_KOISHI 37564162 #define EFFECT_LINK_SPELL_KOISHI 37564162
#define EFFECT_SEA_PULSE 37564163
//status //status
#define EFFECT_STATUS_AVAILABLE 0x0001 #define EFFECT_STATUS_AVAILABLE 0x0001
......
...@@ -573,7 +573,17 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer ...@@ -573,7 +573,17 @@ int32 field::get_useable_count_fromex(card* pcard, uint8 playerid, uint8 uplayer
if(core.duel_rule >= 4 && !is_player_affected_by_effect(playerid, EFFECT_EXTRA_TOMAIN_KOISHI) && !pcard->is_affected_by_effect(EFFECT_EXTRA_TOMAIN_KOISHI)) if(core.duel_rule >= 4 && !is_player_affected_by_effect(playerid, EFFECT_EXTRA_TOMAIN_KOISHI) && !pcard->is_affected_by_effect(EFFECT_EXTRA_TOMAIN_KOISHI))
useable_count = get_useable_count_fromex_rule4(pcard, playerid, uplayer, zone, list); useable_count = get_useable_count_fromex_rule4(pcard, playerid, uplayer, zone, list);
else else
{
useable_count = get_useable_count_other(pcard, playerid, LOCATION_MZONE, uplayer, LOCATION_REASON_TOFIELD, zone, list); useable_count = get_useable_count_other(pcard, playerid, LOCATION_MZONE, uplayer, LOCATION_REASON_TOFIELD, zone, list);
if(core.duel_rule >= 4) {
uint32 temp_list = 0;
get_useable_count_fromex_rule4(pcard, playerid, uplayer, zone, &temp_list);
if(~temp_list & ((1u << 5) | (1u << 6)))
useable_count++;
if(list)
*list &= temp_list;
}
}
if(use_temp_card) if(use_temp_card)
pcard->current.location = 0; pcard->current.location = 0;
return useable_count; return useable_count;
...@@ -1773,7 +1783,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater ...@@ -1773,7 +1783,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
} }
for(auto& pcard : player[1 - playerid].list_mzone) { for(auto& pcard : player[1 - playerid].list_mzone) {
if(pcard && (pcard->get_level() || pcard->is_affected_by_effect(EFFECT_MINIATURE_GARDEN_GIRL)) && pcard->is_affect_by_effect(peffect) if(pcard && (pcard->get_level() || pcard->is_affected_by_effect(EFFECT_MINIATURE_GARDEN_GIRL)) && pcard->is_affect_by_effect(peffect)
&& pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE) && (pcard->is_affected_by_effect(EFFECT_EXTRA_RELEASE) || is_player_affected_by_effect(playerid, EFFECT_SEA_PULSE))
&& pcard->is_releasable_by_nonsummon(playerid) && pcard->is_releasable_by_effect(playerid, peffect)) && pcard->is_releasable_by_nonsummon(playerid) && pcard->is_releasable_by_effect(playerid, peffect))
material->insert(pcard); material->insert(pcard);
} }
......
...@@ -636,7 +636,7 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -636,7 +636,7 @@ interpreter::interpreter(duel* pd): coroutines(256) {
set_duel_info(lua_state, pd); set_duel_info(lua_state, pd);
//Initial //Initial
luaL_openlibs(lua_state); luaL_openlibs(lua_state);
/* #ifdef YGOPRO_LUA_SAVE
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setglobal(lua_state, "io"); lua_setglobal(lua_state, "io");
lua_pushnil(lua_state); lua_pushnil(lua_state);
...@@ -647,7 +647,7 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -647,7 +647,7 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_pushnil(lua_state); lua_pushnil(lua_state);
lua_setfield(lua_state, -2, "os"); lua_setfield(lua_state, -2, "os");
lua_pop(lua_state, 1); lua_pop(lua_state, 1);
*/ #endif
//add bit lib back //add bit lib back
lua_getglobal(lua_state, "bit32"); lua_getglobal(lua_state, "bit32");
lua_setglobal(lua_state, "bit"); lua_setglobal(lua_state, "bit");
...@@ -732,6 +732,9 @@ interpreter::interpreter(duel* pd): coroutines(256) { ...@@ -732,6 +732,9 @@ interpreter::interpreter(duel* pd): coroutines(256) {
lua_setglobal(lua_state, "EFFECT_CHANGE_SUMMON_LOCATION_KOISHI"); lua_setglobal(lua_state, "EFFECT_CHANGE_SUMMON_LOCATION_KOISHI");
lua_pushinteger(lua_state, EFFECT_LINK_SPELL_KOISHI); lua_pushinteger(lua_state, EFFECT_LINK_SPELL_KOISHI);
lua_setglobal(lua_state, "EFFECT_LINK_SPELL_KOISHI"); lua_setglobal(lua_state, "EFFECT_LINK_SPELL_KOISHI");
lua_pushinteger(lua_state, EFFECT_SEA_PULSE);
lua_setglobal(lua_state, "EFFECT_SEA_PULSE");
//music hints //music hints
lua_pushinteger(lua_state, HINT_MUSIC); lua_pushinteger(lua_state, HINT_MUSIC);
lua_setglobal(lua_state, "HINT_MUSIC"); lua_setglobal(lua_state, "HINT_MUSIC");
......
...@@ -14,12 +14,14 @@ ...@@ -14,12 +14,14 @@
#include "ocgapi.h" #include "ocgapi.h"
int32 scriptlib::debug_message(lua_State *L) { int32 scriptlib::debug_message(lua_State *L) {
#ifndef YGOPRO_SERVER_MODE
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
lua_getglobal(L, "tostring"); lua_getglobal(L, "tostring");
lua_pushvalue(L, -2); lua_pushvalue(L, -2);
lua_pcall(L, 1, 1, 0); lua_pcall(L, 1, 1, 0);
interpreter::sprintf(pduel->strbuffer, "%s", lua_tostring(L, -1)); interpreter::sprintf(pduel->strbuffer, "%s", lua_tostring(L, -1));
handle_message(pduel, 2); handle_message(pduel, 2);
#endif
return 0; return 0;
} }
int32 scriptlib::debug_add_card(lua_State *L) { int32 scriptlib::debug_add_card(lua_State *L) {
...@@ -174,6 +176,7 @@ int32 scriptlib::debug_reload_field_end(lua_State *L) { ...@@ -174,6 +176,7 @@ int32 scriptlib::debug_reload_field_end(lua_State *L) {
return 0; return 0;
} }
int32 scriptlib::debug_set_ai_name(lua_State *L) { int32 scriptlib::debug_set_ai_name(lua_State *L) {
#ifndef YGOPRO_SERVER_MODE
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_STRING, 1); check_param(L, PARAM_TYPE_STRING, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
...@@ -187,9 +190,11 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) { ...@@ -187,9 +190,11 @@ int32 scriptlib::debug_set_ai_name(lua_State *L) {
pduel->bufferp += len; pduel->bufferp += len;
pduel->bufferlen += len; pduel->bufferlen += len;
pduel->write_buffer8(0); pduel->write_buffer8(0);
#endif
return 0; return 0;
} }
int32 scriptlib::debug_show_hint(lua_State *L) { int32 scriptlib::debug_show_hint(lua_State *L) {
#ifndef YGOPRO_SERVER_MODE
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_STRING, 1); check_param(L, PARAM_TYPE_STRING, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
...@@ -203,5 +208,6 @@ int32 scriptlib::debug_show_hint(lua_State *L) { ...@@ -203,5 +208,6 @@ int32 scriptlib::debug_show_hint(lua_State *L) {
pduel->bufferp += len; pduel->bufferp += len;
pduel->bufferlen += len; pduel->bufferlen += len;
pduel->write_buffer8(0); pduel->write_buffer8(0);
#endif
return 0; return 0;
} }
...@@ -4613,7 +4613,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe ...@@ -4613,7 +4613,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe
target->current.reason_player = target->temp.reason_player; target->current.reason_player = target->temp.reason_player;
if(is_destroy) if(is_destroy)
core.destroy_canceled.insert(target); core.destroy_canceled.insert(target);
replace_effect->dec_count(); replace_effect->dec_count(replace_effect->get_handler_player());
} else } else
core.units.begin()->step = 2; core.units.begin()->step = 2;
return FALSE; return FALSE;
...@@ -4680,7 +4680,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe ...@@ -4680,7 +4680,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe
targets->container.erase(rm); targets->container.erase(rm);
} }
} }
replace_effect->dec_count(); replace_effect->dec_count(replace_effect->get_handler_player());
} else } else
core.units.begin()->step = 7; core.units.begin()->step = 7;
return FALSE; return FALSE;
...@@ -4742,7 +4742,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe ...@@ -4742,7 +4742,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe
target->current.reason_player = target->temp.reason_player; target->current.reason_player = target->temp.reason_player;
if(is_destroy) if(is_destroy)
core.destroy_canceled.insert(target); core.destroy_canceled.insert(target);
replace_effect->dec_count(); replace_effect->dec_count(replace_effect->get_handler_player());
core.desrep_chain.push_back(core.continuous_chain.front()); core.desrep_chain.push_back(core.continuous_chain.front());
} }
core.continuous_chain.pop_front(); core.continuous_chain.pop_front();
...@@ -4791,7 +4791,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe ...@@ -4791,7 +4791,7 @@ int32 field::operation_replace(uint16 step, effect* replace_effect, group* targe
targets->container.erase(rm); targets->container.erase(rm);
} }
} }
replace_effect->dec_count(); replace_effect->dec_count(replace_effect->get_handler_player());
core.desrep_chain.push_back(core.continuous_chain.front()); core.desrep_chain.push_back(core.continuous_chain.front());
} }
core.continuous_chain.pop_front(); core.continuous_chain.pop_front();
......
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