Commit fdafde2c authored by argon's avatar argon

fix

parent f37aa3ee
......@@ -420,22 +420,22 @@ void SingleDuel::TPResult(DuelPlayer* dp, unsigned char tp) {
last_replay.WriteInt32(opt, false);
last_replay.Flush();
last_replay.WriteInt32(pdeck[0].main.size(), false);
for(size_t i = pdeck[0].main.size() - 1; i >= 0; --i) {
for(int32 i = (int32)pdeck[0].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].main[i]->first, 0, 0, LOCATION_DECK, 0, 0);
last_replay.WriteInt32(pdeck[0].main[i]->first, false);
}
last_replay.WriteInt32(pdeck[0].extra.size(), false);
for(size_t i = pdeck[0].extra.size() - 1; i >= 0; --i) {
for(int32 i = (int32)pdeck[0].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[0].extra[i]->first, 0, 0, LOCATION_EXTRA, 0, 0);
last_replay.WriteInt32(pdeck[0].extra[i]->first, false);
}
last_replay.WriteInt32(pdeck[1].main.size(), false);
for(size_t i = pdeck[1].main.size() - 1; i >= 0; --i) {
for(int32 i = (int32)pdeck[1].main.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[1].main[i]->first, 1, 1, LOCATION_DECK, 0, 0);
last_replay.WriteInt32(pdeck[1].main[i]->first, false);
}
last_replay.WriteInt32(pdeck[1].extra.size(), false);
for(size_t i = pdeck[1].extra.size() - 1; i >= 0; --i) {
for(int32 i = (int32)pdeck[1].extra.size() - 1; i >= 0; --i) {
new_card(pduel, pdeck[1].extra[i]->first, 1, 1, LOCATION_EXTRA, 0, 0);
last_replay.WriteInt32(pdeck[1].extra[i]->first, false);
}
......
......@@ -697,7 +697,7 @@ void card::cancel_field_effect() {
&& (it->second->type & EFFECT_TYPE_TRIGGER_O) && !(it->second->code & EVENT_PHASE)))
pduel->game_field->remove_effect(it->second);
}
if(unique_code && current.location & LOCATION_ONFIELD)
if(unique_code && (current.location & LOCATION_ONFIELD))
pduel->game_field->remove_unique_card(this);
}
void card::enable_field_effect(int32 enabled) {
......
......@@ -1327,7 +1327,7 @@ effect* field::check_unique_onfield(card* pcard, uint8 controler) {
return 0;
for(auto iter = core.unique_cards[controler].begin(); iter != core.unique_cards[controler].end(); ++iter) {
card* ucard = *iter;
if((ucard != pcard) && ucard->is_position(POS_FACEUP) && ucard->unique_code == pcard->unique_code
if((ucard != pcard) && ucard->get_status(STATUS_EFFECT_ENABLED) && (ucard->unique_code == pcard->unique_code)
&& (!(pcard->current.location & LOCATION_ONFIELD) || pcard->is_position(POS_FACEDOWN) || (ucard->unique_uid < pcard->unique_uid)))
return pcard->unique_effect;
}
......
......@@ -799,11 +799,15 @@ int32 field::get_control(uint16 step, effect * reason_effect, uint8 reason_playe
if(!pcard->is_affect_by_effect(reason_effect))
return TRUE;
pcard->filter_disable_related_cards();
if(pcard->unique_code)
pduel->game_field->remove_unique_card(pcard);
move_to_field(pcard, playerid, playerid, LOCATION_MZONE, pcard->current.position);
pcard->set_status(STATUS_ATTACK_CANCELED, TRUE);
return FALSE;
}
case 1: {
if(pcard->unique_code)
pduel->game_field->add_unique_card(pcard);
set_control(pcard, playerid, reset_phase, reset_count);
pcard->reset(RESET_CONTROL, RESET_EVENT);
pcard->filter_disable_related_cards();
......@@ -843,10 +847,18 @@ int32 field::swap_control(uint16 step, effect * reason_effect, uint8 reason_play
return TRUE;
pcard1->filter_disable_related_cards();
pcard2->filter_disable_related_cards();
if(pcard1->unique_code)
pduel->game_field->remove_unique_card(pcard1);
if(pcard2->unique_code)
pduel->game_field->remove_unique_card(pcard2);
remove_card(pcard1);
remove_card(pcard2);
add_card(p2, pcard1, l2, s2);
add_card(p1, pcard2, l1, s1);
if(pcard1->unique_code)
pduel->game_field->add_unique_card(pcard1);
if(pcard2->unique_code)
pduel->game_field->add_unique_card(pcard2);
set_control(pcard1, p2, reset_phase, reset_count);
set_control(pcard2, p1, reset_phase, reset_count);
pcard1->reset(RESET_CONTROL, RESET_EVENT);
......
......@@ -18,7 +18,7 @@ function c32339440.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c32339440.filter(c)
return c:IsSetCard(0x88) and c:IsAbleToHand()
return c:IsSetCard(0x88) and c:IsType(TYPE_MONSTER) and sc:IsAbleToHand()
end
function c32339440.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c32339440.filter,tp,LOCATION_DECK,0,1,nil) end
......
......@@ -48,6 +48,9 @@ function c48333324.activate(e,tp,eg,ep,ev,re,r,rp)
end
g=Duel.GetMatchingGroup(c48333324.negfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,sc)
tc=g:GetFirst()
if tc then
Duel.BreakEffect()
end
while tc do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -41,7 +41,7 @@ end
function c49678559.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()>0 then
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -21,7 +21,7 @@ function c7152333.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c7152333.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetAttack()==0 then return end
if c:IsFacedown() or not c:IsRelateToEffect(e) or c:GetAttack()==0 then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......
......@@ -34,8 +34,9 @@ function c73906480.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,g1:GetCount(),0,0)
end
function c73906480.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<g:GetCount() then return end
if g:GetCount()~=2 then return end
local tc=g:GetFirst()
local c=e:GetHandler()
while tc do
......
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