Commit b502f4e3 authored by VanillaSalt's avatar VanillaSalt

fix

parent 703095c2
...@@ -1735,18 +1735,15 @@ int32 field::is_player_can_discard_deck_as_cost(uint8 playerid, int32 count) { ...@@ -1735,18 +1735,15 @@ int32 field::is_player_can_discard_deck_as_cost(uint8 playerid, int32 count) {
if((count == 1) && core.deck_reversed) if((count == 1) && core.deck_reversed)
return player[playerid].list_main.back()->is_capable_cost_to_grave(playerid); return player[playerid].list_main.back()->is_capable_cost_to_grave(playerid);
effect_set eset; effect_set eset;
auto cit = player[playerid].list_main.rbegin(); filter_field_effect(EFFECT_TO_GRAVE_REDIRECT, &eset);
for(int32 j = 0; j < count; ++j) {
eset.clear();
(*cit)->filter_effect(EFFECT_TO_GRAVE_REDIRECT, &eset);
for(int32 i = 0; i < eset.count; ++i) { for(int32 i = 0; i < eset.count; ++i) {
uint32 redirect = eset[i]->get_value(); uint32 redirect = eset[i]->get_value();
if((redirect & LOCATION_REMOVED) && (*cit)->is_affected_by_effect(EFFECT_CANNOT_REMOVE)) if((redirect & LOCATION_REMOVED) && player[playerid].list_main.back()->is_affected_by_effect(EFFECT_CANNOT_REMOVE))
continue; continue;
uint8 p = eset[i]->get_handler_player();
if((eset[i]->flag & EFFECT_FLAG_IGNORE_RANGE) || (p == playerid && eset[i]->s_range & LOCATION_DECK) || (p != playerid && eset[i]->o_range & LOCATION_DECK))
return FALSE; return FALSE;
} }
++cit;
}
return TRUE; return TRUE;
} }
int32 field::is_player_can_discard_hand(uint8 playerid, card * pcard, effect * peffect, uint32 reason) { int32 field::is_player_can_discard_hand(uint8 playerid, card * pcard, effect * peffect, uint32 reason) {
......
...@@ -13,12 +13,28 @@ function c31615285.initial_effect(c) ...@@ -13,12 +13,28 @@ function c31615285.initial_effect(c)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1) e2:SetTargetRange(1,1)
e2:SetCondition(c31615285.dscon) e2:SetCondition(c31615285.discon)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--adjust
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetCode(EVENT_ADJUST)
e3:SetRange(LOCATION_MZONE)
e3:SetOperation(c31615285.adjustop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c31615285.discon(e)
return e:GetLabel()~=0
end end
function c31615285.filter(c) function c31615285.filter(c)
return c:IsFaceup() and c:IsRace(RACE_PLANT) return c:IsFaceup() and c:IsRace(RACE_PLANT)
end end
function c31615285.dscon(e) function c31615285.adjustop(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c31615285.filter,0,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) local phase=Duel.GetCurrentPhase()
if (phase==PHASE_DAMAGE and not Duel.IsDamageCalculated()) or phase==PHASE_DAMAGE_CAL then return end
if Duel.IsExistingMatchingCard(c31615285.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) then
e:GetLabelObject():SetLabel(1)
else e:GetLabelObject():SetLabel(0) end
end end
...@@ -9,6 +9,23 @@ function c44394295.initial_effect(c) ...@@ -9,6 +9,23 @@ function c44394295.initial_effect(c)
e1:SetTarget(c44394295.target) e1:SetTarget(c44394295.target)
e1:SetOperation(c44394295.activate) e1:SetOperation(c44394295.activate)
c:RegisterEffect(e1) c:RegisterEffect(e1)
if not c44394295.global_check then
c44394295.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c44394295.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c44394295.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
if tc:IsPreviousLocation(LOCATION_EXTRA) then
tc:RegisterFlagEffect(44394295,RESET_EVENT+0x46e0000,0,0)
end
tc=eg:GetNext()
end
end end
function c44394295.filter1(c,e) function c44394295.filter1(c,e)
return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e)
...@@ -18,7 +35,7 @@ function c44394295.filter2(c,e,tp,m,f,chkf) ...@@ -18,7 +35,7 @@ function c44394295.filter2(c,e,tp,m,f,chkf)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end end
function c44394295.cfilter(c) function c44394295.cfilter(c)
return bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL and c:IsPreviousLocation(LOCATION_EXTRA) return c:GetFlagEffect(44394295)~=0
end end
function c44394295.target(e,tp,eg,ep,ev,re,r,rp,chk) function c44394295.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
......
...@@ -10,9 +10,10 @@ function c58481572.initial_effect(c) ...@@ -10,9 +10,10 @@ function c58481572.initial_effect(c)
--remove --remove
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e2:SetCode(EFFECT_TO_GRAVE_REDIRECT) e2:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e2:SetRange(LOCATION_MZONE) e2:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0xfe,0xff)
e2:SetValue(LOCATION_REMOVED) e2:SetValue(LOCATION_REMOVED)
e2:SetTarget(c58481572.rmtg) e2:SetTarget(c58481572.rmtg)
c:RegisterEffect(e2) c:RegisterEffect(e2)
......
...@@ -46,6 +46,7 @@ function c89493368.damcon(e,tp,eg,ep,ev,re,r,rp) ...@@ -46,6 +46,7 @@ function c89493368.damcon(e,tp,eg,ep,ev,re,r,rp)
end end
function c89493368.damtg(e,tp,eg,ep,ev,re,r,rp,chk) function c89493368.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
e:GetHandler():RegisterFlagEffect(89493368,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800)
end end
function c89493368.damop(e,tp,eg,ep,ev,re,r,rp) function c89493368.damop(e,tp,eg,ep,ev,re,r,rp)
...@@ -65,7 +66,7 @@ end ...@@ -65,7 +66,7 @@ end
function c89493368.naop(e,tp,eg,ep,ev,re,r,rp) function c89493368.naop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker() local tc=Duel.GetAttacker()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then if tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.NegateAttack(tc) Duel.NegateAttack()
end end
end end
function c89493368.spcfilter(c,code) function c89493368.spcfilter(c,code)
......
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