Commit 445f4348 authored by VanillaSalt's avatar VanillaSalt

fix

parent 10c5edce
...@@ -146,6 +146,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -146,6 +146,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
pcard->operation_param = (pcard->operation_param & 0x00ffffff) | (POS_FACEDOWN_DEFENCE << 24); pcard->operation_param = (pcard->operation_param & 0x00ffffff) | (POS_FACEDOWN_DEFENCE << 24);
} }
if ((pcard->data.type & TYPE_PENDULUM) && (location == LOCATION_GRAVE) if ((pcard->data.type & TYPE_PENDULUM) && (location == LOCATION_GRAVE)
&& !pcard->is_affected_by_effect(EFFECT_CANNOT_TO_DECK) && is_player_can_send_to_deck(playerid, pcard)
&& (((pcard->previous.location == LOCATION_MZONE) && !pcard->is_status(STATUS_SUMMON_DISABLED)) && (((pcard->previous.location == LOCATION_MZONE) && !pcard->is_status(STATUS_SUMMON_DISABLED))
|| ((pcard->previous.location == LOCATION_SZONE) && !pcard->is_status(STATUS_ACTIVATE_DISABLED)))) { || ((pcard->previous.location == LOCATION_SZONE) && !pcard->is_status(STATUS_ACTIVATE_DISABLED)))) {
location = LOCATION_EXTRA; location = LOCATION_EXTRA;
...@@ -1719,7 +1720,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 min, int32 max, ...@@ -1719,7 +1720,7 @@ int32 field::check_xyz_material(card* scard, int32 findex, int32 min, int32 max,
core.xmaterial_lst.insert(std::make_pair(0, *cit)); core.xmaterial_lst.insert(std::make_pair(0, *cit));
} }
} else { } else {
pduel->game_field->get_xyz_material(scard, findex, max); get_xyz_material(scard, findex, max);
} }
return core.xmaterial_lst.size() >= min; return core.xmaterial_lst.size() >= min;
} }
......
...@@ -742,15 +742,15 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8 ...@@ -742,15 +742,15 @@ int32 field::remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8
core.units.begin()->step = 3; core.units.begin()->step = 3;
return FALSE; return FALSE;
} }
pduel->game_field->core.select_cards.clear(); core.select_cards.clear();
if(pcard) { if(pcard) {
for(auto cit = pcard->xyz_materials.begin(); cit != pcard->xyz_materials.end(); ++cit) for(auto cit = pcard->xyz_materials.begin(); cit != pcard->xyz_materials.end(); ++cit)
pduel->game_field->core.select_cards.push_back(*cit); core.select_cards.push_back(*cit);
} else { } else {
card_set cset; card_set cset;
pduel->game_field->get_overlay_group(rplayer, s, o, &cset); get_overlay_group(rplayer, s, o, &cset);
for(auto cit = cset.begin(); cit != cset.end(); ++cit) for(auto cit = cset.begin(); cit != cset.end(); ++cit)
pduel->game_field->core.select_cards.push_back(*cit); core.select_cards.push_back(*cit);
} }
pduel->write_buffer8(MSG_HINT); pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG); pduel->write_buffer8(HINT_SELECTMSG);
...@@ -800,14 +800,14 @@ int32 field::get_control(uint16 step, effect * reason_effect, uint8 reason_playe ...@@ -800,14 +800,14 @@ int32 field::get_control(uint16 step, effect * reason_effect, uint8 reason_playe
return TRUE; return TRUE;
pcard->filter_disable_related_cards(); pcard->filter_disable_related_cards();
if(pcard->unique_code) if(pcard->unique_code)
pduel->game_field->remove_unique_card(pcard); remove_unique_card(pcard);
move_to_field(pcard, playerid, playerid, LOCATION_MZONE, pcard->current.position); move_to_field(pcard, playerid, playerid, LOCATION_MZONE, pcard->current.position);
pcard->set_status(STATUS_ATTACK_CANCELED, TRUE); pcard->set_status(STATUS_ATTACK_CANCELED, TRUE);
return FALSE; return FALSE;
} }
case 1: { case 1: {
if(pcard->unique_code) if(pcard->unique_code)
pduel->game_field->add_unique_card(pcard); add_unique_card(pcard);
set_control(pcard, playerid, reset_phase, reset_count); set_control(pcard, playerid, reset_phase, reset_count);
pcard->reset(RESET_CONTROL, RESET_EVENT); pcard->reset(RESET_CONTROL, RESET_EVENT);
pcard->filter_disable_related_cards(); pcard->filter_disable_related_cards();
...@@ -848,17 +848,17 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play ...@@ -848,17 +848,17 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play
pcard1->filter_disable_related_cards(); pcard1->filter_disable_related_cards();
pcard2->filter_disable_related_cards(); pcard2->filter_disable_related_cards();
if(pcard1->unique_code) if(pcard1->unique_code)
pduel->game_field->remove_unique_card(pcard1); remove_unique_card(pcard1);
if(pcard2->unique_code) if(pcard2->unique_code)
pduel->game_field->remove_unique_card(pcard2); remove_unique_card(pcard2);
remove_card(pcard1); remove_card(pcard1);
remove_card(pcard2); remove_card(pcard2);
add_card(p2, pcard1, l2, s2); add_card(p2, pcard1, l2, s2);
add_card(p1, pcard2, l1, s1); add_card(p1, pcard2, l1, s1);
if(pcard1->unique_code) if(pcard1->unique_code)
pduel->game_field->add_unique_card(pcard1); add_unique_card(pcard1);
if(pcard2->unique_code) if(pcard2->unique_code)
pduel->game_field->add_unique_card(pcard2); add_unique_card(pcard2);
set_control(pcard1, p2, reset_phase, reset_count); set_control(pcard1, p2, reset_phase, reset_count);
set_control(pcard2, p1, reset_phase, reset_count); set_control(pcard2, p1, reset_phase, reset_count);
pcard1->reset(RESET_CONTROL, RESET_EVENT); pcard1->reset(RESET_CONTROL, RESET_EVENT);
...@@ -903,8 +903,8 @@ int32 field::control_adjust(uint16 step) { ...@@ -903,8 +903,8 @@ int32 field::control_adjust(uint16 step) {
switch(step) { switch(step) {
case 0: { case 0: {
core.operated_set.clear(); core.operated_set.clear();
uint32 b0 = pduel->game_field->get_useable_count(0, LOCATION_MZONE, PLAYER_NONE, 0); uint32 b0 = get_useable_count(0, LOCATION_MZONE, PLAYER_NONE, 0);
uint32 b1 = pduel->game_field->get_useable_count(1, LOCATION_MZONE, PLAYER_NONE, 0); uint32 b1 = get_useable_count(1, LOCATION_MZONE, PLAYER_NONE, 0);
for(auto cit = core.control_adjust_set[0].begin(); cit != core.control_adjust_set[0].end(); ++cit) for(auto cit = core.control_adjust_set[0].begin(); cit != core.control_adjust_set[0].end(); ++cit)
(*cit)->filter_disable_related_cards(); (*cit)->filter_disable_related_cards();
for(auto cit = core.control_adjust_set[1].begin(); cit != core.control_adjust_set[1].end(); ++cit) for(auto cit = core.control_adjust_set[1].begin(); cit != core.control_adjust_set[1].end(); ++cit)
...@@ -4258,11 +4258,21 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable, ...@@ -4258,11 +4258,21 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
rmax += (*cit)->operation_param; rmax += (*cit)->operation_param;
min -= rmax; min -= rmax;
max -= rmin; max -= rmin;
core.units.begin()->arg2 = (max << 16) + min;
if(min <= 0) { if(min <= 0) {
core.units.begin()->step = 5; if(max > 0)
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, playerid, 210);
else
core.units.begin()->step = 6;
} else
returns.ivalue[0] = TRUE;
return FALSE;
}
case 5: {
if(!returns.ivalue[0]) {
core.units.begin()->step = 6;
return FALSE; return FALSE;
} }
core.units.begin()->arg2 = (max << 16) + min;
core.select_cards.clear(); core.select_cards.clear();
for(auto cit = core.release_cards.begin(); cit != core.release_cards.end(); ++cit) for(auto cit = core.release_cards.begin(); cit != core.release_cards.end(); ++cit)
core.select_cards.push_back(*cit); core.select_cards.push_back(*cit);
...@@ -4273,12 +4283,12 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable, ...@@ -4273,12 +4283,12 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
add_process(PROCESSOR_SELECT_TRIBUTE_P, 0, 0, 0, ((uint32)cancelable << 16) + playerid, (max << 16) + min); add_process(PROCESSOR_SELECT_TRIBUTE_P, 0, 0, 0, ((uint32)cancelable << 16) + playerid, (max << 16) + min);
return FALSE; return FALSE;
} }
case 5: { case 6: {
for(int32 i = 0; i < returns.bvalue[0]; ++i) for(int32 i = 0; i < returns.bvalue[0]; ++i)
core.operated_set.insert(core.select_cards[returns.bvalue[i + 1]]); core.operated_set.insert(core.select_cards[returns.bvalue[i + 1]]);
return FALSE; return FALSE;
} }
case 6: { case 7: {
core.select_cards.clear(); core.select_cards.clear();
returns.bvalue[0] = core.operated_set.size(); returns.bvalue[0] = core.operated_set.size();
int32 i = 0; int32 i = 0;
......
...@@ -3429,9 +3429,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3429,9 +3429,12 @@ int32 field::process_battle_command(uint16 step) {
else damp = pd; else damp = pd;
if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE)) if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE))
damp = 1 - damp; damp = 1 - damp;
if(damp == pd || (!core.attacker->is_affected_by_effect(EFFECT_AVOID_BATTLE_DAMAGE, core.attack_target)
&& !is_player_affected_by_effect(damp, EFFECT_AVOID_BATTLE_DAMAGE))) {
core.battle_damage[damp] = a - d; core.battle_damage[damp] = a - d;
reason_card = core.attacker; reason_card = core.attacker;
} }
}
if(core.attack_target->is_destructable_by_battle(core.attacker)) if(core.attack_target->is_destructable_by_battle(core.attacker))
bd[1] = TRUE; bd[1] = TRUE;
} else if (a < d) { } else if (a < d) {
...@@ -3448,9 +3451,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3448,9 +3451,12 @@ int32 field::process_battle_command(uint16 step) {
else damp = pa; else damp = pa;
if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE)) if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE))
damp = 1 - damp; damp = 1 - damp;
if(damp == pa || (!core.attack_target->is_affected_by_effect(EFFECT_AVOID_BATTLE_DAMAGE, core.attacker)
&& !is_player_affected_by_effect(damp, EFFECT_AVOID_BATTLE_DAMAGE))) {
core.battle_damage[damp] = d - a; core.battle_damage[damp] = d - a;
reason_card = core.attack_target; reason_card = core.attack_target;
} }
}
if(core.attacker->is_destructable_by_battle(core.attack_target)) if(core.attacker->is_destructable_by_battle(core.attack_target))
bd[0] = TRUE; bd[0] = TRUE;
} else { } else {
...@@ -3488,8 +3494,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3488,8 +3494,12 @@ int32 field::process_battle_command(uint16 step) {
dp[pd] = 1; dp[pd] = 1;
dp[1 - pd] = 0; dp[1 - pd] = 0;
} }
if(dp[0]) core.battle_damage[0] = a - d; if(dp[pd] && !core.attack_target->is_affected_by_effect(EFFECT_AVOID_BATTLE_DAMAGE, core.attacker)
if(dp[1]) core.battle_damage[1] = a - d; && !is_player_affected_by_effect(pd, EFFECT_AVOID_BATTLE_DAMAGE))
core.battle_damage[pd] = a - d;
if(dp[1 - pd] && !core.attacker->is_affected_by_effect(EFFECT_AVOID_BATTLE_DAMAGE, core.attack_target)
&& !is_player_affected_by_effect(1 - pd, EFFECT_AVOID_BATTLE_DAMAGE))
core.battle_damage[1 - pd] = a - d;
reason_card = core.attacker; reason_card = core.attacker;
} }
if(core.attack_target->is_destructable_by_battle(core.attacker)) if(core.attack_target->is_destructable_by_battle(core.attacker))
...@@ -3508,11 +3518,14 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3508,11 +3518,14 @@ int32 field::process_battle_command(uint16 step) {
else damp = pa; else damp = pa;
if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE)) if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE))
damp = 1 - damp; damp = 1 - damp;
if(damp == pa || (!core.attack_target->is_affected_by_effect(EFFECT_AVOID_BATTLE_DAMAGE, core.attacker)
&& !is_player_affected_by_effect(damp, EFFECT_AVOID_BATTLE_DAMAGE))) {
core.battle_damage[damp] = d - a; core.battle_damage[damp] = d - a;
reason_card = core.attack_target; reason_card = core.attack_target;
} }
} }
} }
}
} else { } else {
damchange = core.attacker->is_affected_by_effect(EFFECT_BATTLE_DAMAGE_TO_EFFECT); damchange = core.attacker->is_affected_by_effect(EFFECT_BATTLE_DAMAGE_TO_EFFECT);
if(damchange) { if(damchange) {
...@@ -3524,10 +3537,12 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3524,10 +3537,12 @@ int32 field::process_battle_command(uint16 step) {
damp = 1 - pa; damp = 1 - pa;
if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE)) if(is_player_affected_by_effect(damp, EFFECT_REFLECT_BATTLE_DAMAGE))
damp = 1 - damp; damp = 1 - damp;
if(!is_player_affected_by_effect(damp, EFFECT_AVOID_BATTLE_DAMAGE)) {
core.battle_damage[damp] = a; core.battle_damage[damp] = a;
reason_card = core.attacker; reason_card = core.attacker;
} }
} }
}
if(bd[0]) if(bd[0])
core.attacker->set_status(STATUS_BATTLE_DESTROYED, TRUE); core.attacker->set_status(STATUS_BATTLE_DESTROYED, TRUE);
if(bd[1]) if(bd[1])
......
...@@ -62,9 +62,9 @@ function c20644748.mvalue(e,fp,rp,r) ...@@ -62,9 +62,9 @@ function c20644748.mvalue(e,fp,rp,r)
return 5-Duel.GetFieldGroupCount(fp,LOCATION_SZONE,0) return 5-Duel.GetFieldGroupCount(fp,LOCATION_SZONE,0)
end end
function c20644748.svalue(e,fp,rp,r) function c20644748.svalue(e,fp,rp,r)
if Duel.GetFieldCard(fp,LOCATION_SZONE,5) then local ct=5
return 4-Duel.GetFieldGroupCount(fp,LOCATION_MZONE,0) for i=5,7 do
else if Duel.GetFieldCard(fp,LOCATION_SZONE,i) then ct=ct-1 end
return 5-Duel.GetFieldGroupCount(fp,LOCATION_MZONE,0)
end end
return ct-Duel.GetFieldGroupCount(fp,LOCATION_MZONE,0)
end end
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
function c32646477.initial_effect(c) function c32646477.initial_effect(c)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--damage --damage
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(32646477,0)) e1:SetDescription(aux.Stringid(32646477,0))
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
function c37474917.initial_effect(c) function c37474917.initial_effect(c)
--synchro summon --synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--damage --damage
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(37474917,0)) e1:SetDescription(aux.Stringid(37474917,0))
......
...@@ -6,7 +6,7 @@ function c4130270.initial_effect(c) ...@@ -6,7 +6,7 @@ function c4130270.initial_effect(c)
e1:SetCode(EFFECT_CANNOT_TO_DECK) e1:SetCode(EFFECT_CANNOT_TO_DECK)
e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
c:RegisterEffect(e1) c:RegisterEffect(e1)
local e2=e1:Clone() local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_TO_HAND) e2:SetCode(EFFECT_CANNOT_TO_HAND)
......
...@@ -54,7 +54,6 @@ function c50485594.thtg(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -54,7 +54,6 @@ function c50485594.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_EXTRA)
end end
function c50485594.thop(e,tp,eg,ep,ev,re,r,rp) function c50485594.thop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(c50485594.filter,tp,LOCATION_EXTRA,0,nil) local g=Duel.GetMatchingGroup(c50485594.filter,tp,LOCATION_EXTRA,0,nil)
local sg=g:Filter(c50485594.filter2,nil,g) local sg=g:Filter(c50485594.filter2,nil,g)
if sg:GetCount()==0 then return end if sg:GetCount()==0 then return end
......
...@@ -38,7 +38,7 @@ function c77462146.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -38,7 +38,7 @@ function c77462146.activate(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_UPDATE_ATTACK) e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END) e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(300) e1:SetValue(300)
tc:RegisterEffect(e1) tc:RegisterEffect(e1)
local e2=e1:Clone() local e2=e1:Clone()
......
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