Commit efe3de3c authored by argon.sun's avatar argon.sun

Merge branch 'master' of github.com:Fluorohydride/ygopro

parents 44949d96 41c50e5e
...@@ -315,7 +315,7 @@ void Game::DrawMisc() { ...@@ -315,7 +315,7 @@ void Game::DrawMisc() {
lpcFont->draw(lpcstring, recti(400, 162, 922, 210), lpccolor, true, false, 0); lpcFont->draw(lpcstring, recti(400, 162, 922, 210), lpccolor, true, false, 0);
} }
} }
if(!dInfo.isReplay && !dInfo.isObserver && dInfo.time_limit) { if(!dInfo.isReplay && dInfo.player_type < 7 && dInfo.time_limit) {
driver->draw2DRectangle(recti(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(recti(525, 34, 525 + dInfo.time_left[0] * 100 / dInfo.time_limit, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
driver->draw2DRectangleOutline(recti(525, 34, 625, 44), 0xffffffff); driver->draw2DRectangleOutline(recti(525, 34, 625, 44), 0xffffffff);
driver->draw2DRectangle(recti(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0); driver->draw2DRectangle(recti(795 - dInfo.time_left[1] * 100 / dInfo.time_limit, 34, 795, 44), 0xa0e0e0e0, 0xa0e0e0e0, 0xa0c0c0c0, 0xa0c0c0c0);
...@@ -343,7 +343,7 @@ void Game::DrawMisc() { ...@@ -343,7 +343,7 @@ void Game::DrawMisc() {
lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 687, 40), 0x8000ffff, true, false, 0); lpcFont->draw(dataManager.GetNumString(dInfo.turn), recti(635, 5, 687, 40), 0x8000ffff, true, false, 0);
for(int i = 0; i < 5; ++i) { for(int i = 0; i < 5; ++i) {
ClientCard* pcard = dField.mzone[0][i]; ClientCard* pcard = dField.mzone[0][i];
if(pcard) { if(pcard && pcard->code != 0) {
int m = 483 + i * 90; int m = 483 + i * 90;
adFont->draw(L"/", recti(m - 4, 396, m + 4, 416), 0xff000000, true, false, 0); adFont->draw(L"/", recti(m - 4, 396, m + 4, 416), 0xff000000, true, false, 0);
adFont->draw(L"/", recti(m - 3, 397, m + 5, 417), 0xffffffff, true, false, 0); adFont->draw(L"/", recti(m - 3, 397, m + 5, 417), 0xffffffff, true, false, 0);
......
This diff is collapsed.
...@@ -93,7 +93,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -93,7 +93,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_LEAVE_GAME: { case BUTTON_LEAVE_GAME: {
if(mainGame->dInfo.isObserver) { if(mainGame->dInfo.player_type == 7) {
DuelClient::StopClient(); DuelClient::StopClient();
mainGame->CloseDuelWindow(); mainGame->CloseDuelWindow();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
...@@ -471,6 +471,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -471,6 +471,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case BUTTON_CARD_2: case BUTTON_CARD_2:
case BUTTON_CARD_3: case BUTTON_CARD_3:
case BUTTON_CARD_4: { case BUTTON_CARD_4: {
if(mainGame->dInfo.isReplay)
break;
switch(mainGame->dInfo.curMsg) { switch(mainGame->dInfo.curMsg) {
case MSG_SELECT_IDLECMD: case MSG_SELECT_IDLECMD:
case MSG_SELECT_BATTLECMD: case MSG_SELECT_BATTLECMD:
...@@ -602,6 +604,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -602,6 +604,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break; break;
} }
case BUTTON_CARD_SEL_OK: { case BUTTON_CARD_SEL_OK: {
if(mainGame->dInfo.isReplay) {
mainGame->HideElement(mainGame->wCardSelect);
break;
}
if(mainGame->dInfo.curMsg == MSG_SELECT_CARD) { if(mainGame->dInfo.curMsg == MSG_SELECT_CARD) {
if(select_ready) { if(select_ready) {
unsigned char respbuf[64]; unsigned char respbuf[64];
...@@ -768,9 +774,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -768,9 +774,12 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
const wchar_t* input = mainGame->ebChatInput->getText(); const wchar_t* input = mainGame->ebChatInput->getText();
if(input[0]) { if(input[0]) {
unsigned short msgbuf[256]; unsigned short msgbuf[256];
if(!mainGame->dInfo.isObserver) if(mainGame->dInfo.player_type < 7) {
mainGame->AddChatMsg((wchar_t*)input, 0); if(mainGame->dInfo.is_tag && (mainGame->dInfo.player_type % 2))
else mainGame->AddChatMsg((wchar_t*)input, 2); mainGame->AddChatMsg((wchar_t*)input, 2);
else
mainGame->AddChatMsg((wchar_t*)input, 0);
} else mainGame->AddChatMsg((wchar_t*)input, 10);
int len = BufferIO::CopyWStr(input, msgbuf, 256); int len = BufferIO::CopyWStr(input, msgbuf, 256);
DuelClient::SendBufferToServer(CTOS_CHAT, msgbuf, (len + 1) * sizeof(short)); DuelClient::SendBufferToServer(CTOS_CHAT, msgbuf, (len + 1) * sizeof(short));
mainGame->ebChatInput->setText(L""); mainGame->ebChatInput->setText(L"");
...@@ -804,8 +813,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -804,8 +813,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case irr::EET_MOUSE_INPUT_EVENT: { case irr::EET_MOUSE_INPUT_EVENT: {
switch(event.MouseInput.Event) { switch(event.MouseInput.Event) {
case irr::EMIE_LMOUSE_LEFT_UP: { case irr::EMIE_LMOUSE_LEFT_UP: {
if(mainGame->dInfo.isReplay)
break;
if(!mainGame->dInfo.isStarted) if(!mainGame->dInfo.isStarted)
break; break;
s32 x = event.MouseInput.X; s32 x = event.MouseInput.X;
...@@ -819,6 +826,52 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -819,6 +826,52 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
if(panel && panel->isVisible()) if(panel && panel->isVisible())
break; break;
GetHoverField(x, y); GetHoverField(x, y);
if(mainGame->dInfo.isReplay) {
if(mainGame->wCardSelect->isVisible())
break;
selectable_cards.clear();
switch(hovered_location) {
case LOCATION_DECK: {
for(int i = deck[hovered_controler].size() - 1; i >= 0 ; --i)
selectable_cards.push_back(deck[hovered_controler][i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1000), deck[hovered_controler].size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
case LOCATION_MZONE: {
ClientCard* pcard = deck[hovered_controler][hovered_sequence];
for(int i = 0; i < pcard->overlayed.size(); ++i)
selectable_cards.push_back(pcard->overlayed[i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1007), pcard->overlayed.size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
case LOCATION_GRAVE: {
for(int i = grave[hovered_controler].size() - 1; i >= 0 ; --i)
selectable_cards.push_back(grave[hovered_controler][i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1004), grave[hovered_controler].size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
case LOCATION_REMOVED: {
for(int i = remove[hovered_controler].size() - 1; i >= 0 ; --i)
selectable_cards.push_back(remove[hovered_controler][i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1005), remove[hovered_controler].size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
case LOCATION_EXTRA: {
for(int i = extra[hovered_controler].size() - 1; i >= 0 ; --i)
selectable_cards.push_back(extra[hovered_controler][i]);
myswprintf(formatBuffer, L"%ls(%d)", dataManager.GetSysString(1006), extra[hovered_controler].size());
mainGame->wCardSelect->setText(formatBuffer);
break;
}
}
if(selectable_cards.size())
ShowSelectCard(true);
break;
}
if(hovered_location & 0xe) if(hovered_location & 0xe)
clicked_card = GetCard(hovered_controler, hovered_location, hovered_sequence); clicked_card = GetCard(hovered_controler, hovered_location, hovered_sequence);
else clicked_card = 0; else clicked_card = 0;
...@@ -1337,7 +1390,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) { ...@@ -1337,7 +1390,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
} }
} }
break; break;
} }
case irr::EMIE_MOUSE_WHEEL: { case irr::EMIE_MOUSE_WHEEL: {
break; break;
} }
......
...@@ -144,15 +144,21 @@ bool Game::Initialize() { ...@@ -144,15 +144,21 @@ bool Game::Initialize() {
wHostPrepare->getCloseButton()->setVisible(false); wHostPrepare->getCloseButton()->setVisible(false);
wHostPrepare->setVisible(false); wHostPrepare->setVisible(false);
btnHostPrepDuelist = env->addButton(rect<s32>(10, 30, 110, 55), wHostPrepare, BUTTON_HP_DUELIST, dataManager.GetSysString(1251)); btnHostPrepDuelist = env->addButton(rect<s32>(10, 30, 110, 55), wHostPrepare, BUTTON_HP_DUELIST, dataManager.GetSysString(1251));
for(int i = 0; i < 4; ++i) { for(int i = 0; i < 2; ++i) {
stHostPrepDuelist[i] = env->addStaticText(L"", rect<s32>(40, 65 + i * 25, 240, 85 + i * 25), true, false, wHostPrepare); stHostPrepDuelist[i] = env->addStaticText(L"", rect<s32>(40, 65 + i * 25, 240, 85 + i * 25), true, false, wHostPrepare);
btnHostPrepKick[i] = env->addButton(rect<s32>(10, 65 + i * 25, 30, 85 + i * 25), wHostPrepare, BUTTON_HP_KICK, L"X"); btnHostPrepKick[i] = env->addButton(rect<s32>(10, 65 + i * 25, 30, 85 + i * 25), wHostPrepare, BUTTON_HP_KICK, L"X");
chkHostPrepReady[i] = env->addCheckBox(false, rect<s32>(250, 65 + i * 25, 270, 85 + i * 25), wHostPrepare, CHECKBOX_HP_READY, L""); chkHostPrepReady[i] = env->addCheckBox(false, rect<s32>(250, 65 + i * 25, 270, 85 + i * 25), wHostPrepare, CHECKBOX_HP_READY, L"");
chkHostPrepReady[i]->setEnabled(false); chkHostPrepReady[i]->setEnabled(false);
} }
btnHostPrepOB = env->addButton(rect<s32>(10, 170, 110, 195), wHostPrepare, BUTTON_HP_OBSERVER, dataManager.GetSysString(1252)); for(int i = 2; i < 4; ++i) {
stHostPrepDuelist[i] = env->addStaticText(L"", rect<s32>(40, 75 + i * 25, 240, 95 + i * 25), true, false, wHostPrepare);
btnHostPrepKick[i] = env->addButton(rect<s32>(10, 75 + i * 25, 30, 95 + i * 25), wHostPrepare, BUTTON_HP_KICK, L"X");
chkHostPrepReady[i] = env->addCheckBox(false, rect<s32>(250, 75 + i * 25, 270, 95 + i * 25), wHostPrepare, CHECKBOX_HP_READY, L"");
chkHostPrepReady[i]->setEnabled(false);
}
btnHostPrepOB = env->addButton(rect<s32>(10, 180, 110, 205), wHostPrepare, BUTTON_HP_OBSERVER, dataManager.GetSysString(1252));
myswprintf(dataManager.strBuffer, L"%ls%d", dataManager.GetSysString(1253), 0); myswprintf(dataManager.strBuffer, L"%ls%d", dataManager.GetSysString(1253), 0);
stHostPrepOB = env->addStaticText(dataManager.strBuffer, rect<s32>(10, 200, 270, 220), false, false, wHostPrepare); stHostPrepOB = env->addStaticText(dataManager.strBuffer, rect<s32>(10, 210, 270, 230), false, false, wHostPrepare);
stHostPrepRule = env->addStaticText(L"", rect<s32>(280, 30, 460, 230), false, true, wHostPrepare); stHostPrepRule = env->addStaticText(L"", rect<s32>(280, 30, 460, 230), false, true, wHostPrepare);
env->addStaticText(dataManager.GetSysString(1254), rect<s32>(10, 235, 110, 255), false, false, wHostPrepare); env->addStaticText(dataManager.GetSysString(1254), rect<s32>(10, 235, 110, 255), false, false, wHostPrepare);
cbDeckSelect = env->addComboBox(rect<s32>(120, 230, 270, 255), wHostPrepare); cbDeckSelect = env->addComboBox(rect<s32>(120, 230, 270, 255), wHostPrepare);
......
...@@ -29,7 +29,6 @@ struct Config { ...@@ -29,7 +29,6 @@ struct Config {
struct DuelInfo { struct DuelInfo {
bool isStarted; bool isStarted;
bool isReplay; bool isReplay;
bool isObserver;
bool isFirst; bool isFirst;
bool is_shuffling; bool is_shuffling;
bool is_tag; bool is_tag;
...@@ -44,6 +43,7 @@ struct DuelInfo { ...@@ -44,6 +43,7 @@ struct DuelInfo {
wchar_t strLP[2][16]; wchar_t strLP[2][16];
wchar_t strTurn[8]; wchar_t strTurn[8];
wchar_t* vic_string; wchar_t* vic_string;
unsigned char player_type;
unsigned char time_player; unsigned char time_player;
unsigned short time_limit; unsigned short time_limit;
unsigned short time_left[2]; unsigned short time_left[2];
......
...@@ -115,8 +115,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -115,8 +115,8 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
mainGame->btnJoinCancel->setEnabled(true); mainGame->btnJoinCancel->setEnabled(true);
mainGame->HideElement(mainGame->wHostPrepare); mainGame->HideElement(mainGame->wHostPrepare);
mainGame->ShowElement(mainGame->wLanWindow); mainGame->ShowElement(mainGame->wLanWindow);
if(exit_on_return) if(exit_on_return)
mainGame->device->closeDevice(); mainGame->device->closeDevice();
break; break;
} }
case BUTTON_REPLAY_MODE: { case BUTTON_REPLAY_MODE: {
...@@ -224,7 +224,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -224,7 +224,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
tm* st = localtime(&curtime); tm* st = localtime(&curtime);
myswprintf(infobuf, L"%d/%d/%d %02d:%02d:%02d\n", st->tm_year + 1900, st->tm_mon + 1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec); myswprintf(infobuf, L"%d/%d/%d %02d:%02d:%02d\n", st->tm_year + 1900, st->tm_mon + 1, st->tm_mday, st->tm_hour, st->tm_min, st->tm_sec);
repinfo.append(infobuf); repinfo.append(infobuf);
myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", (wchar_t*)ReplayMode::cur_replay.replay_data, (wchar_t*)(&ReplayMode::cur_replay.replay_data[40])); if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG)
myswprintf(infobuf, L"%ls\n%ls\n===VS===\n%ls\n%ls\n", (wchar_t*)ReplayMode::cur_replay.replay_data, (wchar_t*)(&ReplayMode::cur_replay.replay_data[40]),
(wchar_t*)(&ReplayMode::cur_replay.replay_data[80]), (wchar_t*)(&ReplayMode::cur_replay.replay_data[120]));
else
myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", (wchar_t*)ReplayMode::cur_replay.replay_data, (wchar_t*)(&ReplayMode::cur_replay.replay_data[40]));
repinfo.append(infobuf); repinfo.append(infobuf);
mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, (wchar_t*)repinfo.c_str()); mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, (wchar_t*)repinfo.c_str());
break; break;
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace ygo { namespace ygo {
#define REPLAY_COMPRESSED 0x1 #define REPLAY_COMPRESSED 0x1
#define REPLAY_TAG 0x2
struct ReplayHeader { struct ReplayHeader {
unsigned int id; unsigned int id;
......
...@@ -56,8 +56,15 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -56,8 +56,15 @@ int ReplayMode::ReplayThread(void* param) {
mtrandom rnd; mtrandom rnd;
int seed = rh.seed; int seed = rh.seed;
rnd.reset(seed); rnd.reset(seed);
cur_replay.ReadData(mainGame->dInfo.hostname, 40); if(rh.flag & REPLAY_TAG) {
cur_replay.ReadData(mainGame->dInfo.clientname, 40); cur_replay.ReadData(mainGame->dInfo.hostname, 40);
cur_replay.ReadData(mainGame->dInfo.hostname_tag, 40);
cur_replay.ReadData(mainGame->dInfo.clientname_tag, 40);
cur_replay.ReadData(mainGame->dInfo.clientname, 40);
} else {
cur_replay.ReadData(mainGame->dInfo.hostname, 40);
cur_replay.ReadData(mainGame->dInfo.clientname, 40);
}
set_card_reader((card_reader)DataManager::CardReader); set_card_reader((card_reader)DataManager::CardReader);
set_message_handler((message_handler)MessageHandler); set_message_handler((message_handler)MessageHandler);
pduel = create_duel(rnd.rand()); pduel = create_duel(rnd.rand());
...@@ -117,6 +124,10 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -117,6 +124,10 @@ int ReplayMode::ReplayThread(void* param) {
new_tag_card(pduel, cur_replay.ReadInt32(), 1, LOCATION_EXTRA); new_tag_card(pduel, cur_replay.ReadInt32(), 1, LOCATION_EXTRA);
} }
start_duel(pduel, opt); start_duel(pduel, opt);
ReplayRefreshDeck(0);
ReplayRefreshDeck(1);
ReplayRefreshExtra(0);
ReplayRefreshExtra(1);
mainGame->dInfo.isStarted = true; mainGame->dInfo.isStarted = true;
mainGame->dInfo.isReplay = true; mainGame->dInfo.isReplay = true;
char engineBuffer[0x1000]; char engineBuffer[0x1000];
...@@ -136,6 +147,8 @@ int ReplayMode::ReplayThread(void* param) { ...@@ -136,6 +147,8 @@ int ReplayMode::ReplayThread(void* param) {
if(!is_closing) { if(!is_closing) {
mainGame->stMessage->setText(dataManager.GetSysString(1501)); mainGame->stMessage->setText(dataManager.GetSysString(1501));
mainGame->actionSignal.Reset(); mainGame->actionSignal.Reset();
if(mainGame->wCardSelect->isVisible())
mainGame->HideElement(mainGame->wCardSelect);
mainGame->PopupElement(mainGame->wMessage); mainGame->PopupElement(mainGame->wMessage);
mainGame->actionSignal.Wait(); mainGame->actionSignal.Wait();
mainGame->dInfo.isStarted = false; mainGame->dInfo.isStarted = false;
...@@ -287,8 +300,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -287,8 +300,9 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_SHUFFLE_DECK: { case MSG_SHUFFLE_DECK: {
pbuf++; player = BufferIO::ReadInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshDeck(player);
break; break;
} }
case MSG_SHUFFLE_HAND: { case MSG_SHUFFLE_HAND: {
...@@ -325,7 +339,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -325,7 +339,7 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_NEW_TURN: { case MSG_NEW_TURN: {
pbuf++; player = BufferIO::ReadInt8(pbuf);
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
break; break;
} }
...@@ -595,8 +609,11 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) { ...@@ -595,8 +609,11 @@ bool ReplayMode::ReplayAnalyze(char* msg, unsigned int len) {
break; break;
} }
case MSG_TAG_SWAP: { case MSG_TAG_SWAP: {
player = pbuf[0];
pbuf += pbuf[3] * 4 + 8; pbuf += pbuf[3] * 4 + 8;
DuelClient::ClientAnalyze(offset, pbuf - offset); DuelClient::ClientAnalyze(offset, pbuf - offset);
ReplayRefreshDeck(player);
ReplayRefreshExtra(player);
break; break;
} }
} }
...@@ -631,9 +648,19 @@ void ReplayMode::ReplayRefreshHand(int player, int flag) { ...@@ -631,9 +648,19 @@ void ReplayMode::ReplayRefreshHand(int player, int flag) {
} }
void ReplayMode::ReplayRefreshGrave(int player, int flag) { void ReplayMode::ReplayRefreshGrave(int player, int flag) {
unsigned char queryBuffer[0x1000]; unsigned char queryBuffer[0x1000];
int len = query_field_card(pduel, 0, LOCATION_GRAVE, flag, queryBuffer, 0); int len = query_field_card(pduel, player, LOCATION_GRAVE, flag, queryBuffer, 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), LOCATION_GRAVE, (char*)queryBuffer); mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), LOCATION_GRAVE, (char*)queryBuffer);
} }
void ReplayMode::ReplayRefreshDeck(int player, int flag) {
unsigned char queryBuffer[0x1000];
int len = query_field_card(pduel, player, LOCATION_DECK, flag, queryBuffer, 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), LOCATION_DECK, (char*)queryBuffer);
}
void ReplayMode::ReplayRefreshExtra(int player, int flag) {
unsigned char queryBuffer[0x1000];
int len = query_field_card(pduel, player, LOCATION_EXTRA, flag, queryBuffer, 0);
mainGame->dField.UpdateFieldCard(mainGame->LocalPlayer(player), LOCATION_EXTRA, (char*)queryBuffer);
}
void ReplayMode::ReplayRefreshSingle(int player, int location, int sequence, int flag) { void ReplayMode::ReplayRefreshSingle(int player, int location, int sequence, int flag) {
unsigned char queryBuffer[0x1000]; unsigned char queryBuffer[0x1000];
int len = query_card(pduel, player, location, sequence, flag, queryBuffer, 0); int len = query_card(pduel, player, location, sequence, flag, queryBuffer, 0);
......
...@@ -34,6 +34,8 @@ public: ...@@ -34,6 +34,8 @@ public:
static void ReplayRefresh(int flag = 0x181fff); static void ReplayRefresh(int flag = 0x181fff);
static void ReplayRefreshHand(int player, int flag = 0x181fff); static void ReplayRefreshHand(int player, int flag = 0x181fff);
static void ReplayRefreshGrave(int player, int flag = 0x181fff); static void ReplayRefreshGrave(int player, int flag = 0x181fff);
static void ReplayRefreshDeck(int player, int flag = 0x181fff);
static void ReplayRefreshExtra(int player, int flag = 0x181fff);
static void ReplayRefreshSingle(int player, int location, int sequence, int flag = 0x181fff); static void ReplayRefreshSingle(int player, int location, int sequence, int flag = 0x181fff);
static int MessageHandler(long fduel, int type); static int MessageHandler(long fduel, int type);
......
...@@ -209,6 +209,7 @@ void TagDuel::ToObserver(DuelPlayer* dp) { ...@@ -209,6 +209,7 @@ void TagDuel::ToObserver(DuelPlayer* dp) {
for(auto pit = observers.begin(); pit != observers.end(); ++pit) for(auto pit = observers.begin(); pit != observers.end(); ++pit)
NetServer::SendPacketToPlayer(*pit, STOC_HS_PLAYER_CHANGE, scpc); NetServer::SendPacketToPlayer(*pit, STOC_HS_PLAYER_CHANGE, scpc);
players[dp->type] = 0; players[dp->type] = 0;
ready[dp->type] = false;
dp->type = NETPLAYER_TYPE_OBSERVER; dp->type = NETPLAYER_TYPE_OBSERVER;
observers.insert(dp); observers.insert(dp);
STOC_TypeChange sctc; STOC_TypeChange sctc;
...@@ -340,7 +341,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -340,7 +341,7 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
ReplayHeader rh; ReplayHeader rh;
rh.id = 0x31707279; rh.id = 0x31707279;
rh.version = PRO_VERSION; rh.version = PRO_VERSION;
rh.flag = 0; rh.flag = REPLAY_TAG;
time_t seed = time(0); time_t seed = time(0);
rh.seed = seed; rh.seed = seed;
last_replay.BeginRecord(); last_replay.BeginRecord();
...@@ -348,6 +349,8 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) { ...@@ -348,6 +349,8 @@ void TagDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
rnd.reset(seed); rnd.reset(seed);
last_replay.WriteData(players[0]->name, 40, false); last_replay.WriteData(players[0]->name, 40, false);
last_replay.WriteData(players[1]->name, 40, false); last_replay.WriteData(players[1]->name, 40, false);
last_replay.WriteData(players[2]->name, 40, false);
last_replay.WriteData(players[3]->name, 40, false);
if(!host_info.no_shuffle_deck) { if(!host_info.no_shuffle_deck) {
for(int i = 0; i < pdeck[0].main.size(); ++i) { for(int i = 0; i < pdeck[0].main.size(); ++i) {
int swap = rnd.real() * pdeck[0].main.size(); int swap = rnd.real() * pdeck[0].main.size();
...@@ -798,12 +801,6 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -798,12 +801,6 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
} }
} }
turn_count++; turn_count++;
RefreshMzone(0);
RefreshMzone(1);
RefreshSzone(0);
RefreshSzone(1);
RefreshHand(0);
RefreshHand(1);
break; break;
} }
case MSG_NEW_PHASE: { case MSG_NEW_PHASE: {
...@@ -1347,6 +1344,12 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) { ...@@ -1347,6 +1344,12 @@ int TagDuel::Analyze(char* msgbuffer, unsigned int len) {
for(auto oit = observers.begin(); oit != observers.end(); ++oit) for(auto oit = observers.begin(); oit != observers.end(); ++oit)
NetServer::ReSendToPlayer(*oit); NetServer::ReSendToPlayer(*oit);
RefreshExtra(player); RefreshExtra(player);
RefreshMzone(0, 0x81fff, 0);
RefreshMzone(1, 0x81fff, 0);
RefreshSzone(0, 0x81fff, 0);
RefreshSzone(1, 0x81fff, 0);
RefreshHand(0, 0x181fff, 0);
RefreshHand(1, 0x181fff, 0);
break; break;
} }
} }
......
--アドバンスド・ダーク
function c12644061.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--attribute
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE+LOCATION_GRAVE,LOCATION_MZONE+LOCATION_GRAVE)
e2:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x34))
e2:SetValue(ATTRIBUTE_DARK)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_ATTACK_ANNOUNCE)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c12644061.discon)
e3:SetOperation(c12644061.disop)
c:RegisterEffect(e3)
--
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(74823665,0))
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e4:SetRange(LOCATION_SZONE)
e4:SetCondition(c12644061.damcon)
e4:SetCost(c12644061.damcost)
e4:SetOperation(c12644061.damop)
c:RegisterEffect(e4)
end
function c12644061.discon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local code=a:GetCode()
local at=Duel.GetAttackTarget()
return at and (code==79856792 or code==79407975)
end
function c12644061.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttackTarget()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
tc:RegisterEffect(e2)
end
function c12644061.damcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local at=Duel.GetAttackTarget()
return ep==tp and ((a:IsControler(tp) and a:IsSetCard(0x34)) or (at and at:IsControler(tp) and at:IsSetCard(0x34)))
end
function c12644061.dfilter(c)
return c:IsSetCard(0x34) and c:IsAbleToGraveAsCost()
end
function c12644061.damcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c12644061.dfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c12644061.dfilter,tp,LOCATION_DECK,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c12644061.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeBattleDamage(tp,0)
end
...@@ -48,7 +48,12 @@ function c13093792.spelltg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -48,7 +48,12 @@ function c13093792.spelltg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
return not ftg or ftg(e,tp,eg,ep,ev,re,r,rp,chk) return not ftg or ftg(e,tp,eg,ep,ev,re,r,rp,chk)
end end
ftg(e,tp,eg,ep,ev,re,r,rp,chk) if ae:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else e:SetProperty(0) end
if ftg then
ftg(e,tp,eg,ep,ev,re,r,rp,chk)
end
end end
function c13093792.spellop(e,tp,eg,ep,ev,re,r,rp) function c13093792.spellop(e,tp,eg,ep,ev,re,r,rp)
local ae=e:GetHandler():GetActivateEffect() local ae=e:GetHandler():GetActivateEffect()
......
--Trial and Tribulation
function c26285788.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c26285788.cost)
e1:SetOperation(c26285788.activate)
c:RegisterEffect(e1)
if c26285788.counter==nil then
c26285788.counter=true
c26285788[0]=0
c26285788[1]=0
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
e1:SetOperation(c26285788.resetcount)
Duel.RegisterEffect(e1,0)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_RELEASE)
e2:SetOperation(c26285788.addcount)
Duel.RegisterEffect(e2,0)
end
end
function c26285788.resetcount(e,tp,eg,ep,ev,re,r,rp)
c26285788[0]=0
c26285788[1]=0
end
function c26285788.addcount(e,tp,eg,ep,ev,re,r,rp)
local c=eg:GetFirst()
while c~=nil do
local p=c:GetPreviousControler()
c26285788[p]=c26285788[p]+1
c=eg:GetNext()
end
end
function c26285788.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,26285788)==0 end
Duel.RegisterFlagEffect(tp,26285788,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c26285788.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetCondition(c26285788.effectcon)
e1:SetOperation(c26285788.effectop)
Duel.RegisterEffect(e1,tp)
end
function c26285788.effectcon(e,tp,eg,ep,ev,re,r,rp)
return c26285788[tp]>0
end
function c26285788.filter1(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c26285788.filter2(c)
return c:IsFaceup() and c:IsDestructable()
end
function c26285788.effectop(e,tp,eg,ep,ev,re,r,rp)
if c26285788[tp]==1 then
Duel.Draw(tp,1,REASON_EFFECT)
elseif c26285788[tp]==2 then
local g=Duel.GetMatchingGroup(c26285788.filter1,tp,LOCATION_GRAVE,0,nil)
if g:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg=g:Select(tp,2,2,nil)
Duel.SendtoHand(tg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg)
end
else
local g=Duel.GetMatchingGroup(c26285788.filter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
if g:GetCount()>2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local tg=g:Select(tp,3,3,nil)
Duel.Destroy(tg,REASON_EFFECT)
end
end
end
--Lightray Grepher
function c27407330.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c27407330.spcon)
e1:SetOperation(c27407330.spop)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(27407330,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c27407330.rmcost)
e2:SetTarget(c27407330.rmtg)
e2:SetOperation(c27407330.rmop)
c:RegisterEffect(e2)
end
function c27407330.spfilter(c)
return c:GetLevel()>=5 and c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c27407330.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
Duel.IsExistingMatchingCard(c27407330.spfilter,c:GetControler(),LOCATION_HAND,0,1,c)
end
function c27407330.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g=Duel.SelectMatchingCard(tp,c27407330.spfilter,tp,LOCATION_HAND,0,1,1,c)
Duel.SendtoGrave(g,REASON_DISCARD+REASON_COST)
end
function c27407330.costfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsDiscardable()
end
function c27407330.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c27407330.costfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,c27407330.costfilter,1,1,REASON_COST+REASON_DISCARD)
end
function c27407330.filter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemove()
end
function c27407330.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c27407330.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
end
function c27407330.rmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c27407330.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
end
--ミラクル・コンタクト
function c35255456.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c35255456.target)
e1:SetOperation(c35255456.activate)
c:RegisterEffect(e1)
end
function c35255456.filter1(c,e)
return c:IsAbleToDeck() and c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c35255456.filter2(c,e,tp,m,chkf)
return c:IsType(TYPE_FUSION) and c:IsSetCard(0x3008) and c:IsSetCard(0x9) and c:GetCode()~=86346643
and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and c:CheckFusionMaterial(m,nil,chkf)
end
function c35255456.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp
local mg=Duel.GetMatchingGroup(c35255456.filter1,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE,0,nil,e)
return Duel.IsExistingMatchingCard(c35255456.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg,chkf)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function c35255456.cffilter(c)
return c:IsLocation(LOCATION_HAND) or (c:IsLocation(LOCATION_MZONE) and c:IsFacedown())
end
function c35255456.activate(e,tp,eg,ep,ev,re,r,rp)
local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp
local mg=Duel.GetMatchingGroup(c35255456.filter1,tp,LOCATION_HAND+LOCATION_GRAVE+LOCATION_MZONE,0,nil,e)
local sg=Duel.GetMatchingGroup(c35255456.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg,chkf)
if sg:GetCount()>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst()
local mat=Duel.SelectFusionMaterial(tp,tc,mg,nil,chkf)
local cf=mat:Filter(c35255456.cffilter,nil)
if cf:GetCount()>0 then
Duel.ConfirmCards(1-tp,cf)
end
Duel.SendtoDeck(mat,nil,2,REASON_EFFECT)
Duel.BreakEffect()
Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)
end
end
--Ancient Dragon
function c38520918.initial_effect(c)
-- atk/lv up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(38520918,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(c38520918.condition)
e1:SetOperation(c38520918.operation)
c:RegisterEffect(e1)
end
function c38520918.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and Duel.GetAttackTarget()==nil
end
function c38520918.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_LEVEL)
e2:SetValue(1)
c:RegisterEffect(e2)
end
end
--連続魔法
function c49398568.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c49398568.condition)
e1:SetCost(c49398568.cost)
e1:SetTarget(c49398568.target)
e1:SetOperation(c49398568.activate)
c:RegisterEffect(e1)
end
function c49398568.condition(e,tp,eg,ep,ev,re,r,rp)
return re:GetActiveType()==TYPE_SPELL and re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp
end
function c49398568.cfilter(c)
return c:IsDiscardable() and c:IsAbleToGraveAsCost()
end
function c49398568.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local hg=Duel.GetFieldGroup(tp,LOCATION_HAND,0)
if chk==0 then return hg:GetCount()>0 and hg:FilterCount(c49398568.cfilter,nil)==hg:GetCount() end
Duel.SendtoGrave(hg,REASON_COST)
end
function c49398568.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ftg=re:GetTarget()
if chkc then return ftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end
if chk==0 then return not ftg or ftg(e,tp,eg,ep,ev,re,r,rp,chk) end
if re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else e:SetProperty(0) end
if ftg then
ftg(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function c49398568.activate(e,tp,eg,ep,ev,re,r,rp)
local fop=re:GetOperation()
fop(e,tp,eg,ep,ev,re,r,rp)
end
--Hieratic Seal of the Dragon King
function c64514622.initial_effect(c)
aux.EnableDualAttribute(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetDescription(aux.Stringid(64514622,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(aux.IsDualState)
e1:SetCost(c64514622.cost)
e1:SetTarget(c64514622.target)
e1:SetOperation(c64514622.operation)
c:RegisterEffect(e1)
end
function c64514622.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReleaseable() end
Duel.Release(e:GetHandler(),REASON_COST)
end
function c64514622.filter(c,e,tp)
return c:IsSetCard(0x69) and c:GetCode()~=64514622 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c64514622.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c64514622.filter,tp,0x13,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0x13)
end
function c64514622.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c64514622.filter,tp,0x13,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--Tardy Orc
function c64892035.initial_effect(c)
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c64892035.atklimit)
c:RegisterEffect(e1)
end
function c64892035.atklimit(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
--Draconnection
function c90887783.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c90887783.target)
e1:SetOperation(c90887783.operation)
c:RegisterEffect(e1)
end
function c90887783.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function c90887783.filter1(c,tp)
return c:IsRace(RACE_DRAGON) and c:IsAbleToDeck() and not c:IsPublic()
and Duel.IsExistingMatchingCard(c90887783.filter2,tp,LOCATION_DECK,0,1,nil,c:GetLevel())
end
function c90887783.filter2(c,lv)
return c:IsRace(RACE_DRAGON) and c:GetLevel()==lv and c:IsAbleToHand()
end
function c90887783.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c90887783.filter1,tp,LOCATION_HAND,0,1,nil,tp) end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c90887783.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g1=Duel.SelectMatchingCard(tp,c90887783.filter1,tp,LOCATION_HAND,0,1,1,nil,tp)
Duel.ConfirmCards(1-tp,g1)
if g1:GetCount()==0 then return end
local g2=Duel.SelectMatchingCard(tp,c90887783.filter2,tp,LOCATION_DECK,0,1,1,nil,g1:GetFirst():GetLevel())
Duel.SendtoHand(g2,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g2)
Duel.SendtoDeck(g1,nil,2,REASON_EFFECT)
end
--Evoltile Elginero
function c91903221.initial_effect(c)
--draw & search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(91903221,0))
e1:SetCategory(CATEGORY_DRAW+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_RELEASE)
e1:SetCondition(c91903221.condition)
e1:SetTarget(c91903221.target)
e1:SetOperation(c91903221.operation)
c:RegisterEffect(e1)
end
function c91903221.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsLocation(LOCATION_GRAVE)
end
function c91903221.filter1(c)
return c:IsRace(RACE_DINOSAUR) and c:IsAbleToDeck()
end
function c91903221.filter2(c)
return c:IsSetCard(0x304e) and c:IsAbleToHand()
end
function c91903221.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c91903221.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
local g1=Duel.GetMatchingGroup(c91903221.filter1,tp,LOCATION_HAND,0,nil)
local g2=Duel.GetMatchingGroup(c91903221.filter2,tp,LOCATION_DECK,0,nil)
if g1:GetCount()>0 and g2:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(91903221,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local tg1=g1:Select(tp,1,1,nil)
Duel.ConfirmCards(1-tp,tg1)
Duel.SendtoDeck(tg1,nil,2,REASON_EFFECT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local tg2=g2:Select(tp,1,1,nil)
Duel.SendtoHand(tg2,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tg2)
end
end
...@@ -9,5 +9,5 @@ lastdeck = T1 ...@@ -9,5 +9,5 @@ lastdeck = T1
textfont = c:/windows/fonts/simsun.ttc 14 textfont = c:/windows/fonts/simsun.ttc 14
numfont = c:/windows/fonts/arialbd.ttf numfont = c:/windows/fonts/arialbd.ttf
serverport = 7911 serverport = 7911
lastip = 192.168.2.100 lastip = 192.168.3.235
lastport = 7911 lastport = 7911
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