Commit cd13c762 authored by Momobako's avatar Momobako

Merge branch 'master' of https://github.com/purerosefallen/ygopro-222DIY into beta

parents 2824dddd 81d7b018
...@@ -9,12 +9,12 @@ addons: ...@@ -9,12 +9,12 @@ addons:
packages: packages:
- libevent-dev - libevent-dev
- libsqlite3-dev - libsqlite3-dev
- liblua5.2-dev - liblua5.3-dev
before_install: before_install:
- git submodule update --init --recursive - git submodule update --init --recursive
- wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-linux.tar.gz | tar zfx - - wget -O - https://github.com/premake/premake-core/releases/download/v5.0.0-alpha10/premake-5.0.0-alpha10-linux.tar.gz | tar zfx -
script: script:
- ./premake5 gmake - ./premake5 gmake
- cd build - cd build
- sed -i 's/-llua/-llua5.2/g' ygopro.make - sed -i 's/-llua/-llua5.3/g' ygopro.make
- make config=release - make config=release
...@@ -12,9 +12,9 @@ install: ...@@ -12,9 +12,9 @@ install:
- move libevent-2.0.22-stable event - move libevent-2.0.22-stable event
- xcopy /E event\WIN32-Code event\include - xcopy /E event\WIN32-Code event\include
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.2.4.tar.gz ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.lua.org/ftp/lua-5.3.4.tar.gz ; exit 0"
- tar xf lua-5.2.4.tar.gz - tar xf lua-5.3.4.tar.gz
- move lua-5.2.4\src lua - move lua-5.3.4\src lua
- bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip ; exit 0" - bash -c "curl --retry 5 --connect-timeout 30 --location --remote-header-name --remote-name https://www.sqlite.org/2016/sqlite-amalgamation-3150200.zip ; exit 0"
- 7z x sqlite-amalgamation-3150200.zip - 7z x sqlite-amalgamation-3150200.zip
...@@ -116,7 +116,7 @@ cache: ...@@ -116,7 +116,7 @@ cache:
- libevent-2.0.22-stable.tar.gz - libevent-2.0.22-stable.tar.gz
- freetype-2.8.tar.bz2 - freetype-2.8.tar.bz2
- irrlicht-1.8.4.zip - irrlicht-1.8.4.zip
- lua-5.2.4.tar.gz - lua-5.3.4.tar.gz
- sqlite-amalgamation-3200100.zip - sqlite-amalgamation-3200100.zip
- irrKlang-32bit-1.5.0.zip - irrKlang-32bit-1.5.0.zip
- irrKlang-pro-1.5.0.zip - irrKlang-pro-1.5.0.zip
......
No preview for this file type
...@@ -128,7 +128,7 @@ end ...@@ -128,7 +128,7 @@ end
function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params) function cm.CheckGroupRecursive(c,sg,g,f,min,max,ext_params)
sg:AddCard(c) sg:AddCard(c)
local ct=sg:GetCount() local ct=sg:GetCount()
local res=(ct>=min and ct<= max and f(sg,table.unpack(ext_params))) local res=(ct>=min and ct<=max and f(sg,table.unpack(ext_params)))
or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params)) or (ct<max and g:IsExists(cm.CheckGroupRecursive,1,sg,sg,g,f,min,max,ext_params))
sg:RemoveCard(c) sg:RemoveCard(c)
return res return res
......
...@@ -24,5 +24,5 @@ project "ygopro" ...@@ -24,5 +24,5 @@ project "ygopro"
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=gnu++0x", "-fno-rtti" } buildoptions { "-std=gnu++0x", "-fno-rtti" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" } includedirs { "/usr/include/lua", "/usr/include/lua5.3", "/usr/include/lua/5.3" }
links { "event_pthreads", "dl", "pthread" } links { "event_pthreads", "dl", "pthread" }
...@@ -104,6 +104,7 @@ public: ...@@ -104,6 +104,7 @@ public:
public: public:
void addcard(card* pcard); void addcard(card* pcard);
}; };
//millux //millux
uint32 get_ritual_type(); uint32 get_ritual_type();
//222DIY //222DIY
......
...@@ -38,6 +38,7 @@ typedef int BOOL; ...@@ -38,6 +38,7 @@ typedef int BOOL;
#ifndef NULL #ifndef NULL
#define NULL 0 #define NULL 0
#endif #endif
#define lua_tonumberint(L,i) (lua_Integer)(((lua_tonumberx(L, (i), NULL) > 0) ? 0.5 : -0.5) + lua_tonumberx(L, (i), NULL))
struct card_sort { struct card_sort {
bool operator()(void* const & c1, void* const & c2) const; bool operator()(void* const & c1, void* const & c2) const;
}; };
......
...@@ -454,6 +454,9 @@ int32 effect::is_target(card* pcard) { ...@@ -454,6 +454,9 @@ int32 effect::is_target(card* pcard) {
} }
} }
} }
return is_fit_target_function(pcard);
}
int32 effect::is_fit_target_function(card* pcard) {
if(target) { if(target) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT); pduel->lua->add_param(this, PARAM_TYPE_EFFECT);
pduel->lua->add_param(pcard, PARAM_TYPE_CARD); pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
......
...@@ -75,6 +75,7 @@ public: ...@@ -75,6 +75,7 @@ public:
int32 is_condition_check(uint8 playerid, const tevent& e); int32 is_condition_check(uint8 playerid, const tevent& e);
int32 is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_target(card* pcard); int32 is_target(card* pcard);
int32 is_fit_target_function(card* pcard);
int32 is_target_player(uint8 playerid); int32 is_target_player(uint8 playerid);
int32 is_player_effect_target(card* pcard); int32 is_player_effect_target(card* pcard);
int32 is_immuned(card* pcard); int32 is_immuned(card* pcard);
......
...@@ -1210,9 +1210,38 @@ void field::filter_field_effect(uint32 code, effect_set* eset, uint8 sort) { ...@@ -1210,9 +1210,38 @@ void field::filter_field_effect(uint32 code, effect_set* eset, uint8 sort) {
} }
// put all cards in the target of peffect into cset // put all cards in the target of peffect into cset
void field::filter_affected_cards(effect* peffect, card_set* cset) { void field::filter_affected_cards(effect* peffect, card_set* cset) {
if((peffect->type & EFFECT_TYPE_ACTIONS) || !(peffect->type & EFFECT_TYPE_FIELD)) if((peffect->type & EFFECT_TYPE_ACTIONS) || !(peffect->type & EFFECT_TYPE_FIELD) || peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET))
return; return;
filter_inrange_cards(peffect, cset); uint8 self = peffect->get_handler_player();
if(self == PLAYER_NONE)
return;
std::vector<card_vector*> cvec;
uint16 range = peffect->s_range;
for(uint32 p = 0; p < 2; ++p) {
if(range & LOCATION_MZONE)
cvec.push_back(&player[self].list_mzone);
if(range & LOCATION_SZONE)
cvec.push_back(&player[self].list_szone);
if(range & LOCATION_GRAVE)
cvec.push_back(&player[self].list_grave);
if(range & LOCATION_REMOVED)
cvec.push_back(&player[self].list_remove);
if(range & LOCATION_HAND)
cvec.push_back(&player[self].list_hand);
if(range & LOCATION_DECK)
cvec.push_back(&player[self].list_main);
if(range & LOCATION_EXTRA)
cvec.push_back(&player[self].list_extra);
range = peffect->o_range;
self = 1 - self;
}
for(auto cvit = cvec.begin(); cvit != cvec.end(); ++cvit) {
for(auto it = (*cvit)->begin(); it != (*cvit)->end(); ++it) {
card* pcard = *it;
if(pcard && peffect->is_target(pcard))
cset->insert(pcard);
}
}
} }
void field::filter_inrange_cards(effect* peffect, card_set* cset) { void field::filter_inrange_cards(effect* peffect, card_set* cset) {
if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET)) if(peffect->is_flag(EFFECT_FLAG_PLAYER_TARGET))
...@@ -1221,59 +1250,32 @@ void field::filter_inrange_cards(effect* peffect, card_set* cset) { ...@@ -1221,59 +1250,32 @@ void field::filter_inrange_cards(effect* peffect, card_set* cset) {
if(self == PLAYER_NONE) if(self == PLAYER_NONE)
return; return;
uint16 range = peffect->s_range; uint16 range = peffect->s_range;
std::vector<card_vector*> cvec;
for(uint32 p = 0; p < 2; ++p) { for(uint32 p = 0; p < 2; ++p) {
if (range & LOCATION_MZONE) { if(range & LOCATION_MZONE)
for (auto it = player[self].list_mzone.begin(); it != player[self].list_mzone.end(); ++it) { cvec.push_back(&player[self].list_mzone);
card* pcard = *it; if(range & LOCATION_SZONE)
if (pcard && peffect->is_target(pcard)) cvec.push_back(&player[self].list_szone);
cset->insert(pcard); if(range & LOCATION_GRAVE)
} cvec.push_back(&player[self].list_grave);
} if(range & LOCATION_REMOVED)
if (range & LOCATION_SZONE) { cvec.push_back(&player[self].list_remove);
for (auto it = player[self].list_szone.begin(); it != player[self].list_szone.end(); ++it) { if(range & LOCATION_HAND)
card* pcard = *it; cvec.push_back(&player[self].list_hand);
if (pcard && peffect->is_target(pcard)) if(range & LOCATION_DECK)
cset->insert(pcard); cvec.push_back(&player[self].list_main);
} if(range & LOCATION_EXTRA)
} cvec.push_back(&player[self].list_extra);
if (range & LOCATION_GRAVE) {
for (auto it = player[self].list_grave.begin(); it != player[self].list_grave.end(); ++it) {
card* pcard = *it;
if (peffect->is_target(pcard))
cset->insert(pcard);
}
}
if (range & LOCATION_REMOVED) {
for (auto it = player[self].list_remove.begin(); it != player[self].list_remove.end(); ++it) {
card* pcard = *it;
if (peffect->is_target(pcard))
cset->insert(pcard);
}
}
if (range & LOCATION_HAND) {
for (auto it = player[self].list_hand.begin(); it != player[self].list_hand.end(); ++it) {
card* pcard = *it;
if (peffect->is_target(pcard))
cset->insert(pcard);
}
}
if(range & LOCATION_DECK) {
for(auto it = player[self].list_main.begin(); it != player[self].list_main.end(); ++it) {
card* pcard = *it;
if(peffect->is_target(pcard))
cset->insert(pcard);
}
}
if(range & LOCATION_EXTRA) {
for(auto it = player[self].list_extra.begin(); it != player[self].list_extra.end(); ++it) {
card* pcard = *it;
if(peffect->is_target(pcard))
cset->insert(pcard);
}
}
range = peffect->o_range; range = peffect->o_range;
self = 1 - self; self = 1 - self;
} }
for(auto cvit = cvec.begin(); cvit != cvec.end(); ++cvit) {
for(auto it = (*cvit)->begin(); it != (*cvit)->end(); ++it) {
card* pcard = *it;
if(pcard && peffect->is_fit_target_function(pcard))
cset->insert(pcard);
}
}
} }
void field::filter_player_effect(uint8 playerid, uint32 code, effect_set* eset, uint8 sort) { void field::filter_player_effect(uint8 playerid, uint32 code, effect_set* eset, uint8 sort) {
auto rg = effects.aura_effect.equal_range(code); auto rg = effects.aura_effect.equal_range(code);
...@@ -3340,15 +3342,11 @@ int32 field::get_cteffect(effect* peffect, int32 playerid, int32 store) { ...@@ -3340,15 +3342,11 @@ int32 field::get_cteffect(effect* peffect, int32 playerid, int32 store) {
core.select_chains.clear(); core.select_chains.clear();
core.select_options.clear(); core.select_options.clear();
} }
const bool damage_step = infos.phase == PHASE_DAMAGE && !peffect->is_flag(EFFECT_FLAG_DAMAGE_STEP);
const bool damage_cal = infos.phase == PHASE_DAMAGE_CAL && !peffect->is_flag(EFFECT_FLAG_DAMAGE_CAL);
for(auto efit = phandler->field_effect.begin(); efit != phandler->field_effect.end(); ++efit) { for(auto efit = phandler->field_effect.begin(); efit != phandler->field_effect.end(); ++efit) {
effect* feffect = efit->second; effect* feffect = efit->second;
if(!(feffect->type & (EFFECT_TYPE_TRIGGER_F | EFFECT_TYPE_TRIGGER_O | EFFECT_TYPE_QUICK_O))) if(!(feffect->type & (EFFECT_TYPE_TRIGGER_F | EFFECT_TYPE_TRIGGER_O | EFFECT_TYPE_QUICK_O)))
continue; continue;
if(damage_step && !feffect->is_flag(EFFECT_FLAG_DAMAGE_STEP)) if(!feffect->in_range(phandler))
continue;
if(damage_cal && !feffect->is_flag(EFFECT_FLAG_DAMAGE_CAL))
continue; continue;
uint32 code = efit->first; uint32 code = efit->first;
if(code == EVENT_FREE_CHAIN || code == EVENT_PHASE + infos.phase) { if(code == EVENT_FREE_CHAIN || code == EVENT_PHASE + infos.phase) {
......
...@@ -1037,7 +1037,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg ...@@ -1037,7 +1037,7 @@ int32 interpreter::get_operation_value(card* pcard, int32 findex, int32 extraarg
} }
return OPERATION_FAIL; return OPERATION_FAIL;
} }
result = lua_tointeger(current_state, -1); result = lua_tonumberint(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -1059,7 +1059,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) { ...@@ -1059,7 +1059,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count) {
if (lua_isboolean(current_state, -1)) if (lua_isboolean(current_state, -1))
result = lua_toboolean(current_state, -1); result = lua_toboolean(current_state, -1);
else else
result = lua_tointeger(current_state, -1); result = lua_tonumberint(current_state, -1);
lua_pop(current_state, 1); lua_pop(current_state, 1);
no_action--; no_action--;
call_depth--; call_depth--;
...@@ -1093,7 +1093,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i ...@@ -1093,7 +1093,7 @@ int32 interpreter::get_function_value(int32 f, uint32 param_count, std::vector<i
if (lua_isboolean(current_state, index)) if (lua_isboolean(current_state, index))
return_value = lua_toboolean(current_state, index); return_value = lua_toboolean(current_state, index);
else else
return_value = lua_tointeger(current_state, index); return_value = lua_tonumberint(current_state, index);
result->push_back(return_value); result->push_back(return_value);
} }
lua_settop(current_state, stack_top); lua_settop(current_state, stack_top);
...@@ -1154,7 +1154,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -1154,7 +1154,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
if (result == 0) { if (result == 0) {
coroutines.erase(f); coroutines.erase(f);
if(yield_value) if(yield_value)
*yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : lua_tointeger(rthread, -1); *yield_value = lua_isboolean(rthread, -1) ? lua_toboolean(rthread, -1) : lua_tonumberint(rthread, -1);
current_state = lua_state; current_state = lua_state;
call_depth--; call_depth--;
if(call_depth == 0) { if(call_depth == 0) {
......
This diff is collapsed.
...@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) { ...@@ -25,12 +25,12 @@ int32 scriptlib::debug_message(lua_State *L) {
int32 scriptlib::debug_add_card(lua_State *L) { int32 scriptlib::debug_add_card(lua_State *L) {
check_param_count(L, 6); check_param_count(L, 6);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
int32 code = lua_tointeger(L, 1); int32 code = lua_tonumberint(L, 1);
int32 owner = lua_tointeger(L, 2); int32 owner = lua_tonumberint(L, 2);
int32 playerid = lua_tointeger(L, 3); int32 playerid = lua_tonumberint(L, 3);
int32 location = lua_tointeger(L, 4); int32 location = lua_tonumberint(L, 4);
int32 sequence = lua_tointeger(L, 5); int32 sequence = lua_tonumberint(L, 5);
int32 position = lua_tointeger(L, 6); int32 position = lua_tonumberint(L, 6);
int32 proc = lua_toboolean(L, 7); int32 proc = lua_toboolean(L, 7);
if(owner != 0 && owner != 1) if(owner != 0 && owner != 1)
return 0; return 0;
...@@ -77,10 +77,10 @@ int32 scriptlib::debug_add_card(lua_State *L) { ...@@ -77,10 +77,10 @@ int32 scriptlib::debug_add_card(lua_State *L) {
int32 scriptlib::debug_set_player_info(lua_State *L) { int32 scriptlib::debug_set_player_info(lua_State *L) {
check_param_count(L, 4); check_param_count(L, 4);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 playerid = lua_tointeger(L, 1); uint32 playerid = lua_tonumberint(L, 1);
uint32 lp = lua_tointeger(L, 2); uint32 lp = lua_tonumberint(L, 2);
uint32 startcount = lua_tointeger(L, 3); uint32 startcount = lua_tonumberint(L, 3);
uint32 drawcount = lua_tointeger(L, 4); uint32 drawcount = lua_tonumberint(L, 4);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
pduel->game_field->player[playerid].lp = lp; pduel->game_field->player[playerid].lp = lp;
...@@ -92,10 +92,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) { ...@@ -92,10 +92,10 @@ int32 scriptlib::debug_pre_summon(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 summon_type = lua_tointeger(L, 2); uint32 summon_type = lua_tonumberint(L, 2);
uint8 summon_location = 0; uint8 summon_location = 0;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
summon_location = lua_tointeger(L, 3); summon_location = lua_tonumberint(L, 3);
pcard->summon_info = summon_type | (summon_location << 16); pcard->summon_info = summon_type | (summon_location << 16);
return 0; return 0;
} }
...@@ -130,8 +130,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -130,8 +130,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 countertype = lua_tointeger(L, 2); uint32 countertype = lua_tonumberint(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(L, 3);
uint16 cttype = countertype & ~COUNTER_NEED_ENABLE; uint16 cttype = countertype & ~COUNTER_NEED_ENABLE;
auto pr = pcard->counters.insert(std::make_pair(cttype, card::counter_map::mapped_type())); auto pr = pcard->counters.insert(std::make_pair(cttype, card::counter_map::mapped_type()));
auto cmit = pr.first; auto cmit = pr.first;
...@@ -148,8 +148,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) { ...@@ -148,8 +148,8 @@ int32 scriptlib::debug_pre_add_counter(lua_State *L) {
int32 scriptlib::debug_reload_field_begin(lua_State *L) { int32 scriptlib::debug_reload_field_begin(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
uint32 flag = lua_tointeger(L, 1); uint32 flag = lua_tonumberint(L, 1);
int32 rule = lua_tointeger(L, 2); int32 rule = lua_tonumberint(L, 2);
pduel->clear(); pduel->clear();
pduel->game_field->core.duel_options = flag; pduel->game_field->core.duel_options = flag;
if (rule) if (rule)
......
This diff is collapsed.
...@@ -291,7 +291,7 @@ int32 scriptlib::effect_set_value(lua_State *L) { ...@@ -291,7 +291,7 @@ int32 scriptlib::effect_set_value(lua_State *L) {
if(lua_isboolean(L, 2)) if(lua_isboolean(L, 2))
peffect->value = lua_toboolean(L, 2); peffect->value = lua_toboolean(L, 2);
else else
peffect->value = lua_tointeger(L, 2); peffect->value = lua_tonumberint(L, 2);
} }
return 0; return 0;
} }
...@@ -485,7 +485,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) { ...@@ -485,7 +485,7 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 tpe = lua_tointeger(L, 2); uint32 tpe = lua_tonumberint(L, 2);
uint32 atype; uint32 atype;
if(peffect->type & 0x7f0) { if(peffect->type & 0x7f0) {
if(peffect->active_type) if(peffect->active_type)
...@@ -515,7 +515,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) { ...@@ -515,7 +515,7 @@ int32 scriptlib::effect_is_has_category(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 tcate = lua_tointeger(L, 2); uint32 tcate = lua_tonumberint(L, 2);
if (peffect && (peffect->category & tcate)) if (peffect && (peffect->category & tcate))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -526,7 +526,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -526,7 +526,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 ttype = lua_tointeger(L, 2); uint32 ttype = lua_tonumberint(L, 2);
if (peffect && (peffect->type & ttype)) if (peffect && (peffect->type & ttype))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
...@@ -536,7 +536,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) { ...@@ -536,7 +536,7 @@ int32 scriptlib::effect_is_has_type(lua_State *L) {
int32 scriptlib::effect_is_activatable(lua_State *L) { int32 scriptlib::effect_is_activatable(lua_State *L) {
check_param_count(L, 2); check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1); check_param(L, PARAM_TYPE_EFFECT, 1);
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
effect* peffect = *(effect**) lua_touserdata(L, 1); effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 neglect_loc = 0; uint32 neglect_loc = 0;
if(lua_gettop(L) > 2) if(lua_gettop(L) > 2)
......
...@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) { ...@@ -206,11 +206,11 @@ int32 scriptlib::group_filter_select(lua_State *L) {
cset.erase(*cit); cset.erase(*cit);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 4); uint32 min = lua_tonumberint(L, 4);
uint32 max = lua_tointeger(L, 5); uint32 max = lua_tonumberint(L, 5);
uint32 extraargs = lua_gettop(L) - 6; uint32 extraargs = lua_gettop(L) - 6;
pduel->game_field->core.select_cards.clear(); pduel->game_field->core.select_cards.clear();
for (auto it = cset.begin(); it != cset.end(); ++it) { for (auto it = cset.begin(); it != cset.end(); ++it) {
...@@ -235,11 +235,11 @@ int32 scriptlib::group_select(lua_State *L) { ...@@ -235,11 +235,11 @@ int32 scriptlib::group_select(lua_State *L) {
cset.erase(*cit); cset.erase(*cit);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 playerid = lua_tointeger(L, 2); uint32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
uint32 min = lua_tointeger(L, 3); uint32 min = lua_tonumberint(L, 3);
uint32 max = lua_tointeger(L, 4); uint32 max = lua_tonumberint(L, 4);
pduel->game_field->core.select_cards.clear(); pduel->game_field->core.select_cards.clear();
for (auto it = cset.begin(); it != cset.end(); ++it) { for (auto it = cset.begin(); it != cset.end(); ++it) {
pduel->game_field->core.select_cards.push_back(*it); pduel->game_field->core.select_cards.push_back(*it);
...@@ -255,7 +255,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -255,7 +255,7 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
group* pgroup1 = *(group**) lua_touserdata(L, 1); group* pgroup1 = *(group**) lua_touserdata(L, 1);
group* pgroup2 = *(group**) lua_touserdata(L, 2); group* pgroup2 = *(group**) lua_touserdata(L, 2);
duel* pduel = pgroup1->pduel; duel* pduel = pgroup1->pduel;
uint32 playerid = lua_tointeger(L, 3); uint32 playerid = lua_tonumberint(L, 3);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
for (auto it = pgroup2->container.begin(); it != pgroup2->container.end(); ++it) { for (auto it = pgroup2->container.begin(); it != pgroup2->container.end(); ++it) {
...@@ -276,11 +276,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) { ...@@ -276,11 +276,11 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
} }
uint32 min = 1; uint32 min = 1;
if (lua_gettop(L) > 5) { if (lua_gettop(L) > 5) {
min = lua_tointeger(L, 6); min = lua_tonumberint(L, 6);
} }
uint32 max = 1; uint32 max = 1;
if (lua_gettop(L) > 6) { if (lua_gettop(L) > 6) {
max = lua_tointeger(L, 7); max = lua_tonumberint(L, 7);
} }
if (min > max) if (min > max)
min = max; min = max;
...@@ -299,8 +299,8 @@ int32 scriptlib::group_random_select(lua_State *L) { ...@@ -299,8 +299,8 @@ int32 scriptlib::group_random_select(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 3);
check_param(L, PARAM_TYPE_GROUP, 1); check_param(L, PARAM_TYPE_GROUP, 1);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
int32 playerid = lua_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
int32 count = lua_tointeger(L, 3); int32 count = lua_tonumberint(L, 3);
pgroup->pduel->game_field->add_process(PROCESSOR_RANDOM_SELECT_S, 0, 0, pgroup, playerid, count); pgroup->pduel->game_field->add_process(PROCESSOR_RANDOM_SELECT_S, 0, 0, pgroup, playerid, count);
return lua_yield(L, 0); return lua_yield(L, 0);
} }
...@@ -319,7 +319,7 @@ int32 scriptlib::group_is_exists(lua_State *L) { ...@@ -319,7 +319,7 @@ int32 scriptlib::group_is_exists(lua_State *L) {
cset.erase(*cit); cset.erase(*cit);
} }
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
uint32 count = lua_tointeger(L, 3); uint32 count = lua_tonumberint(L, 3);
uint32 extraargs = lua_gettop(L) - 4; uint32 extraargs = lua_gettop(L) - 4;
uint32 fcount = 0; uint32 fcount = 0;
uint32 result = FALSE; uint32 result = FALSE;
...@@ -341,9 +341,9 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) { ...@@ -341,9 +341,9 @@ int32 scriptlib::group_check_with_sum_equal(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 acc = lua_tointeger(L, 3); int32 acc = lua_tonumberint(L, 3);
int32 min = lua_tointeger(L, 4); int32 min = lua_tonumberint(L, 4);
int32 max = lua_tointeger(L, 5); int32 max = lua_tonumberint(L, 5);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
...@@ -369,12 +369,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) { ...@@ -369,12 +369,12 @@ int32 scriptlib::group_select_with_sum_equal(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 3); check_param(L, PARAM_TYPE_FUNCTION, 3);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 playerid = lua_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = lua_tonumberint(L, 4);
int32 min = lua_tointeger(L, 5); int32 min = lua_tonumberint(L, 5);
int32 max = lua_tointeger(L, 6); int32 max = lua_tonumberint(L, 6);
if(min < 0) if(min < 0)
min = 0; min = 0;
if(max < min) if(max < min)
...@@ -405,7 +405,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) { ...@@ -405,7 +405,7 @@ int32 scriptlib::group_check_with_sum_greater(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 2); check_param(L, PARAM_TYPE_FUNCTION, 2);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 acc = lua_tointeger(L, 3); int32 acc = lua_tonumberint(L, 3);
int32 extraargs = lua_gettop(L) - 3; int32 extraargs = lua_gettop(L) - 3;
field::card_vector cv(pduel->game_field->core.must_select_cards); field::card_vector cv(pduel->game_field->core.must_select_cards);
int32 mcount = cv.size(); int32 mcount = cv.size();
...@@ -427,10 +427,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) { ...@@ -427,10 +427,10 @@ int32 scriptlib::group_select_with_sum_greater(lua_State *L) {
check_param(L, PARAM_TYPE_FUNCTION, 3); check_param(L, PARAM_TYPE_FUNCTION, 3);
group* pgroup = *(group**) lua_touserdata(L, 1); group* pgroup = *(group**) lua_touserdata(L, 1);
duel* pduel = pgroup->pduel; duel* pduel = pgroup->pduel;
int32 playerid = lua_tointeger(L, 2); int32 playerid = lua_tonumberint(L, 2);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 acc = lua_tointeger(L, 4); int32 acc = lua_tonumberint(L, 4);
int32 extraargs = lua_gettop(L) - 4; int32 extraargs = lua_gettop(L) - 4;
pduel->game_field->core.select_cards.assign(pgroup->container.begin(), pgroup->container.end()); pduel->game_field->core.select_cards.assign(pgroup->container.begin(), pgroup->container.end());
for(auto cit = pduel->game_field->core.must_select_cards.begin(); cit != pduel->game_field->core.must_select_cards.end(); ++cit) { for(auto cit = pduel->game_field->core.must_select_cards.begin(); cit != pduel->game_field->core.must_select_cards.end(); ++cit) {
......
...@@ -7,4 +7,4 @@ project "ocgcore" ...@@ -7,4 +7,4 @@ project "ocgcore"
configuration "not vs*" configuration "not vs*"
buildoptions { "-std=gnu++0x" } buildoptions { "-std=gnu++0x" }
configuration "not windows" configuration "not windows"
includedirs { "/usr/include/lua", "/usr/include/lua5.2", "/usr/include/lua/5.2" } includedirs { "/usr/include/lua", "/usr/include/lua5.3", "/usr/include/lua/5.3" }
...@@ -4445,7 +4445,6 @@ int32 field::add_chain(uint16 step) { ...@@ -4445,7 +4445,6 @@ int32 field::add_chain(uint16 step) {
if(phandler->current.location == LOCATION_HAND) if(phandler->current.location == LOCATION_HAND)
clit.flag |= CHAIN_HAND_EFFECT; clit.flag |= CHAIN_HAND_EFFECT;
core.current_chain.push_back(clit); core.current_chain.push_back(clit);
core.new_chains.pop_front();
check_chain_counter(peffect, clit.triggering_player, clit.chain_count); check_chain_counter(peffect, clit.triggering_player, clit.chain_count);
// triggered events which are not caused by RaiseEvent create relation with the handler // triggered events which are not caused by RaiseEvent create relation with the handler
if(!peffect->is_flag(EFFECT_FLAG_FIELD_ONLY) && (!(peffect->type & 0x2a0) || (peffect->code & EVENT_PHASE) == EVENT_PHASE)) { if(!peffect->is_flag(EFFECT_FLAG_FIELD_ONLY) && (!(peffect->type & 0x2a0) || (peffect->code & EVENT_PHASE) == EVENT_PHASE)) {
...@@ -4463,6 +4462,7 @@ int32 field::add_chain(uint16 step) { ...@@ -4463,6 +4462,7 @@ int32 field::add_chain(uint16 step) {
negeff->reset_flag = RESET_CHAIN | RESET_EVENT | deffect->get_value(); negeff->reset_flag = RESET_CHAIN | RESET_EVENT | deffect->get_value();
phandler->add_effect(negeff); phandler->add_effect(negeff);
} }
core.new_chains.pop_front();
return FALSE; return FALSE;
} }
case 2: { case 2: {
...@@ -4476,7 +4476,7 @@ int32 field::add_chain(uint16 step) { ...@@ -4476,7 +4476,7 @@ int32 field::add_chain(uint16 step) {
returns.ivalue[0] = TRUE; returns.ivalue[0] = TRUE;
return FALSE; return FALSE;
} }
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, playerid, 94); add_process(PROCESSOR_SELECT_EFFECTYN, 0, 0, (group*)peffect->get_handler(), playerid, 94);
} else } else
returns.ivalue[0] = FALSE; returns.ivalue[0] = FALSE;
return FALSE; return FALSE;
......
...@@ -2,8 +2,10 @@ solution "ygo" ...@@ -2,8 +2,10 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
......
...@@ -2,8 +2,10 @@ solution "ygo" ...@@ -2,8 +2,10 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
startproject "ygopro"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
defines { "LUA_COMPAT_5_2" }
configuration "windows" configuration "windows"
defines { "WIN32", "_WIN32" } defines { "WIN32", "_WIN32" }
......
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