Commit 04bd958a authored by VanillaSalt's avatar VanillaSalt

fix

parent fec64124
...@@ -79,6 +79,7 @@ field::field(duel* pduel) { ...@@ -79,6 +79,7 @@ field::field(duel* pduel) {
core.duel_options = 0; core.duel_options = 0;
core.attacker = 0; core.attacker = 0;
core.attack_target = 0; core.attack_target = 0;
core.attack_rollback = FALSE;
core.deck_reversed = FALSE; core.deck_reversed = FALSE;
core.remove_brainwashing = FALSE; core.remove_brainwashing = FALSE;
core.effect_damage_step = FALSE; core.effect_damage_step = FALSE;
......
...@@ -243,6 +243,7 @@ struct processor { ...@@ -243,6 +243,7 @@ struct processor {
group* limit_xyz; group* limit_xyz;
group* limit_syn; group* limit_syn;
uint8 attack_cancelable; uint8 attack_cancelable;
uint8 attack_rollback;
uint8 effect_damage_step; uint8 effect_damage_step;
int32 battle_damage[2]; int32 battle_damage[2];
int32 summon_count[2]; int32 summon_count[2];
......
...@@ -3120,6 +3120,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3120,6 +3120,7 @@ int32 field::process_battle_command(uint16 step) {
core.units.begin()->step = -1; core.units.begin()->step = -1;
return FALSE; return FALSE;
} }
core.attack_rollback = FALSE;
for(uint32 i = 0; i < 5; ++i) { for(uint32 i = 0; i < 5; ++i) {
if(player[1 - infos.turn_player].list_mzone[i]) if(player[1 - infos.turn_player].list_mzone[i])
core.opp_mzone[i] = player[1 - infos.turn_player].list_mzone[i]->fieldid_r; core.opp_mzone[i] = player[1 - infos.turn_player].list_mzone[i]->fieldid_r;
...@@ -3139,7 +3140,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3139,7 +3140,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 8: { case 8: {
if(is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP)) { if(is_player_affected_by_effect(infos.turn_player, EFFECT_SKIP_BP) || core.attack_rollback) {
core.units.begin()->step = 9; core.units.begin()->step = 9;
return FALSE; return FALSE;
} }
...@@ -3164,7 +3165,7 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3164,7 +3165,7 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
case 10: { case 10: {
bool rollback = false; uint8 rollback = core.attack_rollback;
bool atk_disabled = false; bool atk_disabled = false;
uint32 acon = core.units.begin()->arg2 >> 16; uint32 acon = core.units.begin()->arg2 >> 16;
uint32 afid = core.units.begin()->arg2 & 0xffff; uint32 afid = core.units.begin()->arg2 & 0xffff;
...@@ -5368,8 +5369,26 @@ int32 field::adjust_step(uint16 step) { ...@@ -5368,8 +5369,26 @@ int32 field::adjust_step(uint16 step) {
case 14: { case 14: {
//attack cancel //attack cancel
card* attacker = core.attacker; card* attacker = core.attacker;
if(attacker && attacker->is_affected_by_effect(EFFECT_CANNOT_ATTACK)) if(!attacker)
return FALSE;
if(attacker->is_affected_by_effect(EFFECT_CANNOT_ATTACK))
attacker->set_status(STATUS_ATTACK_CANCELED, TRUE); attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
if(core.attack_rollback)
return FALSE;
for(uint32 i = 0; i < 5; ++i) {
card* pcard = player[1 - infos.turn_player].list_mzone[i];
if(pcard) {
if(!core.opp_mzone[i] || core.opp_mzone[i] != pcard->fieldid_r) {
core.attack_rollback = TRUE;
break;
}
} else {
if(core.opp_mzone[i]) {
core.attack_rollback = TRUE;
break;
}
}
}
return FALSE; return FALSE;
} }
case 15: { case 15: {
......
...@@ -82,6 +82,7 @@ function c10960419.rmop(e,tp,eg,ep,ev,re,r,rp) ...@@ -82,6 +82,7 @@ function c10960419.rmop(e,tp,eg,ep,ev,re,r,rp)
e1:SetLabel(ct) e1:SetLabel(ct)
e1:SetLabelObject(tc) e1:SetLabelObject(tc)
e1:SetCountLimit(1) e1:SetCountLimit(1)
e1:SetCondition(c10960419.turncon)
e1:SetOperation(c10960419.turnop) e1:SetOperation(c10960419.turnop)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
local e2=e1:Clone() local e2=e1:Clone()
...@@ -95,6 +96,10 @@ function c10960419.rmop(e,tp,eg,ep,ev,re,r,rp) ...@@ -95,6 +96,10 @@ function c10960419.rmop(e,tp,eg,ep,ev,re,r,rp)
end end
end end
end end
function c10960419.turncon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
return tc:GetFlagEffect(1082946)~=0
end
function c10960419.turnop(e,tp,eg,ep,ev,re,r,rp) function c10960419.turnop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject() local tc=e:GetLabelObject()
local ct=tc:GetTurnCounter() local ct=tc:GetTurnCounter()
...@@ -107,17 +112,15 @@ function c10960419.turnop(e,tp,eg,ep,ev,re,r,rp) ...@@ -107,17 +112,15 @@ function c10960419.turnop(e,tp,eg,ep,ev,re,r,rp)
end end
function c10960419.retcon(e,tp,eg,ep,ev,re,r,rp) function c10960419.retcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject() local tc=e:GetLabelObject()
if tc:GetTurnCounter()>e:GetLabel() then local ct=tc:GetTurnCounter()
e:Reset() if ct==e:GetLabel() then
return false
else
return true return true
end end
if ct>e:GetLabel() then
e:Reset()
end
return false
end end
function c10960419.retop(e,tp,eg,ep,ev,re,r,rp) function c10960419.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject() Duel.ReturnToField(tc)
local ct=tc:GetTurnCounter()
if ct==e:GetLabel() then
Duel.ReturnToField(tc)
end
end end
...@@ -6,7 +6,6 @@ function c32491822.initial_effect(c) ...@@ -6,7 +6,6 @@ function c32491822.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(aux.FALSE)
c:RegisterEffect(e1) c:RegisterEffect(e1)
--special summon --special summon
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
...@@ -42,21 +41,31 @@ function c32491822.spfilter(c) ...@@ -42,21 +41,31 @@ function c32491822.spfilter(c)
end end
function c32491822.spcon(e,c) function c32491822.spcon(e,c)
if c==nil then return true end if c==nil then return true end
if Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)==0 then local tp=c:GetControler()
return Duel.IsExistingMatchingCard(c32491822.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
and Duel.IsExistingMatchingCard(c32491822.spfilter,c:GetControler(),LOCATION_ONFIELD,0,3,nil) if ft<-2 then return false end
if ft<=0 then
local ct=-ft+1
return Duel.IsExistingMatchingCard(c32491822.spfilter,tp,LOCATION_MZONE,0,ct,nil)
and Duel.IsExistingMatchingCard(c32491822.spfilter,tp,LOCATION_ONFIELD,0,3,nil)
else else
return Duel.IsExistingMatchingCard(c32491822.spfilter,c:GetControler(),LOCATION_ONFIELD,0,3,nil) return Duel.IsExistingMatchingCard(c32491822.spfilter,tp,LOCATION_ONFIELD,0,3,nil)
end end
end end
function c32491822.spop(e,tp,eg,ep,ev,re,r,rp,c) function c32491822.spop(e,tp,eg,ep,ev,re,r,rp,c)
if Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)==0 then local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g1=Duel.SelectMatchingCard(tp,c32491822.spfilter,tp,LOCATION_MZONE,0,1,1,nil) local sg=Duel.GetMatchingGroup(c32491822.spfilter,tp,LOCATION_ONFIELD,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local ct=-ft+1
local g2=Duel.SelectMatchingCard(tp,c32491822.spfilter,tp,LOCATION_ONFIELD,0,2,2,g1:GetFirst()) local g1=sg:FilterSelect(tp,Card.IsLocation,ct,ct,nil,LOCATION_MZONE)
g2:AddCard(g1:GetFirst()) if ct<3 then
Duel.SendtoGrave(g2,REASON_COST) sg:Sub(g1)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g2=sg:Select(tp,3-ct,3-ct,nil)
g1:Merge(g2)
end
Duel.SendtoGrave(g1,REASON_COST)
else else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c32491822.spfilter,tp,LOCATION_ONFIELD,0,3,3,nil) local g=Duel.SelectMatchingCard(tp,c32491822.spfilter,tp,LOCATION_ONFIELD,0,3,3,nil)
...@@ -66,7 +75,7 @@ end ...@@ -66,7 +75,7 @@ end
function c32491822.damcon(e,tp,eg,ep,ev,re,r,rp) function c32491822.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
local bc=c:GetBattleTarget() local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE) and bc:IsType(TYPE_MONSTER) return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE) and bc:IsType(TYPE_MONSTER)
end end
function c32491822.damtg(e,tp,eg,ep,ev,re,r,rp,chk) function c32491822.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end if chk==0 then return true end
......
...@@ -33,6 +33,7 @@ function c67696066.spop(e,tp,eg,ep,ev,re,r,rp) ...@@ -33,6 +33,7 @@ function c67696066.spop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(0) e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1) tc:RegisterEffect(e1)
......
...@@ -117,6 +117,7 @@ function c71645242.spop2(e,tp,eg,ep,ev,re,r,rp) ...@@ -117,6 +117,7 @@ function c71645242.spop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(dg,REASON_EFFECT) Duel.Destroy(dg,REASON_EFFECT)
Duel.BreakEffect() Duel.BreakEffect()
local og=Duel.GetOperatedGroup() local og=Duel.GetOperatedGroup()
if not og:IsContains(c) then return end
og:RemoveCard(c) og:RemoveCard(c)
local atk=og:GetSum(Card.GetPreviousAttackOnField) local atk=og:GetSum(Card.GetPreviousAttackOnField)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
......
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