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

new features & scripts

parent 7482ae69
......@@ -579,37 +579,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
}
if(!is_draging && pre_code != hovered_code) {
if(hovered_code) {
CardData cd;
wchar_t formatBuffer[64];
mainGame->dataManager.GetData(hovered_code, &cd);
mainGame->imgCard->setImage(mainGame->imageManager.GetTexture(hovered_code));
myswprintf(formatBuffer, L"%ls[%d]", mainGame->dataManager.GetName(hovered_code), hovered_code);
mainGame->stName->setText(formatBuffer);
if(cd.type & TYPE_MONSTER) {
myswprintf(formatBuffer, L"[%ls] %ls/%ls", DataManager::FormatType(cd.type), DataManager::FormatRace(cd.race), DataManager::FormatAttribute(cd.attribute));
mainGame->stInfo->setText(formatBuffer);
formatBuffer[0] = L'[';
for(int i = 1; i <= cd.level; ++i)
formatBuffer[i] = L'★';
formatBuffer[cd.level + 1] = L']';
formatBuffer[cd.level + 2] = L' ';
if(cd.attack < 0 && cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/?");
else if(cd.attack < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/%d", cd.defence);
else if(cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"%d/?", cd.attack);
else
myswprintf(&formatBuffer[cd.level + 3], L"%d/%d", cd.attack, cd.defence);
mainGame->stDataInfo->setText(formatBuffer);
mainGame->stText->setRelativePosition(irr::core::position2di(15, 83));
} else {
myswprintf(formatBuffer, L"[%ls]", DataManager::FormatType(cd.type));
mainGame->stInfo->setText(formatBuffer);
mainGame->stDataInfo->setText(L"");
mainGame->stText->setRelativePosition(irr::core::position2di(15, 60));
}
mainGame->SetStaticText(mainGame->stText, 270, mainGame->textFont, (wchar_t*)mainGame->dataManager.GetText(hovered_code));
mainGame->ShowCardInfo(hovered_code);
}
if(pre_code)
mainGame->imageManager.RemoveTexture(pre_code);
......
......@@ -17,6 +17,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
switch(id) {
case BUTTON_CLEAR_LOG: {
mainGame->lstLog->clear();
mainGame->logParam.clear();
break;
}
case BUTTON_MODE_EXIT: {
......@@ -759,6 +760,25 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
mainGame->ebJoinPort->setText(formatBuffer);
break;
}
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->ShowCardInfo(mainGame->logParam[sel]);
}
break;
}
}
break;
}
case irr::gui::EGET_LISTBOX_SELECTED_AGAIN: {
switch(id) {
case LISTBOX_LOG: {
int sel = mainGame->lstLog->getSelected();
if(sel != -1 && mainGame->logParam.size() >= sel && mainGame->logParam[sel]) {
mainGame->wInfos->setActiveTab(0);
}
break;
}
}
break;
}
......@@ -1285,36 +1305,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
for(auto cit = mcard->ownerTarget.begin(); cit != mcard->ownerTarget.end(); ++cit)
(*cit)->is_showtarget = true;
if(mcard->code) {
CardData cd;
mainGame->dataManager.GetData(mcard->code, &cd);
mainGame->imgCard->setImage(mainGame->imageManager.GetTexture(mcard->code));
myswprintf(formatBuffer, L"%ls[%d]", mainGame->dataManager.GetName(mcard->code), mcard->code);
mainGame->stName->setText(formatBuffer);
if(cd.type & TYPE_MONSTER) {
myswprintf(formatBuffer, L"[%ls] %ls/%ls", DataManager::FormatType(cd.type), DataManager::FormatRace(cd.race), DataManager::FormatAttribute(cd.attribute));
mainGame->stInfo->setText(formatBuffer);
formatBuffer[0] = L'[';
for(int i = 1; i <= cd.level; ++i)
formatBuffer[i] = L'★';
formatBuffer[cd.level + 1] = L']';
formatBuffer[cd.level + 2] = L' ';
if(cd.attack < 0 && cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/?");
else if(cd.attack < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/%d", cd.defence);
else if(cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"%d/?", cd.attack);
else
myswprintf(&formatBuffer[cd.level + 3], L"%d/%d", cd.attack, cd.defence);
mainGame->stDataInfo->setText(formatBuffer);
mainGame->stText->setRelativePosition(irr::core::position2di(15, 83));
} else {
myswprintf(formatBuffer, L"[%ls]", DataManager::FormatType(cd.type));
mainGame->stInfo->setText(formatBuffer);
mainGame->stDataInfo->setText(L"");
mainGame->stText->setRelativePosition(irr::core::position2di(15, 60));
}
mainGame->SetStaticText(mainGame->stText, 270, mainGame->textFont, (wchar_t*)mainGame->dataManager.GetText(mcard->code));
mainGame->ShowCardInfo(mcard->code);
if(mcard->location & 0xe) {
std::wstring str;
if(mcard->type & TYPE_MONSTER) {
......
......@@ -165,7 +165,7 @@ bool Game::Initialize() {
stText = env->addStaticText(L"", rect<s32>(15, 83, 296, 324), false, true, tabInfo, -1, false);
//log
irr::gui::IGUITab* tabLog = wInfos->addTab(L"消息记录");
lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, -1, false);
lstLog = env->addListBox(rect<s32>(10, 10, 290, 290), tabLog, LISTBOX_LOG, false);
lstLog->setItemHeight(18);
btnClearLog = env->addButton(rect<s32>(160, 300, 260, 325), tabLog, BUTTON_CLEAR_LOG, L"清除记录");
btnSaveLog = env->addButton(rect<s32>(40, 300, 140, 325), tabLog, BUTTON_SAVE_LOG, L"保存记录");
......@@ -604,5 +604,38 @@ void Game::LoadConfig() {
void Game::SaveConfig() {
}
void Game::ShowCardInfo(int code) {
CardData cd;
wchar_t formatBuffer[256];
dataManager.GetData(code, &cd);
imgCard->setImage(imageManager.GetTexture(code));
myswprintf(formatBuffer, L"%ls[%d]", dataManager.GetName(code), code);
stName->setText(formatBuffer);
if(cd.type & TYPE_MONSTER) {
myswprintf(formatBuffer, L"[%ls] %ls/%ls", DataManager::FormatType(cd.type), DataManager::FormatRace(cd.race), DataManager::FormatAttribute(cd.attribute));
stInfo->setText(formatBuffer);
formatBuffer[0] = L'[';
for(int i = 1; i <= cd.level; ++i)
formatBuffer[i] = L'★';
formatBuffer[cd.level + 1] = L']';
formatBuffer[cd.level + 2] = L' ';
if(cd.attack < 0 && cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/?");
else if(cd.attack < 0)
myswprintf(&formatBuffer[cd.level + 3], L"?/%d", cd.defence);
else if(cd.defence < 0)
myswprintf(&formatBuffer[cd.level + 3], L"%d/?", cd.attack);
else
myswprintf(&formatBuffer[cd.level + 3], L"%d/%d", cd.attack, cd.defence);
stDataInfo->setText(formatBuffer);
stText->setRelativePosition(irr::core::position2di(15, 83));
} else {
myswprintf(formatBuffer, L"[%ls]", DataManager::FormatType(cd.type));
stInfo->setText(formatBuffer);
stDataInfo->setText(L"");
stText->setRelativePosition(irr::core::position2di(15, 60));
}
SetStaticText(stText, 270, textFont, (wchar_t*)dataManager.GetText(code));
}
}
......@@ -74,7 +74,8 @@ public:
void DrawDeckBd();
void LoadConfig();
void SaveConfig();
void ShowCardInfo(int code);
int LocalPlayer(int player);
const wchar_t* LocalName(int local_player);
bool SendByte(int player, char val);
......@@ -123,7 +124,7 @@ public:
DeckManager deckManager;
Materials matManager;
Replay lastReplay;
std::vector<int> logParam;
unsigned short linePattern;
int waitFrame;
int signalFrame;
......@@ -342,6 +343,7 @@ public:
#define TAB_MODES 50
#define BUTTON_SAVE_LOG 100
#define BUTTON_CLEAR_LOG 101
#define LISTBOX_LOG 102
#define BUTTON_LAN_START_SERVER 110
#define BUTTON_LAN_CANCEL_SERVER 111
#define BUTTON_LAN_CONNECT 112
......
......@@ -338,6 +338,7 @@ int Game::EngineThread(void* pd) {
mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false);
mainGame->lstLog->clear();
mainGame->logParam.clear();
mainGame->imgCard->setImage(0);
mainGame->stName->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -1065,6 +1066,7 @@ int Game::RecvThread(void* pd) {
mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false);
mainGame->lstLog->clear();
mainGame->logParam.clear();
mainGame->imgCard->setImage(0);
mainGame->stName->setText(L"");
mainGame->stDataInfo->setText(L"");
......@@ -1149,6 +1151,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
case HINT_OPSELECTED: {
myswprintf(textBuffer, L"对方选择了:[%ls]", mainGame->dataManager.GetDesc(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1164,6 +1167,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
case HINT_RACE: {
myswprintf(textBuffer, L"对方宣言了:[%ls]", DataManager::FormatRace(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1172,6 +1176,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
case HINT_ATTRIB: {
myswprintf(textBuffer, L"对方宣言了:[%ls]", DataManager::FormatAttribute(data));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1180,6 +1185,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->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1188,6 +1194,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
case HINT_NUMBER: {
myswprintf(textBuffer, L"对方选择了:[%d]", data);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->SetStaticText(mainGame->stACMessage, 310, mainGame->textFont, textBuffer);
mainGame->PopupElement(mainGame->wACMessage, 20);
mainGame->WaitFrameSignal(40);
......@@ -1864,6 +1871,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
ClientCard* pcard;
myswprintf(textBuffer, L"翻开卡组上方%d张卡:", count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
mainGame->dField.selectable_cards.clear();
for (int i = 0; i < count; ++i) {
code = NetManager::ReadInt32(pbuf);
......@@ -1875,6 +1883,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
pcard->SetCode(code);
myswprintf(textBuffer, L"%d [%ls]", i, mainGame->dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code);
float shift = -0.15f;
if (player == 1) shift = 0.15f;
pcard->dPos = irr::core::vector3df(shift, 0, 0);
......@@ -1895,6 +1904,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
ClientCard* pcard;
myswprintf(textBuffer, L"确认%d张卡:", count);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
for (int i = 0; i < count; ++i) {
code = NetManager::ReadInt32(pbuf);
c = mainGame->LocalPlayer(NetManager::ReadInt8(pbuf));
......@@ -1905,6 +1915,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
pcard->SetCode(code);
myswprintf(textBuffer, L"%d [%ls]", i, mainGame->dataManager.GetName(code));
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(code);
if (l & 0x41) {
float shift = -0.15f;
if ((c == 0 && l == 0x40) || (c == 1 && l == 0x1)) shift = 0.15f;
......@@ -2547,6 +2558,7 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
mainGame->WaitFrameSignal(30);
myswprintf(textBuffer, L"[%ls](%ls,%d)成为对象", mainGame->dataManager.GetName(pcard->code), DataManager::FormatLocation(l), s);
mainGame->lstLog->addItem(textBuffer);
mainGame->logParam.push_back(0);
pcard->is_highlighting = false;
}
return true;
......@@ -3107,6 +3119,7 @@ int Game::ReplayThread(void* pd) {
mainGame->btnM2->setVisible(false);
mainGame->btnEP->setVisible(false);
mainGame->lstLog->clear();
mainGame->logParam.clear();
mainGame->imgCard->setImage(0);
mainGame->stName->setText(L"");
mainGame->stDataInfo->setText(L"");
......
......@@ -5,7 +5,7 @@
#include <set>
#include <vector>
#define PROTO_VERSION 0x100e
#define PROTO_VERSION 0x100f
namespace ygo {
......
......@@ -3460,6 +3460,7 @@ int32 field::add_chain(uint16 step) {
clit->disable_player = PLAYER_NONE;
clit->replace_op = 0;
core.current_chain.push_back(*clit);
peffect->handler->create_relation(peffect);
if(peffect->cost) {
core.sub_solving_event.push_back(clit->evt);
add_process(PROCESSOR_EXECUTE_COST, 0, peffect, 0, clit->triggering_player, 0);
......@@ -3491,7 +3492,6 @@ int32 field::add_chain(uint16 step) {
process_single_event();
}
}
clit->triggering_effect->handler->create_relation(clit->triggering_effect);
if(peffect->type & EFFECT_TYPE_ACTIVATE) {
core.leave_confirmed.insert(peffect->handler);
if(!(peffect->handler->data.type & (TYPE_CONTINUOUS + TYPE_FIELD + TYPE_EQUIP))
......
--カラクリ粉
function c16708652.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c16708652.condition)
e1:SetTarget(c16708652.target)
e1:SetOperation(c16708652.activate)
c:RegisterEffect(e1)
end
function c16708652.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph==PHASE_BATTLE or (ph==PHASE_DAMAGE and not Duel.IsDamageCalculated())
end
function c16708652.filter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsSetCard(0x11)
end
function c16708652.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c16708652.filter,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(16708652,0))
local g1=Duel.SelectTarget(tp,c16708652.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(16708652,1))
local g2=Duel.SelectTarget(tp,c16708652.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,g1:GetFirst())
e:SetLabelObject(g1:GetFirst())
end
function c16708652.activate(e,tp,eg,ep,ev,re,r,rp)
local tc1=e:GetLabelObject()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc2=g:GetFirst()
if tc1==tc2 then tc2=g:GetNext() end
if tc1:IsRelateToEffect(e) and tc1:IsPosition(POS_FACEUP_ATTACK) and tc2:IsRelateToEffect(e) then
Duel.ChangePosition(tc1,POS_FACEUP_DEFENCE)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(tc1:GetAttack())
tc2:RegisterEffect(e1)
end
end
--風雲カラクリ城
function c22751868.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--pos
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(22751868,0))
e2:SetCategory(CATEGIORY_POSITION)
e2:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetCondition(c22751868.poscon)
e2:SetTarget(c22751868.postg)
e2:SetOperation(c22751868.posop)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetDescription(aux.Stringid(22751868,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c22751868.spcon)
e3:SetTarget(c22751868.sptg)
e3:SetOperation(c22751868.spop)
c:RegisterEffect(e3)
end
function c22751868.poscon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
return a:IsControler(tp) and a:IsSetCard(0x11) and d:IsFaceup()
end
function c22751868.postg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.GetAttackTarget():CreateEffectRelation(e)
end
function c22751868.posop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttackTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE,0,POS_FACEUP_ATTACK,0)
end
end
function c22751868.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP)
end
function c22751868.filter(c,e,tp)
return c:IsLevelAbove(4) and c:IsSetCard(0x11) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c22751868.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and c22751868.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c22751868.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c22751868.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c22751868.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -5,7 +5,7 @@ function c23434538.initial_effect(c)
e1:SetDescription(aux.Stringid(23434538,0))
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE+0x1c0)
e1:SetRange(LOCATION_HAND)
e1:SetCost(c23434538.cost)
e1:SetOperation(c23434538.operation)
......
--カラクリ将軍 無零
function c23874409.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_MACHINE),1)
c:EnableReviveLimit()
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(23874409,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c23874409.spcon)
e1:SetTarget(c23874409.sptg)
e1:SetOperation(c23874409.spop)
c:RegisterEffect(e1)
--pos
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(23874409,1))
e2:SetCategory(CATEGORY_POSITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(c23874409.postg)
e2:SetOperation(c23874409.posop)
c:RegisterEffect(e2)
end
function c23874409.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c23874409.spfilter(c,e,tp)
return c:IsSetCard(0x11) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c23874409.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c23874409.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c23874409.spop(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,c23874409.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c23874409.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENCE)
local g=Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c23874409.posop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
end
--カラクリ無双 八壱八
function c24150026.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c24150026.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(24150026,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c24150026.poscon)
e3:SetOperation(c24150026.posop)
c:RegisterEffect(e3)
--to defence
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_PHASE+PHASE_BATTLE)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCondition(c24150026.bpcon)
e4:SetOperation(c24150026.bpop)
c:RegisterEffect(e4)
end
function c24150026.becon(e)
return e:GetHandler():IsAttackable()
end
function c24150026.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c24150026.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c24150026.bpcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetAttackedCount()>0
end
function c24150026.bpop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsAttack() then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
--カラクリ小町 弐弐四
function c24621460.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c24621460.becon)
c:RegisterEffect(e2)
--pos change
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(24621460,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetOperation(c24621460.posop)
c:RegisterEffect(e3)
--extra summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(24621460,1))
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
e4:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0)
e4:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
e4:SetCondition(c24621460.escon)
e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x11))
e4:SetValue(c24621460.esop)
c:RegisterEffect(e4)
end
function c24621460.becon(e)
return e:GetHandler():IsAttackable()
end
function c24621460.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE,0,POS_FACEUP_ATTACK,0)
end
end
function c24621460.escon(e)
return Duel.GetFlagEffect(Duel.GetTurnPlayer(),24621460)==0
end
function c24621460.esop(e,c)
Duel.RegisterFlagEffect(c:GetControler(),24621460,RESET_PHASE+PHASE_END,0,1)
end
......@@ -4,7 +4,7 @@ function c25789292.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP+0x1c0)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c25789292.condition)
......@@ -13,11 +13,10 @@ function c25789292.initial_effect(c)
c:RegisterEffect(e1)
end
function c25789292.condition(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetCurrentPhase()==PHASE_DAMAGE and Duel.IsDamageCalculated() then return false end
return true
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c25789292.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetLocation()==LOCATION_MZONE and chkc:IsFaceup() end
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_FACEUP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
--借カラクリ整備蔵
function c2924048.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c2924048.condition)
e1:SetTarget(c2924048.target)
e1:SetOperation(c2924048.activate)
c:RegisterEffect(e1)
end
function c2924048.cfilter(c)
return c:IsPosition(POS_FACEUP_DEFENCE) and c:IsSetCard(0x11)
end
function c2924048.condition(e,tp,eg,ep,ev,re,r,rp)
if ep==tp or not Duel.IsExistingMatchingCard(c2924048.cfilter,tp,LOCATION_MZONE,0,1,nil) then return false end
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainInactivatable(ev)
end
function c2924048.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
local loc=eg:GetFirst():GetLocation()
if eg:GetFirst():IsDestructable() and loc~=LOCATION_DECK then
eg:GetFirst():CreateEffectRelation(e)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c2924048.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateActivation(ev)
local ec=eg:GetFirst()
local loc=ec:GetLocation()
if ec:IsRelateToEffect(e) and loc~=LOCATION_DECK then
Duel.Destroy(eg,REASON_EFFECT)
end
end
--カラクリ商人 壱七七
function c30230789.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c30230789.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(30230789,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c30230789.poscon)
e3:SetOperation(c30230789.posop)
c:RegisterEffect(e3)
--search
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(30230789,1))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetTarget(c30230789.tg)
e4:SetOperation(c30230789.op)
c:RegisterEffect(e4)
end
function c30230789.becon(e)
return e:GetHandler():IsAttackable()
end
function c30230789.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c30230789.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c30230789.filter(c)
return c:IsSetCard(0x11) and c:IsAbleToHand()
end
function c30230789.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c30230789.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c30230789.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c30230789.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--カラクリ屋敷
function c33184236.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_CHANGE_POS)
e1:SetCondition(c33184236.condition)
e1:SetTarget(c33184236.target)
e1:SetOperation(c33184236.activate)
c:RegisterEffect(e1)
end
function c33184236.cfilter(c,tp)
local np=c:GetPosition()
local pp=c:GetPreviousPosition()
return c:IsControler(tp) and c:IsSetCard(0x11) and ((pp==0x1 and np==0x4) or (pp==0x4 and np==0x1) or (pp==0x8 and np==0x1))
end
function c33184236.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c33184236.cfilter,1,nil,tp)
end
function c33184236.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsDestructable() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c33184236.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--カラクリ兵 弐参六
function c3846170.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c3846170.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(3846170,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c3846170.poscon)
e3:SetOperation(c3846170.posop)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(3846170,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_BATTLE_DESTROYED)
e4:SetCondition(c3846170.spcon)
e4:SetTarget(c3846170.sptg)
e4:SetOperation(c3846170.spop)
c:RegisterEffect(e4)
end
function c3846170.becon(e)
return e:GetHandler():IsAttackable()
end
function c3846170.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c3846170.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c3846170.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
end
function c3846170.filter(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0x11) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c3846170.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c3846170.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c3846170.spop(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,c3846170.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
end
--カラクリ武者 六参壱八
function c39118197.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c39118197.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(39118197,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c39118197.poscon)
e3:SetOperation(c39118197.posop)
c:RegisterEffect(e3)
--atkup
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(39118197,1))
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
e4:SetCategory(CATEGORY_ATKCHANGE)
e4:SetCode(EVENT_DESTROY)
e4:SetCondition(c39118197.atkcon)
e4:SetTarget(c39118197.atktg)
e4:SetOperation(c39118197.atkop)
c:RegisterEffect(e4)
end
function c39118197.becon(e)
return e:GetHandler():IsAttackable()
end
function c39118197.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c39118197.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c39118197.filter(c)
return c:IsFaceup() and c:IsSetCard(0x11) and c:IsLocation(LOCATION_MZONE)
end
function c39118197.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c39118197.filter,1,nil)
end
function c39118197.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
end
function c39118197.atkop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(400)
e:GetHandler():RegisterEffect(e1)
end
--チューンド·マジシャン
function c47459126.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DUAL_SUMMONABLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CHANGE_TYPE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(aux.DualNormalCondition)
e2:SetValue(TYPE_NORMAL+TYPE_DUAL+TYPE_MONSTER)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CHANGE_TYPE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetValue(c47459126.tpval)
c:RegisterEffect(e3)
end
function c47459126.tpval(e,c)
if c:IsFaceup() and not c:IsDualState() then return TYPE_NORMAL+TYPE_DUAL+TYPE_MONSTER
else return TYPE_EFFECT+TYPE_DUAL+TYPE_MONSTER+TYPE_TUNER end
end
--カラクリ忍者 七七四九
function c50615578.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c50615578.becon)
c:RegisterEffect(e2)
--pos change
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(50615578,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetOperation(c50615578.posop)
c:RegisterEffect(e3)
--draw
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(50615578,1))
e4:SetCategory(CATEGORY_DRAW)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetTarget(c50615578.drtg)
e4:SetOperation(c50615578.drop)
c:RegisterEffect(e4)
end
function c50615578.becon(e)
return e:GetHandler():IsAttackable()
end
function c50615578.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE,0,POS_FACEUP_ATTACK,0)
end
end
function c50615578.drfilter(c)
return c:IsPosition(POS_FACEUP_DEFENCE) and c:IsSetCard(0x11)
end
function c50615578.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetMatchingGroupCount(c50615578.drfilter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(ct)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function c50615578.drop(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(c50615578.drfilter,tp,LOCATION_MZONE,0,nil)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.Draw(p,ct,REASON_EFFECT)
end
--黄金の歯車装置箱
function c59156966.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c59156966.condition)
e1:SetTarget(c59156966.target)
e1:SetOperation(c59156966.activate)
c:RegisterEffect(e1)
end
function c59156966.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c59156966.filter(c)
return c:IsFaceup() and c:IsSetCard(0x11)
end
function c59156966.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c59156966.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c59156966.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c59156966.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c59156966.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(500)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_UPDATE_DEFENCE)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e2:SetValue(1500)
tc:RegisterEffect(e2)
end
end
--カラクリ忍者 九壱九
function c6276588.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c6276588.becon)
c:RegisterEffect(e2)
--pos change
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(6276588,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetOperation(c6276588.posop)
c:RegisterEffect(e3)
--special summon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(23297235,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_BATTLE_DESTROYED)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c6276588.spcon)
e4:SetTarget(c6276588.sptg)
e4:SetOperation(c6276588.spop)
c:RegisterEffect(e4)
end
function c6276588.becon(e)
return e:GetHandler():IsAttackable()
end
function c6276588.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE,0,POS_FACEUP_ATTACK,0)
end
end
function c6276588.spcon(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
return eg:GetCount()==1 and tc:GetReasonCard()==e:GetHandler()
and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE)
end
function c6276588.filter(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0x11) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c6276588.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c6276588.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c6276588.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c6276588.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
end
end
--カラクリ参謀 弐四八
function c66625883.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c66625883.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(66625883,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c66625883.poscon)
e3:SetOperation(c66625883.posop)
c:RegisterEffect(e3)
--pos
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(66625883,1))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_SUMMON_SUCCESS)
e4:SetTarget(c66625883.tg)
e4:SetOperation(c66625883.op)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e5)
end
function c66625883.becon(e)
return e:GetHandler():IsAttackable()
end
function c66625883.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c66625883.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c66625883.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSCHANGE,g,1,0,0)
end
function c66625883.op(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
end
--カラクリ大将軍 無零怒
function c66976526.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_MACHINE),1)
c:EnableReviveLimit()
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66976526,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c66976526.spcon)
e1:SetTarget(c66976526.sptg)
e1:SetOperation(c66976526.spop)
c:RegisterEffect(e1)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(66976526,1))
e2:SetCategory(CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_CHANGE_POS)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c66976526.drcon)
e2:SetTarget(c66976526.drtg)
e2:SetOperation(c66976526.drop)
c:RegisterEffect(e2)
end
function c66976526.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c66976526.spfilter(c,e,tp)
return c:IsSetCard(0x11) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c66976526.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c66976526.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c66976526.spop(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,c66976526.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c66976526.cfilter(c,tp)
local np=c:GetPosition()
local pp=c:GetPreviousPosition()
return c:IsSetCard(0x11) and c:IsControler(tp) and ((pp==0x1 and np==0x4) or (pp==0x4 and np==0x1) or (pp==0x8 and np==0x1))
end
function c66976526.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c85541675.cfilter,1,nil,tp)
end
function c66976526.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUs_CHAINING) and Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c66976526.drop(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
--カラクリ守衛 参壱参
function c70271583.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c70271583.becon)
c:RegisterEffect(e2)
--pos change
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(70271583,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetOperation(c70271583.posop)
c:RegisterEffect(e3)
--atkup
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(70271583,1))
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
e4:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE)
e4:SetCode(EVENT_DAMAGE)
e4:SetCondition(c70271583.atkcon)
e4:SetOperation(c70271583.atkop)
c:RegisterEffect(e4)
--indes
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e5:SetCondition(c70271583.indcon)
e5:SetValue(1)
c:RegisterEffect(e5)
end
function c70271583.becon(e)
return e:GetHandler():IsAttackable()
end
function c70271583.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE,0,POS_FACEUP_ATTACK,0)
end
end
function c70271583.atkcon(e,tp,eg,ep,ev,re,r,rp)
return ep==tp and bit.band(r,REASON_BATTLE)~=0 and (e:GetHandler()==Duel.GetAttacker() or e:GetHandler()==Duel.GetAttackTarget())
end
function c70271583.filter(c)
return c:IsFaceup() and c:IsSetCard(0x11)
end
function c70271583.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local g=Duel.GetMatchingGroup(c70271583.filter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(800)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENCE)
tc:RegisterEffect(e2)
tc=g:GetNext()
end
end
function c70271583.indcon(e)
return e:GetHandler():IsPosition(POS_FACEUP_ATTACK)
end
......@@ -44,7 +44,7 @@ function c72345736.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c72345736.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetCounter(0x3003)>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=c:GetCounter(0x3003)end
if chk==0 then return c:GetCounter(0x3003)>0 and Duel.IsPlayerCanDraw(tp,c:GetCounter(0x3003)) end
local ct=e:GetLabel()
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(ct)
......
--時限カラクリ爆弾
function c79178930.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetCondition(c79178930.condition)
e1:SetTarget(c79178930.target)
e1:SetOperation(c79178930.activate)
c:RegisterEffect(e1)
end
function c79178930.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
return tc:IsFaceup() and tc:IsDefence() and tc:IsSetCard(0x11)
end
function c79178930.filter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c79178930.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c79178930.filter,tp,0,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(c79178930.filter,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c79178930.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c79178930.filter,tp,0,LOCATION_MZONE,nil)
if g:GetCount()>0 then
Duel.Destroy(g,REASON_EFFECT)
end
end
--借カラクリ蔵
function c80204957.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_POSITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c80204957.target)
e1:SetOperation(c80204957.activate)
c:RegisterEffect(e1)
end
function c80204957.filter1(c)
return c:IsLevelBelow(4) and c:IsSetCard(0x11) and c:IsAbleToHand()
end
function c80204957.filter2(c)
return c:IsFaceup() and c:IsSetCard(0x11)
end
function c80204957.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return Duel.IsExistingMatchingCard(c80204957.filter1,tp,LOCATION_DECK,0,1,nil)
and Duel.IsExistingTarget(c80204957.filter2,tp,LOCATION_MZONE,0,1,nil) end
local g=Duel.SelectTarget(tp,c80204957.filter2,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c80204957.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c80204957.filter1,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
--カラクリ大暴走
function c83831356.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP+0x1c0)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c83831356.condition)
e1:SetTarget(c83831356.target)
e1:SetOperation(c83831356.activate)
c:RegisterEffect(e1)
end
function c83831356.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c83831356.filter(c)
return c:IsFaceup() and c:IsSetCard(0x11)
end
function c83831356.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c83831356.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c83831356.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c83831356.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c83831356.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(1000)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_DISABLE_EFFECT)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e3)
end
end
--カラクリ解体新書
function c85541675.initial_effect(c)
c:SetCounterLimit(0x12,2)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHANGE_POS)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c85541675.accon)
e2:SetOperation(c85541675.acop)
c:RegisterEffect(e2)
--draw
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DRAW)
e3:SetDescription(aux.Stringid(85541675,0))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCost(c85541675.drcost)
e3:SetTarget(c85541675.drtg)
e3:SetOperation(c85541675.drop)
c:RegisterEffect(e3)
end
function c85541675.cfilter(c)
local np=c:GetPosition()
local pp=c:GetPreviousPosition()
return c:IsSetCard(0x11) and ((pp==0x1 and np==0x4) or (pp==0x4 and np==0x1) or (pp==0x8 and np==0x1))
end
function c85541675.accon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c85541675.cfilter,1,nil)
end
function c85541675.acop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x12,1)
end
function c85541675.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
local ct=e:GetHandler():GetCounter(0x12)
e:SetLabel(ct)
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c85541675.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetCounter(0x12)>0 and Duel.IsPlayerCanDraw(tp,c:GetCounter(0x12)) end
local ct=e:GetLabel()
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(ct)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function c85541675.drop(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
--E·HERO ネクロダークマン
function c89252153.initial_effect(c)
--summon with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(89252153,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_GRAVE)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(c89252153.ntcon)
e1:SetTarget(c89252153.nttg)
e1:SetOperation(c89252153.ntop)
c:RegisterEffect(e1)
end
function c89252153.ntcon(e,c)
if e:GetHandler():GetFlagEffect(89252153)~=0 then return false end
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
end
function c89252153.nttg(e,c)
return c:IsLevelAbove(5) and c:IsSetCard(0x3008)
end
function c89252153.ntop(e,tp,eg,ep,ev,re,r,rp,c)
e:GetHandler():RegisterFlagEffect(89252153,RESET_EVENT+0x1fe0000,0,1)
end
--カラクリ樽 真九六
function c92300891.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c92300891.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(92300891,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c92300891.poscon)
e3:SetOperation(c92300891.posop)
c:RegisterEffect(e3)
--battle des rep
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_DESTROY_REPLACE)
e4:SetCountLimit(1)
e4:SetTarget(c92300891.reptg)
c:RegisterEffect(e4)
end
function c92300891.becon(e)
return e:GetHandler():IsAttackable()
end
function c92300891.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c92300891.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c92300891.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReason(REASON_BATTLE) end
return true
end
--カラクリ忍者 参参九
function c93724592.initial_effect(c)
--must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_EP)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetCondition(c93724592.becon)
c:RegisterEffect(e2)
--to defence
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(93724592,0))
e3:SetCategory(CATEGIORY_POSITION)
e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetCondition(c93724592.poscon)
e3:SetOperation(c93724592.posop)
c:RegisterEffect(e3)
--Destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(93724592,1))
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetCode(EVENT_FLIP)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetTarget(c93724592.tgtg)
e4:SetOperation(c93724592.tgop)
c:RegisterEffect(e4)
--direct attack
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e5:SetCode(EVENT_FLIP)
e5:SetOperation(c93724592.dirop)
c:RegisterEffect(e5)
end
function c93724592.becon(e)
return e:GetHandler():IsAttackable()
end
function c93724592.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttack()
end
function c93724592.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c93724592.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,g:GetCount(),0,0)
end
function c93724592.tgop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.SendtoGrave(tc,REASON_EFFECT)
end
end
function c93724592.dirop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DIRECT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
--静寂のロッド-ケースト
function c95515060.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(c95515060.target)
e1:SetOperation(c95515060.operation)
c:RegisterEffect(e1)
--Def
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_DEFENCE)
e2:SetValue(500)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetValue(1)
c:RegisterEffect(e3)
--disable
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_DISABLE)
e4:SetRange(LOCATION_SZONE)
e4:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e4:SetTarget(c95515060.distg)
c:RegisterEffect(e4)
--disable effect
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_CHAIN_SOLVING)
e5:SetRange(LOCATION_SZONE)
e5:SetOperation(c95515060.disop)
c:RegisterEffect(e5)
--self destroy
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_FIELD)
e6:SetCode(EFFECT_SELF_DESTROY)
e6:SetRange(LOCATION_SZONE)
e6:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e6:SetTarget(c95515060.distg)
c:RegisterEffect(e6)
end
function c95515060.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 c95515060.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 c95515060.distg(e,c)
local ec=e:GetHandler()
if c==ec or c:GetCardTargetCount()==0 then return false end
return ec:GetEquipTarget() and c:GetCardTarget():IsContains(ec:GetEquipTarget())
end
function c95515060.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetChainInfo(ev,CHAININFO_TYPE)~=TYPE_SPELL then return end
local ec=e:GetHandler()
if not ec:GetEquipTarget() or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not g or not g:IsContains(ec:GetEquipTarget()) then return end
Duel.NegateEffect(ev)
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(re:GetHandler(),REASON_EFFECT)
end
end
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