Commit 339c1aa3 authored by Argon.Sun's avatar Argon.Sun

spsummon once

parent 7168f086
...@@ -63,6 +63,7 @@ card::card() { ...@@ -63,6 +63,7 @@ card::card() {
unique_code = 0; unique_code = 0;
assume_type = 0; assume_type = 0;
assume_value = 0; assume_value = 0;
spsummon_code = 0;
current.controler = PLAYER_NONE; current.controler = PLAYER_NONE;
} }
card::~card() { card::~card() {
...@@ -1854,6 +1855,8 @@ int32 card::is_special_summonable(uint8 playerid) { ...@@ -1854,6 +1855,8 @@ int32 card::is_special_summonable(uint8 playerid) {
return FALSE; return FALSE;
if(pduel->game_field->check_unique_onfield(this, playerid)) if(pduel->game_field->check_unique_onfield(this, playerid))
return FALSE; return FALSE;
if(!pduel->game_field->check_spsummon_once(this, playerid))
return FALSE;
if(is_affected_by_effect(EFFECT_CANNOT_SPECIAL_SUMMON)) if(is_affected_by_effect(EFFECT_CANNOT_SPECIAL_SUMMON))
return FALSE; return FALSE;
if(is_affected_by_effect(EFFECT_FORBIDDEN)) if(is_affected_by_effect(EFFECT_FORBIDDEN))
...@@ -1889,6 +1892,8 @@ int32 card::is_can_be_special_summoned(effect * reason_effect, uint32 sumtype, u ...@@ -1889,6 +1892,8 @@ int32 card::is_can_be_special_summoned(effect * reason_effect, uint32 sumtype, u
} }
if(((sumpos & POS_FACEDOWN) == 0) && pduel->game_field->check_unique_onfield(this, toplayer)) if(((sumpos & POS_FACEDOWN) == 0) && pduel->game_field->check_unique_onfield(this, toplayer))
return FALSE; return FALSE;
if(!pduel->game_field->check_spsummon_once(this, sumplayer))
return FALSE;
sumtype |= SUMMON_TYPE_SPECIAL; sumtype |= SUMMON_TYPE_SPECIAL;
if((sumplayer == 0 || sumplayer == 1) && !pduel->game_field->is_player_can_spsummon(reason_effect, sumtype, sumpos, sumplayer, toplayer, this)) if((sumplayer == 0 || sumplayer == 1) && !pduel->game_field->is_player_can_spsummon(reason_effect, sumtype, sumpos, sumplayer, toplayer, this))
return FALSE; return FALSE;
......
...@@ -108,6 +108,7 @@ public: ...@@ -108,6 +108,7 @@ public:
uint8 unique_pos[2]; uint8 unique_pos[2];
uint16 unique_uid; uint16 unique_uid;
uint32 unique_code; uint32 unique_code;
uint32 spsummon_code;
uint8 assume_type; uint8 assume_type;
uint32 assume_value; uint32 assume_value;
effect* unique_effect; effect* unique_effect;
......
...@@ -1411,13 +1411,24 @@ effect* field::check_unique_onfield(card* pcard, uint8 controler) { ...@@ -1411,13 +1411,24 @@ effect* field::check_unique_onfield(card* pcard, uint8 controler) {
return 0; return 0;
} }
int32 field::check_spsummon_once(card* pcard, uint8 playerid) {
if(pcard->spsummon_code == 0)
return TRUE;
auto iter = core.spsummon_once_map[playerid].find(pcard->spsummon_code);
return (iter == core.spsummon_once_map[playerid].end()) || (iter->second == 0);
}
void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid) { void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid) {
auto& counter_map = (counter_type == 1) ? core.summon_counter : auto& counter_map = (counter_type == 1) ? core.summon_counter :
(counter_type == 2) ? core.normalsummon_counter : (counter_type == 2) ? core.normalsummon_counter :
(counter_type == 3) ? core.spsummon_counter : (counter_type == 3) ? core.spsummon_counter :
(counter_type == 4) ? core.flipsummon_counter : core.attack_counter; (counter_type == 4) ? core.flipsummon_counter : core.attack_counter;
for(auto iter = counter_map.begin();iter!=counter_map.end();++iter) { for(auto iter = counter_map.begin(); iter != counter_map.end(); ++iter) {
auto& info = iter->second; auto& info = iter->second;
if((playerid == 0) && (info.second & 0xffff) != 0)
continue;
if((playerid == 1) && (info.second & 0xffff0000) != 0)
continue;
if(info.first) { if(info.first) {
pduel->lua->add_param(pcard, PARAM_TYPE_CARD); pduel->lua->add_param(pcard, PARAM_TYPE_CARD);
if(!pduel->lua->check_condition(info.first, 1)) { if(!pduel->lua->check_condition(info.first, 1)) {
...@@ -1429,51 +1440,13 @@ void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid) ...@@ -1429,51 +1440,13 @@ void field::check_card_counter(card* pcard, int32 counter_type, int32 playerid)
} }
} }
} }
void field::check_card_counter(card_set* pcards, int32 counter_type, int32 playerid) {
auto& counter_map = (counter_type == 1) ? core.summon_counter :
(counter_type == 2) ? core.normalsummon_counter :
(counter_type == 3) ? core.spsummon_counter :
(counter_type == 4) ? core.flipsummon_counter : core.attack_counter;
for(auto iter = counter_map.begin();iter!=counter_map.end();++iter) {
auto& info = iter->second;
if(info.first) {
for(auto piter = pcards->begin(); piter != pcards->end(); ++piter) {
pduel->lua->add_param(*piter, PARAM_TYPE_CARD);
if(!pduel->lua->check_condition(info.first, 1)) {
if(playerid == 0)
info.second += 0x1;
else
info.second += 0x10000;
break;
}
}
}
}
}
void field::check_card_counter(card_vector* pcards, int32 counter_type, int32 playerid) {
auto& counter_map = (counter_type == 1) ? core.summon_counter :
(counter_type == 2) ? core.normalsummon_counter :
(counter_type == 3) ? core.spsummon_counter :
(counter_type == 4) ? core.flipsummon_counter : core.attack_counter;
for(auto iter = counter_map.begin();iter!=counter_map.end();++iter) {
auto& info = iter->second;
if(info.first) {
for(auto piter = pcards->begin(); piter != pcards->end(); ++piter) {
pduel->lua->add_param(*piter, PARAM_TYPE_CARD);
if(!pduel->lua->check_condition(info.first, 1)) {
if(playerid == 0)
info.second += 0x1;
else
info.second += 0x10000;
break;
}
}
}
}
}
void field::check_chain_counter(effect* peffect, int32 playerid, int32 chainid) { void field::check_chain_counter(effect* peffect, int32 playerid, int32 chainid) {
for(auto iter = core.chain_counter.begin();iter != core.chain_counter.end(); ++iter) { for(auto iter = core.chain_counter.begin();iter != core.chain_counter.end(); ++iter) {
auto& info = iter->second; auto& info = iter->second;
if((playerid == 0) && (info.second & 0xffff) != 0)
continue;
if((playerid == 1) && (info.second & 0xffff0000) != 0)
continue;
if(info.first) { if(info.first) {
pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT); pduel->lua->add_param(peffect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
......
...@@ -212,6 +212,7 @@ struct processor { ...@@ -212,6 +212,7 @@ struct processor {
std::unordered_set<card*> unique_cards[2]; std::unordered_set<card*> unique_cards[2];
std::unordered_map<uint32, uint32> effect_count_code; std::unordered_map<uint32, uint32> effect_count_code;
std::unordered_map<uint32, uint32> effect_count_code_duel; std::unordered_map<uint32, uint32> effect_count_code_duel;
std::unordered_map<uint32, uint32> spsummon_once_map[2];
std::multimap<int32, card*, std::greater<int32> > xmaterial_lst; std::multimap<int32, card*, std::greater<int32> > xmaterial_lst;
ptr temp_var[4]; ptr temp_var[4];
uint32 global_flag; uint32 global_flag;
...@@ -357,9 +358,8 @@ public: ...@@ -357,9 +358,8 @@ public:
void add_unique_card(card* pcard); void add_unique_card(card* pcard);
void remove_unique_card(card* pcard); void remove_unique_card(card* pcard);
effect* check_unique_onfield(card* pcard, uint8 controler); effect* check_unique_onfield(card* pcard, uint8 controler);
int32 check_spsummon_once(card* pcard, uint8 playerid);
void check_card_counter(card* pcard, int32 counter_type, int32 playerid); void check_card_counter(card* pcard, int32 counter_type, int32 playerid);
void check_card_counter(card_set* pcards, int32 counter_type, int32 playerid);
void check_card_counter(card_vector* pcards, int32 counter_type, int32 playerid);
void check_chain_counter(effect* peffect, int32 playerid, int32 chainid); void check_chain_counter(effect* peffect, int32 playerid, int32 chainid);
int32 check_lp_cost(uint8 playerid, uint32 cost); int32 check_lp_cost(uint8 playerid, uint32 cost);
...@@ -575,6 +575,7 @@ public: ...@@ -575,6 +575,7 @@ public:
#define GLOBALFLAG_SPSUMMON_COUNT 0x40 #define GLOBALFLAG_SPSUMMON_COUNT 0x40
#define GLOBALFLAG_XMAT_COUNT_LIMIT 0x80 #define GLOBALFLAG_XMAT_COUNT_LIMIT 0x80
#define GLOBALFLAG_SELF_TOGRAVE 0x100 #define GLOBALFLAG_SELF_TOGRAVE 0x100
#define GLOBALFLAG_SPSUMMON_ONCE 0x200
// //
#define PROCESSOR_NONE 0 #define PROCESSOR_NONE 0
#define PROCESSOR_WAITING 0x10000 #define PROCESSOR_WAITING 0x10000
......
...@@ -208,6 +208,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -208,6 +208,7 @@ static const struct luaL_Reg cardlib[] = {
{ "CheckUniqueOnField", scriptlib::card_check_unique_onfield }, { "CheckUniqueOnField", scriptlib::card_check_unique_onfield },
{ "ResetNegateEffect", scriptlib::card_reset_negate_effect }, { "ResetNegateEffect", scriptlib::card_reset_negate_effect },
{ "AssumeProperty", scriptlib::card_assume_prop }, { "AssumeProperty", scriptlib::card_assume_prop },
{ "SetSPSummonOnce", scriptlib::card_set_spsummon_once},
{ NULL, NULL } { NULL, NULL }
}; };
......
...@@ -2069,3 +2069,13 @@ int32 scriptlib::card_assume_prop(lua_State *L) { ...@@ -2069,3 +2069,13 @@ int32 scriptlib::card_assume_prop(lua_State *L) {
pcard->pduel->assumes.insert(pcard); pcard->pduel->assumes.insert(pcard);
return 0; return 0;
} }
int32 scriptlib::card_set_spsummon_once(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->status & STATUS_COPYING_EFFECT)
return 0;
pcard->spsummon_code = lua_tointeger(L, 2);
pcard->pduel->game_field->core.global_flag |= GLOBALFLAG_SPSUMMON_ONCE;
return 0;
}
...@@ -2036,6 +2036,8 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) { ...@@ -2036,6 +2036,8 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
target->summon_player = sumplayer; target->summon_player = sumplayer;
core.spsummon_state_count[sumplayer]++; core.spsummon_state_count[sumplayer]++;
check_card_counter(target, 3, sumplayer); check_card_counter(target, 3, sumplayer);
if(target->spsummon_code)
core.spsummon_once_map[sumplayer][target->spsummon_code]++;
break_effect(); break_effect();
return FALSE; return FALSE;
} }
...@@ -2184,7 +2186,6 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) { ...@@ -2184,7 +2186,6 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
if(pgroup->container.size() == 0) if(pgroup->container.size() == 0)
return TRUE; return TRUE;
core.phase_action = TRUE; core.phase_action = TRUE;
check_card_counter(&pgroup->container, 3, sumplayer);
pgroup->it = pgroup->container.begin(); pgroup->it = pgroup->container.begin();
return FALSE; return FALSE;
} }
...@@ -2197,6 +2198,9 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) { ...@@ -2197,6 +2198,9 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
pcard->current.reason_player = sumplayer; pcard->current.reason_player = sumplayer;
pcard->summon_player = sumplayer; pcard->summon_player = sumplayer;
pcard->summon_info = (peffect->get_value(pcard) & 0xff00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)pcard->current.location << 16); pcard->summon_info = (peffect->get_value(pcard) & 0xff00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)pcard->current.location << 16);
check_card_counter(pcard, 3, sumplayer);
if(pcard->spsummon_code)
core.spsummon_once_map[sumplayer][pcard->spsummon_code]++;
move_to_field(pcard, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP); move_to_field(pcard, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP);
return FALSE; return FALSE;
} }
...@@ -2342,6 +2346,9 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) { ...@@ -2342,6 +2346,9 @@ int32 field::special_summon_step(uint16 step, group * targets, card * target) {
if(!targets) if(!targets)
core.special_summoning.insert(target); core.special_summoning.insert(target);
target->enable_field_effect(FALSE); target->enable_field_effect(FALSE);
if(target->spsummon_code)
core.spsummon_once_map[target->summon_player][target->spsummon_code]++;
check_card_counter(target, 3, target->summon_player);
move_to_field(target, target->summon_player, playerid, LOCATION_MZONE, positions); move_to_field(target, target->summon_player, playerid, LOCATION_MZONE, positions);
return FALSE; return FALSE;
} }
...@@ -2378,7 +2385,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl ...@@ -2378,7 +2385,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
if(cvs.size() > 1) if(cvs.size() > 1)
std::sort(cvs.begin(), cvs.end(), card::card_operation_sort); std::sort(cvs.begin(), cvs.end(), card::card_operation_sort);
core.spsummon_state_count[infos.turn_player]++; core.spsummon_state_count[infos.turn_player]++;
check_card_counter(&cvs, 3, infos.turn_player);
core.hint_timing[infos.turn_player] |= TIMING_SPSUMMON; core.hint_timing[infos.turn_player] |= TIMING_SPSUMMON;
for(auto cvit = cvs.begin(); cvit != cvs.end(); ++cvit) for(auto cvit = cvs.begin(); cvit != cvs.end(); ++cvit)
add_process(PROCESSOR_SPSUMMON_STEP, 0, 0, targets, 0, (ptr)(*cvit)); add_process(PROCESSOR_SPSUMMON_STEP, 0, 0, targets, 0, (ptr)(*cvit));
...@@ -2387,7 +2393,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl ...@@ -2387,7 +2393,6 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
if(cvo.size() > 1) if(cvo.size() > 1)
std::sort(cvo.begin(), cvo.end(), card::card_operation_sort); std::sort(cvo.begin(), cvo.end(), card::card_operation_sort);
core.spsummon_state_count[1 - infos.turn_player]++; core.spsummon_state_count[1 - infos.turn_player]++;
check_card_counter(&cvo, 3, 1 - infos.turn_player);
core.hint_timing[1 - infos.turn_player] |= TIMING_SPSUMMON; core.hint_timing[1 - infos.turn_player] |= TIMING_SPSUMMON;
for(auto cvit = cvo.begin(); cvit != cvo.end(); ++cvit) for(auto cvit = cvo.begin(); cvit != cvo.end(); ++cvit)
add_process(PROCESSOR_SPSUMMON_STEP, 0, 0, targets, 0, (ptr)(*cvit)); add_process(PROCESSOR_SPSUMMON_STEP, 0, 0, targets, 0, (ptr)(*cvit));
......
...@@ -4034,6 +4034,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) { ...@@ -4034,6 +4034,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
core.battle_phase_count[p] = 0; core.battle_phase_count[p] = 0;
core.summon_count[p] = 0; core.summon_count[p] = 0;
core.extra_summon[p] = 0; core.extra_summon[p] = 0;
core.spsummon_once_map[p].clear();
} }
for(auto rit = effects.rechargeable.begin(); rit != effects.rechargeable.end(); ++rit) for(auto rit = effects.rechargeable.begin(); rit != effects.rechargeable.end(); ++rit)
if(!((*rit)->flag & EFFECT_FLAG_NO_TURN_RESET)) if(!((*rit)->flag & EFFECT_FLAG_NO_TURN_RESET))
...@@ -4284,21 +4285,21 @@ int32 field::process_turn(uint16 step, uint8 turn_player) { ...@@ -4284,21 +4285,21 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
int32 field::add_chain(uint16 step) { int32 field::add_chain(uint16 step) {
switch (step) { switch (step) {
case 0: { case 0: {
chain_list::iterator clit = core.new_chains.begin(); auto& clit = core.new_chains.front();
effect* peffect = clit->triggering_effect; effect* peffect = clit.triggering_effect;
if (!core.new_chains.size()) if (!core.new_chains.size())
return TRUE; return TRUE;
effect_set eset; effect_set eset;
filter_player_effect(clit->triggering_player, EFFECT_ACTIVATE_COST, &eset); filter_player_effect(clit.triggering_player, EFFECT_ACTIVATE_COST, &eset);
for(int32 i = 0; i < eset.count; ++i) { for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT); pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
pduel->lua->add_param(clit->triggering_effect, PARAM_TYPE_EFFECT); pduel->lua->add_param(clit.triggering_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(clit->triggering_player, PARAM_TYPE_INT); pduel->lua->add_param(clit.triggering_player, PARAM_TYPE_INT);
if(!pduel->lua->check_condition(eset[i]->target, 3)) if(!pduel->lua->check_condition(eset[i]->target, 3))
continue; continue;
if(eset[i]->operation) { if(eset[i]->operation) {
core.sub_solving_event.push_back(clit->evt); core.sub_solving_event.push_back(clit.evt);
add_process(PROCESSOR_EXECUTE_OPERATION, 0, eset[i], 0, clit->triggering_player, 0); add_process(PROCESSOR_EXECUTE_OPERATION, 0, eset[i], 0, clit.triggering_player, 0);
} }
} }
if(peffect->type & EFFECT_TYPE_ACTIVATE) { if(peffect->type & EFFECT_TYPE_ACTIVATE) {
...@@ -4347,20 +4348,20 @@ int32 field::add_chain(uint16 step) { ...@@ -4347,20 +4348,20 @@ int32 field::add_chain(uint16 step) {
return FALSE; return FALSE;
} }
case 1: { case 1: {
chain_list::iterator clit = core.new_chains.begin(); auto& clit = core.new_chains.front();
effect* peffect = clit->triggering_effect; effect* peffect = clit.triggering_effect;
card* phandler = peffect->handler; card* phandler = peffect->handler;
if(peffect->type & EFFECT_TYPE_ACTIVATE) { if(peffect->type & EFFECT_TYPE_ACTIVATE) {
clit->triggering_controler = phandler->current.controler; clit.triggering_controler = phandler->current.controler;
clit->triggering_location = phandler->current.location; clit.triggering_location = phandler->current.location;
clit->triggering_sequence = phandler->current.sequence; clit.triggering_sequence = phandler->current.sequence;
} }
pduel->write_buffer8(MSG_CHAINING); pduel->write_buffer8(MSG_CHAINING);
pduel->write_buffer32(phandler->data.code); pduel->write_buffer32(phandler->data.code);
pduel->write_buffer32(phandler->get_info_location()); pduel->write_buffer32(phandler->get_info_location());
pduel->write_buffer8(clit->triggering_controler); pduel->write_buffer8(clit.triggering_controler);
pduel->write_buffer8(clit->triggering_location); pduel->write_buffer8(clit.triggering_location);
pduel->write_buffer8(clit->triggering_sequence); pduel->write_buffer8(clit.triggering_sequence);
pduel->write_buffer32(peffect->description); pduel->write_buffer32(peffect->description);
pduel->write_buffer8(core.current_chain.size() + 1); pduel->write_buffer8(core.current_chain.size() + 1);
break_effect(); break_effect();
...@@ -4381,48 +4382,48 @@ int32 field::add_chain(uint16 step) { ...@@ -4381,48 +4382,48 @@ int32 field::add_chain(uint16 step) {
if((peffect->card_type & 0x5) == 0x5) if((peffect->card_type & 0x5) == 0x5)
peffect->card_type -= TYPE_TRAP; peffect->card_type -= TYPE_TRAP;
peffect->active_type = peffect->card_type; peffect->active_type = peffect->card_type;
clit->chain_count = core.current_chain.size() + 1; clit.chain_count = core.current_chain.size() + 1;
clit->target_cards = 0; clit.target_cards = 0;
clit->target_player = PLAYER_NONE; clit.target_player = PLAYER_NONE;
clit->target_param = 0; clit.target_param = 0;
clit->disable_reason = 0; clit.disable_reason = 0;
clit->disable_player = PLAYER_NONE; clit.disable_player = PLAYER_NONE;
clit->replace_op = 0; clit.replace_op = 0;
if((phandler->current.location == LOCATION_HAND)) if((phandler->current.location == LOCATION_HAND))
clit->flag |= CHAIN_HAND_EFFECT; clit.flag |= CHAIN_HAND_EFFECT;
core.current_chain.push_back(*clit); core.current_chain.push_back(clit);
check_chain_counter(peffect, clit->triggering_controler, clit->chain_count); check_chain_counter(peffect, clit.triggering_player, clit.chain_count);
// triggered events which are not caused by RaiseEvent create relation with the handler // triggered events which are not caused by RaiseEvent create relation with the handler
if(!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && (!(peffect->type & 0x2a0) || (peffect->code & EVENT_PHASE) == EVENT_PHASE)) { if(!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && (!(peffect->type & 0x2a0) || (peffect->code & EVENT_PHASE) == EVENT_PHASE)) {
peffect->handler->create_relation(peffect); peffect->handler->create_relation(peffect);
} }
if(peffect->cost) { if(peffect->cost) {
core.sub_solving_event.push_back(clit->evt); core.sub_solving_event.push_back(clit.evt);
add_process(PROCESSOR_EXECUTE_COST, 0, peffect, 0, clit->triggering_player, 0); add_process(PROCESSOR_EXECUTE_COST, 0, peffect, 0, clit.triggering_player, 0);
} }
core.new_chains.pop_front(); core.new_chains.pop_front();
return FALSE; return FALSE;
} }
case 2: { case 2: {
chain_array::iterator clit = --(core.current_chain.end()); auto& clit = core.current_chain.back();
effect* peffect = clit->triggering_effect; effect* peffect = clit.triggering_effect;
if(peffect->target) { if(peffect->target) {
core.sub_solving_event.push_back(clit->evt); core.sub_solving_event.push_back(clit.evt);
add_process(PROCESSOR_EXECUTE_TARGET, 0, peffect, 0, clit->triggering_player, 0); add_process(PROCESSOR_EXECUTE_TARGET, 0, peffect, 0, clit.triggering_player, 0);
} }
return FALSE; return FALSE;
} }
case 3: { case 3: {
break_effect(); break_effect();
chain_array::iterator clit = --(core.current_chain.end()); auto& clit = core.current_chain.back();
effect* peffect = clit->triggering_effect; effect* peffect = clit.triggering_effect;
if(clit->target_cards && clit->target_cards->container.size()) { if(clit.target_cards && clit.target_cards->container.size()) {
if(peffect->flag & EFFECT_FLAG_CARD_TARGET) { if(peffect->flag & EFFECT_FLAG_CARD_TARGET) {
for(auto cit = clit->target_cards->container.begin(); cit != clit->target_cards->container.end(); ++cit) for(auto cit = clit.target_cards->container.begin(); cit != clit.target_cards->container.end(); ++cit)
raise_single_event(*cit, 0, EVENT_BECOME_TARGET, peffect, 0, clit->triggering_player, 0, clit->chain_count); raise_single_event(*cit, 0, EVENT_BECOME_TARGET, peffect, 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, peffect, 0, clit->triggering_player, clit->triggering_player, clit->chain_count); raise_event(&clit.target_cards->container, EVENT_BECOME_TARGET, peffect, 0, clit.triggering_player, clit.triggering_player, clit.chain_count);
} }
} }
if(peffect->type & EFFECT_TYPE_ACTIVATE) { if(peffect->type & EFFECT_TYPE_ACTIVATE) {
...@@ -4432,11 +4433,23 @@ int32 field::add_chain(uint16 step) { ...@@ -4432,11 +4433,23 @@ int32 field::add_chain(uint16 step) {
peffect->handler->set_status(STATUS_LEAVE_CONFIRMED, TRUE); peffect->handler->set_status(STATUS_LEAVE_CONFIRMED, TRUE);
} }
core.phase_action = TRUE; core.phase_action = TRUE;
if(clit->opinfos.count(0x200)) if(clit.opinfos.count(0x200)) {
core.spsummon_state_count[clit->triggering_player]++; core.spsummon_state_count[clit.triggering_player]++;
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && (peffect->flag & EFFECT_FLAG_CARD_TARGET)) {
auto& optarget = clit.opinfos[0x200];
if(optarget.op_cards) {
for(auto& spcard : optarget.op_cards->container) {
if(spcard->spsummon_code) {
uint8 sumpl = optarget.op_player ? 1 : 0;
core.spsummon_once_map[sumpl][spcard->spsummon_code]++;
}
}
}
}
}
pduel->write_buffer8(MSG_CHAINED); pduel->write_buffer8(MSG_CHAINED);
pduel->write_buffer8(clit->chain_count); pduel->write_buffer8(clit.chain_count);
raise_event(peffect->handler, EVENT_CHAINING, peffect, 0, clit->triggering_player, clit->triggering_player, clit->chain_count); raise_event(peffect->handler, EVENT_CHAINING, peffect, 0, clit.triggering_player, clit.triggering_player, clit.chain_count);
process_instant_event(); process_instant_event();
if(core.new_chains.size()) if(core.new_chains.size())
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0); add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
...@@ -4567,8 +4580,20 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4567,8 +4580,20 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
raise_event((card*)0, EVENT_CHAIN_NEGATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count); raise_event((card*)0, EVENT_CHAIN_NEGATED, peffect, 0, cait->triggering_player, cait->triggering_player, cait->chain_count);
process_instant_event(); process_instant_event();
core.units.begin()->step = 9; core.units.begin()->step = 9;
if(cait->opinfos.count(0x200)) if(cait->opinfos.count(0x200)) {
core.spsummon_state_count[cait->triggering_player]--; core.spsummon_state_count[cait->triggering_player]--;
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && (peffect->flag & EFFECT_FLAG_CARD_TARGET)) {
auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) {
for(auto& spcard : optarget.op_cards->container) {
if(spcard->spsummon_code) {
uint8 sumpl = optarget.op_player ? 1 : 0;
core.spsummon_once_map[sumpl][spcard->spsummon_code]--;
}
}
}
}
}
return FALSE; return FALSE;
} }
for(auto oeit = effects.oath.begin(); oeit != effects.oath.end(); ++oeit) for(auto oeit = effects.oath.begin(); oeit != effects.oath.end(); ++oeit)
...@@ -4608,10 +4633,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4608,10 +4633,12 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
return FALSE; return FALSE;
} }
} }
core.units.begin()->peffect = (effect*)(size_t)cait->triggering_effect->operation;
core.units.begin()->arg2 = core.spsummon_state_count[cait->triggering_player]; core.units.begin()->arg2 = core.spsummon_state_count[cait->triggering_player];
if(cait->replace_op) if(cait->replace_op) {
core.units.begin()->peffect = (effect*)(size_t)cait->triggering_effect->operation;
cait->triggering_effect->operation = cait->replace_op; cait->triggering_effect->operation = cait->replace_op;
} else
core.units.begin()->peffect = 0;
if(cait->triggering_effect->operation) { if(cait->triggering_effect->operation) {
core.sub_solving_event.push_back(cait->evt); core.sub_solving_event.push_back(cait->evt);
add_process(PROCESSOR_EXECUTE_OPERATION, 0, cait->triggering_effect, 0, cait->triggering_player, 0); add_process(PROCESSOR_EXECUTE_OPERATION, 0, cait->triggering_effect, 0, cait->triggering_player, 0);
...@@ -4620,9 +4647,26 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) { ...@@ -4620,9 +4647,26 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
} }
case 3: { case 3: {
effect* peffect = cait->triggering_effect; effect* peffect = cait->triggering_effect;
peffect->operation = (ptr)core.units.begin()->peffect; if(core.units.begin()->peffect) {
if(cait->opinfos.count(0x200) && (core.units.begin()->arg2 != core.spsummon_state_count[cait->triggering_player])) peffect->operation = (ptr)core.units.begin()->peffect;
core.spsummon_state_count[cait->triggering_player]--; if(cait->opinfos.count(0x200)) {
core.spsummon_state_count[cait->triggering_player]--;
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && (peffect->flag & EFFECT_FLAG_CARD_TARGET)) {
auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) {
for(auto& spcard : optarget.op_cards->container) {
if(spcard->spsummon_code) {
uint8 sumpl = optarget.op_player ? 1 : 0;
core.spsummon_once_map[sumpl][spcard->spsummon_code]--;
}
}
}
}
}
} else {
if(cait->opinfos.count(0x200) && (core.units.begin()->arg2 != core.spsummon_state_count[cait->triggering_player]))
core.spsummon_state_count[cait->triggering_player]--;
}
if(core.special_summoning.size()) if(core.special_summoning.size())
core.special_summoning.clear(); core.special_summoning.clear();
if(core.equiping_cards.size()) if(core.equiping_cards.size())
......
...@@ -210,7 +210,8 @@ public: ...@@ -210,7 +210,8 @@ public:
static int32 card_check_unique_onfield(lua_State *L); static int32 card_check_unique_onfield(lua_State *L);
static int32 card_reset_negate_effect(lua_State *L); static int32 card_reset_negate_effect(lua_State *L);
static int32 card_assume_prop(lua_State *L); static int32 card_assume_prop(lua_State *L);
static int32 card_set_spsummon_once(lua_State *L);
//Effect functions //Effect functions
static int32 effect_new(lua_State *L); static int32 effect_new(lua_State *L);
static int32 effect_newex(lua_State *L); static int32 effect_newex(lua_State *L);
......
--精霊獣 ペトルフィン --精霊獣 ペトルフィン
function c13890468.initial_effect(c) function c13890468.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(13890468)
--tohand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_TOHAND)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCondition(c13890468.limcon) e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(c13890468.cost)
e1:SetTarget(c13890468.target)
e1:SetOperation(c13890468.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c13890468.cost)
e2:SetTarget(c13890468.target)
e2:SetOperation(c13890468.operation)
c:RegisterEffect(e2)
if not c13890468.global_check then
c13890468.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c13890468.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c13890468.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(13890468) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,13890468,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,13890468,RESET_PHASE+PHASE_END,0,1) end
end
function c13890468.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),13890468)~=0
end end
function c13890468.filter(c) function c13890468.filter(c)
return c:IsSetCard(0xb5) and c:IsAbleToRemoveAsCost() return c:IsSetCard(0xb5) and c:IsAbleToRemoveAsCost()
......
--霊獣使いの長老 --霊獣使いの長老
function c14513016.initial_effect(c) function c14513016.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(14513016)
--extra summon
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(c14513016.limcon) e1:SetOperation(c14513016.sumop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--extra summon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetOperation(c14513016.sumop)
c:RegisterEffect(e2)
if not c14513016.global_check then
c14513016.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c14513016.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c14513016.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(14513016) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,14513016,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,14513016,RESET_PHASE+PHASE_END,0,1) end
end
function c14513016.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),14513016)~=0
end end
function c14513016.sumop(e,tp,eg,ep,ev,re,r,rp) function c14513016.sumop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,14513017)~=0 then return end if Duel.GetFlagEffect(tp,14513016)~=0 then return end
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0) e1:SetTargetRange(LOCATION_HAND+LOCATION_MZONE,0)
...@@ -46,5 +17,5 @@ function c14513016.sumop(e,tp,eg,ep,ev,re,r,rp) ...@@ -46,5 +17,5 @@ function c14513016.sumop(e,tp,eg,ep,ev,re,r,rp)
e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0xb5)) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0xb5))
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,14513017,RESET_PHASE+PHASE_END,0,1) Duel.RegisterFlagEffect(tp,14513016,RESET_PHASE+PHASE_END,0,1)
end end
--霊獣使い ウェン --霊獣使い ウェン
function c40907115.initial_effect(c) function c40907115.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(40907115)
--spsummon
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetDescription(aux.Stringid(40907115,0))
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCondition(c40907115.limcon) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c40907115.sptg)
e1:SetOperation(c40907115.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(40907115,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(c40907115.sptg)
e2:SetOperation(c40907115.spop)
c:RegisterEffect(e2)
if not c40907115.global_check then
c40907115.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c40907115.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c40907115.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(40907115) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,40907115,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,40907115,RESET_PHASE+PHASE_END,0,1) end
end
function c40907115.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),40907115)~=0
end end
function c40907115.filter(c,e,tp) function c40907115.filter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(0xb5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsFaceup() and c:IsSetCard(0xb5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
--ジェムナイトレディ・ラピスラズリ --ジェムナイトレディ・ラピスラズリ
function c47611119.initial_effect(c) function c47611119.initial_effect(c)
c:SetSPSummonOnce(47611119)
--fusion material --fusion material
c:EnableReviveLimit() c:EnableReviveLimit()
aux.AddFusionProcCodeFun(c,99645428,aux.FilterBoolFunction(Card.IsSetCard,0x1047),1,false,false) aux.AddFusionProcCodeFun(c,99645428,aux.FilterBoolFunction(Card.IsSetCard,0x1047),1,false,false)
...@@ -10,50 +11,20 @@ function c47611119.initial_effect(c) ...@@ -10,50 +11,20 @@ function c47611119.initial_effect(c)
e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(c47611119.splimit) e1:SetValue(c47611119.splimit)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--spsummon limit --damage
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCategory(CATEGORY_DAMAGE)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCondition(c47611119.limcon) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(c47611119.damtg)
e2:SetOperation(c47611119.damop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--damage
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetTarget(c47611119.damtg)
e3:SetOperation(c47611119.damop)
c:RegisterEffect(e3)
if not c47611119.global_check then
c47611119.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c47611119.checkop)
Duel.RegisterEffect(ge1,0)
end
end end
function c47611119.splimit(e,se,sp,st) function c47611119.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA) or bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION return not e:GetHandler():IsLocation(LOCATION_EXTRA) or bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end end
function c47611119.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(47611119) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,47611119,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,47611119,RESET_PHASE+PHASE_END,0,1) end
end
function c47611119.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),47611119)~=0
end
function c47611119.filter(c) function c47611119.filter(c)
return c:IsSetCard(0x1047) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave() return c:IsSetCard(0x1047) and c:IsType(TYPE_MONSTER) and c:IsAbleToGrave()
end end
......
--精霊獣 カンナホーク --精霊獣 カンナホーク
function c49885567.initial_effect(c) function c49885567.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(49885567)
--tohand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_REMOVE)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCondition(c49885567.limcon) e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c49885567.target)
e1:SetOperation(c49885567.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(c49885567.target)
e2:SetOperation(c49885567.operation)
c:RegisterEffect(e2)
if not c49885567.global_check then
c49885567.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c49885567.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c49885567.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(49885567) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,49885567,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,49885567,RESET_PHASE+PHASE_END,0,1) end
end
function c49885567.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),49885567)~=0
end end
function c49885567.filter(c) function c49885567.filter(c)
return c:IsSetCard(0xb5) and c:IsAbleToRemove() return c:IsSetCard(0xb5) and c:IsAbleToRemove()
......
--波動竜フォノン・ドラゴン --波動竜フォノン・ドラゴン
function c67556500.initial_effect(c) function c67556500.initial_effect(c)
Duel.EnableGlobalFlag(GLOBALFLAG_MUST_BE_SMATERIAL) Duel.EnableGlobalFlag(GLOBALFLAG_MUST_BE_SMATERIAL)
c:SetSPSummonOnce(67556500)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit() c:EnableReviveLimit()
......
--精霊獣 アペライオ --精霊獣 アペライオ
function c86396750.initial_effect(c) function c86396750.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(86396750)
--atk
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetDescription(aux.Stringid(86396750,0))
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCondition(c86396750.limcon) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP+0x1c0)
e1:SetCountLimit(1)
e1:SetCondition(c86396750.atkcon)
e1:SetCost(c86396750.atkcost)
e1:SetOperation(c86396750.atkop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(86396750,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP+0x1c0)
e2:SetCountLimit(1)
e2:SetCondition(c86396750.atkcon)
e2:SetCost(c86396750.atkcost)
e2:SetOperation(c86396750.atkop)
c:RegisterEffect(e2)
if not c86396750.global_check then
c86396750.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c86396750.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c86396750.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(86396750) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,86396750,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,86396750,RESET_PHASE+PHASE_END,0,1) end
end
function c86396750.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),86396750)~=0
end end
function c86396750.atkcon(e,tp,eg,ep,ev,re,r,rp) function c86396750.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated() return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
......
--霊獣使い レラ --霊獣使い レラ
function c87118301.initial_effect(c) function c87118301.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(87118301)
--spsuccess
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetDescription(aux.Stringid(87118301,0))
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCondition(c87118301.limcon) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c87118301.sptg)
e1:SetOperation(c87118301.spop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--spsuccess
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(87118301,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(c87118301.sptg)
e2:SetOperation(c87118301.spop)
c:RegisterEffect(e2)
if not c87118301.global_check then
c87118301.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c87118301.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c87118301.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(87118301) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,87118301,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,87118301,RESET_PHASE+PHASE_END,0,1) end
end
function c87118301.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),87118301)~=0
end end
function c87118301.filter(c,e,tp) function c87118301.filter(c,e,tp)
return c:IsSetCard(0xb5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) return c:IsSetCard(0xb5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
--精霊獣 ラムペンタ --精霊獣 ラムペンタ
function c88123329.initial_effect(c) function c88123329.initial_effect(c)
--spsummon limit c:SetSPSummonOnce(88123329)
--tohand
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TOGRAVE)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCondition(c88123329.limcon) e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(c88123329.target)
e1:SetOperation(c88123329.operation)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--tohand
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_REMOVE+CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetTarget(c88123329.target)
e2:SetOperation(c88123329.operation)
c:RegisterEffect(e2)
if not c88123329.global_check then
c88123329.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c88123329.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c88123329.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if tc:IsCode(88123329) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,88123329,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,88123329,RESET_PHASE+PHASE_END,0,1) end
end
function c88123329.limcon(e)
return Duel.GetFlagEffect(e:GetHandlerPlayer(),88123329)~=0
end end
function c88123329.tgfilter(c,rac) function c88123329.tgfilter(c,rac)
return c:IsSetCard(0xb5) and c:IsRace(rac) and c:IsAbleToGrave() return c:IsSetCard(0xb5) and c:IsRace(rac) and c:IsAbleToGrave()
......
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