Commit f07748ae authored by mercury233's avatar mercury233
parents 1528daf8 6a348907
......@@ -272,6 +272,7 @@ struct processor {
uint8 remove_brainwashing;
uint8 flip_delayed;
uint8 damage_calculated;
uint8 hand_adjusted;
uint8 summon_state_count[2];
uint8 normalsummon_state_count[2];
uint8 flipsummon_state_count[2];
......
......@@ -1351,51 +1351,53 @@ int32 field::process_phase_event(int16 step, int32 phase) {
cn_count++;
}
core.spe_effect[check_player] = 0;
pr = effects.trigger_o_effect.equal_range(phase_event);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
core.spe_effect[check_player]++;
}
if(phase == PHASE_DRAW)
core.hint_timing[infos.turn_player] = TIMING_DRAW_PHASE;
else if(phase == PHASE_STANDBY)
core.hint_timing[infos.turn_player] = TIMING_STANDBY_PHASE;
else if(phase == PHASE_BATTLE)
core.hint_timing[infos.turn_player] = TIMING_BATTLE_END;
else core.hint_timing[infos.turn_player] = TIMING_END_PHASE;
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
if(!core.hand_adjusted) {
pr = effects.trigger_o_effect.equal_range(phase_event);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
if(phase == PHASE_DRAW)
core.hint_timing[infos.turn_player] = TIMING_DRAW_PHASE;
else if(phase == PHASE_STANDBY)
core.hint_timing[infos.turn_player] = TIMING_STANDBY_PHASE;
else if(phase == PHASE_BATTLE)
core.hint_timing[infos.turn_player] = TIMING_BATTLE_END;
else core.hint_timing[infos.turn_player] = TIMING_END_PHASE;
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
}
if(core.select_chains.size() == 0) {
returns.ivalue[0] = -1;
......@@ -1520,53 +1522,55 @@ int32 field::process_phase_event(int16 step, int32 phase) {
cn_count++;
}
core.spe_effect[check_player] = 0;
pr = effects.trigger_o_effect.equal_range(phase_event);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
core.spe_effect[check_player]++;
}
if(phase == PHASE_DRAW)
core.hint_timing[infos.turn_player] = TIMING_DRAW_PHASE;
else if(phase == PHASE_STANDBY)
core.hint_timing[infos.turn_player] = TIMING_STANDBY_PHASE;
else if(phase == PHASE_BATTLE)
core.hint_timing[infos.turn_player] = TIMING_BATTLE_END;
else core.hint_timing[infos.turn_player] = TIMING_END_PHASE;
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
if(!core.hand_adjusted) {
pr = effects.trigger_o_effect.equal_range(phase_event);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
if(phase == PHASE_DRAW)
core.hint_timing[infos.turn_player] = TIMING_DRAW_PHASE;
else if(phase == PHASE_STANDBY)
core.hint_timing[infos.turn_player] = TIMING_STANDBY_PHASE;
else if(phase == PHASE_BATTLE)
core.hint_timing[infos.turn_player] = TIMING_BATTLE_END;
else core.hint_timing[infos.turn_player] = TIMING_END_PHASE;
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
core.select_chains.push_back(newchain);
fc_count++;
}
}
if(core.select_chains.size() == 0) {
returns.ivalue[0] = -1;
......@@ -1691,6 +1695,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
return FALSE;
}
case 22: {
core.hand_adjusted = TRUE;
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0);
core.units.begin()->step = -1;
return FALSE;
......@@ -1702,11 +1707,6 @@ int32 field::process_phase_event(int16 step, int32 phase) {
return FALSE;
}
case 26: {
if(core.new_fchain.size() || core.new_ochain.size()) {
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, 0, 0);
core.units.begin()->step = -1;
return FALSE;
}
core.quick_f_chain.clear();
core.instant_event.clear();
core.point_event.clear();
......@@ -2018,9 +2018,10 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
case 9: {
infos.priorities[0] = 0;
infos.priorities[1] = 0;
if(core.current_chain.size() == 0)
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, skip_freechain, infos.turn_player);
else
if(core.current_chain.size() == 0) {
if(!core.hand_adjusted)
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, skip_freechain, infos.turn_player);
} else
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, skip_freechain, 1 - core.current_chain.back().triggering_player);
return FALSE;
}
......@@ -4086,6 +4087,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
}
infos.phase = PHASE_DRAW;
core.phase_action = FALSE;
core.hand_adjusted = FALSE;
raise_event((card*)0, EVENT_PHASE_START + PHASE_DRAW, 0, 0, 0, turn_player, 0);
process_instant_event();
adjust_all();
......
......@@ -29,6 +29,7 @@ function c15609017.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
e:SetLabel(0)
local rt=Duel.GetTargetCount(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
if rt>2 then rt=2 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local cg=Duel.SelectMatchingCard(tp,c15609017.costfilter,tp,LOCATION_GRAVE,0,1,rt,nil)
local ct=cg:GetCount()
......
......@@ -98,7 +98,7 @@ function c18175965.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD)
end
function c18175965.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end
if chk==0 then return e:GetHandler():IsStatus(STATUS_PROC_COMPLETE) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,tp,1)
end
......
......@@ -21,7 +21,7 @@ function c24082387.filter1(c,e,tp,cg,minc)
and cg:CheckWithSumEqual(Card.GetLevel,c:GetLevel(),minc,99)
end
function c24082387.cgfilter(c)
return c:GetLevel()>0 and c:IsAbleToGraveAsCost()
return c:GetLevel()>0 and c:IsAbleToGraveAsCost() and bit.band(c:GetOriginalType(),TYPE_MONSTER)~=0
end
function c24082387.target(e,tp,eg,ep,ev,re,r,rp,chk)
local cg=Duel.GetMatchingGroup(c24082387.cgfilter,tp,LOCATION_MZONE,0,nil)
......
......@@ -33,7 +33,7 @@ function c36970611.initial_effect(c)
c:RegisterEffect(e3)
end
function c36970611.cfilter(c)
return c:IsSetCard(0xc1) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToRemoveAsCost()
return c:IsSetCard(0xc1) and c:IsType(TYPE_MONSTER) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToRemoveAsCost()
and Duel.IsExistingTarget(Card.IsAbleToRemove,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c)
end
function c36970611.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -45,11 +45,17 @@ function c37192109.rmop(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end
local g=Group.FromCards(c,tc)
if Duel.Remove(g,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local fid=e:GetHandler():GetFieldID()
local fid=c:GetFieldID()
local rct=1
if Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_STANDBY then rct=2 end
local og=Duel.GetOperatedGroup()
local oc=og:GetFirst()
while oc do
oc:RegisterFlagEffect(37192109,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY,0,2,fid)
if oc:IsControler(tp) then
oc:RegisterFlagEffect(37192109,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,rct,fid)
else
oc:RegisterFlagEffect(37192109,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_OPPO_TURN,0,1,fid)
end
oc=og:GetNext()
end
og:KeepAlive()
......@@ -57,12 +63,18 @@ function c37192109.rmop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetReset(RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(og)
e1:SetCondition(c37192109.retcon)
e1:SetOperation(c37192109.retop)
if Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_STANDBY then
e1:SetReset(RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,2)
e1:SetValue(Duel.GetTurnCount())
else
e1:SetReset(RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN)
e1:SetValue(0)
end
Duel.RegisterEffect(e1,tp)
end
end
......@@ -70,7 +82,7 @@ function c37192109.retfilter(c,fid)
return c:GetFlagEffectLabel(37192109)==fid
end
function c37192109.retcon(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()~=tp then return false end
if Duel.GetTurnPlayer()~=tp or Duel.GetTurnCount()==e:GetValue() then return false end
local g=e:GetLabelObject()
if not g:IsExists(c37192109.retfilter,1,nil,e:GetLabel()) then
g:DeleteGroup()
......
......@@ -23,7 +23,7 @@ function c55690251.initial_effect(c)
--send to grave
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(55690251,1))
e4:SetCategory(CATEGORY_REMOVE)
e4:SetCategory(CATEGORY_TOGRAVE)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetCountLimit(1)
......@@ -66,7 +66,7 @@ function c55690251.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-1000)
c:RegisterEffect(e1)
if tc and tc:IsRelateToEffect(e) then
if tc and tc:IsRelateToEffect(e) and not c:IsHasEffect(EFFECT_REVERSE_UPDATE) then
Duel.SendtoGrave(tc,REASON_EFFECT)
end
end
......
--琰魔竜王 レッド・デーモン・カラミティ
function c62242678.initial_effect(c)
--synchro summon
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c62242678.syncon)
e1:SetOperation(c62242678.synop)
e1:SetValue(SUMMON_TYPE_SYNCHRO)
c:RegisterEffect(e1)
--act limit
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(62242678,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c62242678.limcon)
e2:SetTarget(c62242678.limtg)
e2:SetOperation(c62242678.limop)
c:RegisterEffect(e2)
--damage
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(62242678,1))
e3:SetCategory(CATEGORY_DAMAGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EVENT_BATTLE_DESTROYING)
e3:SetCondition(aux.bdcon)
e3:SetTarget(c62242678.damtg)
e3:SetOperation(c62242678.damop)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(62242678,2))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e4:SetCondition(c62242678.spcon)
e4:SetTarget(c62242678.sptg)
e4:SetOperation(c62242678.spop)
c:RegisterEffect(e4)
end
function c62242678.matfilter1(c,syncard)
return c:IsType(TYPE_TUNER) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsCanBeSynchroMaterial(syncard)
end
function c62242678.matfilter2(c,syncard)
return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSynchroMaterial(syncard)
end
function c62242678.synfilter1(c,syncard,lv,g1,g2,g3)
local tlv=c:GetSynchroLevel(syncard)
if lv-tlv<=0 then return false end
local f1=c.tuner_filter
if c:IsHasEffect(55863245) then
return g3:IsExists(c62242678.synfilter2,1,c,syncard,lv-tlv,g2,f1,c)
else
return g1:IsExists(c62242678.synfilter2,1,c,syncard,lv-tlv,g2,f1,c)
end
end
function c62242678.synfilter2(c,syncard,lv,g2,f1,tuner1)
local tlv=c:GetSynchroLevel(syncard)
if lv-tlv<=0 then return false end
local f2=c.tuner_filter
if f1 and not f1(c) then return false end
if f2 and not f2(tuner1) then return false end
return g2:IsExists(c62242678.synfilter3,1,nil,syncard,lv-tlv,f1,f2)
end
function c62242678.synfilter3(c,syncard,lv,f1,f2)
local mlv=c:GetSynchroLevel(syncard)
local lv1=bit.band(mlv,0xffff)
local lv2=bit.rshift(mlv,16)
return (lv1==lv or lv2==lv) and (not f1 or f1(c)) and (not f2 or f2(c))
end
function c62242678.syncon(e,c,tuner,mg)
if c==nil then return true end
local tp=c:GetControler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<-2 then return false end
local g1=nil
local g2=nil
local g3=nil
if mg then
g1=mg:Filter(c62242678.matfilter1,nil,c)
g2=mg:Filter(c62242678.matfilter2,nil,c)
g3=mg:Filter(c62242678.matfilter1,nil,c)
else
g1=Duel.GetMatchingGroup(c62242678.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c62242678.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g3=Duel.GetMatchingGroup(c62242678.matfilter1,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,nil,c)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
if tuner then
local tlv=tuner:GetSynchroLevel(c)
if lv-tlv<=0 then return false end
local f1=tuner.tuner_filter
if not pe then
return g1:IsExists(c62242678.synfilter2,1,tuner,c,lv-tlv,g2,f1,tuner)
else
return c62242678.synfilter2(pe:GetOwner(),c,lv-tlv,g2,f1,tuner)
end
end
if not pe then
return g1:IsExists(c62242678.synfilter1,1,nil,c,lv,g1,g2,g3)
else
return c62242678.synfilter1(pe:GetOwner(),c,lv,g1,g2)
end
end
function c62242678.synop(e,tp,eg,ep,ev,re,r,rp,c,tuner,mg)
local g=Group.CreateGroup()
local g1=nil
local g2=nil
local g3=nil
if mg then
g1=mg:Filter(c62242678.matfilter1,nil,c)
g2=mg:Filter(c62242678.matfilter2,nil,c)
g3=mg:Filter(c62242678.matfilter1,nil,c)
else
g1=Duel.GetMatchingGroup(c62242678.matfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g2=Duel.GetMatchingGroup(c62242678.matfilter2,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c)
g3=Duel.GetMatchingGroup(c62242678.matfilter1,tp,LOCATION_MZONE+LOCATION_HAND,LOCATION_MZONE,nil,c)
end
local pe=Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_SMATERIAL)
local lv=c:GetLevel()
if tuner then
g:AddCard(tuner)
local lv1=tuner:GetSynchroLevel(c)
local f1=tuner.tuner_filter
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local tuner2=nil
if not pe then
local t2=g1:FilterSelect(tp,c62242678.synfilter2,1,1,tuner,c,lv-lv1,g2,f1,tuner)
tuner2=t2:GetFirst()
else
tuner2=pe:GetOwner()
Group.FromCards(tuner2):Select(tp,1,1,nil)
end
g:AddCard(tuner2)
local lv2=tuner2:GetSynchroLevel(c)
local f2=tuner2.tuner_filter
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local m3=g2:FilterSelect(tp,c62242678.synfilter3,1,1,nil,c,lv-lv1-lv2,f1,f2)
g:Merge(m3)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local tuner1=nil
if not pe then
local t1=g1:FilterSelect(tp,c62242678.synfilter1,1,1,nil,c,lv,g1,g2,g3)
tuner1=t1:GetFirst()
else
tuner1=pe:GetOwner()
Group.FromCards(tuner1):Select(tp,1,1,nil)
end
g:AddCard(tuner1)
local lv1=tuner1:GetSynchroLevel(c)
local f1=tuner1.tuner_filter
local t2=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
if tuner1:IsHasEffect(55863245) then
t2=g3:FilterSelect(tp,c62242678.synfilter2,1,1,tuner1,c,lv-lv1,g2,f1,tuner1)
else
t2=g1:FilterSelect(tp,c62242678.synfilter2,1,1,tuner1,c,lv-lv1,g2,f1,tuner1)
end
local tuner2=t2:GetFirst()
g:AddCard(tuner2)
local lv2=tuner2:GetSynchroLevel(c)
local f2=tuner2.tuner_filter
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL)
local m3=g2:FilterSelect(tp,c62242678.synfilter3,1,1,nil,c,lv-lv1-lv2,f1,f2)
g:Merge(m3)
end
c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_SYNCHRO)
end
function c62242678.limcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c62242678.limtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetChainLimit(c62242678.chainlm)
end
function c62242678.chainlm(e,rp,tp)
return tp==rp
end
function c62242678.limop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetValue(c62242678.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c62242678.aclimit(e,re,tp)
return re:GetHandler():IsOnField()
end
function c62242678.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local dam=e:GetHandler():GetBattleTarget():GetBaseAttack()
if dam<0 then dam=0 end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(dam)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
end
function c62242678.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
function c62242678.spcon(e,tp,eg,ep,ev,re,r,rp)
return rp~=tp and e:GetHandler():GetPreviousControler()==tp
end
function c62242678.spfilter(c,e,tp)
return c:IsLevelBelow(8) and c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_DARK)
and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c62242678.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c62242678.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c62242678.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c62242678.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c62242678.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -47,6 +47,9 @@ function c69750546.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c69750546.costfilter,tp,LOCATION_DECK+LOCATION_HAND,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.GetMatchingGroup(c69750546.costfilter,tp,LOCATION_DECK+LOCATION_HAND,0,nil)
if g:GetCount()>2 then
g=Duel.SelectMatchingCard(tp,c69750546.costfilter,tp,LOCATION_DECK+LOCATION_HAND,0,2,2,nil)
end
Duel.SendtoGrave(g,REASON_COST)
end
function c69750546.destg(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -55,11 +55,15 @@ function c74586817.rmop(e,tp,eg,ep,ev,re,r,rp)
local rs=g:RandomSelect(1-tp,1)
local rg=Group.FromCards(c,rs:GetFirst())
if Duel.Remove(rg,POS_FACEUP,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local fid=e:GetHandler():GetFieldID()
local fid=c:GetFieldID()
local og=Duel.GetOperatedGroup()
local oc=og:GetFirst()
while oc do
oc:RegisterFlagEffect(74586817,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY,0,2,fid)
if oc:IsControler(tp) then
oc:RegisterFlagEffect(74586817,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,0,1,fid)
else
oc:RegisterFlagEffect(74586817,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_OPPO_TURN,0,1,fid)
end
oc=og:GetNext()
end
og:KeepAlive()
......@@ -67,12 +71,12 @@ function c74586817.rmop(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetReset(RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(og)
e1:SetCondition(c74586817.retcon)
e1:SetOperation(c74586817.retop)
e1:SetReset(RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN)
Duel.RegisterEffect(e1,tp)
end
end
......@@ -121,7 +125,7 @@ function c74586817.retop(e,tp,eg,ep,ev,re,r,rp)
end
function c74586817.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToDeck() and chkc~=e:GetHandler() end
if chk==0 then return e:GetHandler():IsAbleToDeck()
if chk==0 then return e:GetHandler():IsAbleToExtra()
and Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,e:GetHandler())
......
......@@ -62,9 +62,9 @@ function c87602890.operation(e,tp,eg,ep,ev,re,r,rp)
local att=0
if tc:IsFaceup() then att=tc:GetAttribute() end
if Duel.Destroy(tc,REASON_EFFECT)==0 or bit.band(att,ATTRIBUTE_LIGHT)==0 then return end
local lv=tc:GetLevel()
local lv=tc:GetOriginalLevel()
if tc:IsType(TYPE_XYZ) then
lv=tc:GetRank()
lv=tc:GetOriginalRank()
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_EXTRA,0,lv,lv,nil)
......
......@@ -75,5 +75,5 @@ function c95403418.spop(e,tp,eg,ep,ev,re,r,rp,c)
end
function c95403418.descon(e)
local tp=e:GetHandlerPlayer()
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)
return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
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