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

bug fix & new cards

parent 6094c122
......@@ -3,7 +3,7 @@
namespace ygo {
const unsigned short PROTO_VERSION = 0x1012;
const unsigned short PROTO_VERSION = 0x1013;
bool NetManager::CreateHost() {
wchar_t* pstr;
......
......@@ -44,7 +44,7 @@ card::card() {
owner = PLAYER_NONE;
operation_param = 0;
status = 0;
memset(&q_cache, 0, sizeof(query_cache));
memset(&q_cache, 0xff, sizeof(query_cache));
equiping_target = 0;
pre_equip_target = 0;
overlay_target = 0;
......@@ -871,7 +871,6 @@ void card::reset(uint32 id, uint32 reset_type) {
}
if(id & 0x1fe0000) {
battled_cards.clear();
counters.clear();
reset_effect_count();
pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
for(; pr.first != pr.second; ++pr.first)
......@@ -879,6 +878,7 @@ void card::reset(uint32 id, uint32 reset_type) {
set_status(STATUS_UNION, FALSE);
}
if(id & 0x57e0000) {
counters.clear();
for(cit = effect_target_owner.begin(); cit != effect_target_owner.end(); ++cit)
(*cit)->effect_target_cards.erase(this);
for(cit = effect_target_cards.begin(); cit != effect_target_cards.end(); ++cit)
......@@ -1121,7 +1121,6 @@ void card::cancel_card_target(card* pcard) {
}
}
void card::filter_effect(int32 code, effect_set* eset, uint8 sort) {
card_set::iterator cit;
effect* peffect;
auto rg = single_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
......@@ -1129,7 +1128,7 @@ void card::filter_effect(int32 code, effect_set* eset, uint8 sort) {
if (peffect->is_available() && (!(peffect->flag & EFFECT_FLAG_SINGLE_RANGE) || is_affect_by_effect(peffect)))
eset->add_item(peffect);
}
for (cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
for (auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
rg = (*cit)->equip_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
......@@ -1160,17 +1159,15 @@ void card::filter_single_continuous_effect(int32 code, effect_set* eset, uint8 s
eset->sort();
}
void card::filter_immune_effect() {
card_set::iterator cit;
effect* peffect;
immune_effect.clear();
pair<effect_container::iterator, effect_container::iterator> rg;
rg = single_effect.equal_range(EFFECT_IMMUNE_EFFECT);
auto rg = single_effect.equal_range(EFFECT_IMMUNE_EFFECT);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
if (peffect->is_available())
immune_effect.add_item(peffect);
}
for (cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
for (auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
rg = (*cit)->equip_effect.equal_range(EFFECT_IMMUNE_EFFECT);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
......@@ -1187,10 +1184,8 @@ void card::filter_immune_effect() {
immune_effect.sort();
}
void card::filter_disable_related_cards() {
effect_indexer::iterator it;
effect* peffect;
for (it = indexer.begin(); it != indexer.end(); ++it) {
peffect = it->first;
for (auto it = indexer.begin(); it != indexer.end(); ++it) {
effect* peffect = it->first;
if (peffect->is_disable_related()) {
if (peffect->type & EFFECT_TYPE_FIELD)
pduel->game_field->update_disable_check_list(peffect);
......@@ -1268,8 +1263,7 @@ int32 card::filter_set_procedure(uint8 playerid, effect_set* peset, uint8 ignore
return FALSE;
}
void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset) {
std::pair<effect_container::iterator, effect_container::iterator> pr;
pr = field_effect.equal_range(EFFECT_SPSUMMON_PROC);
auto pr = field_effect.equal_range(EFFECT_SPSUMMON_PROC);
uint8 toplayer;
uint8 topos;
effect* peffect;
......@@ -1285,21 +1279,20 @@ void card::filter_spsummon_procedure(uint8 playerid, effect_set* peset) {
topos = POS_FACEUP;
toplayer = playerid;
}
if(is_summonable(peffect) && pduel->game_field->is_player_can_spsummon(peffect, peffect->get_value(this), topos, playerid, toplayer, this))
if(peffect->is_available() && is_summonable(peffect)
&& pduel->game_field->is_player_can_spsummon(peffect, peffect->get_value(this), topos, playerid, toplayer, this))
peset->add_item(pr.first->second);
}
}
effect* card::is_affected_by_effect(int32 code) {
card_set::iterator cit;
effect* peffect;
pair<effect_container::iterator, effect_container::iterator> rg;
rg = single_effect.equal_range(code);
auto rg = single_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
if (peffect->is_available() && (!(peffect->flag & EFFECT_FLAG_SINGLE_RANGE) || is_affect_by_effect(peffect)))
return peffect;
}
for (cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
for (auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
rg = (*cit)->equip_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
......@@ -1317,17 +1310,15 @@ effect* card::is_affected_by_effect(int32 code) {
return 0;
}
effect* card::is_affected_by_effect(int32 code, card* target) {
card_set::iterator cit;
effect* peffect;
pair<effect_container::iterator, effect_container::iterator> rg;
rg = single_effect.equal_range(code);
auto rg = single_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
if (peffect->is_available() && (!(peffect->flag & EFFECT_FLAG_SINGLE_RANGE) || is_affect_by_effect(peffect))
&& peffect->get_value(target))
return peffect;
}
for (cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
for (auto cit = equiping_cards.begin(); cit != equiping_cards.end(); ++cit) {
rg = (*cit)->equip_effect.equal_range(code);
for (; rg.first != rg.second; ++rg.first) {
peffect = rg.first->second;
......@@ -1345,8 +1336,7 @@ effect* card::is_affected_by_effect(int32 code, card* target) {
return 0;
}
int32 card::fusion_check(group* fusion_m, card* cg, int32 chkf) {
effect_container::iterator ecit;
ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
if(ecit == single_effect.end())
return FALSE;
effect* peffect = ecit->second;
......@@ -1359,9 +1349,8 @@ int32 card::fusion_check(group* fusion_m, card* cg, int32 chkf) {
return pduel->lua->check_condition(peffect->condition, 4);
}
void card::fusion_select(uint8 playerid, group* fusion_m, card* cg, int32 chkf) {
effect_container::iterator ecit;
effect* peffect = 0;
ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
auto ecit = single_effect.find(EFFECT_FUSION_MATERIAL);
if(ecit != single_effect.end())
peffect = ecit->second;
pduel->game_field->add_process(PROCESSOR_SELECT_FUSION, 0, peffect, fusion_m, playerid + (chkf << 16), (ptr)cg);
......
......@@ -559,7 +559,7 @@ int32 interpreter::load_script(char* script_name) {
no_action++;
error = luaL_loadbuffer(current_state, (const char*) buffer, len, (const char*) script_name) || lua_pcall(current_state, 0, 0, 0);
if (error) {
sprintf(pduel->strbuffer, "%s", lua_tostring(current_state, -1));
sprintf(pduel->strbuffer, lua_tostring(current_state, -1));
handle_message(pduel, 1);
lua_pop(current_state, 1);
no_action--;
......
--竜の転生
function c20638610.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_ENG_PHASE)
e1:SetTarget(c20638610.target)
e1:SetOperation(c20638610.operation)
c:RegisterEffect(e1)
end
function c20638610.rmfilter(c)
return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsAbleToRemove()
end
function c20638610.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c20638610.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c20638610.rmfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c20638610.rmfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(c20638610.spfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c20638610.rmfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_HAND)
end
function c20638610.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsControler(tp) and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c20638610.spfilter,tp,LOCATION_GRAVE+LOCATION_HAND,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
end
--ダークフレア・ドラゴン
function c25460258.initial_effect(c)
--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(c25460258.spcon)
e1:SetOperation(c25460258.spop)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(25460258,0))
e2:SetCategory(CATEGORY_REMOVE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(c25460258.rmcost)
e2:SetTarget(c25460258.rmtg)
e2:SetOperation(c25460258.rmop)
c:RegisterEffect(e2)
end
function c25460258.spfilter(c,att)
return c:IsAttribute(att) and c:IsAbleToRemoveAsCost()
end
function c25460258.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c25460258.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)
and Duel.IsExistingMatchingCard(c25460258.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK)
end
function c25460258.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,c25460258.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectMatchingCard(tp,c25460258.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
function c25460258.cfilter(c)
return c:IsRace(RACE_DRAGON) and c:IsAbleToGraveAsCost()
end
function c25460258.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c25460258.cfilter,tp,LOCATION_HAND,0,1,nil)
and Duel.IsExistingMatchingCard(c25460258.cfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,c25460258.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(tp,c25460258.cfilter,tp,LOCATION_DECK,0,1,1,nil)
g1:Merge(g2)
Duel.SendtoGrave(g1,REASON_COST)
end
function c25460258.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chk:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function c25460258.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
......@@ -26,7 +26,7 @@ function c26834022.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c26834022.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,c26834022.filter,p,LOCATION_HAND,0,1,1,nil)
local g=Duel.SelectMatchingCard(tp,c26834022.filter,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
Duel.NegateActivation(ev)
local ec=eg:GetFirst()
......
......@@ -16,7 +16,7 @@ function c27970830.initial_effect(c)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
--special summon
--atkup
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_ATKCHANGE)
e4:SetDescription(aux.Stringid(27970830,0))
......@@ -39,8 +39,9 @@ function c27970830.initial_effect(c)
c:RegisterEffect(e5)
--special summon
local e6=Effect.CreateEffect(c)
e6:SetCategory(CATEGORY_TOHAND)
e6:SetCategory(CATEGORY_SPECIAL_SUMMON)
e6:SetDescription(aux.Stringid(27970830,2))
e6:SetProperty(EFFECT_FLAG_CARD_TARGET)
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetRange(LOCATION_SZONE)
e6:SetCost(c27970830.cost3)
......@@ -112,7 +113,7 @@ end
function c27970830.tg3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()==tp and chkc:GetLocation()==LOCATION_GRAVE and c27970830.filter3(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,0)>0
and Duel.IsExistingMatchingCard(c27970830.filter3,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
and Duel.IsExistingTarget(c27970830.filter3,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c27970830.filter3,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
......
......@@ -40,7 +40,7 @@ end
function c29590752.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and not tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Destroy(tg,REASON_EFFECT)
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c29590752.dcon(e,tp,eg,ep,ev,re,r,rp)
......
--エクリプス・ワイバーン
function c51858306.initial_effect(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(51858306,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c51858306.condition)
e1:SetTarget(c51858306.target)
e1:SetOperation(c51858306.operation)
c:RegisterEffect(e1)
--remove
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(51858306,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_REMOVE)
e2:SetCondition(c51858306.thcon)
e2:SetTarget(c51858306.thtg)
e2:SetOperation(c51858306.thop)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function c51858306.condition(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_RETURN)
end
function c51858306.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
end
function c51858306.filter(c)
return c:IsLevelAbove(7) and c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)
and c:IsAbleToRemove()
end
function c51858306.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c51858306.filter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
e:SetLabelObject(tc)
e:GetHandler():RegisterFlagEffect(51858306,RESET_EVENT+0x1e60000,0,1)
tc:RegisterFlagEffect(51858306,RESET_EVENT+0x1fe0000,0,1)
end
end
function c51858306.thcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject():GetLabelObject()
return e:GetHandler():IsFaceup() and e:GetHandler():GetFlagEffect(51858306)~=0
end
function c51858306.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=e:GetLabelObject():GetLabelObject()
if chk==0 then return tc and tc:GetFlagEffect(51858306)~=0 and tc:IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tc,1,0,0)
end
function c51858306.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject():GetLabelObject()
if tc:GetFlagEffect(51858306)~=0 and Duel.SendtoHand(tc,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,tc)
end
end
......@@ -19,7 +19,7 @@ function c52518793.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,0x19))
e3:SetValue(c52518793.atkval)
c:RegisterEffect(e3)
......@@ -36,7 +36,7 @@ function c52518793.atkval(e,c)
return e:GetHandler():GetCounter(0x7)*100
end
function c52518793.cfilter(c,tp)
return c:GetPreviousLocation()==LOCATION_DECK
return c:IsPreviousLocation(LOCATION_DECK)
end
function c52518793.accon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c52518793.cfilter,1,nil,tp)
......
......@@ -20,7 +20,7 @@ function c64034255.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoHand(g,nil,REASON_EFFECT)
end
function c64034255.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c64034255.spop(e,tp,eg,ep,ev,re,r,rp,c)
......
......@@ -10,11 +10,11 @@ function c67223587.initial_effect(c)
e1:SetOperation(c67223587.activate)
c:RegisterEffect(e1)
end
function c67223587.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x19)
function c67223587.cfilter(c,tp)
return c:IsFaceup() and c:GetSummonPlayer()==tp and c:IsSetCard(0x19)
end
function c67223587.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c67223587.cfilter,1,nil)
return eg:IsExists(c67223587.cfilter,1,nil,tp)
end
function c67223587.filter(c,e,tp)
return c:IsLevelBelow(4) and c:IsSetCard(0x19) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
--混沌空間
function c94243005.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_REMOVE)
e2:SetOperation(c94243005.ctop)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetDescription(aux.Stringid(94243005,0))
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1)
e3:SetRange(LOCATION_SZONE)
e3:SetTarget(c94243005.sptg)
e3:SetOperation(c94243005.spop)
c:RegisterEffect(e3)
--search
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_TOHAND)
e4:SetDescription(aux.Stringid(94243005,1))
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e4:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetCondition(c94243005.thcon)
e4:SetTarget(c94243005.thtg)
e4:SetOperation(c94243005.thop)
c:RegisterEffect(e4)
end
function c94243005.ctop(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(Card.IsType,nil,TYPE_MONSTER)
if ct>0 then
e:GetHandler():AddCounter(0x13,ct)
end
end
function c94243005.spfilter(c,e,tp)
local lv=c:GetLevel()
return lv>0 and Duel.IsCanRemoveCounter(tp,1,0,0x13,lv,REASON_COST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c94243005.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_REMOVED) and c94243005.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,0)>0
and Duel.IsExistingTarget(c94243005.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c94243005.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil,e,tp)
Duel.RemoveCounter(tp,1,0,0x13,g:GetFirst():GetLevel(),REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c94243005.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
function c94243005.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x13)
e:SetLabel(ct)
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousControler()==tp
and ct>0 and rp~=tp and bit.band(r,REASON_EFFECT)~=0
end
function c94243005.thfilter(c,lv)
return c:IsLevelBelow(lv) and c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsAbleToHand()
end
function c94243005.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c94243005.thfilter,tp,LOCATION_DECK,0,1,nil,e:GetLabel()) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c94243005.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c94243005.thfilter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel())
if g:GetCount()~=0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -53,7 +53,7 @@ function c97077563.desop(e,tp,eg,ep,ev,re,r,rp)
end
function c97077563.descon2(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY) end
return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY)
end
function c97077563.desop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
......
......@@ -10,11 +10,11 @@ function c97234686.initial_effect(c)
e1:SetOperation(c97234686.activate)
c:RegisterEffect(e1)
end
function c97234686.filter(c)
return c:IsFaceup() and c:IsSetCard(0x19)
function c97234686.filter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x19)
end
function c97234686.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c97234686.filter,1,nil)
return eg:IsExists(c97234686.filter,1,nil,tp)
end
function c97234686.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end
......
--ライトパルサー・ドラゴン
function c99365553.initial_effect(c)
--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(c99365553.spcon1)
e1:SetOperation(c99365553.spop1)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_SPSUMMON_PROC)
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c99365553.spcon2)
e2:SetOperation(c99365553.spop2)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(99365553,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c99365553.spcon3)
e3:SetTarget(c99365553.sptg3)
e3:SetOperation(c99365553.spop3)
c:RegisterEffect(e3)
end
function c99365553.spfilter1(c,att)
return c:IsAttribute(att) and c:IsAbleToRemoveAsCost()
end
function c99365553.spcon1(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c99365553.spfilter1,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT)
and Duel.IsExistingMatchingCard(c99365553.spfilter1,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK)
end
function c99365553.spop1(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,c99365553.spfilter1,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectMatchingCard(tp,c99365553.spfilter1,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
function c99365553.spfilter2(c,att)
return c:IsAttribute(att) and c:IsAbleToGraveAsCost()
end
function c99365553.spcon2(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c99365553.spfilter2,tp,LOCATION_HAND,0,1,nil,ATTRIBUTE_LIGHT)
and Duel.IsExistingMatchingCard(c99365553.spfilter2,tp,LOCATION_HAND,0,1,nil,ATTRIBUTE_DARK)
end
function c99365553.spop2(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,c99365553.spfilter2,tp,LOCATION_HAND,0,1,1,nil,ATTRIBUTE_LIGHT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=Duel.SelectMatchingCard(tp,c99365553.spfilter2,tp,LOCATION_HAND,0,1,1,nil,ATTRIBUTE_DARK)
g1:Merge(g2)
Duel.SendtoGrave(g1,REASON_COST)
end
function c99365553.spcon3(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c99365553.spfilter3(c,e,tp)
return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c99365553.sptg3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chk:IsLocation(LOCATION_GRAVE) and c99365553.spfilter3(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and Duel.IsExistingTarget(c99365553.spfilter3,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c99365553.spfilter3,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c99365553.spop3(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
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