Commit 8f361df9 authored by argon.sun's avatar argon.sun

fix&gaov-2

parent 1390116e
...@@ -51,7 +51,7 @@ bool Game::Initialize() { ...@@ -51,7 +51,7 @@ bool Game::Initialize() {
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16); numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12); adFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 12);
lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48); lpcFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 48);
guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 14); guiFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, 12);
textFont = guiFont; textFont = guiFont;
smgr = device->getSceneManager(); smgr = device->getSceneManager();
device->setWindowCaption(L"[---]"); device->setWindowCaption(L"[---]");
......
...@@ -23,8 +23,9 @@ class group; ...@@ -23,8 +23,9 @@ class group;
class effect; class effect;
struct tevent { struct tevent {
card* trigger_card;
uint32 event_code; uint32 event_code;
void* event_cards; group* event_cards;
uint32 event_value; uint32 event_value;
uint8 event_player; uint8 event_player;
effect* reason_effect; effect* reason_effect;
...@@ -357,7 +358,7 @@ public: ...@@ -357,7 +358,7 @@ public:
int32 execute_target(uint16 step, effect* peffect, uint8 triggering_player); int32 execute_target(uint16 step, effect* peffect, uint8 triggering_player);
void raise_event(card* event_card, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value); void raise_event(card* event_card, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
void raise_event(card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value); void raise_event(card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
void raise_single_event(card* event_card, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value ); void raise_single_event(card* trigger_card, card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value );
int32 check_event(uint32 code, tevent* pe = 0); int32 check_event(uint32 code, tevent* pe = 0);
int32 check_hint_timing(effect* peffect); int32 check_hint_timing(effect* peffect);
int32 process_phase_event(int16 step, int32 phase_event); int32 process_phase_event(int16 step, int32 phase_event);
......
...@@ -699,7 +699,7 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) { ...@@ -699,7 +699,7 @@ int32 scriptlib::duel_raise_single_event(lua_State *L) {
uint32 ep = lua_tointeger(L, 6); uint32 ep = lua_tointeger(L, 6);
uint32 ev = lua_tointeger(L, 7); uint32 ev = lua_tointeger(L, 7);
duel* pduel = pcard->pduel; duel* pduel = pcard->pduel;
pduel->game_field->raise_single_event(pcard, code, peffect, r, rp, ep, ev); pduel->game_field->raise_single_event(pcard, 0, code, peffect, r, rp, ep, ev);
pduel->game_field->process_single_event(); pduel->game_field->process_single_event();
return lua_yield(L, 0); return lua_yield(L, 0);
} }
......
...@@ -342,7 +342,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -342,7 +342,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
} }
if(cset.size()) { if(cset.size()) {
for(cit = cset.begin(); cit != cset.end(); ++cit) for(cit = cset.begin(); cit != cset.end(); ++cit)
raise_single_event((*cit), EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, 0); raise_single_event((*cit), 0, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, 0);
process_single_event(); process_single_event();
raise_event(&cset, EVENT_DRAW, reason_effect, reason, reason_player, playerid, drawed); raise_event(&cset, EVENT_DRAW, reason_effect, reason, reason_player, playerid, drawed);
raise_event(&cset, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, drawed); raise_event(&cset, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, drawed);
...@@ -764,7 +764,7 @@ int32 field::get_control(uint16 step, effect * reason_effect, uint8 reason_playe ...@@ -764,7 +764,7 @@ int32 field::get_control(uint16 step, effect * reason_effect, uint8 reason_playe
return FALSE; return FALSE;
} }
case 2: { case 2: {
raise_single_event(pcard, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, playerid, 0); raise_single_event(pcard, 0, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, playerid, 0);
process_single_event(); process_single_event();
raise_event(pcard, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, playerid, 0); raise_event(pcard, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, playerid, 0);
process_instant_event(); process_instant_event();
...@@ -821,8 +821,8 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play ...@@ -821,8 +821,8 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play
pduel->write_buffer8(pcard1->current.location); pduel->write_buffer8(pcard1->current.location);
pduel->write_buffer8(pcard1->current.sequence); pduel->write_buffer8(pcard1->current.sequence);
pduel->write_buffer8(pcard1->current.position); pduel->write_buffer8(pcard1->current.position);
raise_single_event(pcard1, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, pcard1->current.controler, 0); raise_single_event(pcard1, 0, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, pcard1->current.controler, 0);
raise_single_event(pcard2, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, pcard2->current.controler, 0); raise_single_event(pcard2, 0, EVENT_CONTROL_CHANGED, reason_effect, 0, reason_player, pcard2->current.controler, 0);
process_single_event(); process_single_event();
card_set cset; card_set cset;
cset.insert(pcard1); cset.insert(pcard1);
...@@ -838,7 +838,7 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play ...@@ -838,7 +838,7 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play
} }
return TRUE; return TRUE;
} }
int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * target, uint32 up) { int32 field::equip(uint16 step, uint8 equip_player, card* equip_card, card* target, uint32 up) {
switch(step) { switch(step) {
case 0: { case 0: {
returns.ivalue[0] = FALSE; returns.ivalue[0] = FALSE;
...@@ -884,7 +884,12 @@ int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * ta ...@@ -884,7 +884,12 @@ int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * ta
equip_card->effect_target_cards.insert(target); equip_card->effect_target_cards.insert(target);
target->effect_target_owner.insert(equip_card); target->effect_target_owner.insert(equip_card);
adjust_instant(); adjust_instant();
raise_event(equip_card, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0); card_set cset;
cset.insert(equip_card);
raise_single_event(target, &cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
raise_event(&cset, EVENT_EQUIP, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
process_single_event();
process_instant_event();
return FALSE; return FALSE;
} }
case 2: { case 2: {
...@@ -1166,7 +1171,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1166,7 +1171,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
adjust_instant(); adjust_instant();
if(target->material_cards.size()) { if(target->material_cards.size()) {
for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit) for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0); raise_single_event(*mit, 0, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0);
} }
raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0); raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, REASON_SUMMON, sumplayer, sumplayer, 0);
process_single_event(); process_single_event();
...@@ -1174,7 +1179,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1174,7 +1179,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
return false; return false;
} }
case 17: { case 17: {
raise_single_event(target, EVENT_SUMMON_SUCCESS, proc, 0, sumplayer, sumplayer, 0); raise_single_event(target, 0, EVENT_SUMMON_SUCCESS, proc, 0, sumplayer, sumplayer, 0);
process_single_event(); process_single_event();
raise_event(target, EVENT_SUMMON_SUCCESS, proc, 0, sumplayer, sumplayer, 0); raise_event(target, EVENT_SUMMON_SUCCESS, proc, 0, sumplayer, sumplayer, 0);
process_instant_event(); process_instant_event();
...@@ -1254,9 +1259,9 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) { ...@@ -1254,9 +1259,9 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
case 4: { case 4: {
pduel->write_buffer8(MSG_FLIPSUMMONED); pduel->write_buffer8(MSG_FLIPSUMMONED);
adjust_instant(); adjust_instant();
raise_single_event(target, EVENT_FLIP, 0, 0, sumplayer, sumplayer, 0); raise_single_event(target, 0, EVENT_FLIP, 0, 0, sumplayer, sumplayer, 0);
raise_single_event(target, EVENT_FLIP_SUMMON_SUCCESS, 0, 0, sumplayer, sumplayer, 0); raise_single_event(target, 0, EVENT_FLIP_SUMMON_SUCCESS, 0, 0, sumplayer, sumplayer, 0);
raise_single_event(target, EVENT_CHANGE_POS, 0, 0, sumplayer, sumplayer, 0); raise_single_event(target, 0, EVENT_CHANGE_POS, 0, 0, sumplayer, sumplayer, 0);
process_single_event(); process_single_event();
raise_event(target, EVENT_FLIP, 0, 0, sumplayer, sumplayer, 0); raise_event(target, EVENT_FLIP, 0, 0, sumplayer, sumplayer, 0);
raise_event(target, EVENT_FLIP_SUMMON_SUCCESS, 0, 0, sumplayer, sumplayer, 0); raise_event(target, EVENT_FLIP_SUMMON_SUCCESS, 0, 0, sumplayer, sumplayer, 0);
...@@ -1650,7 +1655,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) { ...@@ -1650,7 +1655,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
int32 matreason = proc->value == SUMMON_TYPE_SYNCHRO ? REASON_SYNCHRO : proc->value == SUMMON_TYPE_XYZ ? REASON_XYZ : REASON_SPSUMMON; int32 matreason = proc->value == SUMMON_TYPE_SYNCHRO ? REASON_SYNCHRO : proc->value == SUMMON_TYPE_XYZ ? REASON_XYZ : REASON_SPSUMMON;
if(target->material_cards.size()) { if(target->material_cards.size()) {
for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit) for(auto mit = target->material_cards.begin(); mit != target->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0); raise_single_event(*mit, 0, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0);
} }
raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0); raise_event(&target->material_cards, EVENT_BE_MATERIAL, proc, matreason, sumplayer, sumplayer, 0);
process_single_event(); process_single_event();
...@@ -1658,7 +1663,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) { ...@@ -1658,7 +1663,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
return false; return false;
} }
case 17: { case 17: {
raise_single_event(target, EVENT_SPSUMMON_SUCCESS, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0); raise_single_event(target, 0, EVENT_SPSUMMON_SUCCESS, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0);
process_single_event(); process_single_event();
raise_event(target, EVENT_SPSUMMON_SUCCESS, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0); raise_event(target, EVENT_SPSUMMON_SUCCESS, core.units.begin()->peffect, 0, sumplayer, sumplayer, 0);
process_instant_event(); process_instant_event();
...@@ -1789,12 +1794,12 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl ...@@ -1789,12 +1794,12 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
pduel->write_buffer8(MSG_SPSUMMONED); pduel->write_buffer8(MSG_SPSUMMONED);
for(cit = targets->container.begin(); cit != targets->container.end(); ++cit) { for(cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
if(!((*cit)->current.position & POS_FACEDOWN)) if(!((*cit)->current.position & POS_FACEDOWN))
raise_single_event(*cit, EVENT_SPSUMMON_SUCCESS, (*cit)->current.reason_effect, 0, (*cit)->current.reason_player, (*cit)->summon_player, 0); raise_single_event(*cit, 0, EVENT_SPSUMMON_SUCCESS, (*cit)->current.reason_effect, 0, (*cit)->current.reason_player, (*cit)->summon_player, 0);
int32 summontype = (*cit)->summon_type & 0x3000000; int32 summontype = (*cit)->summon_type & 0x3000000;
if(summontype && (*cit)->material_cards.size()) { if(summontype && (*cit)->material_cards.size()) {
int32 matreason = (summontype & SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype & SUMMON_TYPE_RITUAL) ? REASON_RITUAL : 0; int32 matreason = (summontype & SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype & SUMMON_TYPE_RITUAL) ? REASON_RITUAL : 0;
for(auto mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit) for(auto mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit)
raise_single_event(*mit, EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0); raise_single_event(*mit, 0, EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
raise_event(&((*cit)->material_cards), EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0); raise_event(&((*cit)->material_cards), EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
} }
} }
...@@ -1935,7 +1940,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -1935,7 +1940,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
} }
(*cvit)->current.reason |= REASON_DESTROY; (*cvit)->current.reason |= REASON_DESTROY;
core.hint_timing[(*cvit)->current.controler] |= TIMING_DESTROY; core.hint_timing[(*cvit)->current.controler] |= TIMING_DESTROY;
raise_single_event(*cvit, EVENT_DESTROY, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0); raise_single_event(*cvit, 0, EVENT_DESTROY, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0);
} }
adjust_instant(); adjust_instant();
process_single_event(); process_single_event();
...@@ -2108,12 +2113,8 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2108,12 +2113,8 @@ int32 field::release(uint16 step, group * targets, effect * reason_effect, uint3
continue; continue;
} }
(*cvit)->current.reason |= REASON_RELEASE; (*cvit)->current.reason |= REASON_RELEASE;
raise_single_event(*cvit, EVENT_RELEASE, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0);
} }
adjust_instant(); adjust_instant();
process_single_event();
raise_event(&targets->container, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0);
process_instant_event();
return FALSE; return FALSE;
} }
case 3: { case 3: {
...@@ -2231,7 +2232,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2231,7 +2232,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
if(((*cit)->current.location == LOCATION_MZONE) && (*cit)->is_status(STATUS_BATTLE_DESTROYED) && !((*cit)->current.reason & REASON_DESTROY)) if(((*cit)->current.location == LOCATION_MZONE) && (*cit)->is_status(STATUS_BATTLE_DESTROYED) && !((*cit)->current.reason & REASON_DESTROY))
(*cit)->current.reason |= REASON_DESTROY | REASON_BATTLE; (*cit)->current.reason |= REASON_DESTROY | REASON_BATTLE;
if(((*cit)->current.location & LOCATION_ONFIELD) && !(*cit)->is_status(STATUS_SUMMON_DISABLED)) { if(((*cit)->current.location & LOCATION_ONFIELD) && !(*cit)->is_status(STATUS_SUMMON_DISABLED)) {
raise_single_event(*cit, EVENT_LEAVE_FIELD_P, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0); raise_single_event(*cit, 0, EVENT_LEAVE_FIELD_P, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
leave_p.insert(*cit); leave_p.insert(*cit);
} }
} }
...@@ -2318,11 +2319,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2318,11 +2319,11 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
(*cvit)->previous.location = 0; (*cvit)->previous.location = 0;
} else if(oloc & LOCATION_ONFIELD) { } else if(oloc & LOCATION_ONFIELD) {
(*cvit)->reset(RESET_LEAVE, RESET_EVENT); (*cvit)->reset(RESET_LEAVE, RESET_EVENT);
raise_single_event(*cvit, EVENT_LEAVE_FIELD, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0); raise_single_event(*cvit, 0, EVENT_LEAVE_FIELD, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0);
leave.insert(*cvit); leave.insert(*cvit);
} }
if((*cvit)->current.reason & REASON_DISCARD) { if((*cvit)->current.reason & REASON_DISCARD) {
raise_single_event(*cvit, EVENT_DISCARD, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0); raise_single_event(*cvit, 0, EVENT_DISCARD, (*cvit)->current.reason_effect, (*cvit)->current.reason, (*cvit)->current.reason_player, 0, 0);
discard.insert(*cvit); discard.insert(*cvit);
} }
} }
...@@ -2340,7 +2341,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2340,7 +2341,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
case 5: { case 5: {
uint8 nloc; uint8 nloc;
card_set tohand, todeck, tograve, remove; card_set tohand, todeck, tograve, remove, released;
card_set equipings, overlays; card_set equipings, overlays;
for(cit = targets->container.begin(); cit != targets->container.end(); ++cit) { for(cit = targets->container.begin(); cit != targets->container.end(); ++cit) {
nloc = (*cit)->current.location; nloc = (*cit)->current.location;
...@@ -2358,22 +2359,26 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2358,22 +2359,26 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
if(nloc == LOCATION_HAND) { if(nloc == LOCATION_HAND) {
tohand.insert(*cit); tohand.insert(*cit);
(*cit)->reset(RESET_TOHAND, RESET_EVENT); (*cit)->reset(RESET_TOHAND, RESET_EVENT);
raise_single_event(*cit, EVENT_TO_HAND, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0); raise_single_event(*cit, 0, EVENT_TO_HAND, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
} else if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) { } else if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) {
todeck.insert(*cit); todeck.insert(*cit);
(*cit)->reset(RESET_TODECK, RESET_EVENT); (*cit)->reset(RESET_TODECK, RESET_EVENT);
raise_single_event(*cit, EVENT_TO_DECK, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0); raise_single_event(*cit, 0, EVENT_TO_DECK, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
} else if(nloc == LOCATION_GRAVE) { } else if(nloc == LOCATION_GRAVE) {
tograve.insert(*cit); tograve.insert(*cit);
(*cit)->reset(RESET_TOGRAVE, RESET_EVENT); (*cit)->reset(RESET_TOGRAVE, RESET_EVENT);
raise_single_event(*cit, EVENT_TO_GRAVE, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0); raise_single_event(*cit, 0, EVENT_TO_GRAVE, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
} else if(nloc == LOCATION_REMOVED) { } else if(nloc == LOCATION_REMOVED) {
remove.insert(*cit); remove.insert(*cit);
if((*cit)->current.reason & REASON_TEMPORARY) if((*cit)->current.reason & REASON_TEMPORARY)
(*cit)->reset(RESET_TEMP_REMOVE, RESET_EVENT); (*cit)->reset(RESET_TEMP_REMOVE, RESET_EVENT);
else else
(*cit)->reset(RESET_REMOVE, RESET_EVENT); (*cit)->reset(RESET_REMOVE, RESET_EVENT);
raise_single_event(*cit, EVENT_REMOVE, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0); raise_single_event(*cit, 0, EVENT_REMOVE, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
}
if((*cit)->current.reason & REASON_RELEASE) {
released.insert(*cit);
raise_single_event(*cit, 0, EVENT_RELEASE, (*cit)->current.reason_effect, (*cit)->current.reason, (*cit)->current.reason_player, 0, 0);
} }
if((*cit)->xyz_materials.size()) { if((*cit)->xyz_materials.size()) {
for(auto clit = (*cit)->xyz_materials.begin(); clit != (*cit)->xyz_materials.end(); ++clit) for(auto clit = (*cit)->xyz_materials.begin(); clit != (*cit)->xyz_materials.end(); ++clit)
...@@ -2388,6 +2393,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -2388,6 +2393,8 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0); raise_event(&tograve, EVENT_TO_GRAVE, reason_effect, reason, reason_player, 0, 0);
if(remove.size()) if(remove.size())
raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0); raise_event(&remove, EVENT_REMOVE, reason_effect, reason, reason_player, 0, 0);
if(released.size())
raise_event(&released, EVENT_RELEASE, reason_effect, reason, reason_player, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
if(equipings.size()) if(equipings.size())
...@@ -2480,16 +2487,16 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso ...@@ -2480,16 +2487,16 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso
pduel->write_buffer32(pcard->current.reason); pduel->write_buffer32(pcard->current.reason);
if(dest == LOCATION_HAND) { if(dest == LOCATION_HAND) {
tohand.insert(pcard); tohand.insert(pcard);
raise_single_event(pcard, EVENT_TO_HAND, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_TO_HAND, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} else if(dest == LOCATION_DECK || dest == LOCATION_EXTRA) { } else if(dest == LOCATION_DECK || dest == LOCATION_EXTRA) {
todeck.insert(pcard); todeck.insert(pcard);
raise_single_event(pcard, EVENT_TO_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_TO_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} else if(dest == LOCATION_GRAVE) { } else if(dest == LOCATION_GRAVE) {
tograve.insert(pcard); tograve.insert(pcard);
raise_single_event(pcard, EVENT_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} else if(dest == LOCATION_REMOVED) { } else if(dest == LOCATION_REMOVED) {
remove.insert(pcard); remove.insert(pcard);
raise_single_event(pcard, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} }
core.discarded_set.insert(pcard); core.discarded_set.insert(pcard);
} }
...@@ -2672,7 +2679,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -2672,7 +2679,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) { if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) {
(*cvit)->fieldid = infos.field_id++; (*cvit)->fieldid = infos.field_id++;
if((*cvit)->current.location == LOCATION_MZONE) { if((*cvit)->current.location == LOCATION_MZONE) {
raise_single_event((*cvit), EVENT_FLIP, reason_effect, 0, reason_player, 0, noflip); raise_single_event((*cvit), 0, EVENT_FLIP, reason_effect, 0, reason_player, 0, noflip);
if(infos.phase == PHASE_BATTLE && (*cvit)->current.controler != infos.turn_player) if(infos.phase == PHASE_BATTLE && (*cvit)->current.controler != infos.turn_player)
core.pre_field[(*cvit)->current.sequence] = (*cvit)->fieldid; core.pre_field[(*cvit)->current.sequence] = (*cvit)->fieldid;
} }
...@@ -2682,7 +2689,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -2682,7 +2689,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
(*cvit)->refresh_disable_status(); (*cvit)->refresh_disable_status();
} }
if((*cvit)->current.location == LOCATION_MZONE) { if((*cvit)->current.location == LOCATION_MZONE) {
raise_single_event(*cvit, EVENT_CHANGE_POS, reason_effect, 0, reason_player, 0, 0); raise_single_event(*cvit, 0, EVENT_CHANGE_POS, reason_effect, 0, reason_player, 0, 0);
pos_changed.insert(*cvit); pos_changed.insert(*cvit);
} }
bool trapmonster = false; bool trapmonster = false;
......
...@@ -1120,12 +1120,13 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg ...@@ -1120,12 +1120,13 @@ int32 field::execute_target(uint16 step, effect * triggering_effect, uint8 trigg
} }
return FALSE; return FALSE;
} }
void field::raise_event(card * event_card, uint32 event_code, effect * reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) { void field::raise_event(card* event_card, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) {
tevent new_event; tevent new_event;
new_event.trigger_card = 0;
if (event_card) { if (event_card) {
group* pgroup = pduel->new_group(event_card); group* pgroup = pduel->new_group(event_card);
pgroup->is_readonly = TRUE; pgroup->is_readonly = TRUE;
new_event.event_cards = (void*)pgroup; new_event.event_cards = pgroup;
} else } else
new_event.event_cards = 0; new_event.event_cards = 0;
new_event.event_code = event_code; new_event.event_code = event_code;
...@@ -1136,14 +1137,16 @@ void field::raise_event(card * event_card, uint32 event_code, effect * reason_ef ...@@ -1136,14 +1137,16 @@ void field::raise_event(card * event_card, uint32 event_code, effect * reason_ef
new_event.event_value = event_value; new_event.event_value = event_value;
core.queue_event.push_back(new_event); core.queue_event.push_back(new_event);
} }
void field::raise_event(card_set * event_cards, uint32 event_code, effect * reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) { void field::raise_event(card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) {
tevent new_event; tevent new_event;
new_event.trigger_card = 0;
if (event_cards) { if (event_cards) {
group* pgroup = pduel->new_group(); group* pgroup = pduel->new_group();
pgroup->is_readonly = TRUE; pgroup->is_readonly = TRUE;
pgroup->container = *event_cards; pgroup->container = *event_cards;
new_event.event_cards = (void*)pgroup; new_event.event_cards = pgroup;
} else new_event.event_cards = 0; } else
new_event.event_cards = 0;
new_event.event_code = event_code; new_event.event_code = event_code;
new_event.reason_effect = reason_effect; new_event.reason_effect = reason_effect;
new_event.reason = reason; new_event.reason = reason;
...@@ -1152,9 +1155,16 @@ void field::raise_event(card_set * event_cards, uint32 event_code, effect * reas ...@@ -1152,9 +1155,16 @@ void field::raise_event(card_set * event_cards, uint32 event_code, effect * reas
new_event.event_value = event_value; new_event.event_value = event_value;
core.queue_event.push_back(new_event); core.queue_event.push_back(new_event);
} }
void field::raise_single_event(card * event_card, uint32 event_code, effect * reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) { void field::raise_single_event(card* trigger_card, card_set* event_cards, uint32 event_code, effect * reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value) {
tevent new_event; tevent new_event;
new_event.event_cards = (void*) event_card; new_event.trigger_card = trigger_card;
if (event_cards) {
group* pgroup = pduel->new_group();
pgroup->is_readonly = TRUE;
pgroup->container = *event_cards;
new_event.event_cards = pgroup;
} else
new_event.event_cards = 0;
new_event.event_code = event_code; new_event.event_code = event_code;
new_event.reason_effect = reason_effect; new_event.reason_effect = reason_effect;
new_event.reason = reason; new_event.reason = reason;
...@@ -1991,7 +2001,6 @@ int32 field::process_instant_event() { ...@@ -1991,7 +2001,6 @@ int32 field::process_instant_event() {
return TRUE; return TRUE;
} }
int32 field::process_single_event() { int32 field::process_single_event() {
pair<effect_container::iterator, effect_container::iterator> pr;
if(core.single_event.size() == 0) if(core.single_event.size() == 0)
return TRUE; return TRUE;
card* starget; card* starget;
...@@ -2004,12 +2013,11 @@ int32 field::process_single_event() { ...@@ -2004,12 +2013,11 @@ int32 field::process_single_event() {
event_list ntev; event_list ntev;
effect_vector::iterator eit; effect_vector::iterator eit;
event_list::iterator evit; event_list::iterator evit;
for(event_list::iterator elit = core.single_event.begin(); elit != core.single_event.end(); ++elit) { for(auto elit = core.single_event.begin(); elit != core.single_event.end(); ++elit) {
starget = (card*)elit->event_cards; starget = elit->trigger_card;
ev = elit->event_code; ev = elit->event_code;
pr = starget->single_effect.equal_range(ev); auto pr = starget->single_effect.equal_range(ev);
tevent e = *elit; tevent e = *elit;
e.event_cards = 0;
for(; pr.first != pr.second; ++pr.first) { for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second; peffect = pr.first->second;
if(!(peffect->type & EFFECT_TYPE_ACTIONS)) if(!(peffect->type & EFFECT_TYPE_ACTIONS))
...@@ -2550,7 +2558,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2550,7 +2558,7 @@ int32 field::process_battle_command(uint16 step) {
pduel->write_buffer8(MSG_ATTACK); pduel->write_buffer8(MSG_ATTACK);
pduel->write_buffer32(core.attacker->get_info_location()); pduel->write_buffer32(core.attacker->get_info_location());
if(core.attack_target) { if(core.attack_target) {
raise_single_event(core.attack_target, EVENT_BE_BATTLE_TARGET, 0, 0, 0, 1 - infos.turn_player, 0); raise_single_event(core.attack_target, 0, EVENT_BE_BATTLE_TARGET, 0, 0, 0, 1 - infos.turn_player, 0);
raise_event(core.attack_target, EVENT_BE_BATTLE_TARGET, 0, 0, 0, 1 - infos.turn_player, 0); raise_event(core.attack_target, EVENT_BE_BATTLE_TARGET, 0, 0, 0, 1 - infos.turn_player, 0);
pduel->write_buffer32(core.attack_target->get_info_location()); pduel->write_buffer32(core.attack_target->get_info_location());
} else } else
...@@ -2567,7 +2575,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2567,7 +2575,7 @@ int32 field::process_battle_command(uint16 step) {
} }
//core.units.begin()->arg1 ---> is rollbacked //core.units.begin()->arg1 ---> is rollbacked
if(!core.units.begin()->arg1) { if(!core.units.begin()->arg1) {
raise_single_event(core.attacker, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0); raise_single_event(core.attacker, 0, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0);
raise_event(core.attacker, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0); raise_event(core.attacker, EVENT_ATTACK_ANNOUNCE, 0, 0, 0, infos.turn_player, 0);
} }
core.units.begin()->arg2 = (core.attacker->current.controler << 16) + core.attacker->fieldid; core.units.begin()->arg2 = (core.attacker->current.controler << 16) + core.attacker->fieldid;
...@@ -2735,9 +2743,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2735,9 +2743,9 @@ int32 field::process_battle_command(uint16 step) {
core.pre_field[1] = core.attack_target->fieldid; core.pre_field[1] = core.attack_target->fieldid;
else else
core.pre_field[1] = 0; core.pre_field[1] = 0;
raise_single_event(core.attacker, EVENT_BATTLE_START, 0, 0, 0, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLE_START, 0, 0, 0, 0, 0);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_BATTLE_START, 0, 0, 0, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLE_START, 0, 0, 0, 0, 1);
raise_event((card*)0, EVENT_BATTLE_START, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_BATTLE_START, 0, 0, 0, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
...@@ -2783,11 +2791,11 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2783,11 +2791,11 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 12: { case 12: {
raise_single_event(core.attacker, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0);
if(core.attack_target) { if(core.attack_target) {
if(core.attack_target->temp.position & POS_FACEDOWN) if(core.attack_target->temp.position & POS_FACEDOWN)
core.pre_field[1] = core.attack_target->fieldid; core.pre_field[1] = core.attack_target->fieldid;
raise_single_event(core.attack_target, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 1);
} }
raise_event((card*)0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_BATTLE_CONFIRM, 0, 0, 0, 0, 0);
process_single_event(); process_single_event();
...@@ -2834,9 +2842,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2834,9 +2842,9 @@ int32 field::process_battle_command(uint16 step) {
} }
case 14: { case 14: {
infos.phase = PHASE_DAMAGE_CAL; infos.phase = PHASE_DAMAGE_CAL;
raise_single_event(core.attacker, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 0); raise_single_event(core.attacker, 0, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 0);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 1); raise_single_event(core.attack_target, 0, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 1);
raise_event((card*)0, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_PRE_DAMAGE_CALCULATE, 0, 0, 0, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
...@@ -3015,15 +3023,15 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3015,15 +3023,15 @@ int32 field::process_battle_command(uint16 step) {
else core.temp_var[1] = 2; else core.temp_var[1] = 2;
if(!damchange) { if(!damchange) {
if(core.battle_damage[0]) { if(core.battle_damage[0]) {
raise_single_event(core.attacker, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]); raise_single_event(core.attacker, 0, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]); raise_single_event(core.attack_target, 0, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]);
raise_event((card*)reason_card, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]); raise_event((card*)reason_card, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 0, core.battle_damage[0]);
} }
if(core.battle_damage[1]) { if(core.battle_damage[1]) {
raise_single_event(core.attacker, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]); raise_single_event(core.attacker, 0, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]); raise_single_event(core.attack_target, 0, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]);
raise_event((card*)reason_card, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]); raise_event((card*)reason_card, EVENT_PRE_BATTLE_DAMAGE, 0, 0, reason_card->current.controler, 1, core.battle_damage[1]);
} }
} }
...@@ -3061,12 +3069,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3061,12 +3069,12 @@ int32 field::process_battle_command(uint16 step) {
if(!damchange) { if(!damchange) {
if(core.battle_damage[0]) { if(core.battle_damage[0]) {
damage(0, REASON_BATTLE, reason_player, reason_card, 0, core.battle_damage[0]); damage(0, REASON_BATTLE, reason_player, reason_card, 0, core.battle_damage[0]);
raise_single_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 0, core.battle_damage[0]); raise_single_event(reason_card, 0, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 0, core.battle_damage[0]);
raise_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 0, core.battle_damage[0]); raise_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 0, core.battle_damage[0]);
} }
if(core.battle_damage[1]) { if(core.battle_damage[1]) {
damage(0, REASON_BATTLE, reason_player, reason_card, 1, core.battle_damage[1]); damage(0, REASON_BATTLE, reason_player, reason_card, 1, core.battle_damage[1]);
raise_single_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 1, core.battle_damage[1]); raise_single_event(reason_card, 0, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 1, core.battle_damage[1]);
raise_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 1, core.battle_damage[1]); raise_event(reason_card, EVENT_BATTLE_DAMAGE, 0, 0, reason_player, 1, core.battle_damage[1]);
} }
} else { } else {
...@@ -3151,9 +3159,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3151,9 +3159,9 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 20: { case 20: {
raise_single_event(core.attacker, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 1);
raise_event((card*)0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0); raise_event((card*)0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
...@@ -3168,9 +3176,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3168,9 +3176,9 @@ int32 field::process_battle_command(uint16 step) {
core.new_ochain.splice(core.new_ochain.begin(), core.new_ochain_b); core.new_ochain.splice(core.new_ochain.begin(), core.new_ochain_b);
core.flip_chain.splice(core.flip_chain.begin(), core.flip_chain_b); core.flip_chain.splice(core.flip_chain.begin(), core.flip_chain_b);
if(core.units.begin()->arg1) { if(core.units.begin()->arg1) {
raise_single_event(core.attacker, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 0);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 1);
raise_event((card*)0, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 0); raise_event((card*)0, EVENT_BATTLED, 0, 0, PLAYER_NONE, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
...@@ -3201,14 +3209,14 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3201,14 +3209,14 @@ int32 field::process_battle_command(uint16 step) {
card_set ing; card_set ing;
card_set ed; card_set ed;
if(core.attacker->is_status(STATUS_BATTLE_DESTROYED)) { if(core.attacker->is_status(STATUS_BATTLE_DESTROYED)) {
raise_single_event(core.attack_target, EVENT_BATTLE_DESTROYING, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYING, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 1);
raise_single_event(core.attacker, EVENT_BATTLE_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0);
ing.insert(core.attack_target); ing.insert(core.attack_target);
ed.insert(core.attacker); ed.insert(core.attacker);
} }
if(core.attack_target && core.attack_target->is_status(STATUS_BATTLE_DESTROYED)) { if(core.attack_target && core.attack_target->is_status(STATUS_BATTLE_DESTROYED)) {
raise_single_event(core.attacker, EVENT_BATTLE_DESTROYING, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 0); raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYING, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 0);
raise_single_event(core.attack_target, EVENT_BATTLE_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1); raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1);
ing.insert(core.attacker); ing.insert(core.attacker);
ed.insert(core.attack_target); ed.insert(core.attack_target);
} }
...@@ -3216,9 +3224,9 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3216,9 +3224,9 @@ int32 field::process_battle_command(uint16 step) {
raise_event(&ing, EVENT_BATTLE_DESTROYING, 0, 0, 0, 0, 0); raise_event(&ing, EVENT_BATTLE_DESTROYING, 0, 0, 0, 0, 0);
if(ed.size()) if(ed.size())
raise_event(&ed, EVENT_BATTLE_DESTROYED, 0, 0, 0, 0, 0); raise_event(&ed, EVENT_BATTLE_DESTROYED, 0, 0, 0, 0, 0);
raise_single_event(core.attacker, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 0); raise_single_event(core.attacker, 0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 0);
if(core.attack_target) if(core.attack_target)
raise_single_event(core.attack_target, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 1); raise_single_event(core.attack_target, 0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 1);
raise_event((card*)0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
...@@ -3619,7 +3627,7 @@ int32 field::add_chain(uint16 step) { ...@@ -3619,7 +3627,7 @@ int32 field::add_chain(uint16 step) {
(*cit)->create_relation(clit->triggering_effect); (*cit)->create_relation(clit->triggering_effect);
if(clit->triggering_effect->flag & EFFECT_FLAG_CARD_TARGET) { if(clit->triggering_effect->flag & EFFECT_FLAG_CARD_TARGET) {
for(cit = clit->target_cards->container.begin(); cit != clit->target_cards->container.end(); ++cit) for(cit = clit->target_cards->container.begin(); cit != clit->target_cards->container.end(); ++cit)
raise_single_event(*cit, EVENT_BECOME_TARGET, clit->triggering_effect, 0, clit->triggering_player, 0, clit->chain_count); raise_single_event(*cit, 0, EVENT_BECOME_TARGET, clit->triggering_effect, 0, clit->triggering_player, 0, clit->chain_count);
process_single_event(); process_single_event();
if(clit->target_cards->container.size()) if(clit->target_cards->container.size())
raise_event(&clit->target_cards->container, EVENT_BECOME_TARGET, clit->triggering_effect, 0, clit->triggering_player, clit->triggering_player, clit->chain_count); raise_event(&clit->target_cards->container, EVENT_BECOME_TARGET, clit->triggering_effect, 0, clit->triggering_player, clit->triggering_player, clit->chain_count);
......
...@@ -16,14 +16,12 @@ function c13293158.initial_effect(c) ...@@ -16,14 +16,12 @@ function c13293158.initial_effect(c)
e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetCode(EVENT_ATTACK_ANNOUNCE)
e2:SetOperation(c13293158.atkop) e2:SetOperation(c13293158.atkop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--damage --destroy
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(13293158,0)) e3:SetDescription(aux.Stringid(13293158,0))
e3:SetCategory(CATEGORY_DAMAGE) e3:SetCategory(CATEGORY_DESTROY)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_BATTLE_DAMAGE) e3:SetCode(EVENT_BATTLE_DAMAGE)
e3:SetCondition(c13293158.condition)
e3:SetTarget(c13293158.target) e3:SetTarget(c13293158.target)
e3:SetOperation(c13293158.activate) e3:SetOperation(c13293158.activate)
c:RegisterEffect(e3) c:RegisterEffect(e3)
...@@ -46,9 +44,6 @@ end ...@@ -46,9 +44,6 @@ end
function c13293158.aclimit(e,re,tp) function c13293158.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) return re:IsHasType(EFFECT_TYPE_ACTIVATE)
end end
function c13293158.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c13293158.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c13293158.filter(c) function c13293158.filter(c)
return c:IsFacedown() and c:IsDestructable() return c:IsFacedown() and c:IsDestructable()
end end
......
...@@ -47,6 +47,7 @@ function c21790410.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -47,6 +47,7 @@ function c21790410.eqop(e,tp,eg,ep,ev,re,r,rp)
if tc then if tc then
if not Duel.Equip(tp,tc,c,true) then return end if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
...@@ -55,7 +56,7 @@ function c21790410.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -55,7 +56,7 @@ function c21790410.eqop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c21790410.eqlimit(e,c) function c21790410.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled() return e:GetOwner()==c
end end
function c21790410.cfilter(c,ec,tp) function c21790410.cfilter(c,ec,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp)
......
...@@ -21,9 +21,8 @@ function c21977828.initial_effect(c) ...@@ -21,9 +21,8 @@ function c21977828.initial_effect(c)
e3:SetDescription(aux.Stringid(21977828,1)) e3:SetDescription(aux.Stringid(21977828,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE) e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(c21977828.spcon) e3:SetCondition(c21977828.spcon)
e3:SetTarget(c21977828.sptg) e3:SetTarget(c21977828.sptg)
e3:SetOperation(c21977828.spop) e3:SetOperation(c21977828.spop)
......
--甲虫装機 グルフ
function c2461031.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetDescription(aux.Stringid(2461031,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c2461031.eqtg)
e1:SetOperation(c2461031.eqop)
c:RegisterEffect(e1)
--equip effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENCE)
e3:SetValue(100)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_UPDATE_LEVEL)
e4:SetValue(2)
c:RegisterEffect(e4)
--lvup
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(2461031,1))
e5:SetProperty(EFFECT_FLAG_CARD_TARGET)
e5:SetType(EFFECT_TYPE_IGNITION)
e5:SetRange(LOCATION_SZONE)
e5:SetCost(c2461031.lvcost)
e5:SetTarget(c2461031.lvtg)
e5:SetOperation(c2461031.lvop)
c:RegisterEffect(e5)
end
function c2461031.filter(c)
return c:IsSetCard(0x56) and c:IsType(TYPE_MONSTER) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c2461031.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c2461031.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c2461031.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c2461031.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c2461031.eqlimit)
tc:RegisterEffect(e1)
end
end
function c2461031.eqlimit(e,c)
return e:GetOwner()==c
end
function c2461031.lvcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c2461031.lvfilter(c)
return c:IsFaceup() and not c:IsType(TYPE_XYZ)
end
function c2461031.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c2461031.lvfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c2461031.lvfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c2461031.lvfilter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c2461031.lvop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local opt=Duel.SelectOption(tp,aux.Stringid(2461031,2),aux.Stringid(2461031,3))
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(opt+1)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
end
end
--甲虫装機の手甲
function c259314.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(c259314.condition)
e1:SetTarget(c259314.target)
e1:SetOperation(c259314.operation)
c:RegisterEffect(e1)
end
function c259314.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c259314.filter(c)
return c:IsFaceup() and c:IsSetCard(0x56)
end
function c259314.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c259314.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c259314.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c259314.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c259314.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
c:CancelToGrave()
--Atk/def
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_DEFENCE)
e1:SetValue(1000)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c259314.eqlimit)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e3:SetReset(RESET_EVENT+0x1fe0000)
e3:SetValue(c259314.efilter)
c:RegisterEffect(e3,true)
end
end
function c259314.eqlimit(e,c)
return c:IsSetCard(0x56)
end
function c259314.efilter(e,re)
return e:GetOwnerPlayer()~=re:GetOwnerPlayer()
end
--甲虫装機 エクサスタッグ
function c26211048.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,c26211048.xyzfilter,2)
c:EnableReviveLimit()
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(26211048,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c26211048.eqcost)
e1:SetTarget(c26211048.eqtg)
e1:SetOperation(c26211048.eqop)
c:RegisterEffect(e1)
end
function c26211048.xyzfilter(c)
return c:IsRace(RACE_INSECT) and c:GetLevel()==5
end
function c26211048.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c26211048.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsType(TYPE_MONSTER) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsType,tp,0,LOCATION_GRAVE+LOCATION_MZONE,1,nil,TYPE_MONSTER) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,Card.IsType,tp,0,LOCATION_GRAVE+LOCATION_MZONE,1,1,nil,TYPE_MONSTER)
if g:GetFirst():IsLocation(LOCATION_GRAVE) then
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
end
end
function c26211048.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 or c:IsFacedown() or not c:IsRelateToEffect(e) then
if tc:IsLocation(LOCATION_MZONE) then Duel.SendtoGrave(tc,REASON_EFFECT) end
return
end
Duel.Equip(tp,tc,c,false)
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c44505297.eqlimit)
tc:RegisterEffect(e1)
if tc:IsFaceup() then
local atk=tc:GetTextAttack()/2
if atk<0 then atk=0 end
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+0x1fe0000)
e2:SetValue(atk)
tc:RegisterEffect(e2)
local def=tc:GetTextDefence()/2
if def<0 then def=0 end
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENCE)
e3:SetReset(RESET_EVENT+0x1fe0000)
e3:SetValue(def)
tc:RegisterEffect(e3)
end
end
function c44505297.eqlimit(e,c)
return e:GetOwner()==c
end
--ライトレイ ディアボロス
function c30126992.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c30126992.spcon)
c:RegisterEffect(e1)
--spsummon limit
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(30126992,0))
e3:SetCategory(CATEGORY_TODECK)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCost(c30126992.tdcost)
e3:SetTarget(c30126992.tdtg)
e3:SetOperation(c30126992.tdop)
c:RegisterEffect(e3)
end
function c30126992.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)==0 then return false end
local g=Duel.GetMatchingGroup(Card.IsAttribute,c:GetControler(),LOCATION_GRAVE,0,nil,ATTRIBUTE_LIGHT)
local ct=g:GetClassCount(Card.GetCode)
return ct>4
end
function c30126992.cfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemove()
end
function c30126992.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c30126992.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c30126992.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c30126992.filter(c)
return c:IsFacedown() and c:IsAbleToDeck()
end
function c30126992.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c30126992.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c30126992.filter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c30126992.filter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
end
function c30126992.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFacedown() then
Duel.ConfirmCards(tp,tc)
local opt=Duel.SelectOption(tp,aux.Stringid(30126992,1),aux.Stringid(30126992,2))
Duel.SendtoDeck(tc,nil,opt,REASON_EFFECT)
end
end
...@@ -43,7 +43,8 @@ function c36099620.acop(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,7 +43,8 @@ function c36099620.acop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c36099620.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) function c36099620.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetCounter(0x5)>=2 end if chk==0 then return not e:GetHandler():IsReason(REASON_RULE)
and e:GetHandler():GetCounter(0x5)>=2 end
return true return true
end end
function c36099620.desrepop(e,tp,eg,ep,ev,re,r,rp) function c36099620.desrepop(e,tp,eg,ep,ev,re,r,rp)
......
--甲虫装機 ウィーグ
function c38450736.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetDescription(aux.Stringid(38450736,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c38450736.eqtg)
e1:SetOperation(c38450736.eqop)
c:RegisterEffect(e1)
--equip effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(1000)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENCE)
e3:SetValue(1000)
c:RegisterEffect(e3)
--atkup
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(38450736,1))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c38450736.atkcon)
e3:SetTarget(c38450736.atktg)
e3:SetOperation(c38450736.atkop)
c:RegisterEffect(e3)
end
function c38450736.filter(c)
return c:IsSetCard(0x56) and c:IsType(TYPE_MONSTER) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c38450736.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c38450736.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c38450736.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c38450736.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c38450736.eqlimit)
tc:RegisterEffect(e1)
end
end
function c38450736.eqlimit(e,c)
return e:GetOwner()==c
end
function c38450736.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=c:GetPreviousEquipTarget()
e:SetLabelObject(ec)
return c:IsPreviousLocation(LOCATION_SZONE) and not c:IsReason(REASON_LOST_TARGET)
end
function c38450736.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ec=e:GetLabelObject()
ec:CreateEffectRelation(e)
end
function c38450736.atkop(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetLabelObject()
if ec:IsLocation(LOCATION_MZONE) and ec:IsFaceup() and ec:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
ec:RegisterEffect(e1)
end
end
--ライトレイ ダイダロス
function c38737148.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c38737148.spcon)
c:RegisterEffect(e1)
--spsummon limit
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
--remove
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(38737148,0))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_MZONE)
e3:SetTarget(c38737148.destg)
e3:SetOperation(c38737148.desop)
c:RegisterEffect(e3)
end
function c38737148.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_GRAVE,0,4,nil,ATTRIBUTE_LIGHT)
end
function c38737148.desfilter(c)
return c:IsDestructable() and c:GetSequence()==5
and Duel.IsExistingTarget(Card.IsDestructable,0,LOCATION_ONFIELD,LOCATION_ONFIELD,2,c)
end
function c38737148.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c38737148.desfilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c38737148.desfilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,g1:GetFirst())
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0)
end
function c38737148.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(g,REASON_EFFECT)
end
...@@ -44,7 +44,7 @@ end ...@@ -44,7 +44,7 @@ end
function c39910367.op(e,tp,eg,ep,ev,re,r,rp) function c39910367.op(e,tp,eg,ep,ev,re,r,rp)
local te=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT) local te=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_EFFECT)
local c=te:GetHandler() local c=te:GetHandler()
if te:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsType(TYPE_SPELL) and c~=e:GetHandler() then if te:IsHasType(EFFECT_TYPE_ACTIVATE) and c:IsType(TYPE_SPELL) and c:GetSequence()~=5 then
e:GetHandler():AddCounter(0x3001,1) e:GetHandler():AddCounter(0x3001,1)
end end
end end
...@@ -55,7 +55,8 @@ function c39910367.rop(e,tp,eg,ep,ev,re,r,rp) ...@@ -55,7 +55,8 @@ function c39910367.rop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RemoveCounter(ep,0x3001,ev,REASON_EFFECT) e:GetHandler():RemoveCounter(ep,0x3001,ev,REASON_EFFECT)
end end
function c39910367.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) function c39910367.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetCounter(0x3001)>0 end if chk==0 then return not e:GetHandler():IsReason(REASON_RULE)
and e:GetHandler():GetCounter(0x3001)>0 end
return Duel.SelectYesNo(tp,aux.Stringid(39910367,1)) return Duel.SelectYesNo(tp,aux.Stringid(39910367,1))
end end
function c39910367.desrepop(e,tp,eg,ep,ev,re,r,rp) function c39910367.desrepop(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -4,17 +4,12 @@ function c423705.initial_effect(c) ...@@ -4,17 +4,12 @@ function c423705.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(423705,0)) e1:SetDescription(aux.Stringid(423705,0))
e1:SetCategory(CATEGORY_DESTROY) e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_EQUIP) e1:SetCode(EVENT_EQUIP)
e1:SetTarget(c423705.descon)
e1:SetTarget(c423705.destg) e1:SetTarget(c423705.destg)
e1:SetOperation(c423705.desop) e1:SetOperation(c423705.desop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c423705.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():GetEquipTarget()==e:GetHandler()
end
function c423705.destg(e,tp,eg,ep,ev,re,r,rp,chk) function c423705.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
eg:GetFirst():CreateEffectRelation(e) eg:GetFirst():CreateEffectRelation(e)
......
...@@ -8,11 +8,9 @@ function c43366227.initial_effect(c) ...@@ -8,11 +8,9 @@ function c43366227.initial_effect(c)
e1:SetDescription(aux.Stringid(43366227,0)) e1:SetDescription(aux.Stringid(43366227,0))
e1:SetCategory(CATEGORY_DAMAGE) e1:SetCategory(CATEGORY_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetCode(EVENT_EQUIP) e1:SetCode(EVENT_EQUIP)
e1:SetTarget(c43366227.damcon)
e1:SetTarget(c43366227.damtg) e1:SetTarget(c43366227.damtg)
e1:SetOperation(c43366227.damop) e1:SetOperation(c43366227.damop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
...@@ -40,9 +38,6 @@ function c43366227.initial_effect(c) ...@@ -40,9 +38,6 @@ function c43366227.initial_effect(c)
e3:SetOperation(c43366227.desop) e3:SetOperation(c43366227.desop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c43366227.damcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():GetEquipTarget()==e:GetHandler()
end
function c43366227.damtg(e,tp,eg,ep,ev,re,r,rp,chk) function c43366227.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
Duel.SetTargetPlayer(1-tp) Duel.SetTargetPlayer(1-tp)
......
...@@ -7,6 +7,7 @@ function c44505297.initial_effect(c) ...@@ -7,6 +7,7 @@ function c44505297.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(44505297,0)) e1:SetDescription(aux.Stringid(44505297,0))
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP) e1:SetCategory(CATEGORY_EQUIP)
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetTarget(c44505297.eqcon) e1:SetTarget(c44505297.eqcon)
...@@ -34,7 +35,8 @@ function c44505297.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) ...@@ -34,7 +35,8 @@ function c44505297.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsType,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,TYPE_MONSTER) end and Duel.IsExistingTarget(Card.IsType,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,TYPE_MONSTER) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsType,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,TYPE_MONSTER) local g=Duel.SelectTarget(tp,Card.IsType,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,TYPE_MONSTER)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0)
end end
function c44505297.eqop(e,tp,eg,ep,ev,re,r,rp) function c44505297.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -43,26 +45,31 @@ function c44505297.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -43,26 +45,31 @@ function c44505297.eqop(e,tp,eg,ep,ev,re,r,rp)
or not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end or not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end
Duel.Equip(tp,tc,c,false) Duel.Equip(tp,tc,c,false)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c44505297.eqlimit) e1:SetValue(c44505297.eqlimit)
tc:RegisterEffect(e1) tc:RegisterEffect(e1)
local atk=tc:GetTextAttack()/2
if atk<0 then atk=0 end
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP) e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetReset(RESET_EVENT+0x1fe0000) e2:SetReset(RESET_EVENT+0x1fe0000)
e2:SetValue(tc:GetTextAttack()/2) e2:SetValue(atk)
tc:RegisterEffect(e2) tc:RegisterEffect(e2)
local def=tc:GetTextDefence()/2
if def<0 then def=0 end
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP) e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_DEFENCE) e3:SetCode(EFFECT_UPDATE_DEFENCE)
e3:SetReset(RESET_EVENT+0x1fe0000) e3:SetReset(RESET_EVENT+0x1fe0000)
e3:SetValue(tc:GetTextDefence()/2) e3:SetValue(def)
tc:RegisterEffect(e3) tc:RegisterEffect(e3)
end end
function c44505297.eqlimit(e,c) function c44505297.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled() return e:GetOwner()==c
end end
function c44505297.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) function c44505297.tgcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
......
--ライトレイ ギア・フリード
function c4722253.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c4722253.spcon)
c:RegisterEffect(e1)
--spsummon limit
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
--negate
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(4722253,0))
e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCode(EVENT_CHAINING)
e3:SetCondition(c4722253.negcon)
e3:SetCost(c4722253.negcost)
e3:SetTarget(c4722253.negtg)
e3:SetOperation(c4722253.negop)
c:RegisterEffect(e3)
end
function c4722253.spcon(e,c)
if c==nil then return true end
if Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)==0 then return false end
local g=Duel.GetMatchingGroup(Card.IsAttribute,c:GetControler(),LOCATION_GRAVE,0,nil,ATTRIBUTE_LIGHT)
local ct=g:GetClassCount(Card.GetCode)
return ct>4
end
function c4722253.cfilter(c)
return c:IsFaceup() and not c:IsRace(RACE_WARRIOR)
end
function c4722253.negcon(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainInactivatable(ev)
and not Duel.IsExistingMatchingCard(c4722253.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c4722253.cfilter2(c)
return c:IsRace(RACE_WARRIOR) and c:IsAbleToRemove()
end
function c4722253.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c4722253.cfilter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c4722253.cfilter2,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c4722253.negtg(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)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c4722253.negop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateActivation(ev)
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
...@@ -29,7 +29,7 @@ function c48505422.spcon(e,c) ...@@ -29,7 +29,7 @@ function c48505422.spcon(e,c)
Duel.IsExistingMatchingCard(c48505422.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) Duel.IsExistingMatchingCard(c48505422.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end end
function c48505422.rlcon(e,tp,eg,ep,ev,re,r,rp) function c48505422.rlcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsOnField() return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end end
function c48505422.filter(c) function c48505422.filter(c)
return c:IsSetCard(0x3d) and c:GetCode()~=48505422 and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() return c:IsSetCard(0x3d) and c:GetCode()~=48505422 and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
......
--ファイナル・インゼクション
function c51549976.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c51549976.cost)
e1:SetTarget(c51549976.target)
e1:SetOperation(c51549976.activate)
c:RegisterEffect(e1)
end
function c51549976.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x56) and c:IsAbleToGraveAsCost()
end
function c51549976.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c51549976.cfilter,tp,LOCATION_ONFIELD,0,5,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c51549976.cfilter,tp,LOCATION_ONFIELD,0,5,5,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c51549976.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c51549976.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
if Duel.Destroy(g,REASON_EFFECT)==0 then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetCondition(c51549976.actcon)
e1:SetValue(c51549976.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c51549976.actcon(e)
local ph=Duel.GetCurrentPhase()
return ph>=PHASE_BATTLE and ph<=PHASE_DAMAGE_CAL
end
function c51549976.aclimit(e,re,tp)
return re:GetHandler():IsType(TYPE_MONSTER) and re:GetHandler():IsLocation(LOCATION_HAND+LOCATION_GRAVE)
end
...@@ -39,7 +39,7 @@ function c525110.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -39,7 +39,7 @@ function c525110.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
t1:RegisterEffect(e1) t1:RegisterEffect(e1)
if t2 then if t2 then
Duel.SpecialSummonStep(t2,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonStep(t2,0,tp,tp,false,false,POS_FACEUP)
local e2=e1:Clone() local e2=e1:Clone()
t2:RegisterEffect(e2) t2:RegisterEffect(e2)
end end
......
--No.25 重装光学撮影機フォーカス・フォース
function c64554883.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,6),2)
c:EnableReviveLimit()
--disable
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64554883,0))
e1:SetCategory(CATEGORY_DISABLE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1c0)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c64554883.cost)
e1:SetTarget(c64554883.target)
e1:SetOperation(c64554883.operation)
c:RegisterEffect(e1)
end
function c64554883.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c64554883.filter(c)
return c:IsFaceup() and c:IsLevelAbove(5) and not c:IsDisabled() and c:IsType(TYPE_EFFECT)
end
function c64554883.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and c64554883.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c64554883.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c64554883.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c64554883.operation(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e2)
end
end
--甲虫装機 ギガグリオル
function c65844845.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(65844845,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_GRAVE)
e1:SetCost(c65844845.eqcost)
e1:SetTarget(c65844845.eqtg)
e1:SetOperation(c65844845.eqop)
c:RegisterEffect(e1)
--equip effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_SET_BASE_ATTACK)
e2:SetValue(2000)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_PIERCE)
c:RegisterEffect(e3)
end
function c65844845.cfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAbleToRemoveAsCost()
end
function c65844845.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c65844845.cfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c65844845.cfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c65844845.filter(c)
return c:IsFaceup() and c:IsSetCard(0x56)
end
function c65844845.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c65844845.filter(chkc) end
if chk==0 then return Duel.GetFlagEffect(tp,65844845)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c65844845.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c65844845.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.RegisterFlagEffect(tp,65844845,RESET_PHASE+PHASE_END,0,1)
end
function c65844845.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) then
return
end
Duel.Equip(tp,c,tc,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c65844845.eqlimit)
c:RegisterEffect(e1)
end
function c65844845.eqlimit(e,c)
return c:IsSetCard(0x56)
end
--甲虫装機 リュシオル
function c66066482.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(66066482,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c66066482.eqtg)
e1:SetOperation(c66066482.eqop)
c:RegisterEffect(e1)
--equip effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_LEVEL)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(100)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_UPDATE_DEFENCE)
e4:SetValue(100)
c:RegisterEffect(e4)
--confirm
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(66066482,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_EQUIP)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(c66066482.cfcon)
e3:SetTarget(c66066482.cftg)
e3:SetOperation(c66066482.cfop)
c:RegisterEffect(e3)
end
function c66066482.filter(c)
return c:IsSetCard(0x56) and c:IsType(TYPE_MONSTER) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c66066482.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingMatchingCard(c66066482.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c66066482.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,c66066482.filter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c66066482.eqlimit)
tc:RegisterEffect(e1)
end
end
function c66066482.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled()
end
function c66066482.cfcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst():IsSetCard(0x56)
end
function c66066482.cftg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) end
end
function c66066482.cfop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_ONFIELD,nil)
if g:GetCount()>0 then
Duel.ConfirmCards(tp,g)
end
end
--ドラゴン・ウィッチ-ドラゴンの守護者-
function c67511500.initial_effect(c)
--cannot be battle target
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_DRAGON))
e1:SetValue(1)
c:RegisterEffect(e1)
--destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetTarget(c67511500.desreptg)
c:RegisterEffect(e2)
end
function c67511500.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsReason(REASON_REPLACE)
and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_HAND,0,1,nil,RACE_DRAGON) end
if Duel.SelectYesNo(tp,aux.Stringid(67511500,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,Card.IsRace,tp,LOCATION_HAND,0,1,1,nil,RACE_DRAGON)
Duel.SendtoGrave(g,REASON_EFFECT+REASON_REPLACE)
return true
else return false end
end
...@@ -47,6 +47,7 @@ function c68184115.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -47,6 +47,7 @@ function c68184115.eqop(e,tp,eg,ep,ev,re,r,rp)
if tc then if tc then
if not Duel.Equip(tp,tc,c,true) then return end if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
...@@ -55,7 +56,7 @@ function c68184115.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -55,7 +56,7 @@ function c68184115.eqop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c68184115.eqlimit(e,c) function c68184115.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled() return e:GetOwner()==c
end end
function c68184115.cfilter(c,ec,tp) function c68184115.cfilter(c,ec,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp)
......
...@@ -56,6 +56,7 @@ function c69207766.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -56,6 +56,7 @@ function c69207766.eqop(e,tp,eg,ep,ev,re,r,rp)
if tc then if tc then
if not Duel.Equip(tp,tc,c,true) then return end if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
...@@ -64,7 +65,7 @@ function c69207766.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -64,7 +65,7 @@ function c69207766.eqop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c69207766.eqlimit(e,c) function c69207766.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled() return e:GetOwner()==c
end end
function c69207766.descost(e,tp,eg,ep,ev,re,r,rp,chk) function c69207766.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
......
--ゼクト・コンバージョン
function c74854609.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(c74854609.condition)
e1:SetTarget(c74854609.target)
e1:SetOperation(c74854609.operation)
c:RegisterEffect(e1)
end
function c74854609.condition(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
return d:IsFaceup() and d:IsSetCard(0x56) and a:IsControler(1-tp)
end
function c74854609.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local a=Duel.GetAttacker()
if chkc then return a==chkc end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and a:IsOnField() and a:IsCanBeEffectTarget(e) end
Duel.SetTargetCard(a)
end
function c74854609.eqlimit(e,c)
return c==e:GetLabelObject()
end
function c74854609.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=Duel.GetAttackTarget()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsAttackable() and not tc:IsStatus(STATUS_ATTACK_CANCELED)
and ec:IsLocation(LOCATION_MZONE) and ec:IsFaceup() then
Duel.Equip(tp,ec,tc)
--Add Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c74854609.eqlimit)
e1:SetLabelObject(tc)
ec:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_CONTROL)
e2:SetValue(tp)
e2:SetReset(RESET_EVENT+0x1fc0000)
e2:SetCondition(c74854609.con)
e2:SetLabelObject(ec)
tc:RegisterEffect(e2)
end
end
function c74854609.con(e)
local c=e:GetLabelObject()
local h=e:GetHandler()
return c:IsHasCardTarget(h)
end
--甲虫装機の魔弓 ゼクトアロー
function c87047074.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(c87047074.target)
e1:SetOperation(c87047074.operation)
c:RegisterEffect(e1)
--Atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(500)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(c87047074.eqlimit)
c:RegisterEffect(e3)
--chain limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetRange(LOCATION_SZONE)
e4:SetCode(EVENT_CHAINING)
e4:SetCondition(c87047074.chcon)
e4:SetOperation(c87047074.chop)
c:RegisterEffect(e4)
end
function c87047074.eqlimit(e,c)
return c:IsSetCard(0x56)
end
function c87047074.filter(c,tp)
return c:IsFaceup() and c:IsSetCard(0x56)
end
function c87047074.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c87047074.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c87047074.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c87047074.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c87047074.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function c87047074.chcon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler()==e:GetHandler():GetEquipTarget()
end
function c87047074.chop(e,tp,eg,ep,ev,re,r,rp)
Duel.SetChainLimit(c87047074.chlimit)
end
function c87047074.chlimit(e,ep,tp)
return ep==tp
end
...@@ -13,7 +13,7 @@ function c88095331.initial_effect(c) ...@@ -13,7 +13,7 @@ function c88095331.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c88095331.condition(e,tp,eg,ep,ev,re,r,rp) function c88095331.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsOnField() return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end end
function c88095331.filter(c,e,tp) function c88095331.filter(c,e,tp)
return c:IsSetCard(0x604e) and c:IsCanBeSpecialSummoned(e,155,tp,false,false) return c:IsSetCard(0x604e) and c:IsCanBeSpecialSummoned(e,155,tp,false,false)
......
--竜魔人 クィーンドラグーン
function c90726340.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,4),2)
c:EnableReviveLimit()
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetTarget(c90726340.indtg)
e1:SetValue(1)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(90726340,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c90726340.spcost)
e2:SetTarget(c90726340.sptg)
e2:SetOperation(c90726340.spop)
c:RegisterEffect(e2)
end
function c90726340.indtg(e,c)
return c:IsRace(RACE_DRAGON) and c:GetCode()~=90726340
end
function c90726340.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c90726340.spfilter(c,e,tp)
return c:IsLevelAbove(5) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c90726340.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c90726340.spfilter(c,e,tp) end
if chk==0 then return Duel.IsExistingTarget(c90726340.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c90726340.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c90726340.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e2,true)
local e3=Effect.CreateEffect(e:GetHandler())
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_ATTACK)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e3,true)
Duel.SpecialSummonComplete()
end
end
--ライトレイ ソーサラー
function c91349449.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c91349449.spcon)
c:RegisterEffect(e1)
--spsummon limit
local e2=Effect.CreateEffect(c)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e2)
--remove
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(91349449,0))
e3:SetCategory(CATEGORY_TODECK+CATEGORY_REMOVE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_MZONE)
e3:SetCost(c91349449.rmcost)
e3:SetTarget(c91349449.rmtg)
e3:SetOperation(c91349449.rmop)
c:RegisterEffect(e3)
end
function c91349449.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_REMOVED,0,3,nil,ATTRIBUTE_LIGHT)
end
function c91349449.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_PHASE+PHASE_END)
e:GetHandler():RegisterEffect(e1,true)
end
function c91349449.filter1(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToDeck()
end
function c91349449.filter2(c)
return c:IsFaceup() and c:IsAbleToRemove()
end
function c91349449.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c91349449.filter1,tp,LOCATION_REMOVED,0,1,nil)
and Duel.IsExistingTarget(c91349449.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectTarget(tp,c91349449.filter1,tp,LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,1,0,0)
e:SetLabelObject(g1:GetFirst())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectTarget(tp,c91349449.filter2,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g2,1,0,0)
end
function c91349449.rmop(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 Duel.SendtoDeck(tc1,nil,2,REASON_EFFECT)~=0 then
if tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
Duel.Remove(tc2,POS_FACEUP,REASON_EFFECT)
end
end
end
...@@ -21,9 +21,8 @@ function c94573223.initial_effect(c) ...@@ -21,9 +21,8 @@ function c94573223.initial_effect(c)
e3:SetDescription(aux.Stringid(94573223,1)) e3:SetDescription(aux.Stringid(94573223,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE) e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(c94573223.spcon) e3:SetCondition(c94573223.spcon)
e3:SetTarget(c94573223.sptg) e3:SetTarget(c94573223.sptg)
e3:SetOperation(c94573223.spop) e3:SetOperation(c94573223.spop)
......
...@@ -52,6 +52,7 @@ function c95395761.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -52,6 +52,7 @@ function c95395761.eqop(e,tp,eg,ep,ev,re,r,rp)
if tc then if tc then
if not Duel.Equip(tp,tc,c,true) then return end if not Duel.Equip(tp,tc,c,true) then return end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
...@@ -60,7 +61,7 @@ function c95395761.eqop(e,tp,eg,ep,ev,re,r,rp) ...@@ -60,7 +61,7 @@ function c95395761.eqop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
function c95395761.eqlimit(e,c) function c95395761.eqlimit(e,c)
return e:GetOwner()==c and not c:IsDisabled() return e:GetOwner()==c
end end
function c95395761.reptg(e,tp,eg,ep,ev,re,r,rp,chk) function c95395761.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
......
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