Commit 9fd3931a authored by mercury233's avatar mercury233
parents c2aa4457 bc630f2e
...@@ -116,7 +116,8 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -116,7 +116,8 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
if(query_flag & QUERY_BASE_ATTACK) q_cache.base_attack = *p++ = get_base_attack(); if(query_flag & QUERY_BASE_ATTACK) q_cache.base_attack = *p++ = get_base_attack();
if(query_flag & QUERY_BASE_DEFENSE) q_cache.base_defense = *p++ = get_base_defense(); if(query_flag & QUERY_BASE_DEFENSE) q_cache.base_defense = *p++ = get_base_defense();
if(query_flag & QUERY_REASON) q_cache.reason = *p++ = current.reason; if(query_flag & QUERY_REASON) q_cache.reason = *p++ = current.reason;
} else { }
else {
if((query_flag & QUERY_ALIAS) && ((uint32)(tdata = get_code()) != q_cache.alias)) { if((query_flag & QUERY_ALIAS) && ((uint32)(tdata = get_code()) != q_cache.alias)) {
q_cache.alias = tdata; q_cache.alias = tdata;
*p++ = tdata; *p++ = tdata;
...@@ -202,7 +203,8 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -202,7 +203,8 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
q_cache.link = *p++ = get_link(); q_cache.link = *p++ = get_link();
q_cache.link_marker = *p++ = get_link_marker(); q_cache.link_marker = *p++ = get_link_marker();
} }
} else { }
else {
if((query_flag & QUERY_LSCALE) && ((uint32)(tdata = get_lscale()) != q_cache.lscale)) { if((query_flag & QUERY_LSCALE) && ((uint32)(tdata = get_lscale()) != q_cache.lscale)) {
q_cache.lscale = tdata; q_cache.lscale = tdata;
*p++ = tdata; *p++ = tdata;
......
...@@ -368,6 +368,7 @@ struct card_sort { ...@@ -368,6 +368,7 @@ struct card_sort {
//Player //Player
#define PLAYER_NONE 2 // #define PLAYER_NONE 2 //
#define PLAYER_ALL 3 // #define PLAYER_ALL 3 //
#define PLAYER_SELFDES 5 //
//Phase //Phase
#define PHASE_DRAW 0x01 #define PHASE_DRAW 0x01
......
...@@ -236,6 +236,8 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -236,6 +236,8 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
pcard->apply_field_effect(); pcard->apply_field_effect();
pcard->fieldid = infos.field_id++; pcard->fieldid = infos.field_id++;
pcard->fieldid_r = pcard->fieldid; pcard->fieldid_r = pcard->fieldid;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
pcard->turnid = infos.turn_id; pcard->turnid = infos.turn_id;
if (location == LOCATION_MZONE) if (location == LOCATION_MZONE)
player[playerid].used_location |= 1 << sequence; player[playerid].used_location |= 1 << sequence;
...@@ -364,8 +366,11 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc ...@@ -364,8 +366,11 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
if(preplayer == playerid) { if(preplayer == playerid) {
pduel->write_buffer32(pcard->get_info_location()); pduel->write_buffer32(pcard->get_info_location());
pduel->write_buffer32(pcard->current.reason); pduel->write_buffer32(pcard->current.reason);
} else } else {
pcard->fieldid = infos.field_id++; pcard->fieldid = infos.field_id++;
if(check_unique_onfield(pcard, pcard->current.controler, pcard->current.location))
pcard->unique_fieldid = UINT_MAX;
}
return; return;
} else if(location == LOCATION_HAND) { } else if(location == LOCATION_HAND) {
if(preplayer == playerid) if(preplayer == playerid)
...@@ -451,6 +456,10 @@ void field::swap_card(card* pcard1, card* pcard2, uint8 new_sequence1, uint8 new ...@@ -451,6 +456,10 @@ void field::swap_card(card* pcard1, card* pcard2, uint8 new_sequence1, uint8 new
if(p1 != p2) { if(p1 != p2) {
pcard1->fieldid = infos.field_id++; pcard1->fieldid = infos.field_id++;
pcard2->fieldid = infos.field_id++; pcard2->fieldid = infos.field_id++;
if(check_unique_onfield(pcard1, pcard1->current.controler, pcard1->current.location))
pcard1->unique_fieldid = UINT_MAX;
if(check_unique_onfield(pcard2, pcard2->current.controler, pcard2->current.location))
pcard2->unique_fieldid = UINT_MAX;
} }
if(l1 == LOCATION_MZONE) { if(l1 == LOCATION_MZONE) {
player[p1].list_mzone[s1] = 0; player[p1].list_mzone[s1] = 0;
......
...@@ -253,7 +253,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint ...@@ -253,7 +253,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
p += 4; p += 4;
} }
} }
} else if(location == LOCATION_SZONE) { }
else if(location == LOCATION_SZONE) {
for(auto& pcard : player.list_szone) { for(auto& pcard : player.list_szone) {
if(pcard) { if(pcard) {
uint32 clen = pcard->get_infos(p, query_flag, use_cache); uint32 clen = pcard->get_infos(p, query_flag, use_cache);
...@@ -263,7 +264,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint ...@@ -263,7 +264,8 @@ extern "C" DECL_DLLEXPORT int32 query_field_card(ptr pduel, uint8 playerid, uint
p += 4; p += 4;
} }
} }
} else { }
else {
field::card_vector* lst = 0; field::card_vector* lst = 0;
if(location == LOCATION_HAND) if(location == LOCATION_HAND)
lst = &player.list_hand; lst = &player.list_hand;
......
...@@ -206,7 +206,7 @@ void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uin ...@@ -206,7 +206,7 @@ void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uin
} }
pcard->temp.reason = pcard->current.reason; pcard->temp.reason = pcard->current.reason;
pcard->current.reason = reason; pcard->current.reason = reason;
if(reason_player != 5) { if(reason_player != PLAYER_SELFDES) {
pcard->temp.reason_effect = pcard->current.reason_effect; pcard->temp.reason_effect = pcard->current.reason_effect;
pcard->temp.reason_player = pcard->current.reason_player; pcard->temp.reason_player = pcard->current.reason_player;
if(reason_effect) if(reason_effect)
...@@ -1255,9 +1255,10 @@ int32 field::control_adjust(uint16 step) { ...@@ -1255,9 +1255,10 @@ int32 field::control_adjust(uint16 step) {
int32 field::self_destroy(uint16 step, card* ucard, int32 p) { int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
switch(step) { switch(step) {
case 0: { case 0: {
core.unique_destroy_set.erase(ucard); if(core.unique_cards[p].find(ucard) == core.unique_cards[p].end()) {
if(core.unique_cards[p].find(ucard) == core.unique_cards[p].end()) core.unique_destroy_set.erase(ucard);
return TRUE; return TRUE;
}
card_set cset; card_set cset;
ucard->get_unique_target(&cset, p); ucard->get_unique_target(&cset, p);
if(cset.size() == 0) if(cset.size() == 0)
...@@ -1305,6 +1306,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) { ...@@ -1305,6 +1306,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
} }
return FALSE; return FALSE;
} }
core.unique_destroy_set.erase(ucard);
return TRUE; return TRUE;
} }
case 1: { case 1: {
...@@ -1319,7 +1321,11 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) { ...@@ -1319,7 +1321,11 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
pcard->current.reason_effect = ucard->unique_effect; pcard->current.reason_effect = ucard->unique_effect;
pcard->current.reason_player = ucard->current.controler; pcard->current.reason_player = ucard->current.controler;
} }
destroy(&cset, 0, REASON_RULE, 5); destroy(&cset, 0, REASON_RULE, PLAYER_SELFDES);
return FALSE;
}
case 2: {
core.unique_destroy_set.erase(ucard);
return TRUE; return TRUE;
} }
case 10: { case 10: {
...@@ -1333,7 +1339,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) { ...@@ -1333,7 +1339,7 @@ int32 field::self_destroy(uint16 step, card* ucard, int32 p) {
pcard->temp.reason_player = pcard->current.reason_player; pcard->temp.reason_player = pcard->current.reason_player;
pcard->current.reason_effect = peffect; pcard->current.reason_effect = peffect;
pcard->current.reason_player = peffect->get_handler_player(); pcard->current.reason_player = peffect->get_handler_player();
destroy(pcard, 0, REASON_EFFECT, 5); destroy(pcard, 0, REASON_EFFECT, PLAYER_SELFDES);
} }
core.self_destroy_set.erase(it); core.self_destroy_set.erase(it);
core.units.begin()->step = 9; core.units.begin()->step = 9;
...@@ -3360,7 +3366,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3360,7 +3366,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
if (pcard->is_affect_by_effect(pcard->current.reason_effect)) { if (pcard->is_affect_by_effect(pcard->current.reason_effect)) {
effect* indestructable_effect = pcard->check_indestructable_by_effect(pcard->current.reason_effect, pcard->current.reason_player); effect* indestructable_effect = pcard->check_indestructable_by_effect(pcard->current.reason_effect, pcard->current.reason_player);
if (indestructable_effect) { if (indestructable_effect) {
if(reason_player != 5) if(reason_player != PLAYER_SELFDES)
indestructable_effect_set.insert(indestructable_effect); indestructable_effect_set.insert(indestructable_effect);
is_destructable = false; is_destructable = false;
} }
...@@ -3380,7 +3386,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3380,7 +3386,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason, PARAM_TYPE_INT);
pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(pcard->current.reason_player, PARAM_TYPE_INT);
if(eset[i]->check_value_condition(3)) { if(eset[i]->check_value_condition(3)) {
if(reason_player != 5) if(reason_player != PLAYER_SELFDES)
indestructable_effect_set.insert(eset[i]); indestructable_effect_set.insert(eset[i]);
is_destructable = false; is_destructable = false;
break; break;
......
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