Commit 16c605be authored by VanillaSalt's avatar VanillaSalt

fix

parent a24ccb3c
......@@ -1826,19 +1826,74 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
return FALSE;
}
case 6: {
if(returns.ivalue[0]) {
auto clit = core.new_ochain_s.begin();
effect* peffect = clit->triggering_effect;
uint8 tp = clit->triggering_player;
peffect->handler->set_status(STATUS_CHAINING, TRUE);
peffect->dec_count(tp);
if(tp == infos.turn_player)
core.tpchain.push_back(*clit);
else
core.ntpchain.push_back(*clit);
if(peffect->flag & EFFECT_FLAG_CVAL_CHECK)
peffect->get_value();
if(!returns.ivalue[0]) {
core.new_ochain_s.pop_front();
core.units.begin()->step = 4;
return FALSE;
}
auto clit = core.new_ochain_s.begin();
effect* peffect = clit->triggering_effect;
card* pcard = peffect->handler;
uint8 tp = clit->triggering_player;
core.select_effects.clear();
core.select_options.clear();
core.select_effects.push_back((effect*)0);
core.select_options.push_back(peffect->description);
int32 index = 0;
while(++clit != core.new_ochain_s.end()) {
++index;
peffect = clit->triggering_effect;
if(pcard != peffect->handler)
continue;
bool act = true;
if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& ((peffect->code == EVENT_FLIP) || (clit->triggering_location & 0x3)
|| !(peffect->handler->current.location & 0x3) || peffect->handler->is_status(STATUS_IS_PUBLIC))) {
if(!(peffect->flag & EFFECT_FLAG_FIELD_ONLY) && clit->triggering_location == LOCATION_HAND
&& (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE) && peffect->handler->is_has_relation(peffect))
|| (peffect->range & LOCATION_HAND))) {
continue;
} else if((peffect->flag & EFFECT_FLAG_FIELD_ONLY) || !(peffect->type & EFFECT_TYPE_FIELD) || (clit->triggering_location & peffect->range)) {
if(peffect->flag & EFFECT_FLAG_CHAIN_UNIQUE) {
if(tp == infos.turn_player) {
for(auto tpit = core.tpchain.begin(); tpit != core.tpchain.end(); ++tpit) {
if(tpit->triggering_effect->handler->data.code == peffect->handler->data.code) {
act = false;
break;
}
}
} else {
for(auto ntpit = core.ntpchain.begin(); ntpit != core.ntpchain.end(); ++ntpit) {
if(ntpit->triggering_effect->handler->data.code == peffect->handler->data.code) {
act = false;
break;
}
}
}
}
} else
continue;
} else continue;
if(act) {
core.select_effects.push_back((effect*)index);
core.select_options.push_back(peffect->description);
}
}
if(core.select_options.size() > 1) {
add_process(PROCESSOR_SELECT_OPTION, 0, 0, 0, tp, 0);
core.units.begin()->step = 19;
return FALSE;
}
clit = core.new_ochain_s.begin();
peffect = clit->triggering_effect;
peffect->handler->set_status(STATUS_CHAINING, TRUE);
peffect->dec_count(tp);
if(tp == infos.turn_player)
core.tpchain.push_back(*clit);
else
core.ntpchain.push_back(*clit);
if(peffect->flag & EFFECT_FLAG_CVAL_CHECK)
peffect->get_value();
core.new_ochain_s.pop_front();
core.units.begin()->step = 4;
return FALSE;
......@@ -1915,6 +1970,24 @@ int32 field::process_point_event(int16 step, int32 special, int32 skip_new) {
}
return TRUE;
}
case 20: {
int32 index = (int32)core.select_effects[returns.ivalue[0]];
auto clit = core.new_ochain_s.begin();
std::advance(clit, index);
effect* peffect = clit->triggering_effect;
uint8 tp = clit->triggering_player;
peffect->handler->set_status(STATUS_CHAINING, TRUE);
peffect->dec_count(tp);
if(tp == infos.turn_player)
core.tpchain.push_back(*clit);
else
core.ntpchain.push_back(*clit);
if(peffect->flag & EFFECT_FLAG_CVAL_CHECK)
peffect->get_value();
core.new_ochain_s.erase(clit);
core.units.begin()->step = 4;
return FALSE;
}
}
return TRUE;
}
......
......@@ -23,24 +23,21 @@ function c21007444.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c21007444.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg0=g:Filter(Card.IsRelateToEffect,nil,e)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
local sg=nil
if sg0:GetCount()==0 or ft<=0 then return end
if ft<sg0:GetCount() then
if sg:GetCount()==0 or ft<=0 then return end
if ft<sg:GetCount() then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
sg=sg0:FilterSelect(tp,c21007444.filter,ft,ft,nil,e,tp)
else
sg=sg0:Clone()
sg=sg:FilterSelect(tp,c21007444.filter,ft,ft,nil,e,tp)
end
if sg:GetCount()>0 then
local tg=sg:GetFirst()
local tc=sg:GetFirst()
local fid=e:GetHandler():GetFieldID()
while tg do
if Duel.SpecialSummonStep(tg,0,tp,tp,false,false,POS_FACEUP_ATTACK) then
tg:RegisterFlagEffect(21007444,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1,fid)
while tc do
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) then
tc:RegisterFlagEffect(21007444,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1,fid)
end
tg=sg:GetNext()
tc=sg:GetNext()
end
Duel.SpecialSummonComplete()
sg:KeepAlive()
......
......@@ -13,7 +13,7 @@ function c65384019.initial_effect(c)
c:RegisterEffect(e1)
end
function c65384019.condition(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()
end
function c65384019.filter(c)
return c:IsFaceup() and c:GetBaseAttack()~=0
......@@ -24,15 +24,18 @@ end
function c65384019.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c65384019.filter,tp,LOCATION_MZONE,0,nil)
local c=e:GetHandler()
local fid=c:GetFieldID()
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(0)
tc:RegisterEffect(e1)
tc:RegisterFlagEffect(65384019,RESET_EVENT+0x17a0000+RESET_PHASE+PHASE_END,0,1)
if not tc:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_BASE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(0)
tc:RegisterEffect(e1)
tc:RegisterFlagEffect(65384019,RESET_EVENT+0x17a0000+RESET_PHASE+PHASE_END,0,1,fid)
end
tc=g:GetNext()
end
local e2=Effect.CreateEffect(c)
......@@ -45,13 +48,14 @@ function c65384019.activate(e,tp,eg,ep,ev,re,r,rp)
e2:SetTarget(c65384019.drtg)
e2:SetOperation(c65384019.drop)
e2:SetReset(RESET_PHASE+PHASE_END)
e2:SetLabel(fid)
Duel.RegisterEffect(e2,tp)
end
function c65384019.drfilter(c)
return c:GetFlagEffect(65384019)~=0
function c65384019.drfilter(c,fid)
return c:GetFlagEffectLabel(65384019)==fid
end
function c65384019.drcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c65384019.drfilter,1,nil)
return eg:IsExists(c65384019.drfilter,1,nil,e:GetLabel())
end
function c65384019.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true 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