Commit 35ba22db authored by nanahira's avatar nanahira

update_core

parent a6ba4d3e
...@@ -1174,12 +1174,22 @@ uint32 card::get_link_marker() { ...@@ -1174,12 +1174,22 @@ uint32 card::get_link_marker() {
if(!(data.type & TYPE_LINK)) if(!(data.type & TYPE_LINK))
return 0; return 0;
effect_set effects; effect_set effects;
effect_set effects2;
uint32 link_marker = data.link_marker; uint32 link_marker = data.link_marker;
filter_effect(710253, &effects); filter_effect(EFFECT_ADD_LINK_MARKER_KOISHI, &effects, FALSE);
for (int32 i = 0; i < effects.size(); ++i){ filter_effect(EFFECT_REMOVE_LINK_MARKER_KOISHI, &effects);
filter_effect(EFFECT_CHANGE_LINK_MARKER_KOISHI, &effects2);
for (int32 i = 0; i < effects.size(); ++i) {
card* ocard = effects[i]->get_handler(); card* ocard = effects[i]->get_handler();
if (!(effects[i]->type & EFFECT_TYPE_FIELD) || !(ocard && ocard->get_status(STATUS_TO_LEAVE_FROMEX))) if (effects[i]->code == EFFECT_ADD_LINK_MARKER_KOISHI && (!(effects[i]->type & EFFECT_TYPE_FIELD) || !(ocard && ocard->get_status(STATUS_TO_LEAVE_FROMEX))))
link_marker = effects[i]->get_value(this); link_marker |= effects[i]->get_value(this);
else if (effects[i]->code == EFFECT_REMOVE_LINK_MARKER_KOISHI && (!(effects[i]->type & EFFECT_TYPE_FIELD) || !(ocard && ocard->get_status(STATUS_TO_LEAVE_FROMEX))))
link_marker &= ~(effects[i]->get_value(this));
}
for (int32 i = 0; i < effects2.size(); ++i) {
card* ocard = effects2[i]->get_handler();
if (!(effects2[i]->type & EFFECT_TYPE_FIELD) || !(ocard && ocard->get_status(STATUS_TO_LEAVE_FROMEX)))
link_marker = effects2[i]->get_value(this);
} }
return link_marker; return link_marker;
} }
......
...@@ -436,6 +436,12 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -436,6 +436,12 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_ADD_LINK_ATTRIBUTE 356 #define EFFECT_ADD_LINK_ATTRIBUTE 356
#define EFFECT_ADD_LINK_RACE 357 #define EFFECT_ADD_LINK_RACE 357
// KoishiPro effects
#define EFFECT_CHANGE_LINK_MARKER_KOISHI 710253
#define EFFECT_ADD_LINK_MARKER_KOISHI 37564151
#define EFFECT_REMOVE_LINK_MARKER_KOISHI 37564152
#define EFFECT_CANNOT_LOSE_KOISHI 37564153
#define EVENT_STARTUP 1000 #define EVENT_STARTUP 1000
#define EVENT_FLIP 1001 #define EVENT_FLIP 1001
#define EVENT_FREE_CHAIN 1002 #define EVENT_FREE_CHAIN 1002
......
...@@ -21,6 +21,8 @@ static const struct luaL_Reg cardlib[] = { ...@@ -21,6 +21,8 @@ static const struct luaL_Reg cardlib[] = {
//modded //modded
{ "SetEntityCode", scriptlib::card_set_entity_code }, { "SetEntityCode", scriptlib::card_set_entity_code },
{ "SetCardData", scriptlib::card_set_card_data }, { "SetCardData", scriptlib::card_set_card_data },
{ "GetLinkMarker", scriptlib::card_get_link_marker },
{ "GetOriginalLinkMarker", scriptlib::card_get_origin_link_marker },
{ "GetCode", scriptlib::card_get_code }, { "GetCode", scriptlib::card_get_code },
{ "GetOriginalCode", scriptlib::card_get_origin_code }, { "GetOriginalCode", scriptlib::card_get_origin_code },
...@@ -752,9 +754,6 @@ int32 interpreter::load_card_script(uint32 code) { ...@@ -752,9 +754,6 @@ int32 interpreter::load_card_script(uint32 code) {
lua_pushvalue(current_state, -2); lua_pushvalue(current_state, -2);
lua_rawset(current_state, -3); lua_rawset(current_state, -3);
//load extra scripts //load extra scripts
sprintf(script_name, "./beta/script/c%d.lua", code);
if (!load_script(script_name)) {
sprintf(script_name, "./expansions/script/c%d.lua", code); sprintf(script_name, "./expansions/script/c%d.lua", code);
if (!load_script(script_name)) { if (!load_script(script_name)) {
sprintf(script_name, "./script/c%d.lua", code); sprintf(script_name, "./script/c%d.lua", code);
...@@ -763,7 +762,6 @@ int32 interpreter::load_card_script(uint32 code) { ...@@ -763,7 +762,6 @@ int32 interpreter::load_card_script(uint32 code) {
} }
} }
} }
}
return OPERATION_SUCCESS; return OPERATION_SUCCESS;
} }
void interpreter::add_param(void *param, int32 type, bool front) { void interpreter::add_param(void *param, int32 type, bool front) {
......
...@@ -83,6 +83,23 @@ int32 scriptlib::card_set_card_data(lua_State *L) { ...@@ -83,6 +83,23 @@ int32 scriptlib::card_set_card_data(lua_State *L) {
} }
return 0; return 0;
} }
int32 scriptlib::card_get_link_marker(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_link_marker());
return 1;
}
int32 scriptlib::card_get_origin_link_marker(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->status & STATUS_NO_LEVEL)
lua_pushinteger(L, 0);
else
lua_pushinteger(L, pcard->data.link_marker);
return 1;
}
int32 scriptlib::card_get_code(lua_State *L) { int32 scriptlib::card_get_code(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
......
...@@ -510,7 +510,7 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea ...@@ -510,7 +510,7 @@ int32 field::damage(uint16 step, effect* reason_effect, uint32 reason, uint8 rea
pduel->write_buffer32(amount); pduel->write_buffer32(amount);
raise_event(reason_card, EVENT_DAMAGE, reason_effect, reason, reason_player, playerid, amount); raise_event(reason_card, EVENT_DAMAGE, reason_effect, reason, reason_player, playerid, amount);
if(reason == REASON_BATTLE && reason_card) { if(reason == REASON_BATTLE && reason_card) {
if((player[playerid].lp <= 0) && (core.attack_target == 0) && reason_card->is_affected_by_effect(EFFECT_MATCH_KILL)) { if((player[playerid].lp <= 0) && (core.attack_target == 0) && reason_card->is_affected_by_effect(EFFECT_MATCH_KILL) && !(is_player_affected_by_effect(playerid, EFFECT_CANNOT_LOSE_KOISHI))) {
pduel->write_buffer8(MSG_MATCH_KILL); pduel->write_buffer8(MSG_MATCH_KILL);
pduel->write_buffer32(reason_card->data.code); pduel->write_buffer32(reason_card->data.code);
} }
......
...@@ -5136,7 +5136,9 @@ int32 field::adjust_step(uint16 step) { ...@@ -5136,7 +5136,9 @@ int32 field::adjust_step(uint16 step) {
case 1: { case 1: {
//win check(deck=0 or lp=0) //win check(deck=0 or lp=0)
uint32 winp = 5, rea = 1; uint32 winp = 5, rea = 1;
if(player[0].lp <= 0 && player[1].lp > 0) { bool lp_zero_0 = (player[0].lp <= 0 && !is_player_affected_by_effect(0, EFFECT_CANNOT_LOSE_KOISHI));
bool lp_zero_1 = (player[1].lp <= 0 && !is_player_affected_by_effect(1, EFFECT_CANNOT_LOSE_KOISHI));
if(lp_zero_0 && !lp_zero_1) {
winp = 1; winp = 1;
rea = 1; rea = 1;
} }
...@@ -5144,7 +5146,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -5144,7 +5146,7 @@ int32 field::adjust_step(uint16 step) {
winp = 1; winp = 1;
rea = 2; rea = 2;
} }
if(player[1].lp <= 0 && player[0].lp > 0) { if(lp_zero_1 && !lp_zero_0) {
winp = 0; winp = 0;
rea = 1; rea = 1;
} }
...@@ -5152,7 +5154,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -5152,7 +5154,7 @@ int32 field::adjust_step(uint16 step) {
winp = 0; winp = 0;
rea = 2; rea = 2;
} }
if(player[1].lp <= 0 && player[0].lp <= 0) { if(lp_zero_0 && lp_zero_1) {
winp = PLAYER_NONE; winp = PLAYER_NONE;
rea = 1; rea = 1;
} }
......
...@@ -21,6 +21,8 @@ public: ...@@ -21,6 +21,8 @@ public:
//modded //modded
static int32 card_set_entity_code(lua_State *L); static int32 card_set_entity_code(lua_State *L);
static int32 card_set_card_data(lua_State *L); static int32 card_set_card_data(lua_State *L);
static int32 card_get_link_marker(lua_State *L);
static int32 card_get_origin_link_marker(lua_State *L);
static int32 effect_set_owner(lua_State *L); static int32 effect_set_owner(lua_State *L);
static int32 effect_get_range(lua_State *L); static int32 effect_get_range(lua_State *L);
static int32 effect_get_count_limit(lua_State *L); static int32 effect_get_count_limit(lua_State *L);
......
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