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

new script

parent a56e464e
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_DEVICE_STUB_H_INCLUDED__
#define __C_IRR_DEVICE_STUB_H_INCLUDED__
#include "IrrlichtDevice.h"
#include "IImagePresenter.h"
#include "SIrrCreationParameters.h"
#include "CVideoModeList.h"
namespace irr
{
// lots of prototypes:
class ILogger;
class CLogger;
namespace gui
{
class IGUIEnvironment;
IGUIEnvironment* createGUIEnvironment(io::IFileSystem* fs,
video::IVideoDriver* Driver, IOSOperator* op);
}
namespace scene
{
ISceneManager* createSceneManager(video::IVideoDriver* driver,
io::IFileSystem* fs, gui::ICursorControl* cc, gui::IGUIEnvironment *gui);
}
namespace io
{
IFileSystem* createFileSystem();
}
namespace video
{
IVideoDriver* createSoftwareDriver(const core::dimension2d<u32>& windowSize,
bool fullscreen, io::IFileSystem* io,
video::IImagePresenter* presenter);
IVideoDriver* createSoftwareDriver2(const core::dimension2d<u32>& windowSize,
bool fullscreen, io::IFileSystem* io,
video::IImagePresenter* presenter);
IVideoDriver* createNullDriver(io::IFileSystem* io, const core::dimension2d<u32>& screenSize);
}
//! Stub for an Irrlicht Device implementation
class CIrrDeviceStub : public IrrlichtDevice
{
public:
//! constructor
CIrrDeviceStub(const SIrrlichtCreationParameters& param);
//! destructor
virtual ~CIrrDeviceStub();
//! returns the video driver
virtual video::IVideoDriver* getVideoDriver();
//! return file system
virtual io::IFileSystem* getFileSystem();
//! returns the gui environment
virtual gui::IGUIEnvironment* getGUIEnvironment();
//! returns the scene manager
virtual scene::ISceneManager* getSceneManager();
//! \return Returns a pointer to the mouse cursor control interface.
virtual gui::ICursorControl* getCursorControl();
//! Returns a pointer to a list with all video modes supported by the gfx adapter.
virtual video::IVideoModeList* getVideoModeList();
//! Returns a pointer to the ITimer object. With it the current Time can be received.
virtual ITimer* getTimer();
//! Returns the version of the engine.
virtual const char* getVersion() const;
//! send the event to the right receiver
virtual bool postEventFromUser(const SEvent& event);
//! Sets a new event receiver to receive events
virtual void setEventReceiver(IEventReceiver* receiver);
//! Returns pointer to the current event receiver. Returns 0 if there is none.
virtual IEventReceiver* getEventReceiver();
//! Sets the input receiving scene manager.
/** If set to null, the main scene manager (returned by GetSceneManager()) will receive the input */
virtual void setInputReceivingSceneManager(scene::ISceneManager* sceneManager);
//! Returns a pointer to the logger.
virtual ILogger* getLogger();
//! Returns the operation system opertator object.
virtual IOSOperator* getOSOperator();
//! Checks if the window is running in fullscreen mode.
virtual bool isFullscreen() const;
//! get color format of the current window
virtual video::ECOLOR_FORMAT getColorFormat() const;
//! Activate any joysticks, and generate events for them.
virtual bool activateJoysticks(core::array<SJoystickInfo> & joystickInfo);
//! Set the current Gamma Value for the Display
virtual bool setGammaRamp( f32 red, f32 green, f32 blue, f32 brightness, f32 contrast );
//! Get the current Gamma Value for the Display
virtual bool getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &brightness, f32 &contrast );
//! Set the maximal elapsed time between 2 clicks to generate doubleclicks for the mouse. It also affects tripleclick behaviour.
//! When set to 0 no double- and tripleclicks will be generated.
virtual void setDoubleClickTime( u32 timeMs );
//! Get the maximal elapsed time between 2 clicks to generate double- and tripleclicks for the mouse.
virtual u32 getDoubleClickTime() const;
//! Remove all messages pending in the system message loop
virtual void clearSystemMessages();
protected:
void createGUIAndScene();
//! checks version of SDK and prints warning if there might be a problem
bool checkVersion(const char* version);
//! Compares to the last call of this function to return double and triple clicks.
//! \return Returns only 1,2 or 3. A 4th click will start with 1 again.
virtual u32 checkSuccessiveClicks(s32 mouseX, s32 mouseY, EMOUSE_INPUT_EVENT inputEvent );
void calculateGammaRamp ( u16 *ramp, f32 gamma, f32 relativebrightness, f32 relativecontrast );
void calculateGammaFromRamp ( f32 &gamma, const u16 *ramp );
video::IVideoDriver* VideoDriver;
gui::IGUIEnvironment* GUIEnvironment;
scene::ISceneManager* SceneManager;
ITimer* Timer;
gui::ICursorControl* CursorControl;
IEventReceiver* UserReceiver;
CLogger* Logger;
IOSOperator* Operator;
io::IFileSystem* FileSystem;
scene::ISceneManager* InputReceivingSceneManager;
struct SMouseMultiClicks
{
SMouseMultiClicks()
: DoubleClickTime(500), CountSuccessiveClicks(0), LastClickTime(0), LastMouseInputEvent(EMIE_COUNT)
{}
u32 DoubleClickTime;
u32 CountSuccessiveClicks;
u32 LastClickTime;
core::position2di LastClick;
EMOUSE_INPUT_EVENT LastMouseInputEvent;
};
SMouseMultiClicks MouseMultiClicks;
video::CVideoModeList VideoModeList;
SIrrlichtCreationParameters CreationParams;
bool Close;
};
} // end namespace irr
#endif
This diff is collapsed.
This diff is collapsed.
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_OS_OPERATOR_H_INCLUDED__
#define __C_OS_OPERATOR_H_INCLUDED__
#include "IOSOperator.h"
#include "irrString.h"
#include "IrrCompileConfig.h"
namespace irr
{
class CIrrDeviceLinux;
//! The Operating system operator provides operation system specific methods and informations.
class COSOperator : public IOSOperator
{
public:
// constructor
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
COSOperator(const c8* osversion, CIrrDeviceLinux* device);
#endif
COSOperator(const c8* osversion);
//! returns the current operation system version as string.
virtual const wchar_t* getOperationSystemVersion() const;
//! copies text to the clipboard
virtual void copyToClipboard(const c8* text) const;
//! gets text from the clipboard
//! \return Returns 0 if no string is in there.
virtual const c8* getTextFromClipboard() const;
//! gets the processor speed in megahertz
//! \param Mhz:
//! \return Returns true if successful, false if not
virtual bool getProcessorSpeedMHz(u32* MHz) const;
//! gets the total and available system RAM in kB
//! \param Total: will contain the total system memory
//! \param Avail: will contain the available memory
//! \return Returns true if successful, false if not
virtual bool getSystemMemory(u32* Total, u32* Avail) const;
private:
core::stringw OperatingSystem;
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_)
CIrrDeviceLinux * IrrDeviceLinux;
#endif
};
} // end namespace
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __C_IRR_C_TIMER_H_INCLUDED__
#define __C_IRR_C_TIMER_H_INCLUDED__
#include "ITimer.h"
#include "os.h"
namespace irr
{
//! Device independent implementation of the timer
class CTimer : public ITimer
{
public:
CTimer()
{
os::Timer::initTimer();
}
//! Returns current real time in milliseconds of the system.
/** This value does not start with 0 when the application starts.
For example in one implementation the value returned could be the
amount of milliseconds which have elapsed since the system was started. */
virtual u32 getRealTime() const
{
return os::Timer::getRealTime();
}
//! Returns current virtual time in milliseconds.
/** This value starts with 0 and can be manipulated using setTime(), stopTimer(),
startTimer(), etc. This value depends on the set speed of the timer if the timer
is stopped, etc. If you need the system time, use getRealTime() */
virtual u32 getTime() const
{
return os::Timer::getTime();
}
//! sets current virtual time
virtual void setTime(u32 time)
{
os::Timer::setTime(time);
}
//! Stops the game timer.
/** The timer is reference counted, which means everything which calls
stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop
corretly again. */
virtual void stop()
{
os::Timer::stopTimer();
}
//! Starts the game timer.
/** The timer is reference counted, which means everything which calls
stopTimer() will also have to call startTimer(), otherwise the timer may not start/stop
corretly again. */
virtual void start()
{
os::Timer::startTimer();
}
//! Sets the speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual void setSpeed(f32 speed = 1.0f)
{
os::Timer::setSpeed(speed);
}
//! Returns current speed of the timer
/** The speed is the factor with which the time is running faster or slower then the
real system time. */
virtual f32 getSpeed() const
{
return os::Timer::getSpeed();
}
//! Returns if game timer is currently stopped
virtual bool isStopped() const
{
bool ret = os::Timer::isStopped();
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return ret;
}
//! Advances the virtual time
/** Makes the virtual timer update the time value based on the real time. This is
called automaticly when calling IrrlichtDevice::run(), but you can call it manually
if you don't use this method. */
virtual void tick()
{
os::Timer::tick();
}
};
} // end namespace
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_C_VIDEO_MODE_LIST_H_INCLUDED__
#define __IRR_C_VIDEO_MODE_LIST_H_INCLUDED__
#include "IVideoModeList.h"
#include "dimension2d.h"
#include "irrArray.h"
namespace irr
{
namespace video
{
class CVideoModeList : public IVideoModeList
{
public:
//! constructor
CVideoModeList();
//! Gets amount of video modes in the list.
virtual s32 getVideoModeCount() const;
//! Returns the screen size of a video mode in pixels.
virtual core::dimension2d<u32> getVideoModeResolution(s32 modeNumber) const;
//! Returns the screen size of an optimal video mode in pixels.
virtual core::dimension2d<u32> getVideoModeResolution(const core::dimension2d<u32>& minSize, const core::dimension2d<u32>& maxSize) const;
//! Returns the pixel depth of a video mode in bits.
virtual s32 getVideoModeDepth(s32 modeNumber) const;
//! Returns current desktop screen resolution.
virtual const core::dimension2d<u32>& getDesktopResolution() const;
//! Returns the pixel depth of a video mode in bits.
virtual s32 getDesktopDepth() const;
//! adds a new mode to the list
void addMode(const core::dimension2d<u32>& size, s32 depth);
void setDesktop(s32 desktopDepth, const core::dimension2d<u32>& desktopSize);
private:
struct SVideoMode
{
core::dimension2d<u32> size;
s32 depth;
bool operator==(const SVideoMode& other) const
{
return size == other.size && depth == other.depth;
}
bool operator <(const SVideoMode& other) const
{
return (size.Width < other.size.Width ||
(size.Width == other.size.Width &&
size.Height < other.size.Height) ||
(size.Width == other.size.Width &&
size.Height == other.size.Height &&
depth < other.depth));
}
};
core::array<SVideoMode> VideoModes;
SVideoMode Desktop;
};
} // end namespace video
} // end namespace irr
#endif
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_IMAGE_PRESENTER_H_INCLUDED__
#define __I_IMAGE_PRESENTER_H_INCLUDED__
#include "IImage.h"
namespace irr
{
namespace video
{
/*!
Interface for a class which is able to present an IImage
an the Screen. Usually only implemented by an IrrDevice for
presenting Software Device Rendered images.
This class should be used only internally.
*/
class IImagePresenter
{
public:
virtual ~IImagePresenter() {};
//! presents a surface in the client area
virtual bool present(video::IImage* surface, void* windowId=0, core::rect<s32>* src=0 ) = 0;
};
} // end namespace video
} // end namespace irr
#endif
......@@ -97,6 +97,7 @@ public:
irr::IrrlichtDevice* device;
irr::gui::IGUIElement* panel;
std::vector<int> ancard;
int hovered_controler;
int hovered_location;
int hovered_sequence;
......
......@@ -24,7 +24,6 @@
#ifdef _WIN32
#include <windows.h>
#include <imm.h>
#define myswprintf swprintf
#else
......
......@@ -52,7 +52,10 @@ bool DataManager::LoadDates(const char* file) {
if(len) {
cs.text = new wchar_t[len + 1];
memcpy(cs.text, strBuffer, (len + 1)*sizeof(wchar_t));
} else cs.text = 0;
} else {
cs.text = new wchar_t[1];
cs.text[0] = 0;
}
for(int i = 14; i < 30; ++i) {
len = DecodeUTF8((const char*)sqlite3_column_text(pStmt, i), strBuffer);
if(len) {
......@@ -98,12 +101,6 @@ bool DataManager::LoadDates(const char* file) {
wchar_t* pbuf = new wchar_t[len + 1];
wcscpy(pbuf, strBuffer);
_counterStrings[value] = pbuf;
} else if(!strcmp(strbuf, "series")) {
sscanf(&linebuf[7], "%x %s", &value, strbuf);
int len = DecodeUTF8(strbuf, strBuffer);
wchar_t* pbuf = new wchar_t[len + 1];
wcscpy(pbuf, strBuffer);
_seriesStrings[value] = pbuf;
}
}
fclose(fp);
......@@ -184,12 +181,6 @@ const wchar_t* DataManager::GetCounterName(int code) {
return unknown_string;
return csit->second;
}
const wchar_t* DataManager::GetSeriesName(int code) {
auto csit = _seriesStrings.find(code);
if(csit == _seriesStrings.end())
return unknown_string;
return csit->second;
}
const wchar_t* DataManager::GetNumString(int num) {
return numStrings[num];
}
......
......@@ -25,7 +25,6 @@ public:
const wchar_t* GetSysString(int code);
const wchar_t* GetVictoryString(int code);
const wchar_t* GetCounterName(int code);
const wchar_t* GetSeriesName(int code);
const wchar_t* GetNumString(int num);
static int EncodeUTF8(const wchar_t * wsrc, char * str);
static int DecodeUTF8(const char * src, wchar_t * wstr);
......@@ -35,7 +34,6 @@ public:
std::unordered_map<unsigned int, wchar_t*> _sysStrings;
std::unordered_map<unsigned int, wchar_t*> _counterStrings;
std::unordered_map<unsigned int, wchar_t*> _victoryStrings;
std::unordered_map<unsigned int, wchar_t*> _seriesStrings;
wchar_t numStrings[256][4];
static wchar_t strBuffer[2048];
......
......@@ -76,7 +76,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case BUTTON_START_FILTER: {
filter_type = mainGame->cbCardType->getSelected();
filter_type2 = mainGame->cbCardType2->getItemData(mainGame->cbCardType2->getSelected());
filter_series = mainGame->cbCardClass->getItemData(mainGame->cbCardClass->getSelected());
filter_lm = mainGame->cbLimit->getSelected();
if(filter_type > 1) {
FilterCards();
......@@ -175,7 +174,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
case BUTTON_RESULT_FILTER: {
filter_type = mainGame->cbCardType->getSelected();
filter_type2 = mainGame->cbCardType2->getItemData(mainGame->cbCardType2->getSelected());
filter_series = mainGame->cbCardClass->getItemData(mainGame->cbCardClass->getSelected());
filter_lm = mainGame->cbLimit->getSelected();
if(filter_type > 1) {
FilterCardsFromResult();
......@@ -271,32 +269,6 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
FilterCardsFromResult();
break;
}
case BUTTON_GETCODE: {
const wchar_t* strcode = mainGame->ebCardCode->getText();
if(*strcode) {
int code = _wtoi(strcode);
auto it = mainGame->dataManager._datas.find(code);
if(it != mainGame->dataManager._datas.end()) {
results.clear();
results.push_back(it);
myswprintf(result_string, L"1");
mainGame->scrFilter->setVisible(false);
mainGame->scrFilter->setPos(0);
mainGame->cbCardClass->setSelected(0);
mainGame->cbAttribute->setSelected(0);
mainGame->cbRace->setSelected(0);
mainGame->cbLimit->setSelected(0);
mainGame->ebAttack->setText(L"");
mainGame->ebDefence->setText(L"");
mainGame->ebStar->setText(L"");
mainGame->ebCardCode->setText(L"");
filter_effect = 0;
for(int i = 0; i < 32; ++i)
mainGame->chkCategory[i]->setChecked(false);
}
break;
}
}
case BUTTON_CATEGORY_OK: {
filter_effect = 0;
long long filter = 0x1;
......@@ -629,8 +601,13 @@ int DeckBuilder::GetVal(const wchar_t * pstr) {
}
void DeckBuilder::FilterCards() {
results.clear();
for(code_pointer ptr = mainGame->dataManager._datas.begin(); ptr != mainGame->dataManager._datas.end(); ++ptr) {
const wchar_t* pstr = mainGame->ebCardName->getText();
if(pstr[0] == 0)
pstr = 0;
auto strpointer = mainGame->dataManager._strings.begin();
for(code_pointer ptr = mainGame->dataManager._datas.begin(); ptr != mainGame->dataManager._datas.end(); ++ptr, ++strpointer) {
CardDataC& data = ptr->second;
CardString& text = strpointer->second;
if(data.type & TYPE_TOKEN)
continue;
switch(filter_type) {
......@@ -683,11 +660,8 @@ void DeckBuilder::FilterCards() {
if(!filterList->count(ptr->first) || (*filterList)[ptr->first] != filter_lm - 1)
continue;
}
if(filter_series) {
uint32 settype = filter_series & 0xfff;
uint32 setsubtype = filter_series & 0xf000;
if (((data.setcode & 0xfff) != settype || ((data.setcode & 0xf000 & setsubtype) != setsubtype)) &&
(((data.setcode >> 16) & 0xfff) != settype || ((data.setcode >> 16) & 0xf000 & setsubtype) != setsubtype))
if(pstr) {
if(wcsstr(text.name, pstr) == 0 && wcsstr(text.text, pstr) == 0)
continue;
}
results.push_back(ptr);
......@@ -702,7 +676,6 @@ void DeckBuilder::FilterCards() {
mainGame->scrFilter->setPos(0);
}
std::sort(results.begin(), results.end(), ClientCard::deck_sort_lv);
mainGame->cbCardClass->setSelected(0);
mainGame->cbAttribute->setSelected(0);
mainGame->cbRace->setSelected(0);
mainGame->cbLimit->setSelected(0);
......@@ -715,6 +688,9 @@ void DeckBuilder::FilterCards() {
}
void DeckBuilder::FilterCardsFromResult() {
int offset = 0;
const wchar_t* pstr = mainGame->ebCardName->getText();
if(pstr[0] == 0)
pstr = 0;
for(int i = 0; i < results.size(); ++i) {
CardDataC& data = results[i]->second;
if(data.type & TYPE_TOKEN)
......@@ -769,11 +745,9 @@ void DeckBuilder::FilterCardsFromResult() {
}
if(filter_effect && !(data.category & filter_effect))
continue;
if(filter_series) {
uint32 settype = filter_series & 0xfff;
uint32 setsubtype = filter_series & 0xf000;
if (((data.setcode & 0xfff) != settype || ((data.setcode & 0xf000 & setsubtype) != setsubtype)) &&
(((data.setcode >> 16) & 0xfff) != settype || ((data.setcode >> 16) & 0xf000 & setsubtype) != setsubtype))
if(pstr) {
CardString& text = mainGame->dataManager._strings[data.code];
if(wcsstr(text.name, pstr) == 0 && wcsstr(text.text, pstr) == 0)
continue;
}
results[offset] = results[i];
......@@ -789,7 +763,6 @@ void DeckBuilder::FilterCardsFromResult() {
mainGame->scrFilter->setVisible(false);
mainGame->scrFilter->setPos(0);
}
mainGame->cbCardClass->setSelected(0);
mainGame->cbAttribute->setSelected(0);
mainGame->cbRace->setSelected(0);
mainGame->cbLimit->setSelected(0);
......
......@@ -18,7 +18,6 @@ public:
long long filter_effect;
int filter_type;
int filter_type2;
int filter_series;
int filter_attrib;
int filter_race;
int filter_atktype;
......
......@@ -102,7 +102,6 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->device->setEventReceiver(&mainGame->deckBuilder);
mainGame->cbCardType->setSelected(0);
mainGame->cbCardType2->setSelected(0);
mainGame->cbCardClass->setSelected(0);
mainGame->cbAttribute->setSelected(0);
mainGame->cbRace->setSelected(0);
mainGame->ebAttack->setText(L"");
......@@ -312,7 +311,10 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
break;
}
case BUTTON_ANCARD_OK: {
mainGame->dInfo.responseI = _wtoi(mainGame->ebANCard->getText());
int sel = mainGame->lstANCard->getSelected();
if(sel == -1)
break;
mainGame->dInfo.responseI = ancard[sel];
mainGame->SetResponseI();
mainGame->HideElement(mainGame->wANCard, true);
break;
......@@ -825,6 +827,44 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case irr::gui::EGET_EDITBOX_CHANGED: {
switch(id) {
case EDITBOX_ANCARD: {
const wchar_t* pname = mainGame->ebANCard->getText();
if(pname[0] == 0 || pname[1] == 0)
break;
mainGame->lstANCard->clear();
ancard.clear();
for(auto cit = mainGame->dataManager._strings.begin(); cit != mainGame->dataManager._strings.end(); ++cit) {
if(wcsstr(cit->second.name, pname) != 0) {
mainGame->lstANCard->addItem(cit->second.name);
ancard.push_back(cit->first);
}
}
break;
}
}
break;
}
case irr::gui::EGET_EDITBOX_ENTER: {
switch(id) {
case EDITBOX_ANCARD: {
const wchar_t* pname = mainGame->ebANCard->getText();
if(pname[0] == 0)
break;
mainGame->lstANCard->clear();
ancard.clear();
for(auto cit = mainGame->dataManager._strings.begin(); cit != mainGame->dataManager._strings.end(); ++cit) {
if(wcsstr(cit->second.name, pname) != 0) {
mainGame->lstANCard->addItem(cit->second.name);
ancard.push_back(cit->first);
}
}
break;
}
}
break;
}
case irr::gui::EGET_ELEMENT_HOVERED: {
if(id >= BUTTON_CARD_0 && id <= BUTTON_CARD_4) {
int pos = mainGame->scrCardList->getPos() / 10;
......
#include "g_ime.h"
namespace ygo {
#ifdef _WIN32
HIMC G_IME::hIMC;
HWND G_IME::hWindow;
HHOOK G_IME::hHook;
void G_IME::Init(irr::video::SExposedVideoData& vdata) {
hWindow = (HWND)vdata.OpenGLWin32.HWnd;
hHook = SetWindowsHookEx(WH_GETMESSAGE, CharHookProc, NULL, GetCurrentThreadId());
hIMC = ImmGetContext(hWindow);
ImmAssociateContext(hWindow, hIMC);
}
LRESULT CALLBACK G_IME::CharHookProc(int nCode, WPARAM wParam, LPARAM lParam) {
if(nCode < 0)
return CallNextHookEx(hHook, nCode, wParam, lParam);
if(!ImmIsIME(GetKeyboardLayout(0)))
return CallNextHookEx(hHook, nCode, wParam, lParam);
MSG* msg = (MSG*)lParam;
switch(msg->message) {
case WM_IME_CHAR: {
break;
}
/* case WM_CHAR: {
switch(msg->wParam) {
case VK_RETURN:
break;
default: {
input_count ++;
if(msg->wParam > 128) {
if(input_count == 1)
input_buffer[1] = msg->wParam;
else if(input_count == 2) {
input_buffer[0] = msg->wParam;
input_count = 0;
}
} else {
input_count = 0;
}
return true;
}
break;
}
}*/
}
return CallNextHookEx(hHook, nCode, wParam, lParam);
}
#else
void G_IME::Init(irr::video::SExposedVideoData&) {
}
#endif
}
#ifndef G_IME_H
#define G_IME_H
#include "config.h"
namespace ygo {
#ifdef _WIN32
class G_IME{
public:
void Init(irr::video::SExposedVideoData&);
static LRESULT CALLBACK CharHookProc(int nCode, WPARAM wParam, LPARAM lParam);
private:
static HIMC hIMC;
static HWND hWindow;
static HHOOK hHook;
};
#else
class G_IME{
void Init(irr::video::SExposedVideoData&);
};
#endif
}
#endif //G_IME_H
......@@ -43,8 +43,6 @@ bool Game::Initialize() {
deckManager.LoadLFList();
driver = device->getVideoDriver();
driver->setTextureCreationFlag(irr::video::ETCF_CREATE_MIP_MAPS, false);
vdata = driver->getExposedVideoData();
ime.Init(vdata);
imageManager.SetDevice(device);
if(!dataManager.LoadDates("cards.cdb"))
return false;
......@@ -251,12 +249,13 @@ bool Game::Initialize() {
cbANNumber->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnANNumberOK = env->addButton(rect<s32>(80, 60, 150, 85), wANNumber, BUTTON_ANNUMBER_OK, L"确定");
//announce card
wANCard = env->addWindow(rect<s32>(570, 200, 760, 295), false, L"");
wANCard = env->addWindow(rect<s32>(560, 170, 770, 370), false, L"");
wANCard->getCloseButton()->setVisible(false);
wANCard->setVisible(false);
ebANCard = env->addEditBox(L"", rect<s32>(20, 30, 170, 50), true, wANCard, -1);
ebANCard = env->addEditBox(L"", rect<s32>(20, 25, 190, 45), true, wANCard, EDITBOX_ANCARD);
ebANCard->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnANCardOK = env->addButton(rect<s32>(60, 60, 130, 85), wANCard, BUTTON_ANCARD_OK, L"确定");
lstANCard = env->addListBox(rect<s32>(20, 50, 190, 160), wANCard, LISTBOX_ANCARD, true);
btnANCardOK = env->addButton(rect<s32>(60, 165, 150, 190), wANCard, BUTTON_ANCARD_OK, L"确定");
//announce attribute
wANAttribute = env->addWindow(rect<s32>(500, 200, 830, 285), false, L"请选择要宣言的属性:");
wANAttribute->getCloseButton()->setVisible(false);
......@@ -322,44 +321,38 @@ bool Game::Initialize() {
cbCardType->addItem(L"陷阱");
cbCardType2 = env->addComboBox(rect<s32>(130, 3, 190, 23), wFilter, -1);
cbCardType2->addItem(L"(无)", 0);
env->addStaticText(L"系列:", rect<s32>(210, 5, 280, 25), false, false, wFilter);
cbCardClass = env->addComboBox(rect<s32>(260, 3, 390, 23), wFilter, -1);
cbCardClass->addItem(L"(无)", 0);
for(auto ssit = dataManager._seriesStrings.begin(); ssit != dataManager._seriesStrings.end(); ++ssit)
cbCardClass->addItem(ssit->second, ssit->first);
env->addStaticText(L"限制:", rect<s32>(205, 5, 280, 25), false, false, wFilter);
cbLimit = env->addComboBox(rect<s32>(260, 3, 390, 23), wFilter, -1);
cbLimit->addItem(L"(无)");
cbLimit->addItem(L"禁止");
cbLimit->addItem(L"限制");
cbLimit->addItem(L"准限制");
env->addStaticText(L"属性:", rect<s32>(10, 28, 70, 48), false, false, wFilter);
cbAttribute = env->addComboBox(rect<s32>(60, 26, 190, 46), wFilter, -1);
cbAttribute->addItem(L"(无)", 0);
for(int filter = 0x1; filter != 0x80; filter <<= 1)
cbAttribute->addItem(DataManager::FormatAttribute(filter), filter);
env->addStaticText(L"种族:", rect<s32>(210, 28, 280, 48), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(260, 26, 390, 46), wFilter, -1);
env->addStaticText(L"种族:", rect<s32>(10, 51, 70, 71), false, false, wFilter);
cbRace = env->addComboBox(rect<s32>(60, 49, 190, 69), wFilter, -1);
cbRace->addItem(L"(无)", 0);
for(int filter = 0x1; filter != 0x400000; filter <<= 1)
cbRace->addItem(DataManager::FormatRace(filter), filter);
env->addStaticText(L"攻击:", rect<s32>(10, 51, 70, 71), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(60, 49, 190, 69), true, wFilter);
env->addStaticText(L"攻击:", rect<s32>(205, 28, 280, 48), false, false, wFilter);
ebAttack = env->addEditBox(L"", rect<s32>(260, 26, 340, 46), true, wFilter);
ebAttack->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(L"守备:", rect<s32>(10, 74, 70, 94), false, false, wFilter);
ebDefence = env->addEditBox(L"", rect<s32>(60, 72, 190, 92), true, wFilter);
env->addStaticText(L"守备:", rect<s32>(205, 51, 280, 71), false, false, wFilter);
ebDefence = env->addEditBox(L"", rect<s32>(260, 49, 340, 69), true, wFilter);
ebDefence->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(L"限制:", rect<s32>(210, 51, 280, 71), false, false, wFilter);
cbLimit = env->addComboBox(rect<s32>(260, 49, 340, 69), wFilter, -1);
cbLimit->addItem(L"(无)");
cbLimit->addItem(L"禁止");
cbLimit->addItem(L"限制");
cbLimit->addItem(L"准限制");
env->addStaticText(L"星数:", rect<s32>(210, 74, 280, 94), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(260, 72, 340, 92), true, wFilter);
env->addStaticText(L"星数:", rect<s32>(10, 74, 80, 94), false, false, wFilter);
ebStar = env->addEditBox(L"", rect<s32>(60, 72, 140, 92), true, wFilter);
ebStar->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
env->addStaticText(L"密码:", rect<s32>(10, 97, 70, 117), false, false, wFilter);
ebCardCode = env->addEditBox(L"", rect<s32>(60, 95, 150, 115), true, wFilter);
ebCardCode->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnCodeDir = env->addButton(rect<s32>(155, 95, 190, 115), wFilter, BUTTON_GETCODE, L"<--");
btnEffectFilter = env->addButton(rect<s32>(345, 49, 390, 92), wFilter, BUTTON_EFFECT_FILTER, L"效果");
btnStartFilter = env->addButton(rect<s32>(210, 96, 260, 118), wFilter, BUTTON_START_FILTER, L"搜索");
btnResultFilter = env->addButton(rect<s32>(290, 96, 390, 118), wFilter, BUTTON_RESULT_FILTER, L"结果中搜索");
wCategories = env->addWindow(rect<s32>(630, 80, 1000, 290), false, dataManager.strBuffer);
env->addStaticText(L"关键字:", rect<s32>(205, 74, 280, 94), false, false, wFilter);
ebCardName = env->addEditBox(L"", rect<s32>(260, 72, 390, 92), true, wFilter);
ebCardName->setTextAlignment(irr::gui::EGUIA_CENTER, irr::gui::EGUIA_CENTER);
btnEffectFilter = env->addButton(rect<s32>(345, 28, 390, 69), wFilter, BUTTON_EFFECT_FILTER, L"效果");
btnStartFilter = env->addButton(rect<s32>(205, 96, 290, 118), wFilter, BUTTON_START_FILTER, L"重新搜索");
btnResultFilter = env->addButton(rect<s32>(305, 96, 390, 118), wFilter, BUTTON_RESULT_FILTER, L"搜索结果");
wCategories = env->addWindow(rect<s32>(630, 60, 1000, 270), false, dataManager.strBuffer);
wCategories->getCloseButton()->setVisible(false);
wCategories->setDrawTitlebar(false);
wCategories->setDraggable(false);
......
......@@ -11,7 +11,6 @@
#include "network.h"
#include "deck_manager.h"
#include "replay.h"
#include "g_ime.h"
#include <string>
#include "../ocgcore/mtrandom.h"
#include <unordered_map>
......@@ -125,7 +124,7 @@ public:
DeckManager deckManager;
Materials matManager;
Replay lastReplay;
G_IME ime;
std::vector<int> logParam;
unsigned short linePattern;
int waitFrame;
......@@ -163,7 +162,6 @@ public:
DeckBuilder deckBuilder;
irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver;
irr::video::SExposedVideoData vdata;
irr::scene::ISceneManager* smgr;
irr::scene::ICameraSceneNode* camera;
//GUI
......@@ -264,6 +262,7 @@ public:
//announce card
irr::gui::IGUIWindow* wANCard;
irr::gui::IGUIEditBox* ebANCard;
irr::gui::IGUIListBox* lstANCard;
irr::gui::IGUIButton* btnANCardOK;
//announce attribute
irr::gui::IGUIWindow* wANAttribute;
......@@ -303,15 +302,13 @@ public:
irr::gui::IGUIScrollBar* scrFilter;
irr::gui::IGUIComboBox* cbCardType;
irr::gui::IGUIComboBox* cbCardType2;
irr::gui::IGUIComboBox* cbCardClass;
irr::gui::IGUIComboBox* cbRace;
irr::gui::IGUIComboBox* cbAttribute;
irr::gui::IGUIComboBox* cbLimit;
irr::gui::IGUIEditBox* ebStar;
irr::gui::IGUIEditBox* ebAttack;
irr::gui::IGUIEditBox* ebDefence;
irr::gui::IGUIEditBox* ebCardCode;
irr::gui::IGUIButton* btnCodeDir;
irr::gui::IGUIEditBox* ebCardName;
irr::gui::IGUIButton* btnEffectFilter;
irr::gui::IGUIButton* btnStartFilter;
irr::gui::IGUIButton* btnResultFilter;
......@@ -386,8 +383,10 @@ extern Game* mainGame;
#define BUTTON_CMD_SHOWLIST 167
#define BUTTON_ANNUMBER_OK 170
#define BUTTON_ANCARD_OK 171
#define CHECK_ATTRIBUTE 172
#define CHECK_RACE 173
#define EDITBOX_ANCARD 172
#define LISTBOX_ANCARD 173
#define CHECK_ATTRIBUTE 174
#define CHECK_RACE 175
#define BUTTON_BP 180
#define BUTTON_M2 181
#define BUTTON_EP 182
......@@ -404,7 +403,6 @@ extern Game* mainGame;
#define BUTTON_START_FILTER 212
#define BUTTON_RESULT_FILTER 213
#define SCROLL_FILTER 214
#define BUTTON_GETCODE 215
#define BUTTON_REPLAY_START 220
#define BUTTON_REPLAY_PAUSE 221
#define BUTTON_REPLAY_STEP 222
......
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="gframe" InternalType="Console">
<Plugins>
<Plugin Name="qmake">
<![CDATA[00020001N0005Debug0000000000000001N0007Release000000000000]]>
</Plugin>
</Plugins>
<Description/>
<Dependencies/>
<VirtualDirectory Name="src">
<File Name="gframe.cpp"/>
<File Name="config.h"/>
<File Name="data_manager.h"/>
<File Name="image_manager.h"/>
<File Name="game.h"/>
<File Name="game.cpp"/>
<File Name="data_manager.cpp"/>
<File Name="image_manager.cpp"/>
<File Name="CGUITTFont.cpp"/>
<File Name="CGUITTFont.h"/>
<File Name="event_handler.cpp"/>
<File Name="irrUString.h"/>
<File Name="CGUIImageButton.h"/>
<File Name="CGUIImageButton.cpp"/>
<File Name="CGUIButton.h"/>
<File Name="drawing.cpp"/>
<File Name="materials.h"/>
<File Name="client_card.h"/>
<File Name="network.h"/>
<File Name="network.cpp"/>
<File Name="deck_manager.h"/>
<File Name="deck_manager.cpp"/>
<File Name="message.cpp"/>
<VirtualDirectory Name="ocgcore">
<File Name="../ocgcore/card.cpp"/>
<File Name="../ocgcore/card.h"/>
<File Name="../ocgcore/common.h"/>
<File Name="../ocgcore/duel.cpp"/>
<File Name="../ocgcore/duel.h"/>
<File Name="../ocgcore/effect.cpp"/>
<File Name="../ocgcore/effect.h"/>
<File Name="../ocgcore/effectset.h"/>
<File Name="../ocgcore/field.cpp"/>
<File Name="../ocgcore/field.h"/>
<File Name="../ocgcore/group.cpp"/>
<File Name="../ocgcore/group.h"/>
<File Name="../ocgcore/interpreter.cpp"/>
<File Name="../ocgcore/interpreter.h"/>
<File Name="../ocgcore/libcard.cpp"/>
<File Name="../ocgcore/libduel.cpp"/>
<File Name="../ocgcore/libeffect.cpp"/>
<File Name="../ocgcore/libgroup.cpp"/>
<File Name="../ocgcore/mem.cpp"/>
<File Name="../ocgcore/mtrandom.h"/>
<File Name="../ocgcore/ocgapi.cpp"/>
<File Name="../ocgcore/ocgapi.h"/>
<File Name="../ocgcore/operations.cpp"/>
<File Name="../ocgcore/playerop.cpp"/>
<File Name="../ocgcore/processor.cpp"/>
<File Name="../ocgcore/scriptlib.cpp"/>
<File Name="../ocgcore/scriptlib.h"/>
</VirtualDirectory>
<File Name="client_field.h"/>
<File Name="client_card.cpp"/>
<File Name="client_field.cpp"/>
<File Name="deck_con.h"/>
<File Name="deck_con.cpp"/>
<File Name="replay.cpp"/>
<File Name="mymutex.h"/>
<File Name="mysignal.h"/>
<File Name="mythread.h"/>
<File Name="mytimer.h"/>
<File Name="replay.h"/>
<VirtualDirectory Name="lzma">
<File Name="lzma/Alloc.c"/>
<File Name="lzma/Alloc.h"/>
<File Name="lzma/LzFind.c"/>
<File Name="lzma/LzFind.h"/>
<File Name="lzma/LzHash.h"/>
<File Name="lzma/LzmaDec.c"/>
<File Name="lzma/LzmaDec.h"/>
<File Name="lzma/LzmaEnc.c"/>
<File Name="lzma/LzmaEnc.h"/>
<File Name="lzma/LzmaLib.c"/>
<File Name="lzma/LzmaLib.h"/>
<File Name="lzma/Types.h"/>
</VirtualDirectory>
<File Name="CIrrDeviceWin32.cpp"/>
<File Name="CIrrDeviceWin32.h"/>
<File Name="CIrrDeviceStub.h"/>
<File Name="IImagePresenter.h"/>
<File Name="CVideoModeList.h"/>
<File Name="COSOperator.h"/>
<File Name="CTimer.h"/>
<File Name="os.h"/>
</VirtualDirectory>
<Settings Type="Executable">
<GlobalSettings>
<Compiler Options="" C_Options="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g -pg -std=gnu++0x" C_Options="-g" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="../res.o -Wall -pg" Required="yes">
<Library Value="lua"/>
<Library Value="Irrlicht"/>
<Library Value="freetype"/>
<Library Value="sqlite3"/>
<Library Value="glu32"/>
<Library Value="opengl32"/>
<Library Value="winmm"/>
<Library Value="gdi32"/>
<Library Value="Ws2_32"/>
<Library Value="imm32"/>
</Linker>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="../$(ProjectName)_d.exe" IntermediateDirectory="../Debug" Command="./$(ProjectName)_d.exe" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="../" PauseExecWhenProcTerminates="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="gnu g++" DebuggerType="GNU gdb debugger" Type="Executable" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-std=gnu++0x" C_Options="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" UseDifferentPCHFlags="no" PCHFlags="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="../res.o -O2 -Wall -s -mwindows" Required="yes">
<Library Value="lua"/>
<Library Value="Irrlicht"/>
<Library Value="freetype"/>
<Library Value="sqlite3"/>
<Library Value="glu32"/>
<Library Value="opengl32"/>
<Library Value="winmm"/>
<Library Value="gdi32"/>
<Library Value="Ws2_32"/>
<Library Value="imm32"/>
</Linker>
<ResourceCompiler Options="" Required="yes"/>
<General OutputFile="../$(ProjectName).exe" IntermediateDirectory="../Release" Command="./$(ProjectName).exe" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="../" PauseExecWhenProcTerminates="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="">
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="no">
<RebuildCommand/>
<CleanCommand/>
<BuildCommand/>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory/>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>
../Release/gframe.o ../Release/game.o ../Release/data_manager.o ../Release/image_manager.o ../Release/CGUITTFont.o ../Release/event_handler.o ../Release/CGUIImageButton.o ../Release/drawing.o ../Release/network.o ../Release/deck_manager.o ../Release/message.o ../Release/ocgcore_card.o ../Release/ocgcore_duel.o ../Release/ocgcore_effect.o ../Release/ocgcore_field.o ../Release/ocgcore_group.o ../Release/ocgcore_interpreter.o ../Release/ocgcore_libcard.o ../Release/ocgcore_libduel.o ../Release/ocgcore_libeffect.o ../Release/ocgcore_libgroup.o ../Release/ocgcore_mem.o ../Release/ocgcore_ocgapi.o ../Release/ocgcore_operations.o ../Release/ocgcore_playerop.o ../Release/ocgcore_processor.o ../Release/ocgcore_scriptlib.o ../Release/client_card.o ../Release/client_field.o ../Release/deck_con.o ../Release/replay.o ../Release/lzma_Alloc.o ../Release/lzma_LzFind.o ../Release/lzma_LzmaDec.o ../Release/lzma_LzmaEnc.o ../Release/lzma_LzmaLib.o ../Release/CIrrDeviceWin32.o
......@@ -1182,7 +1182,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
case HINT_CODE: {
myswprintf(textBuffer, L"对方宣言了:[%ls]", mainGame->dataManager.GetName(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->logParam.push_back(data);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1197,6 +1197,13 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
mainGame->WaitFrameSignal(40);
break;
}
case HINT_CARD: {
mainGame->showcardcode = data;
mainGame->showcarddif = 0;
mainGame->showcard = 1;
mainGame->WaitFrameSignal(30);
break;
}
}
break;
}
......
......@@ -3,7 +3,7 @@
namespace ygo {
const unsigned short PROTO_VERSION = 0x1011;
const unsigned short PROTO_VERSION = 0x1012;
bool NetManager::CreateHost() {
wchar_t* pstr;
......
// Copyright (C) 2002-2010 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __IRR_OS_H_INCLUDED__
#define __IRR_OS_H_INCLUDED__
#include "IrrCompileConfig.h" // for endian check
#include "irrTypes.h"
#include "irrString.h"
#include "path.h"
#include "ILogger.h"
namespace irr
{
namespace os
{
class Byteswap
{
public:
static u16 byteswap(u16 num);
static s16 byteswap(s16 num);
static u32 byteswap(u32 num);
static s32 byteswap(s32 num);
static f32 byteswap(f32 num);
// prevent accidental swapping of chars
static u8 byteswap(u8 num);
static c8 byteswap(c8 num);
};
class Printer
{
public:
// prints out a string to the console out stdout or debug log or whatever
static void print(const c8* message);
static void log(const c8* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const wchar_t* message, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, const c8* hint, ELOG_LEVEL ll = ELL_INFORMATION);
static void log(const c8* message, const io::path& hint, ELOG_LEVEL ll = ELL_INFORMATION);
static ILogger* Logger;
};
class Randomizer
{
public:
//! resets the randomizer
static void reset();
//! generates a pseudo random number
static s32 rand();
private:
static s32 seed;
};
class Timer
{
public:
//! returns the current time in milliseconds
static u32 getTime();
//! initializes the real timer
static void initTimer();
//! sets the current virtual (game) time
static void setTime(u32 time);
//! stops the virtual (game) timer
static void stopTimer();
//! starts the game timer
static void startTimer();
//! sets the speed of the virtual timer
static void setSpeed(f32 speed);
//! gets the speed of the virtual timer
static f32 getSpeed();
//! returns if the timer currently is stopped
static bool isStopped();
//! makes the virtual timer update the time value based on the real time
static void tick();
//! returns the current real time in milliseconds
static u32 getRealTime();
private:
static void initVirtualTimer();
static f32 VirtualTimerSpeed;
static s32 VirtualTimerStopCounter;
static u32 StartRealTime;
static u32 LastVirtualTime;
static u32 StaticTime;
};
} // end namespace os
} // end namespace irr
#endif
......@@ -3240,8 +3240,15 @@ int32 field::toss_coin(uint16 step, uint8 playerid, uint8 count) {
}
}
if(!peffect) {
for(uint8 i = 0; i < count; ++i)
pduel->write_buffer8(MSG_TOSS_COIN);
pduel->write_buffer8(playerid);
pduel->write_buffer8(count);
for(int32 i = 0; i < count; ++i) {
core.coin_result[i] = pduel->get_next_integer(0, 1);
pduel->write_buffer8(core.coin_result[i]);
}
raise_event((card*)0, EVENT_TOSS_COIN, core.reason_effect, 0, core.reason_player, playerid, count);
process_instant_event();
return FALSE;
} else {
core.sub_solving_event.push_back(e);
......@@ -3250,8 +3257,6 @@ int32 field::toss_coin(uint16 step, uint8 playerid, uint8 count) {
}
}
case 1: {
raise_event((card*)0, EVENT_TOSS_COIN, core.reason_effect, 0, core.reason_player, playerid, count);
process_instant_event();
return TRUE;
}
}
......@@ -3278,8 +3283,15 @@ int32 field::toss_dice(uint16 step, uint8 playerid, uint8 count) {
}
}
if(!peffect) {
for(uint8 i = 0; i < count; ++i)
pduel->write_buffer8(MSG_TOSS_DICE);
pduel->write_buffer8(playerid);
pduel->write_buffer8(count);
for(int32 i = 0; i < count; ++i) {
core.dice_result[i] = pduel->get_next_integer(1, 6);
pduel->write_buffer8(core.dice_result[i]);
}
raise_event((card*)0, EVENT_TOSS_DICE, core.reason_effect, 0, core.reason_player, playerid, count);
process_instant_event();
return FALSE;
} else {
core.sub_solving_event.push_back(e);
......@@ -3288,9 +3300,7 @@ int32 field::toss_dice(uint16 step, uint8 playerid, uint8 count) {
}
}
case 1: {
raise_event((card*)0, EVENT_TOSS_DICE, core.reason_effect, 0, core.reason_player, playerid, count);
process_instant_event();
return FALSE;
return TRUE;
}
}
return TRUE;
......
......@@ -531,13 +531,8 @@ int32 field::process() {
}
case PROCESSOR_TOSS_DICE: {
if (toss_dice(it->step, it->arg1, it->arg2)) {
pduel->write_buffer8(MSG_TOSS_DICE);
pduel->write_buffer8(it->arg1);
pduel->write_buffer8(it->arg2);
for(int32 i = 0; i < it->arg2; ++i) {
for(int32 i = 0; i < it->arg2; ++i)
pduel->lua->add_param(core.dice_result[i], PARAM_TYPE_INT);
pduel->write_buffer8(core.dice_result[i]);
}
core.units.pop_front();
} else
core.units.begin()->step++;
......@@ -545,13 +540,8 @@ int32 field::process() {
}
case PROCESSOR_TOSS_COIN: {
if (toss_coin(it->step, it->arg1, it->arg2)) {
pduel->write_buffer8(MSG_TOSS_COIN);
pduel->write_buffer8(it->arg1);
pduel->write_buffer8(it->arg2);
for(int32 i = 0; i < it->arg2; ++i) {
for(int32 i = 0; i < it->arg2; ++i)
pduel->lua->add_param(core.coin_result[i], PARAM_TYPE_INT);
pduel->write_buffer8(core.coin_result[i]);
}
core.units.pop_front();
} else
core.units.begin()->step++;
......
--神竜 アポカリプス
function c20277376.initial_effect(c)
--salvage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(20277376,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c20277376.thcost)
e1:SetTarget(c20277376.thtg)
e1:SetOperation(c20277376.thop)
c:RegisterEffect(e1)
end
function c20277376.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c20277376.filter(c)
return c:IsRace(RACE_DRAGON) and c:IsAbleToHand()
end
function c20277376.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetLocation()==LOCATION_GRAVE and chkc:GetControler()==tp and c20277376.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c20277376.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c20277376.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c20277376.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--王宮の牢獄
function c26586849.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--spsummon limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(c26586849.sumlimit)
c:RegisterEffect(e1)
end
function c26586849.sumlimit(e,c,sump,sumtype,sumpos,targetp)
return c:IsLocation(LOCATION_GRAVE)
end
--セカンド·チャンス
function c36562627.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--coin
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_TOSS_COIN)
e2:SetCondition(c36562627.coincon)
e2:SetOperation(c36562627.coinop)
c:RegisterEffect(e2)
end
function c36562627.coincon(e,tp,eg,ep,ev,re,r,rp)
return rp==tp and Duel.GetFlagEffect(tp,36562627)==0
end
function c36562627.coinop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,36562627)~=0 then return end
if Duel.SelectYesNo(tp,aux.Stringid(36562627,0)) then
Duel.Hint(HINT_CARD,tp,36562627)
Duel.Hint(HINT_CARD,1-tp,36562627)
Duel.RegisterFlagEffect(tp,36562627,RESET_PHASE+PHASE_END,0,1)
Duel.TossCoin(tp,ev)
end
end
......@@ -46,7 +46,7 @@ function c36733451.operation(e,tp,eg,ep,ev,re,r,rp)
end
function c36733451.thcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_DESTROY)>0
and bit.band(e:GetHandler():GetPreviousLocation(),LOCATION_ONFIELD)>0
and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
and e:GetHandler():GetPreviousControler()==tp
end
function c36733451.filter(c)
......@@ -63,5 +63,6 @@ function c36733451.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--カップ·オブ·エース
function c37812118.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_COIN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c37812118.target)
e1:SetOperation(c37812118.activate)
c:RegisterEffect(e1)
end
function c37812118.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsPlayerCanDraw(1-tp,2) end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1)
end
function c37812118.activate(e,tp,eg,ep,ev,re,r,rp)
local res=Duel.TossCoin(tp,1)
if res==1 then Duel.Draw(tp,2,REASON_EFFECT)
else Duel.Draw(1-tp,2,REASON_EFFECT) end
end
--折断的竹光
function c41587307.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c41587307.target)
e1:SetOperation(c41587307.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetValue(1)
c:RegisterEffect(e2)
end
function c41587307.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c41587307.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
--運命の分かれ道
function c50470982.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW+CATEGORY_COIN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE)
e1:SetTarget(c50470982.target)
e1:SetOperation(c50470982.activate)
c:RegisterEffect(e1)
end
function c50470982.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,PLAYER_ALL,1)
end
function c50470982.activate(e,tp,eg,ep,ev,re,r,rp)
local res=Duel.TossCoin(tp,1)
if res==1 then Duel.Recover(tp,2000,REASON_EFFECT)
else Duel.Damage(tp,2000,REASON_EFFECT) end
res=Duel.TossCoin(1-tp,1)
if res==1 then Duel.Recover(1-tp,2000,REASON_EFFECT)
else Duel.Damage(1-tp,2000,REASON_EFFECT) end
end
--魂を吸う竹光
function c51670553.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c51670553.target)
e1:SetOperation(c51670553.operation)
c:RegisterEffect(e1)
--skip draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(51670553,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DAMAGE)
e2:SetCondition(c51670553.skipcon)
e2:SetOperation(c51670553.skipop)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_SZONE)
e3:SetOperation(c51670553.desop)
c:RegisterEffect(e3)
end
function c51670553.filter(c)
return c:GetEquipCount()~=0 and c:GetEquipGroup():IsExists(Card.IsSetCard,1,nil,0x60)
end
function c51670553.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return c:IsLocation(LOCATION_MZONE) and c51670553.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c51670553.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
e:GetHandler():SetTurnCounter(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c51670553.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c51670553.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
c:SetCardTarget(tc)
end
end
function c51670553.skipcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and ep~=tp and r==REASON_BATTLE and (Duel.GetAttacker()==tc or Duel.GetAttackTarget()==tc)
end
function c51670553.skipop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetCode(EFFECT_SKIP_DP)
e1:SetCondition(c51670553.skipdp)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_DRAW+RESET_OPPO_TURN)
e:GetHandler():RegisterEffect(e1)
end
function c51670553.skipdp(e)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and c51670553.filter(tc)
end
function c51670553.desop(e,tp,eg,ep,ev,re,r,rp)
if tp~=Duel.GetTurnPlayer() then return end
local c=e:GetHandler()
local ct=c:GetTurnCounter()
ct=ct+1
c:SetTurnCounter(ct)
if ct==2 then
Duel.Destroy(c,REASON_RULE)
end
end
--No.96 ブラック·ミスト
function c55727845.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,2),3)
c:EnableReviveLimit()
--atk u/d
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(55727845,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCost(c55727845.atkcost)
e1:SetTarget(c55727845.atktg1)
e1:SetOperation(c55727845.atkop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(55727845,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetCost(c55727845.atkcost)
e2:SetTarget(c55727845.atktg2)
e2:SetOperation(c55727845.atkop)
c:RegisterEffect(e2)
end
function c55727845.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c55727845.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttackTarget()
if chk==0 then return at and at:IsFaceup() end
at:CreateEffectRelation(e)
e:SetLabelObject(at)
end
function c55727845.atktg2(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttacker()
if chk==0 then return true end
at:CreateEffectRelation(e)
e:SetLabelObject(at)
end
function c55727845.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local atk=tc:GetAttack()/2
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(atk)
e2:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e2)
end
end
--闇魔界の戦士長 ダークソード
function c57784563.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(57784563,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c57784563.eqcon)
e1:SetCost(c57784563.eqcost)
e1:SetTarget(c57784563.eqtg)
e1:SetOperation(c57784563.eqop)
c:RegisterEffect(e1)
end
function c57784563.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=e:GetLabelObject()
return ec==nil or ec:GetFlagEffect(57784563)==0
end
function c57784563.cfilter(c)
return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost()
end
function c57784563.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c57784563.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c57784563.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
end
function c57784563.filter(c)
return c:IsFaceup() and c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToChangeControler()
end
function c57784563.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c57784563.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c57784563.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c57784563.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0)
end
function c57784563.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled()
end
function c57784563.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
if c:IsFaceup() and c:IsRelateToEffect(e) then
if not Duel.Equip(tp,tc,c,false) then return end
--Add Equip limit
tc:RegisterFlagEffect(57784563,RESET_EVENT+0x1fe0000,0,0)
e:SetLabelObject(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c57784563.eqlimit)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_DESTROY_SUBSTITUTE)
e2:SetReset(RESET_EVENT+0x1fe0000)
e2:SetValue(1)
tc:RegisterEffect(e2)
else Duel.SendtoGrave(tc,REASON_EFFECT) end
end
end
--大逆転クイズ
function c5990062.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c5990062.cost)
e1:SetOperation(c5990062.activate)
c:RegisterEffect(e1)
end
function c5990062.cfilter(c)
return not c:IsAbleToGraveAsCost()
end
function c5990062.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD+LOCATION_HAND,0)
g:RemoveCard(e:GetHandler())
if chk==0 then return g:GetCount()>0 and not g:IsExists(c5990062.cfilter,1,nil) end
Duel.SendtoGrave(g,REASON_EFFECT)
end
function c5990062.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetDecktopGroup(tp,1)
local tc=g:GetFirst()
if not tc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local res=Duel.SelectOption(tp,70,71,72)
Duel.ConfirmDecktop(tp,1)
if (res==0 and tc:IsType(TYPE_MONSTER))
or (res==1 and tc:IsType(TYPE_SPELL))
or (res==2 and tc:IsType(TYPE_TRAP)) then
local lp1=Duel.GetLP(tp)
local lp2=Duel.GetLP(1-tp)
Duel.SetLP(tp,lp2)
Duel.SetLP(1-tp,lp1)
end
Duel.ShuffleDeck(tp)
end
--大革命
function c65396880.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c65396880.condition)
e1:SetTarget(c65396880.target)
e1:SetOperation(c65396880.activate)
c:RegisterEffect(e1)
end
function c65396880.cfilter(c,code)
return c:IsFaceup() and c:IsCode(code)
end
function c65396880.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.GetTurnPlayer()==tp and (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
and Duel.IsExistingMatchingCard(c65396880.cfilter,tp,LOCATION_MZONE,0,1,nil,58538870)
and Duel.IsExistingMatchingCard(c65396880.cfilter,tp,LOCATION_MZONE,0,1,nil,12143771)
and Duel.IsExistingMatchingCard(c65396880.cfilter,tp,LOCATION_MZONE,0,1,nil,85936485)
end
function c65396880.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil)
or Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)~=0 end
local g1=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
local g2=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g2,g2:GetCount(),0,0)
end
function c65396880.activate(e,tp,eg,ep,ev,re,r,rp)
local g1=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
Duel.Destroy(g1,REASON_EFFECT)
local g2=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
Duel.SendtoGrave(g2,REASON_EFFECT)
end
......@@ -31,5 +31,6 @@ function c66337215.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--黄金色の竹光
function c74029853.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c74029853.condition)
e1:SetTarget(c74029853.target)
e1:SetOperation(c74029853.activate)
c:RegisterEffect(e1)
end
function c74029853.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x60) and c:IsType(TYPE_EQUIP)
end
function c74029853.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c74029853.cfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c74029853.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
end
function c74029853.activate(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
......@@ -4,7 +4,6 @@ function c78004197.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(78004197,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c78004197.spcon)
......@@ -13,21 +12,27 @@ function c78004197.initial_effect(c)
c:RegisterEffect(e1)
end
function c78004197.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousLocation()==LOCATION_HAND and bit.band(r,0x4040)==0x4040
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,0x4040)==0x4040
end
function c78004197.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
function c78004197.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsDestructable() end
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
if rp~=tp and Duel.IsExistingTarget(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(78004197,1)) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,2,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
e:SetLabel(1)
else e:SetLabel(0) end
else
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
e:SetProperty(0)
e:SetLabel(0)
end
end
function c78004197.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) and Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)>0 and e:GetLabel()==1 then
Duel.BreakEffect()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(sg,REASON_EFFECT)
......
......@@ -12,7 +12,7 @@ function c79979666.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(79979666,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(c79979666.condition)
......
--トランス·デーモン
function c94283662.initial_effect(c)
--atk up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(94283662,0))
e1:SetCategory(CATEGORY_HANDES+CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c94283662.target)
e1:SetOperation(c94283662.operation)
c:RegisterEffect(e1)
--salvage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(94283662,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c94283662.thcon)
e2:SetTarget(c94283662.thtg)
e2:SetOperation(c94283662.thop)
c:RegisterEffect(e2)
end
function c94283662.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 end
Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1)
end
function c94283662.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=Duel.DiscardHand(tp,Card.IsRace,1,1,REASON_EFFECT+REASON_DISCARD,nil,RACE_FIEND)
if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
e1:SetValue(500)
c:RegisterEffect(e1)
end
end
function c94283662.thcon(e,tp,eg,ep,ev,re,r,rp)
return bit.band(r,REASON_DESTROY)>0
and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
and e:GetHandler():GetPreviousControler()==tp
end
function c94283662.filter(c)
return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToHand()
end
function c94283662.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and c94283662.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c94283662.filter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c94283662.filter,tp,LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
end
function c94283662.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--予言僧 チョウレン
function c95905259.initial_effect(c)
--confirm
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(95905259,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c95905259.target)
e1:SetOperation(c95905259.operation)
c:RegisterEffect(e1)
end
function c95905259.filter(c)
return c:GetSequence()~=5 and c:IsFacedown()
end
function c95905259.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(SZONE) and c95905259.filter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(95905259,1))
Duel.SelectTarget(tp,c95905259.filter,tp,0,LOCATION_SZONE,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local res=Duel.SelectOption(tp,71,72)
e:SetLabel(res)
end
function c95905259.operation(e,tp,eg,ep,ev,re,r,rp)
local res=e:GetLabel()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFacedown() then
Duel.ConfirmCards(tp,tc)
if (res==0 and tc:IsType(TYPE_SPELL)) or (res==1 and tc:IsType(TYPE_TRAP)) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_TRIGGER)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
end
......@@ -501,6 +501,7 @@ HINT_RACE =6
HINT_ATTRIB =7
HINT_CODE =8
HINT_NUMBER =9
HINT_CARD =10
--Hint Message
HINTMSG_RELEASE =500
HINTMSG_DISCARD =501
......@@ -537,6 +538,7 @@ HINTMSG_EFFECT =550
HINTMSG_TARGET =551
HINTMSG_COIN =552
HINTMSG_DICE =553
HINTMSG_CARDTYPE =554
--Timing
TIMING_DRAW_PHASE =0x1
TIMING_STANDBY_PHASE =0x2
......
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