Commit f14f7819 authored by Chrono-Genex's avatar Chrono-Genex Committed by GitHub

fix Card.IsPreviousSetCard (#455)

parent 71b4c40b
...@@ -28,6 +28,28 @@ bool card_state::is_location(int32 loc) const { ...@@ -28,6 +28,28 @@ bool card_state::is_location(int32 loc) const {
return true; return true;
return false; return false;
} }
void card_state::init_state() {
code = 0xffffffff;
code2 = 0xffffffff;
type = 0xffffffff;
level = 0xffffffff;
rank = 0xffffffff;
link = 0xffffffff;
lscale = 0xffffffff;
rscale = 0xffffffff;
attribute = 0xffffffff;
race = 0xffffffff;
attack = 0xffffffff;
defense = 0xffffffff;
base_attack = 0xffffffff;
base_defense = 0xffffffff;
controler = 0xff;
location = 0xff;
sequence = 0xff;
position = 0xff;
reason = 0xffffffff;
reason_player = 0xff;
}
bool card::card_operation_sort(card* c1, card* c2) { bool card::card_operation_sort(card* c1, card* c2) {
duel* pduel = c1->pduel; duel* pduel = c1->pduel;
int32 cp1 = c1->overlay_target ? c1->overlay_target->current.controler : c1->current.controler; int32 cp1 = c1->overlay_target ? c1->overlay_target->current.controler : c1->current.controler;
...@@ -87,9 +109,9 @@ card::card(duel* pd) { ...@@ -87,9 +109,9 @@ card::card(duel* pd) {
equiping_target = 0; equiping_target = 0;
pre_equip_target = 0; pre_equip_target = 0;
overlay_target = 0; overlay_target = 0;
std::memset(&current, 0, sizeof(card_state)); current = {};
std::memset(&previous, 0, sizeof(card_state)); previous = {};
std::memset(&temp, 0xff, sizeof(card_state)); temp.init_state();
unique_pos[0] = unique_pos[1] = 0; unique_pos[0] = unique_pos[1] = 0;
spsummon_counter[0] = spsummon_counter[1] = 0; spsummon_counter[0] = spsummon_counter[1] = 0;
unique_code = 0; unique_code = 0;
...@@ -376,9 +398,10 @@ int32 card::is_pre_set_card(uint32 set_code) { ...@@ -376,9 +398,10 @@ int32 card::is_pre_set_card(uint32 set_code) {
setcode = setcode >> 16; setcode = setcode >> 16;
} }
//add set code //add set code
setcode = previous.setcode; for(auto& presetcode : previous.setcode) {
if (setcode && (setcode & 0xfff) == settype && (setcode & 0xf000 & setsubtype) == setsubtype) if (presetcode && (presetcode & 0xfff) == settype && (presetcode & 0xf000 & setsubtype) == setsubtype)
return TRUE; return TRUE;
}
//another code //another code
uint32 code2 = previous.code2; uint32 code2 = previous.code2;
uint64 setcode2; uint64 setcode2;
......
...@@ -41,12 +41,12 @@ struct card_data { ...@@ -41,12 +41,12 @@ struct card_data {
struct card_state { struct card_state {
card_state() card_state()
: code(0), code2(0), setcode(0), type(0), level(0), rank(0), link(0), lscale(0), rscale(0), attribute(0), race(0), attack(0), defense(0), base_attack(0), base_defense(0), : code(0), code2(0), type(0), level(0), rank(0), link(0), lscale(0), rscale(0), attribute(0), race(0), attack(0), defense(0), base_attack(0), base_defense(0),
controler(PLAYER_NONE), location(0), sequence(0), position(0), reason(0), pzone(false), reason_card(nullptr), reason_player(PLAYER_NONE), reason_effect(nullptr) {} controler(PLAYER_NONE), location(0), sequence(0), position(0), reason(0), pzone(false), reason_card(nullptr), reason_player(PLAYER_NONE), reason_effect(nullptr) {}
uint32 code; uint32 code;
uint32 code2; uint32 code2;
uint16 setcode; std::vector<uint32> setcode;
uint32 type; uint32 type;
uint32 level; uint32 level;
uint32 rank; uint32 rank;
...@@ -69,6 +69,7 @@ struct card_state { ...@@ -69,6 +69,7 @@ struct card_state {
uint8 reason_player; uint8 reason_player;
effect* reason_effect; effect* reason_effect;
bool is_location(int32 loc) const; bool is_location(int32 loc) const;
void init_state();
}; };
struct query_cache { struct query_cache {
......
...@@ -3865,12 +3865,12 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3865,12 +3865,12 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
pcard->previous.attack = pcard->data.attack; pcard->previous.attack = pcard->data.attack;
pcard->previous.defense = pcard->data.defense; pcard->previous.defense = pcard->data.defense;
} }
pcard->previous.setcode.clear();
effect_set eset; effect_set eset;
pcard->filter_effect(EFFECT_ADD_SETCODE, &eset); pcard->filter_effect(EFFECT_ADD_SETCODE, &eset);
if(eset.size()) for(int32 i = 0; i < eset.size(); ++i) {
pcard->previous.setcode = eset.get_last()->get_value(pcard); pcard->previous.setcode.push_back((uint32)eset[i]->get_value(pcard));
else }
pcard->previous.setcode = 0;
} }
} }
if(leave_p.size()) if(leave_p.size())
......
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