Commit badb28d4 authored by nanahira's avatar nanahira

update_core

parent fa5cacb4
......@@ -22,7 +22,7 @@ uint32 card::get_ritual_type() {
return data.type;
return get_type();
}
//222DIY
//modded
uint32 card::set_entity_code(uint32 entity_code, bool remove_alias) {
card_data dat;
::read_card(entity_code, &dat);
......@@ -917,7 +917,7 @@ uint32 card::get_rank() {
return 0;
if(assume_type == ASSUME_RANK)
return assume_value;
//222DIY modded from ygocc
//modded from ygocc
//if(!(current.location & LOCATION_MZONE))
// return data.level;
if (temp.level != 0xffffffff)
......@@ -1129,7 +1129,7 @@ uint32 card::get_rscale() {
temp.rscale = 0xffffffff;
return rscale;
}
//222DIY modded by Flandre
//modded by Flandre
uint32 card::get_link_marker() {
if(!(data.type & TYPE_LINK))
return 0;
......
......@@ -107,7 +107,7 @@ public:
//millux
uint32 get_ritual_type();
//222DIY
//modded
uint32 set_entity_code(uint32 entity_code, bool remove_alias = false);
struct sendto_param_t {
......@@ -502,7 +502,7 @@ public:
#define STATUS_OPPO_BATTLE 0x10000000
#define STATUS_FLIP_SUMMON_TURN 0x20000000
#define STATUS_SPSUMMON_TURN 0x40000000
//222DIY
//modded
#define STATUS_TO_LEAVE_FROMEX 0x80000000
//Counter
#define COUNTER_WITHOUT_PERMIT 0x1000
......
......@@ -18,7 +18,7 @@
static const struct luaL_Reg cardlib[] = {
//millux
{ "IsRitualType", scriptlib::card_is_ritual_type },
//222DIY
//modded
{ "SetEntityCode", scriptlib::card_set_entity_code },
{ "SetCardData", scriptlib::card_set_card_data },
......@@ -266,7 +266,7 @@ static const struct luaL_Reg cardlib[] = {
};
static const struct luaL_Reg effectlib[] = {
//222DIY
//modded
{ "SetOwner", scriptlib::effect_set_owner },
{ "GetRange", scriptlib::effect_get_range },
{ "GetCountLimit", scriptlib::effect_get_count_limit },
......@@ -360,7 +360,7 @@ static const struct luaL_Reg grouplib[] = {
};
static const struct luaL_Reg duellib[] = {
//222DIY
//modded
{ "SelectField", scriptlib::duel_select_field },
{ "GetMasterRule", scriptlib::duel_get_master_rule },
{ "ReadCard", scriptlib::duel_read_card },
......@@ -595,7 +595,7 @@ interpreter::interpreter(duel* pd): coroutines(256) {
pduel = pd;
no_action = 0;
call_depth = 0;
//222DIY
//modded
disable_action_check = 0;
set_duel_info(lua_state, pd);
......
......@@ -44,7 +44,7 @@ public:
coroutine_map coroutines;
int32 no_action;
int32 call_depth;
//222DIY
//modded
int32 disable_action_check;
explicit interpreter(duel* pd);
......
......@@ -13,7 +13,7 @@
#include "group.h"
#include <iostream>
//millux
//modded by millux
int32 scriptlib::card_is_ritual_type(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -25,7 +25,7 @@ int32 scriptlib::card_is_ritual_type(lua_State *L) {
lua_pushboolean(L, 0);
return 1;
}
//222DIY functions
//modded functions
int32 scriptlib::card_set_entity_code(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
......
......@@ -13,7 +13,7 @@
#include "group.h"
#include "ocgapi.h"
//222DIY
//modded
int32 scriptlib::duel_select_field(lua_State * L) {
check_action_permission(L);
check_param_count(L, 4);
......@@ -1739,7 +1739,7 @@ int32 scriptlib::duel_get_location_count(lua_State *L) {
lua_pushinteger(L, pduel->game_field->get_useable_count(playerid, location, uplayer, reason, zone));
return 1;
}
//222DIY modded by Flandre
//modded by Flandre
int32 scriptlib::duel_get_mzone_count(lua_State *L) {
check_param_count(L, 1);
uint32 playerid = lua_tonumberint(L, 1);
......@@ -3200,6 +3200,7 @@ int32 scriptlib::duel_select_position(lua_State * L) {
pduel->game_field->add_process(PROCESSOR_SELECT_POSITION_S, 0, 0, 0, playerid + (positions << 16), pcard->data.code);
return lua_yield(L, 0);
}
//modded
int32 scriptlib::duel_select_disable_field(lua_State * L) {
check_action_permission(L);
check_param_count(L, 5);
......@@ -3229,6 +3230,17 @@ int32 scriptlib::duel_select_disable_field(lua_State * L) {
flag = (flag & 0xffffff) | (plist << 24);
}
flag |= filter | 0xe0e0e0e0;
int32 allow_exzone = lua_toboolean(L, 6);
if (allow_exzone && pduel->game_field->core.duel_rule >= 4) {
if(pduel->game_field->is_location_useable(playerid, LOCATION_MZONE, 5)) {
ct1 = ct1 + 1;
flag = flag - (flag & 0x20);
}
if(pduel->game_field->is_location_useable(playerid, LOCATION_MZONE, 6)) {
ct1 = ct1 + 1;
flag = flag - (flag & 0x40);
}
}
if(count > ct1 + ct2 + ct3 + ct4)
count = ct1 + ct2 + ct3 + ct4;
if(count == 0)
......
......@@ -10,7 +10,7 @@
#include "field.h"
#include "card.h"
#include "effect.h"
//222DIY
//modded
int32 scriptlib::effect_set_owner(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
......
......@@ -295,12 +295,31 @@ int32 scriptlib::group_select_unselect(lua_State *L) {
pduel->game_field->add_process(PROCESSOR_SELECT_UNSELECT_CARD_S, 0, 0, 0, playerid + (cancelable << 16), min + (max << 16), buttonok);
return lua_yield(L, 0);
}
//modded
int32 scriptlib::group_random_select(lua_State *L) {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_GROUP, 1);
group* pgroup = *(group**) lua_touserdata(L, 1);
int32 playerid = lua_tonumberint(L, 2);
int32 count = lua_tonumberint(L, 3);
int32 no_hint = lua_toboolean(L, 4);
if(no_hint) {
duel* pduel = interpreter::get_duel_info(L);
group* newgroup = pduel->new_group();
if(count == pgroup->container.size())
newgroup->container = pgroup->container;
else {
while(newgroup->container.size() < count) {
int32 i = pduel->get_next_integer(0, pgroup->container.size() - 1);
auto cit = pgroup->container.begin();
std::advance(cit, i);
newgroup->container.insert(*cit);
}
}
interpreter::group2value(L, newgroup);
return 1;
}
pgroup->pduel->game_field->add_process(PROCESSOR_RANDOM_SELECT_S, 0, 0, pgroup, playerid, count);
return lua_yield(L, 0);
}
......
......@@ -63,7 +63,7 @@ int32 scriptlib::check_param_count(lua_State* L, int32 count) {
luaL_error(L, "%d Parameters are needed.", count);
return TRUE;
}
//222DIY
//modded
int32 scriptlib::check_action_permission(lua_State* L) {
duel* pduel = interpreter::get_duel_info(L);
if(pduel->lua->no_action && !pduel->lua->disable_action_check)
......
......@@ -18,7 +18,7 @@ public:
static int32 check_action_permission(lua_State* L);
//millux
static int32 card_is_ritual_type(lua_State *L);
//222DIY
//modded
static int32 card_set_entity_code(lua_State *L);
static int32 card_set_card_data(lua_State *L);
static int32 effect_set_owner(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