Commit 619941aa authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro-core into develop

parents 2f611ad8 88a9a6ca
......@@ -16,16 +16,24 @@ jobs:
with:
fetch-depth: 0
- name: Install lua
- name: Download dependencies
run: |
bash -c " \
curl -Z --retry 5 --connect-timeout 30 --location \
--create-dirs --output-dir temp --remote-name-all \
https://www.lua.org/ftp/lua-5.4.7.tar.gz \
https://github.com/premake/premake-core/releases/download/v5.0.0-beta5/premake-5.0.0-beta5-windows.zip \
; exit 0"
- name: Lua
run: |
bash -c "curl -Z --retry 5 --connect-timeout 30 --location --create-dirs --output-dir temp --remote-name-all https://www.lua.org/ftp/lua-5.4.7.tar.gz https://github.com/premake/premake-core/releases/download/v5.0.0-beta2/premake-5.0.0-beta2-windows.zip ; exit 0"
tar -xzf temp/lua-5.4.7.tar.gz
move lua-5.4.7 lua
- name: Premake
run: |
mkdir premake-5
tar -C premake-5 -xzf temp/premake-5.0.0-beta2-windows.zip
tar -C premake-5 -xzf temp/premake-5.0.0-beta5-windows.zip
copy premake\lua.lua lua\premake5.lua
copy premake\dll.lua dll.lua
.\premake-5\premake5.exe vs2022 --file=dll.lua
......
......@@ -1072,9 +1072,9 @@ uint32_t card::get_mat_level_from_effect(card* pcard, uint32_t effect_code) {
return 0;
effect_set eset;
filter_effect(effect_code, &eset);
for(int32_t i = 0; i < eset.size(); ++i) {
uint32_t lev = eset[i]->get_value(pcard);
if(lev)
for (auto& peffect : eset) {
uint32_t lev = peffect->get_value(pcard);
if (lev)
return lev;
}
return 0;
......@@ -1120,7 +1120,7 @@ uint32_t card::check_xyz_level(card* pcard, uint32_t lv) {
return (card_lv & MAX_XYZ_LEVEL) | ((uint32_t)min_count << 12);
return 0;
}
for (auto& peffect: mset) {
for (auto& peffect: eset) {
pduel->lua->add_param(this, PARAM_TYPE_CARD);
pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
uint32_t lev = peffect->get_value(2);
......
......@@ -178,7 +178,8 @@ public:
uint8_t attack_controler{};
uint64_t cardid{};
uint32_t fieldid{};
uint32_t fieldid_r{};
uint32_t fieldid_r{}; //real field id, updated when moving to new location
uint32_t activate_count_id{}; //updated when moving to new location or flipping
uint16_t turnid{};
uint16_t turn_counter{};
uint8_t unique_pos[2]{};
......
......@@ -159,9 +159,6 @@ int32_t effect::is_single_ready() {
int32_t res = pduel->lua->check_condition(condition, 1);
return res;
}
// reset_count: count of effect reset
// count_limit: left count of activation
// count_limit_max: max count of activation
int32_t effect::check_count_limit(uint8_t playerid) {
if(is_flag(EFFECT_FLAG_COUNT_LIMIT)) {
if(count_limit == 0)
......@@ -171,7 +168,7 @@ int32_t effect::check_count_limit(uint8_t playerid) {
uint32_t limit_type = count_code & 0xf0000000U;
int32_t count = count_limit_max;
if(limit_code == EFFECT_COUNT_CODE_SINGLE) {
if(pduel->game_field->get_effect_code(limit_type | get_handler()->fieldid, PLAYER_NONE) >= count)
if(pduel->game_field->get_effect_code(limit_type | get_handler()->activate_count_id, PLAYER_NONE) >= count)
return FALSE;
} else {
if(pduel->game_field->get_effect_code(count_code, playerid) >= count)
......@@ -683,7 +680,7 @@ void effect::dec_count(uint8_t playerid) {
uint32_t limit_code = count_code & MAX_CARD_ID;
uint32_t limit_type = count_code & 0xf0000000;
if(limit_code == EFFECT_COUNT_CODE_SINGLE)
pduel->game_field->add_effect_code(limit_type | get_handler()->fieldid, PLAYER_NONE);
pduel->game_field->add_effect_code(limit_type | get_handler()->activate_count_id, PLAYER_NONE);
else
pduel->game_field->add_effect_code(count_code, playerid);
}
......
......@@ -40,8 +40,8 @@ public:
uint16_t range{ 0 };
uint16_t s_range{ 0 };
uint16_t o_range{ 0 };
uint8_t count_limit{ 0 };
uint8_t count_limit_max{ 0 };
uint8_t count_limit{ 0 }; //left count of activation
uint8_t count_limit_max{ 0 }; //max count of activation
uint16_t status{ 0 };
int32_t reset_count{ 0 };
uint32_t reset_flag{ 0 };
......
......@@ -183,6 +183,7 @@ void field::add_card(uint8_t playerid, card* pcard, uint8_t location, uint8_t se
pcard->apply_field_effect();
pcard->fieldid = infos.field_id++;
pcard->fieldid_r = pcard->fieldid;
pcard->activate_count_id = pcard->fieldid;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
pcard->turnid = infos.turn_id;
......
......@@ -2030,6 +2030,7 @@ int32_t field::flip_summon(uint16_t step, uint8_t sumplayer, card * target, uint
target->summon_player = sumplayer;
target->summon_info |= SUMMON_TYPE_FLIP;
target->fieldid = infos.field_id++;
target->activate_count_id = target->fieldid;
core.phase_action = TRUE;
pduel->write_buffer8(MSG_FLIPSUMMONING);
pduel->write_buffer32(target->data.code);
......@@ -4965,6 +4966,7 @@ int32_t field::change_position(uint16_t step, group * targets, effect * reason_e
core.hint_timing[pcard->current.controler] |= TIMING_POS_CHANGE;
if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) {
pcard->fieldid = infos.field_id++;
pcard->activate_count_id = pcard->fieldid;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
if(pcard->current.location == LOCATION_MZONE) {
......
......@@ -35,7 +35,7 @@ workspace "ocgcoredll"
startproject "ocgcore"
filter { "configurations:Release", "action:vs*" }
flags { "LinkTimeOptimization" }
linktimeoptimization "On"
staticruntime "On"
disablewarnings { "4334" }
......
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