Commit 91e5065a authored by fallenstardust's avatar fallenstardust

同步游戏逻辑改动

parent 836cc324
......@@ -817,7 +817,7 @@ void Game::DrawSpec() {
}
case 2: {
driver->draw2DImage(imageManager.GetTexture(showcardcode), recti(574 * mainGame->xScale, 150 * mainGame->yScale, (574 + CARD_IMG_WIDTH) * mainGame->xScale, (150 + CARD_IMG_HEIGHT) * mainGame->yScale), recti(0, 0, CARD_IMG_WIDTH, CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tMask, recti((574 + showcarddif) * mainGame->xScale, 150 * mainGame->yScale, 761 * mainGame->xScale, 404 * mainGame->yScale), recti(0, 0, (CARD_IMG_WIDTH - showcarddif), CARD_IMG_HEIGHT), 0, 0, true);
driver->draw2DImage(imageManager.tMask, recti((574 + showcarddif) * mainGame->xScale, 150 * mainGame->yScale, 751 * mainGame->xScale, 404 * mainGame->yScale), recti(0, 0, (CARD_IMG_WIDTH - showcarddif), CARD_IMG_HEIGHT), 0, 0, true);
showcarddif += 15;
if(showcarddif >= CARD_IMG_WIDTH) {
showcard = 0;
......
......@@ -1375,72 +1375,39 @@ int32 card::is_link_state() {
int32 card::is_extra_link_state() {
if(current.location != LOCATION_MZONE)
return FALSE;
card_set cset;
card_set excset;
for(int32 p = 0; p < 2; ++p) {
card* pcard1 = pduel->game_field->player[p].list_mzone[5];
if(pcard1)
excset.insert(pcard1);
card* pcard2 = pduel->game_field->player[p].list_mzone[6];
if(pcard2)
excset.insert(pcard2);
card* pcard3 = pduel->game_field->player[1 - p].list_mzone[5];
if(pcard3)
excset.insert(pcard3);
card* pcard4 = pduel->game_field->player[1 - p].list_mzone[6];
if(pcard4)
excset.insert(pcard4);
}
if(excset.size() < 2)
return FALSE;
auto cit = excset.begin();
card* pcard = *cit;
excset.erase(pcard);
card_set linked_group1;
pcard->get_mutual_linked_cards(&linked_group1);
if(!linked_group1.size())
return FALSE;
cset.insert(pcard);
return check_extra_link(&cset, &excset, &linked_group1);
}
int32 card::check_extra_link(card_set* cset, card_set* excset, card_set* linked_group1) {
for(auto cit = linked_group1->begin(); cit != linked_group1->end(); ++cit) {
card* pcard = *cit;
if(cset->find(pcard) != cset->end())
continue;
if(excset->find(pcard) != excset->end()) {
card_set omitted;
if(check_extra_link_finish(cset, &omitted))
return TRUE;
}
card_set linked_group2;
pcard->get_mutual_linked_cards(&linked_group2);
if(!linked_group2.size())
continue;
cset->insert(pcard);
int32 result = check_extra_link(cset, excset, &linked_group2);
cset->erase(pcard);
if(result)
return TRUE;
}
return FALSE;
}
int32 card::check_extra_link_finish(card_set* cset, card_set* omitted) {
if(cset->find(this) != cset->end())
return TRUE;
for(auto cit = cset->begin(); cit != cset->end(); ++cit) {
card* pcard = *cit;
if(omitted->find(pcard) != omitted->end())
continue;
card_set linked_group3;
pcard->get_mutual_linked_cards(&linked_group3);
if(!linked_group3.size())
continue;
omitted->insert(pcard);
int32 result = check_extra_link_finish(&linked_group3, omitted);
omitted->erase(pcard);
if(result)
uint32 checked = 1u << current.sequence;
uint32 linked_zone = get_mutual_linked_zone();
const auto& list_mzone0 = pduel->game_field->player[current.controler].list_mzone;
const auto& list_mzone1 = pduel->game_field->player[1 - current.controler].list_mzone;
while(true) {
if(((linked_zone >> 5) | (linked_zone >> (16 + 6))) & ((linked_zone >> 6) | (linked_zone >> (16 + 5))) & 1)
return TRUE;
int32 checking = (int32)(linked_zone & ~checked);
if(!checking)
return FALSE;
int32 rightmost = checking & (-checking);
checked |= (uint32)rightmost;
if(rightmost < 0x10000) {
for(int32 i = 0; i < 7; ++i) {
if(rightmost & 1) {
card* pcard = list_mzone0[i];
linked_zone |= pcard->get_mutual_linked_zone();
break;
}
rightmost >>= 1;
}
} else {
rightmost >>= 16;
for(int32 i = 0; i < 7; ++i) {
if(rightmost & 1) {
card* pcard = list_mzone1[i];
uint32 zone = pcard->get_mutual_linked_zone();
linked_zone |= (zone << 16) | (zone >> 16);
break;
}
rightmost >>= 1;
}
}
}
return FALSE;
}
......
......@@ -228,8 +228,6 @@ public:
void get_mutual_linked_cards(card_set * cset);
int32 is_link_state();
int32 is_extra_link_state();
int32 check_extra_link(card_set* cset, card_set* excset, card_set* linked_group1);
int32 check_extra_link_finish(card_set* cset, card_set* omitted);
int32 is_position(int32 pos);
void set_status(uint32 status, int32 enabled);
int32 get_status(uint32 status);
......
......@@ -111,6 +111,8 @@ static const struct luaL_Reg cardlib[] = {
{ "IsLevel", scriptlib::card_is_level },
{ "IsRank", scriptlib::card_is_rank },
{ "IsLink", scriptlib::card_is_link },
{ "IsAttack", scriptlib::card_is_attack },
{ "IsDefense", scriptlib::card_is_defense },
{ "IsRace", scriptlib::card_is_race },
{ "IsLinkRace", scriptlib::card_is_link_race },
{ "IsAttribute", scriptlib::card_is_attribute },
......
......@@ -893,33 +893,103 @@ int32 scriptlib::card_is_level(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 tlevel = lua_tointeger(L, 2);
if(pcard->get_level() == tlevel)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
uint32 level = pcard->get_level();
uint32 count = lua_gettop(L) - 1;
uint32 result = FALSE;
for(uint32 i = 0; i < count; ++i) {
if(lua_isnil(L, i + 2))
continue;
uint32 tlevel = lua_tointeger(L, i + 2);
if(level == tlevel) {
result = TRUE;
break;
}
}
lua_pushboolean(L, result);
return 1;
}
int32 scriptlib::card_is_rank(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 trank = lua_tointeger(L, 2);
if(pcard->get_rank() == trank)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
uint32 rank = pcard->get_rank();
uint32 count = lua_gettop(L) - 1;
uint32 result = FALSE;
for(uint32 i = 0; i < count; ++i) {
if(lua_isnil(L, i + 2))
continue;
uint32 trank = lua_tointeger(L, i + 2);
if(rank == trank) {
result = TRUE;
break;
}
}
lua_pushboolean(L, result);
return 1;
}
int32 scriptlib::card_is_link(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 tlink = lua_tointeger(L, 2);
if(pcard->get_link() == tlink)
lua_pushboolean(L, 1);
else
uint32 link = pcard->get_link();
uint32 count = lua_gettop(L) - 1;
uint32 result = FALSE;
for(uint32 i = 0; i < count; ++i) {
if(lua_isnil(L, i + 2))
continue;
uint32 tlink = lua_tointeger(L, i + 2);
if(link == tlink) {
result = TRUE;
break;
}
}
lua_pushboolean(L, result);
return 1;
}
int32 scriptlib::card_is_attack(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if(!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE))
lua_pushboolean(L, 0);
else {
uint32 atk = pcard->get_attack();
uint32 count = lua_gettop(L) - 1;
uint32 result = FALSE;
for(uint32 i = 0; i < count; ++i) {
if(lua_isnil(L, i + 2))
continue;
uint32 tatk = lua_tointeger(L, i + 2);
if(atk == tatk) {
result = TRUE;
break;
}
}
lua_pushboolean(L, result);
}
return 1;
}
int32 scriptlib::card_is_defense(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if((pcard->data.type & TYPE_LINK) || (!(pcard->data.type & TYPE_MONSTER) && !(pcard->get_type() & TYPE_MONSTER) && !(pcard->current.location & LOCATION_MZONE)))
lua_pushboolean(L, 0);
else {
uint32 def = pcard->get_defense();
uint32 count = lua_gettop(L) - 1;
uint32 result = FALSE;
for(uint32 i = 0; i < count; ++i) {
if(lua_isnil(L, i + 2))
continue;
uint32 tdef = lua_tointeger(L, i + 2);
if(def == tdef) {
result = TRUE;
break;
}
}
lua_pushboolean(L, result);
}
return 1;
}
int32 scriptlib::card_is_race(lua_State *L) {
......
......@@ -113,6 +113,8 @@ public:
static int32 card_is_level(lua_State *L);
static int32 card_is_rank(lua_State *L);
static int32 card_is_link(lua_State *L);
static int32 card_is_attack(lua_State *L);
static int32 card_is_defense(lua_State *L);
static int32 card_is_race(lua_State *L);
static int32 card_is_link_race(lua_State *L);
static int32 card_is_attribute(lua_State *L);
......
......@@ -22,7 +22,7 @@
更新:
1.更新ygo内核;
2.TCG2018.5.21禁卡表
3.新卡:CP18;
3.新卡:CP18+VJ
新增:
1.萌卡聊天室
2.开放单人模式——离线人机★
......
......@@ -387,7 +387,7 @@
!system 1382 人机信息:
!system 1383 使用旧规则(大师规则3)
!system 1384 电脑锁定出剪刀
!system 1385 人机模式未实装,努力中……T.T
!system 1385 列表为空,可能误删了文件,请卸载重装或者清除应用数据重启
!system 1390 等待行动中...
!system 1391 等待行动中....
!system 1392 等待行动中.....
......
{
"welcome": [
"本小姐是最强的!",
"尸体大佬让本小姐来手机陪你,还不快谢主隆恩!",
"开发大佬让本小姐屈尊来手机陪你,还不快谢主隆恩!",
"饼蛙是什么,好吃吗?"
],
"deckerror": [
......
{
"welcome": [
"你好,我是一个机器人。",
"尸体大佬让我来你的手机玩,要谢谢大佬们的努力"
"开发大佬让我来你的手机玩,要谢谢大佬们的努力"
],
"deckerror": [
"我的超主流卡组需要{0}才能玩。"
......
{
"welcome": [
"Hi, I'm WindBot.Mercury233 let me here and play with you"
"Hi, I'm WindBot.developers let me here and play with you"
],
"deckerror": [
"Sorry, it seems that I have too much {0} in my deck."
......
{
"welcome": [
"你好,我是一个机器人。",
"尸体大佬让我来你的手机当专属沙包,有问题请反馈。",
"开发大佬让我来你的手机当专属沙包,有问题请反馈。",
"总有人叫我沙包……"
],
"deckerror": [
......
......@@ -2,7 +2,7 @@
"welcome": [
"你好,我是一个机器人,我的名字叫尼亚,但我并不是本体,只是一个分身哦。",
"终有一天,我的力量将会强过本体的!你们走着瞧吧!",
"尸体让我来你手机报社你,来社保我啊!"
"开发大佬让我来你手机报社你,来社保我啊!"
],
"deckerror": [
"什么,居然不让我使用我无敌的{0}!"
......
{
"welcome": [
"你好,我是一个机器人。",
"尸体大佬让我来你的手机陪你决斗,有问题不要怪我……"
"开发大佬让我来你的手机陪你决斗,渣操了请及时反馈……"
],
"deckerror": [
"抱歉,我的卡组里的{0}的数量似乎出了问题。"
......
......@@ -51,7 +51,7 @@ public interface Constants {
String DEFAULT_FONT_NAME = "ygo.ttf";
String DATABASE_NAME = "cards.cdb";
String BOT_CONF = "bot.conf";
String WINDBOT_PATH="windbot";
String WINDBOT_PATH = "windbot";
String FONT_DIRECTORY = "fonts";
String CORE_STRING_PATH = "strings.conf";
String CORE_LIMIT_PATH = "lflist.conf";
......
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