Commit 04bd958a authored by VanillaSalt's avatar VanillaSalt

fix

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