Commit 94fc478e authored by argon.sun's avatar argon.sun

new

parent 252ba99c
......@@ -1397,7 +1397,6 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
if (code != 0 && pcard->code != code)
pcard->SetCode(code);
mainGame->dField.selectable_cards.push_back(pcard);
pcard->select_seq = i;
mainGame->dField.sort_list.push_back(0);
}
if (mainGame->chkAutoChain->isChecked() && mainGame->dInfo.curMsg == MSG_SORT_CHAIN) {
......
......@@ -6,6 +6,7 @@
#include "data_manager.h"
#include "image_manager.h"
#include "replay_mode.h"
#include "single_mode.h"
#include "../ocgcore/field.h"
namespace ygo {
......@@ -94,6 +95,8 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
case BUTTON_LEAVE_GAME: {
if(mainGame->dInfo.isSingleMode) {
mainGame->singleSignal.SetNoWait(true);
SingleMode::StopPlay(false);
break;
}
if(mainGame->dInfo.player_type == 7) {
......@@ -579,11 +582,11 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
case MSG_SORT_CHAIN:
case MSG_SORT_CARD: {
int offset = mainGame->scrCardList->getPos() / 10;
command_card = selectable_cards[id - BUTTON_CARD_0 + offset];
if(sort_list[command_card->select_seq]) {
int sel_seq = id - BUTTON_CARD_0 + offset;
if(sort_list[sel_seq]) {
select_min--;
int sel = sort_list[command_card->select_seq];
sort_list[command_card->select_seq] = 0;
int sel = sort_list[sel_seq];
sort_list[sel_seq] = 0;
for(int i = 0; i < select_max; ++i)
if(sort_list[i] > sel)
sort_list[i]--;
......@@ -597,7 +600,7 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
} else {
select_min++;
sort_list[command_card->select_seq] = select_min;
sort_list[sel_seq] = select_min;
myswprintf(formatBuffer, L"%d", select_min);
mainGame->stCardPos[id - BUTTON_CARD_0]->setText(formatBuffer);
if(select_min == select_max) {
......@@ -1254,6 +1257,14 @@ bool ClientField::OnEvent(const irr::SEvent& event) {
}
break;
}
case MSG_SORT_CHAIN:
case MSG_SORT_CARD: {
if(mainGame->wCardSelect->isVisible()) {
DuelClient::SetResponseI(-1);
mainGame->HideElement(mainGame->wCardSelect, true);
}
break;
}
}
break;
}
......
......@@ -7,6 +7,7 @@
#include "materials.h"
#include "duelclient.h"
#include "netserver.h"
#include "single_mode.h"
#ifndef WIN32
#include <sys/types.h>
......@@ -552,6 +553,8 @@ void Game::MainLoop() {
}
}
DuelClient::StopClient(true);
if(mainGame->dInfo.isSingleMode)
SingleMode::StopPlay(true);
#ifdef _WIN32
Sleep(500);
#else
......
......@@ -171,6 +171,7 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
case BUTTON_LOAD_SINGLEPLAY: {
if(mainGame->lstSinglePlayList->getSelected() == -1)
break;
mainGame->singleSignal.SetNoWait(false);
SingleMode::StartPlay();
break;
}
......
......@@ -9,6 +9,7 @@ class Signal {
public:
Signal() {
_event = CreateEvent(0, FALSE, FALSE, 0);
_nowait = false;
}
~Signal() {
CloseHandle(_event);
......@@ -20,10 +21,16 @@ public:
ResetEvent(_event);
}
void Wait() {
if(_nowait)
return;
WaitForSingleObject(_event, INFINITE);
}
void SetNoWait(bool nowait) {
_nowait = nowait;
}
private:
HANDLE _event;
bool _nowait;
};
#else // _WIN32
......@@ -35,6 +42,7 @@ class Signal {
public:
Signal() {
_state = false;
_nowait = false;
pthread_mutex_init(&_mutex, NULL);
pthread_cond_init(&_cond, NULL);
}
......@@ -61,7 +69,7 @@ public:
pthread_mutex_unlock(&_mutex);
}
void Wait() {
if(pthread_mutex_lock(&_mutex))
if(_nowait || pthread_mutex_lock(&_mutex))
return;
while(!_state)
{
......@@ -75,10 +83,14 @@ public:
_state = false;
pthread_mutex_unlock(&_mutex);
}
void SetNoWait(bool nowait) {
_nowait = nowait;
}
private:
pthread_mutex_t _mutex;
pthread_cond_t _cond;
bool _state;
bool _nowait;
};
#endif // _WIN32
......
......@@ -9,6 +9,7 @@ namespace ygo {
long SingleMode::pduel = 0;
bool SingleMode::is_closing = false;
bool SingleMode::is_continuing = false;
wchar_t SingleMode::event_string[256];
bool SingleMode::StartPlay() {
......@@ -17,7 +18,9 @@ bool SingleMode::StartPlay() {
}
void SingleMode::StopPlay(bool is_exiting) {
is_closing = is_exiting;
is_continuing = false;
mainGame->actionSignal.Set();
mainGame->singleSignal.Set();
}
void SingleMode::SetResponse(unsigned char* resp) {
if(!pduel)
......@@ -73,7 +76,7 @@ int SingleMode::SinglePlayThread(void* param) {
start_duel(pduel, 0);
char engineBuffer[0x1000];
is_closing = false;
bool is_continuing = true;
is_continuing = true;
int len = 0, flag = 0;
while (is_continuing) {
int result = process(pduel);
......@@ -101,7 +104,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
char* offset, *pbufw, *pbuf = msg;
int player, count;
while (pbuf - msg < len) {
if(is_closing)
if(is_closing || !is_continuing)
return false;
offset = pbuf;
mainGame->dInfo.curMsg = BufferIO::ReadUInt8(pbuf);
......@@ -694,7 +697,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
}
}
}
return true;
return is_continuing;
}
void SingleMode::SinglePlayRefresh(int flag) {
unsigned char queryBuffer[0x1000];
......
......@@ -12,6 +12,7 @@ class SingleMode {
private:
static long pduel;
static bool is_closing;
static bool is_continuing;
static wchar_t event_string[256];
public:
......
......@@ -789,8 +789,7 @@ int32 card::add_effect(effect* peffect) {
return peffect->id;
}
void card::remove_effect(effect* peffect) {
effect_indexer::iterator it;
it = indexer.find(peffect);
auto it = indexer.find(peffect);
if (it == indexer.end())
return;
remove_effect(peffect, it->second);
......@@ -815,7 +814,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
else
check_target = 0;
}
if (current.controler != PLAYER_NONE && !get_status(STATUS_DISABLED) && check_target) {
if ((current.controler != PLAYER_NONE) && !get_status(STATUS_DISABLED) && check_target) {
if (peffect->is_disable_related())
pduel->game_field->add_to_disable_check_list(check_target);
}
......@@ -829,7 +828,7 @@ void card::remove_effect(effect* peffect, effect_container::iterator it) {
if(peffect->flag & EFFECT_FLAG_COUNT_LIMIT)
pduel->game_field->effects.rechargeable.erase(peffect);
if(((peffect->code & 0xf0000) == EFFECT_COUNTER_PERMIT) && (peffect->type & EFFECT_TYPE_SINGLE)) {
counter_map::iterator cmit = counters.find(peffect->code & 0xffff);
auto cmit = counters.find(peffect->code & 0xffff);
if(cmit != counters.end()) {
pduel->write_buffer8(MSG_REMOVE_COUNTER);
pduel->write_buffer16(cmit->first);
......@@ -870,18 +869,12 @@ int32 card::copy_effect(uint32 code, uint32 reset, uint32 count) {
return pduel->game_field->infos.copy_id - 1;
}
void card::reset(uint32 id, uint32 reset_type) {
effect_indexer::iterator i, rm;
effect_container::iterator it;
std::pair<effect_container::iterator, effect_container::iterator> pr;
relation_map::iterator rit, rrm;
effect_relation::iterator erit, rrit;
card_set::iterator cit;
effect* peffect;
if (reset_type != RESET_EVENT && reset_type != RESET_PHASE && reset_type != RESET_CODE && reset_type != RESET_COPY)
return;
if (reset_type == RESET_EVENT) {
for (rit = relations.begin(); rit != relations.end();) {
rrm = rit++;
for (auto rit = relations.begin(); rit != relations.end();) {
auto rrm = rit++;
if (rrm->second & 0xffff0000 & id)
relations.erase(rrm);
}
......@@ -896,22 +889,30 @@ void card::reset(uint32 id, uint32 reset_type) {
if(id & 0x1fe0000) {
battled_cards.clear();
reset_effect_count();
pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
auto pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
for(; pr.first != pr.second; ++pr.first)
pr.first->second->value = 0;
set_status(STATUS_UNION, FALSE);
}
if(id & 0x57e0000) {
counters.clear();
for(cit = effect_target_owner.begin(); cit != effect_target_owner.end(); ++cit)
for(auto cit = effect_target_owner.begin(); cit != effect_target_owner.end(); ++cit)
(*cit)->effect_target_cards.erase(this);
for(cit = effect_target_cards.begin(); cit != effect_target_cards.end(); ++cit)
(*cit)->effect_target_owner.erase(this);
for(auto cit = effect_target_cards.begin(); cit != effect_target_cards.end(); ++cit) {
card* pcard = *cit;
pcard->effect_target_owner.erase(this);
for(auto it = pcard->single_effect.begin(); it != pcard->single_effect.end();) {
auto rm = it++;
peffect = rm->second;
if((peffect->owner == this) && (peffect->flag & EFFECT_FLAG_OWNER_RELATE))
pcard->remove_effect(peffect, rm);
}
}
effect_target_owner.clear();
effect_target_cards.clear();
}
if(id & 0x3fe0000) {
pr = field_effect.equal_range(EFFECT_USE_EXTRA_MZONE);
auto pr = field_effect.equal_range(EFFECT_USE_EXTRA_MZONE);
for(; pr.first != pr.second; ++pr.first)
pr.first->second->value = pr.first->second->value & 0xffff;
pr = field_effect.equal_range(EFFECT_USE_EXTRA_SZONE);
......@@ -919,9 +920,8 @@ void card::reset(uint32 id, uint32 reset_type) {
pr.first->second->value = pr.first->second->value & 0xffff;
}
if(id & RESET_DISABLE) {
counter_map::iterator cmit, rm;
for(cmit = counters.begin(); cmit != counters.end();) {
rm = cmit++;
for(auto cmit = counters.begin(); cmit != counters.end();) {
auto rm = cmit++;
if(rm->first & COUNTER_NEED_ENABLE) {
pduel->write_buffer8(MSG_REMOVE_COUNTER);
pduel->write_buffer16(rm->first);
......@@ -949,10 +949,10 @@ void card::reset(uint32 id, uint32 reset_type) {
}
}
}
for (i = indexer.begin(); i != indexer.end();) {
rm = i++;
for (auto i = indexer.begin(); i != indexer.end();) {
auto rm = i++;
peffect = rm->first;
it = rm->second;
auto it = rm->second;
if (peffect->reset(id, reset_type))
remove_effect(peffect, it);
}
......@@ -1025,25 +1025,25 @@ void card::release_relation(effect* peffect) {
}
int32 card::leave_field_redirect(uint32 reason) {
effect_set es;
uint8 redirect;
uint32 redirect;
if(data.type & TYPE_TOKEN)
return 0;
filter_effect(EFFECT_LEAVE_FIELD_REDIRECT, &es);
for(int32 i = 0; i < es.count; ++i) {
pduel->lua->add_param(reason, PARAM_TYPE_INT);
redirect = es[i]->get_value(this, 1);
if(redirect & LOCATION_HAND && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return LOCATION_HAND;
else if(redirect & LOCATION_DECK && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
return LOCATION_DECK;
else if(redirect & LOCATION_REMOVED && !is_affected_by_effect(EFFECT_CANNOT_REMOVE) && pduel->game_field->is_player_can_remove(current.controler, this))
return LOCATION_REMOVED;
if((redirect & LOCATION_HAND) && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return redirect;
else if((redirect & LOCATION_DECK) && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
return redirect;
else if((redirect & LOCATION_REMOVED) && !is_affected_by_effect(EFFECT_CANNOT_REMOVE) && pduel->game_field->is_player_can_remove(current.controler, this))
return redirect;
}
return 0;
}
int32 card::destination_redirect(uint8 destination, uint32 reason) {
effect_set es;
uint8 redirect;
uint32 redirect;
if(data.type & TYPE_TOKEN)
return 0;
if(data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ ) && destination == LOCATION_HAND )
......@@ -1060,12 +1060,12 @@ int32 card::destination_redirect(uint8 destination, uint32 reason) {
for(int32 i = 0; i < es.count; ++i) {
pduel->lua->add_param(reason, PARAM_TYPE_INT);
redirect = es[i]->get_value(this, 1);
if(redirect & LOCATION_HAND && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return LOCATION_HAND;
if(redirect & LOCATION_DECK && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
return LOCATION_DECK;
if(redirect & LOCATION_REMOVED && !is_affected_by_effect(EFFECT_CANNOT_REMOVE) && pduel->game_field->is_player_can_remove(current.controler, this))
return LOCATION_REMOVED;
if((redirect & LOCATION_HAND) && !is_affected_by_effect(EFFECT_CANNOT_TO_HAND) && pduel->game_field->is_player_can_send_to_hand(current.controler, this))
return redirect;
if((redirect & LOCATION_DECK) && !is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && pduel->game_field->is_player_can_send_to_deck(current.controler, this))
return redirect;
if((redirect & LOCATION_REMOVED) && !is_affected_by_effect(EFFECT_CANNOT_REMOVE) && pduel->game_field->is_player_can_remove(current.controler, this))
return redirect;
}
return 0;
}
......@@ -1833,9 +1833,9 @@ int32 card::is_capable_cost_to_grave(uint8 playerid) {
if(!is_capable_send_to_grave(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect(REASON_COST);
redirect = leave_field_redirect(REASON_COST) & 0xffff;
if(redirect) dest = redirect;
redirect = destination_redirect(dest, REASON_COST);
redirect = destination_redirect(dest, REASON_COST) & 0xffff;
if(redirect) dest = redirect;
if(dest != LOCATION_GRAVE)
return FALSE;
......@@ -1853,9 +1853,9 @@ int32 card::is_capable_cost_to_hand(uint8 playerid) {
if(!is_capable_send_to_hand(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect(REASON_COST);
redirect = leave_field_redirect(REASON_COST) & 0xffff;
if(redirect) dest = redirect;
redirect = destination_redirect(dest, REASON_COST);
redirect = destination_redirect(dest, REASON_COST) & 0xffff;
if(redirect) dest = redirect;
if(dest != LOCATION_HAND)
return FALSE;
......@@ -1873,9 +1873,9 @@ int32 card::is_capable_cost_to_deck(uint8 playerid) {
if(!is_capable_send_to_deck(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect(REASON_COST);
redirect = leave_field_redirect(REASON_COST) & 0xffff;
if(redirect) dest = redirect;
redirect = destination_redirect(dest, REASON_COST);
redirect = destination_redirect(dest, REASON_COST) & 0xffff;
if(redirect) dest = redirect;
if(dest != LOCATION_DECK)
return FALSE;
......@@ -1893,9 +1893,9 @@ int32 card::is_capable_cost_to_extra(uint8 playerid) {
if(!is_capable_send_to_deck(playerid))
return FALSE;
if(current.location & LOCATION_ONFIELD)
redirect = leave_field_redirect(REASON_COST);
redirect = leave_field_redirect(REASON_COST) & 0xffff;
if(redirect) dest = redirect;
redirect = destination_redirect(dest, REASON_COST);
redirect = destination_redirect(dest, REASON_COST) & 0xffff;
if(redirect) dest = redirect;
if(dest != LOCATION_DECK)
return FALSE;
......
......@@ -2439,25 +2439,32 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
return FALSE;
}
case 3: {
uint32 redirect, dest;
uint32 redirect, dest, redirect_seq;
card_set leave_p, destroying;
for(auto cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
card* pcard = *cit;
dest = (pcard->operation_param >> 8) & 0xff;
redirect = 0;
if((pcard->current.location & LOCATION_ONFIELD) && !pcard->is_status(STATUS_SUMMON_DISABLED))
redirect_seq = 0;
if((pcard->current.location & LOCATION_ONFIELD) && !pcard->is_status(STATUS_SUMMON_DISABLED)) {
redirect = pcard->leave_field_redirect(pcard->current.reason);
redirect_seq = redirect >> 16;
redirect &= 0xffff;
}
if(redirect) {
pcard->current.reason &= ~REASON_TEMPORARY;
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) + (redirect << 8) + (redirect >> 16);
pcard->operation_param = (pcard->operation_param & 0xffff0000) | (redirect << 8) | redirect_seq;
dest = redirect;
}
redirect = pcard->destination_redirect(dest, pcard->current.reason);
if(redirect && pcard->current.location != redirect) {
if(redirect) {
redirect_seq = redirect >> 16;
redirect &= 0xffff;
}
if(redirect && (pcard->current.location != redirect)) {
pcard->current.reason |= REASON_REDIRECT;
pcard->operation_param = (pcard->operation_param & 0xffff0000) + (redirect << 8) + (redirect >> 16);
dest = redirect;
pcard->operation_param = (pcard->operation_param & 0xffff0000) | (redirect << 8) | redirect_seq;
}
if((pcard->current.location == LOCATION_MZONE) && pcard->is_status(STATUS_BATTLE_DESTROYED) && !(pcard->current.reason & REASON_DESTROY)) {
pcard->current.reason |= REASON_DESTROY | REASON_BATTLE;
......@@ -2712,7 +2719,7 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso
(*cit)->current.reason_effect = core.reason_effect;
(*cit)->current.reason_player = core.reason_player;
(*cit)->current.reason = reason;
redirect = (*cit)->destination_redirect(dest, reason);
redirect = (*cit)->destination_redirect(dest, reason) & 0xffff;
if(redirect) {
(*cit)->operation_param = redirect;
dest = redirect;
......
--ミスフォーチュン
function c1036974.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c1036974.cost)
e1:SetTarget(c1036974.target)
e1:SetOperation(c1036974.activate)
c:RegisterEffect(e1)
end
function c1036974.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.CheckAttackActivity(tp) end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OATH)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetReset(RESET_PHASE+RESET_END)
Duel.RegisterEffect(e1,tp)
end
function c1036974.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0)
end
function c1036974.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Damage(1-tp,tc:GetAttack()/2,REASON_EFFECT)
end
end
--罅割れゆく斧
function c12117532.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c12117532.target)
e1:SetOperation(c12117532.operation)
c:RegisterEffect(e1)
--Destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetCondition(c12117532.descon)
e2:SetOperation(c12117532.desop)
c:RegisterEffect(e2)
--atkdown
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(12117532,0))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetCondition(c12117532.atkcon)
e3:SetOperation(c12117532.atkop)
c:RegisterEffect(e3)
end
function c12117532.filter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT)
end
function c12117532.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c12117532.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c12117532.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c12117532.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c12117532.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
c:SetCardTarget(tc)
end
end
function c12117532.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsStatus(STATUS_DESTROY_CONFIRMED) then return false end
local tc=c:GetFirstCardTarget()
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY)
end
function c12117532.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(), REASON_EFFECT)
end
function c12117532.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and e:GetHandler():GetFirstCardTarget()~=nil
end
function c12117532.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=c:GetFirstCardTarget()
if tc then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_OWNER_RELATE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-300)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetCondition(c12117532.rcon)
tc:RegisterEffect(e1,true)
end
end
function c12117532.rcon(e)
return e:GetOwner():IsHasCardTarget(e:GetHandler())
end
--ディフェンド·スライム
function c21558682.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_BATTLE_START)
e1:SetTarget(c21558682.atktg1)
e1:SetOperation(c21558682.atkop)
c:RegisterEffect(e1)
--change target
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21558682,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c21558682.atkcon)
e2:SetTarget(c21558682.atktg2)
e2:SetOperation(c21558682.atkop)
c:RegisterEffect(e2)
end
function c21558682.atkcon(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttackTarget()
return tp~=Duel.GetTurnPlayer() and at and (at:IsFacedown() or not at:IsCode(31709826))
end
function c21558682.filter(c)
return c:IsFaceup() and c:IsCode(31709826)
end
function c21558682.atktg1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:SetProperty(0)
if Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) and tp~=Duel.GetTurnPlayer() then
local at=Duel.GetAttackTarget()
if at and (at:IsFacedown() or not at:IsCode(31709826)) and Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,nil) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
end
end
function c21558682.atktg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(c21558682.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c21558682.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c21558682.atkop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.ChangeAttackTarget(tc)
end
end
--スライム増殖炉
function c21770260.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--token
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21770260,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c21770260.spcon)
e2:SetTarget(c21770260.sptg)
e2:SetOperation(c21770260.spop)
c:RegisterEffect(e2)
--sum limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e3:SetTargetRange(1,0)
e3:SetTarget(c21770260.sumlimit)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetCode(EFFECT_CANNOT_SUMMON)
e4:SetTargetRange(1,0)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
c:RegisterEffect(e5)
end
function c21770260.sumlimit(e,c,sump,sumtype,sumpos,targetp,se)
return c:GetCode()~=21770261
end
function c21770260.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c21770260.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c21770260.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,21770261,0,0x4011,500,500,1,RACE_AQUA,ATTRIBUTE_WATER) then
local token=Duel.CreateToken(tp,21770261)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
end
--侵略の炎
function c26082229.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c26082229.sumsuc)
c:RegisterEffect(e1)
end
function c26082229.sumsuc(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimitTillChainEnd(c26082229.chlimit)
end
function c26082229.chlimit(re,rp,tp)
return not re:GetHandler():IsType(TYPE_TRAP) or not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
--サイバー·レーザー·ドラゴン
function c4162088.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(4162088,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(c4162088.target)
e2:SetOperation(c4162088.operation)
c:RegisterEffect(e2)
end
function c4162088.filter(c,atk)
return c:IsFaceup() and (c:IsAttackAbove(atk) or c:IsDefenceAbove(atk)) and c:IsDestructable()
end
function c4162088.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c4162088.filter(chkc,e:GetHandler():GetAttack()) end
if chk==0 then return Duel.IsExistingTarget(c4162088.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e:GetHandler():GetAttack()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c4162088.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,e:GetHandler():GetAttack())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c4162088.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and c4162088.filter(tc,c:GetAttack()) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--輪廻転生
function c44182827.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e2:SetRange(LOCATION_SZONE)
e2:SetTarget(c44182827.rmtarget)
e2:SetValue(LOCATION_DECKSHF)
c:RegisterEffect(e2)
end
function c44182827.rmtarget(e,c)
return c:GetReason()==REASON_RELEASE+REASON_RITUAL+REASON_EFFECT+REASON_MATERIAL
end
--ガードペナルティ
function c48653261.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c48653261.target)
e1:SetOperation(c48653261.activate)
c:RegisterEffect(e1)
end
function c48653261.target(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_TARGET)
Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c48653261.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHANGE_POS)
e1:SetCountLimit(1)
e1:SetCondition(c48653261.drcon)
e1:SetOperation(c48653261.drop)
e1:SetLabel(tc:GetRealFieldID())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
end
function c48653261.filter(c,fid)
return c:GetRealFieldID()==fid and c:IsDefencePos() and c:IsPreviousPosition(POS_ATTACK)
end
function c48653261.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c48653261.filter,1,nil,e:GetLabel())
end
function c48653261.drop(e,tp,eg,ep,ev,re,r,rp)
Duel.Draw(tp,1,REASON_EFFECT)
e:Reset()
end
--忍び寄るデビルマンタ
function c52571838.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c52571838.sumsuc)
c:RegisterEffect(e1)
end
function c52571838.sumsuc(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimitTillChainEnd(c52571838.chlimit)
end
function c52571838.chlimit(re,rp,tp)
return not re:GetHandler():IsType(TYPE_TRAP) or not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
--イーグル·アイ
function c53693416.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c53693416.sumsuc)
c:RegisterEffect(e1)
end
function c53693416.sumsuc(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimitTillChainEnd(c53693416.chlimit)
end
function c53693416.chlimit(re,rp,tp)
return not re:GetHandler():IsType(TYPE_TRAP) or not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
--瞬着ボマー
function c53828396.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(53828396,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLE_CONFIRM)
e1:SetCondition(c53828396.eqcon)
e1:SetOperation(c53828396.eqop)
c:RegisterEffect(e1)
end
function c53828396.eqcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()==e:GetHandler() and e:GetHandler():GetBattlePosition()==POS_FACEDOWN_DEFENCE
end
function c53828396.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if not tc:IsRelateToBattle() or not c:IsRelateToBattle() then return end
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsFacedown() then
Duel.Destroy(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc)
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c53828396.eqlimit)
c:RegisterEffect(e1)
--destroy&damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(53828396,1))
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_STANDBY)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c53828396.descon)
e2:SetTarget(c53828396.destg)
e2:SetOperation(c53828396.desop)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
end
function c53828396.eqlimit(e,c)
return e:GetOwner()==c
end
function c53828396.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c53828396.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ec=e:GetHandler():GetEquipTarget()
ec:CreateEffectRelation(e)
e:SetLabelObject(ec)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,ec,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ec:GetAttack())
end
function c53828396.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local ec=e:GetLabelObject()
if ec:IsRelateToEffect(e) and ec:IsFaceup() then
if Duel.Destroy(ec,REASON_EFFECT)~=0 then
else Duel.Destroy(c,REASON_EFFECT) end
end
end
--パワーカプセル
function c54289683.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c54289683.target)
e1:SetOperation(c54289683.operation)
c:RegisterEffect(e1)
end
function c54289683.filter(c)
return c:IsFaceup() and c:IsCode(93130021)
end
function c54289683.desfilter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c54289683.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c54289683.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local cg=Duel.SelectTarget(tp,c54289683.filter,tp,LOCATION_MZONE,0,1,1,nil)
local c=cg:GetFirst()
local t1=Duel.IsExistingTarget(c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
local t2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,0,0,c:GetAttack(),c:GetDefence(),c:GetLevel(),c:GetRace(),c:GetAttribute())
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(93130021,0))
if t1 and t2 then
op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,2),aux.Stringid(93130021,3))
elseif t1 then
op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,2))
elseif t2 then
op=Duel.SelectOption(tp,aux.Stringid(93130021,1),aux.Stringid(93130021,3))
if op==1 then op=2 end
else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end
e:SetLabel(op)
if op==1 then
e:SetCategory(CATEGORY_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c54289683.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
e:SetLabelObject(g:GetFirst())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
elseif op==2 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
else
e:SetCategory(CATEGORY_ATKCHANGE)
end
end
function c54289683.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if e:GetLabel()==1 then
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local dc=e:GetLabelObject()
tc=g:GetFirst()
if tc==dc then tc=g:GetNext() end
if tc:IsFaceup() and tc:IsRelateToEffect(e) and dc:IsRelateToEffect(e) then
Duel.Destroy(dc,REASON_EFFECT)
end
elseif e:GetLabel()==2 then
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end
local atk=tc:GetAttack()
local def=tc:GetDefence()
local lv=tc:GetLevel()
local race=tc:GetRace()
local att=tc:GetAttribute()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,93130022,0,0x4011,atk,def,lv,race,att) then return end
local token=Duel.CreateToken(tp,93130022)
tc:CreateRelation(token,RESET_EVENT+0x1fe0000)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c54289683.tokenatk)
e1:SetLabelObject(tc)
e1:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e1,true)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENCE_FINAL)
e2:SetValue(c54289683.tokendef)
e2:SetLabelObject(tc)
token:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CHANGE_LEVEL)
e3:SetValue(c54289683.tokenlv)
e3:SetLabelObject(tc)
e3:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e3,true)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_CHANGE_RACE)
e4:SetValue(c54289683.tokenrace)
e4:SetLabelObject(tc)
e4:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e4,true)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e5:SetValue(c54289683.tokenatt)
e5:SetLabelObject(tc)
e5:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e5,true)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_SELF_DESTROY)
e6:SetCondition(c54289683.tokendes)
e6:SetLabelObject(tc)
e6:SetReset(RESET_EVENT+0xfe0000)
token:RegisterEffect(e6,true)
Duel.SpecialSummonComplete()
else
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(400)
e1:SetReset(RESET_EVENT+0x1ff0000)
tc:RegisterEffect(e1)
end
end
end
function c54289683.tokenatk(e,c)
return e:GetLabelObject():GetAttack()
end
function c54289683.tokendef(e,c)
return e:GetLabelObject():GetDefence()
end
function c54289683.tokenlv(e,c)
return e:GetLabelObject():GetLevel()
end
function c54289683.tokenrace(e,c)
return e:GetLabelObject():GetRace()
end
function c54289683.tokenatt(e,c)
return e:GetLabelObject():GetAttribute()
end
function c54289683.tokendes(e)
return not e:GetLabelObject():IsRelateToCard(e:GetHandler())
end
--デステニー·デストロイ
function c62980542.initial_effect(c)
--discard deck
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DAMAGE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCost(c62980542.discost)
e1:SetOperation(c62980542.disop)
c:RegisterEffect(e1)
end
function c62980542.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(3)
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3)
end
function c62980542.filter(c)
return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c62980542.disop(e,tp,eg,ep,ev,re,r,rp)
local p,val=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.DiscardDeck(p,val,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
local ct=g:FilterCount(c62980542.filter,nil)
if ct>0 then
Duel.Damage(tp,ct*1000,REASON_EFFECT)
end
end
--フォトン·ジェネレーター·ユニット
function c66607691.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c66607691.cost)
e1:SetTarget(c66607691.target)
e1:SetOperation(c66607691.activate)
c:RegisterEffect(e1)
end
function c66607691.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsCode,2,nil,70095154) end
local g=Duel.SelectReleaseGroup(tp,Card.IsCode,2,2,nil,70095154)
Duel.Release(g,REASON_COST)
end
function c66607691.spfilter(c,e,tp)
return c:IsCode(4162088) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c66607691.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c66607691.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE)
end
function c66607691.activate(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,c66607691.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
--サイバー·バリア·ドラゴン
function c68774379.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--Negate attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c68774379.discon)
e2:SetOperation(c68774379.disop)
c:RegisterEffect(e2)
end
function c68774379.discon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPosition(POS_FACEUP_ATTACK) and eg:GetFirst():IsControler(1-tp)
end
function c68774379.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateAttack()
end
......@@ -44,9 +44,7 @@ end
function c73199638.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
local sg=g:Filter(c73199638.rfilter,nil,e,tp)
if sg:GetCount()==0 then return end
if sg:GetCount()>ft then sg=sg:Select(tp,ft,ft,nil) end
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
if ft<=2 then return end
if g:FilterCount(c73199638.rfilter,nil,e,tp)~=3 then return end
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
--華麗なる潜入工作員
function c89698120.initial_effect(c)
--summon success
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(c89698120.sumsuc)
c:RegisterEffect(e1)
end
function c89698120.sumsuc(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimitTillChainEnd(c89698120.chlimit)
end
function c89698120.chlimit(re,rp,tp)
return not re:GetHandler():IsType(TYPE_TRAP) or not re:IsHasType(EFFECT_TYPE_ACTIVATE)
end
--アタック·リフレクター·ユニット
function c91989718.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c91989718.cost)
e1:SetTarget(c91989718.target)
e1:SetOperation(c91989718.activate)
c:RegisterEffect(e1)
end
function c91989718.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsCode,1,nil,70095154) end
local g=Duel.SelectReleaseGroup(tp,Card.IsCode,1,1,nil,70095154)
Duel.Release(g,REASON_COST)
end
function c91989718.spfilter(c,e,tp)
return c:IsCode(68774379) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function c91989718.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c91989718.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK)
end
function c91989718.activate(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,c91989718.spfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()~=0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
......@@ -9,7 +9,7 @@ function c93130021.initial_effect(c)
c:RegisterEffect(e1)
end
function c93130021.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_SPELL) and c:IsDestructable()
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c93130021.filter(chkc) end
......@@ -29,11 +29,11 @@ function c93130021.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
else op=Duel.SelectOption(tp,aux.Stringid(93130021,1)) end
e:SetLabel(op)
if op==1 then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetCategory(CATEGORY_DESTROY)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c93130021.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetCategory(CATEGORY_DESTROY)
elseif op==2 then
e:SetProperty(0)
e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
......@@ -47,8 +47,7 @@ end
function c93130021.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()==1 then
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc=g:GetFirst()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
......
--エレメンタル·アブソーバー
function c94253609.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c94253609.cost)
c:RegisterEffect(e1)
--cannot attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,LOCATION_MZONE)
e2:SetTarget(c94253609.atktarget)
c:RegisterEffect(e2)
e1:SetLabelObject(e2)
end
function c94253609.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c94253609.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c94253609.cfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c94253609.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
local att=g:GetFirst():GetAttribute()
e:GetLabelObject():SetLabel(att)
e:GetHandler():SetHint(CHINT_ATTRIBUTE,att)
end
function c94253609.atktarget(e,c)
return c:IsAttribute(e:GetLabel())
end
......@@ -8,7 +8,8 @@ LOCATION_REMOVED =0x20 --
LOCATION_EXTRA =0x40 --
LOCATION_OVERLAY =0x80 --
LOCATION_ONFIELD =0x0c --
LOCATION_DECKBOT =0x10000
LOCATION_DECKBOT =0x10001
LOCATION_DECKSHF =0x20001
--Positions
POS_FACEUP_ATTACK =0x1
POS_FACEDOWN_ATTACK =0x2
......
......@@ -52,10 +52,10 @@
!system 209 当前所选的卡已满足选择条件
!system 210 是否要继续选择?
!system 211 回合计数:
!system 212宣言卡:
!system 213宣言种族:
!system 214宣言属性:
!system 215宣言数字:
!system 212选择卡:
!system 213选择种族:
!system 214选择属性:
!system 215选择数字:
!system 500 请选择要解放的卡
!system 501 请选择要丢弃的手牌
!system 502 请选择要破坏的卡
......
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