Commit ca04a9a0 authored by VanillaSalt's avatar VanillaSalt

replace status==STATUS_IS_PUBLIC with position==POS_FACEUP (introduced from ygopro2)

parent 70b98b61
...@@ -179,7 +179,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) { ...@@ -179,7 +179,7 @@ uint32 card::get_infos(byte* buf, int32 query_flag, int32 use_cache) {
query_flag &= ~QUERY_IS_DISABLED; query_flag &= ~QUERY_IS_DISABLED;
} }
if(query_flag & QUERY_IS_PUBLIC) if(query_flag & QUERY_IS_PUBLIC)
*p++ = (status & STATUS_IS_PUBLIC) ? 1 : 0; *p++ = is_position(POS_FACEUP) ? 1 : 0;
if(!use_cache) { if(!use_cache) {
if(query_flag & QUERY_LSCALE) q_cache.lscale = *p++ = get_lscale(); if(query_flag & QUERY_LSCALE) q_cache.lscale = *p++ = get_lscale();
if(query_flag & QUERY_RSCALE) q_cache.rscale = *p++ = get_rscale(); if(query_flag & QUERY_RSCALE) q_cache.rscale = *p++ = get_rscale();
......
...@@ -404,7 +404,7 @@ public: ...@@ -404,7 +404,7 @@ public:
#define STATUS_ACTIVATED 0x800000 #define STATUS_ACTIVATED 0x800000
#define STATUS_JUST_POS 0x1000000 #define STATUS_JUST_POS 0x1000000
#define STATUS_CONTINUOUS_POS 0x2000000 #define STATUS_CONTINUOUS_POS 0x2000000
#define STATUS_IS_PUBLIC 0x4000000 //#define STATUS_IS_PUBLIC 0x4000000
#define STATUS_ACT_FROM_HAND 0x8000000 #define STATUS_ACT_FROM_HAND 0x8000000
#define STATUS_OPPO_BATTLE 0x10000000 #define STATUS_OPPO_BATTLE 0x10000000
#define STATUS_FLIP_SUMMON_TURN 0x20000000 #define STATUS_FLIP_SUMMON_TURN 0x20000000
......
...@@ -157,15 +157,17 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -157,15 +157,17 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
pcard->current.controler = playerid; pcard->current.controler = playerid;
pcard->current.location = location; pcard->current.location = location;
switch (location) { switch (location) {
case LOCATION_MZONE: case LOCATION_MZONE: {
player[playerid].list_mzone[sequence] = pcard; player[playerid].list_mzone[sequence] = pcard;
pcard->current.sequence = sequence; pcard->current.sequence = sequence;
break; break;
case LOCATION_SZONE: }
case LOCATION_SZONE: {
player[playerid].list_szone[sequence] = pcard; player[playerid].list_szone[sequence] = pcard;
pcard->current.sequence = sequence; pcard->current.sequence = sequence;
break; break;
case LOCATION_DECK: }
case LOCATION_DECK: {
if (sequence == 0) { //deck top if (sequence == 0) { //deck top
player[playerid].list_main.push_back(pcard); player[playerid].list_main.push_back(pcard);
pcard->current.sequence = player[playerid].list_main.size() - 1; pcard->current.sequence = player[playerid].list_main.size() - 1;
...@@ -182,27 +184,34 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence ...@@ -182,27 +184,34 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
pcard->current.position = POS_FACEDOWN; pcard->current.position = POS_FACEDOWN;
} }
break; break;
case LOCATION_HAND: }
case LOCATION_HAND: {
player[playerid].list_hand.push_back(pcard); player[playerid].list_hand.push_back(pcard);
pcard->current.sequence = player[playerid].list_hand.size() - 1; pcard->current.sequence = player[playerid].list_hand.size() - 1;
uint32 pos = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? POS_FACEUP : POS_FACEDOWN;
pcard->operation_param = (pcard->operation_param & 0x00ffffff) | (pos << 24);
if(!(pcard->current.reason & REASON_DRAW) && !core.shuffle_check_disabled) if(!(pcard->current.reason & REASON_DRAW) && !core.shuffle_check_disabled)
core.shuffle_hand_check[playerid] = TRUE; core.shuffle_hand_check[playerid] = TRUE;
break; break;
case LOCATION_GRAVE: }
case LOCATION_GRAVE: {
player[playerid].list_grave.push_back(pcard); player[playerid].list_grave.push_back(pcard);
pcard->current.sequence = player[playerid].list_grave.size() - 1; pcard->current.sequence = player[playerid].list_grave.size() - 1;
break; break;
case LOCATION_REMOVED: }
case LOCATION_REMOVED: {
player[playerid].list_remove.push_back(pcard); player[playerid].list_remove.push_back(pcard);
pcard->current.sequence = player[playerid].list_remove.size() - 1; pcard->current.sequence = player[playerid].list_remove.size() - 1;
break; break;
case LOCATION_EXTRA: }
case LOCATION_EXTRA: {
player[playerid].list_extra.push_back(pcard); player[playerid].list_extra.push_back(pcard);
pcard->current.sequence = player[playerid].list_extra.size() - 1; pcard->current.sequence = player[playerid].list_extra.size() - 1;
if((pcard->data.type & TYPE_PENDULUM) && ((pcard->operation_param >> 24) & POS_FACEUP)) if((pcard->data.type & TYPE_PENDULUM) && ((pcard->operation_param >> 24) & POS_FACEUP))
++player[playerid].extra_p_count; ++player[playerid].extra_p_count;
break; break;
} }
}
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;
...@@ -518,7 +527,7 @@ void field::shuffle(uint8 playerid, uint8 location) { ...@@ -518,7 +527,7 @@ void field::shuffle(uint8 playerid, uint8 location) {
if(location == LOCATION_HAND) { if(location == LOCATION_HAND) {
bool shuffle = false; bool shuffle = false;
for(auto cit = svector.begin(); cit != svector.end(); ++cit) for(auto cit = svector.begin(); cit != svector.end(); ++cit)
if(!(*cit)->is_status(STATUS_IS_PUBLIC)) if(!(*cit)->is_position(POS_FACEUP))
shuffle = true; shuffle = true;
if(!shuffle) { if(!shuffle) {
core.shuffle_hand_check[playerid] = FALSE; core.shuffle_hand_check[playerid] = FALSE;
...@@ -703,7 +712,7 @@ void field::tag_swap(uint8 playerid) { ...@@ -703,7 +712,7 @@ void field::tag_swap(uint8 playerid) {
else else
pduel->write_buffer32(0); pduel->write_buffer32(0);
for(auto cit = player[playerid].list_hand.begin(); cit != player[playerid].list_hand.end(); ++cit) for(auto cit = player[playerid].list_hand.begin(); cit != player[playerid].list_hand.end(); ++cit)
pduel->write_buffer32((*cit)->data.code | ((*cit)->is_status(STATUS_IS_PUBLIC) ? 0x80000000 : 0)); pduel->write_buffer32((*cit)->data.code | ((*cit)->is_position(POS_FACEUP) ? 0x80000000 : 0));
for(auto cit = player[playerid].list_extra.begin(); cit != player[playerid].list_extra.end(); ++cit) for(auto cit = player[playerid].list_extra.begin(); cit != player[playerid].list_extra.end(); ++cit)
pduel->write_buffer32((*cit)->data.code | ((*cit)->is_position(POS_FACEUP) ? 0x80000000 : 0)); pduel->write_buffer32((*cit)->data.code | ((*cit)->is_position(POS_FACEUP) ? 0x80000000 : 0));
} }
......
...@@ -1708,7 +1708,7 @@ int32 scriptlib::card_is_public(lua_State *L) { ...@@ -1708,7 +1708,7 @@ int32 scriptlib::card_is_public(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->is_status(STATUS_IS_PUBLIC)) if(pcard->is_position(POS_FACEUP))
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
......
...@@ -316,6 +316,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -316,6 +316,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
core.overdraw[playerid] = TRUE; core.overdraw[playerid] = TRUE;
break; break;
} }
bool is_public = false;
drawed++; drawed++;
pcard = *(player[playerid].list_main.rbegin()); pcard = *(player[playerid].list_main.rbegin());
pcard->enable_field_effect(FALSE); pcard->enable_field_effect(FALSE);
...@@ -330,12 +331,15 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -330,12 +331,15 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
pcard->current.reason_player = reason_player; pcard->current.reason_player = reason_player;
pcard->current.reason = reason | REASON_DRAW; pcard->current.reason = reason | REASON_DRAW;
pcard->current.location = 0; pcard->current.location = 0;
if(pcard->current.position == POS_FACEUP_ATTACK)
is_public = true;
add_card(playerid, pcard, LOCATION_HAND, 0); add_card(playerid, pcard, LOCATION_HAND, 0);
pcard->enable_field_effect(TRUE); pcard->enable_field_effect(TRUE);
if((pcard->current.position == POS_FACEUP_ATTACK) || pcard->is_affected_by_effect(EFFECT_PUBLIC)) { if(pcard->is_affected_by_effect(EFFECT_PUBLIC))
is_public = true;
if(is_public) {
public_count++; public_count++;
if(pcard->current.position != POS_FACEUP_ATTACK) pcard->current.position = POS_FACEUP;
pcard->set_status(STATUS_IS_PUBLIC, TRUE);
} }
cv.push_back(pcard); cv.push_back(pcard);
pcard->reset(RESET_TOHAND, RESET_EVENT); pcard->reset(RESET_TOHAND, RESET_EVENT);
...@@ -365,7 +369,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -365,7 +369,7 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(drawed); pduel->write_buffer8(drawed);
for(uint32 i = 0; i < drawed; ++i) for(uint32 i = 0; i < drawed; ++i)
pduel->write_buffer32(cv[i]->data.code | (cv[i]->is_status(STATUS_IS_PUBLIC) ? 0x80000000 : 0)); pduel->write_buffer32(cv[i]->data.code | (cv[i]->is_position(POS_FACEUP) ? 0x80000000 : 0));
if(core.deck_reversed && (public_count < drawed)) { if(core.deck_reversed && (public_count < drawed)) {
pduel->write_buffer8(MSG_CONFIRM_CARDS); pduel->write_buffer8(MSG_CONFIRM_CARDS);
pduel->write_buffer8(1 - playerid); pduel->write_buffer8(1 - playerid);
......
...@@ -1612,7 +1612,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1612,7 +1612,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
bool act = true; bool act = true;
if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE) if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3) && (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3)
|| !(peffect->handler->current.location & 0x3) || peffect->handler->is_status(STATUS_IS_PUBLIC))) { || !(peffect->handler->current.location & 0x3) || peffect->handler->is_position(POS_FACEUP))) {
if(peffect->is_flag(EFFECT_FLAG_CHAIN_UNIQUE)) { if(peffect->is_flag(EFFECT_FLAG_CHAIN_UNIQUE)) {
if(tp == infos.turn_player) { if(tp == infos.turn_player) {
for(auto tpit = core.tpchain.begin(); tpit != core.tpchain.end(); ++tpit) { for(auto tpit = core.tpchain.begin(); tpit != core.tpchain.end(); ++tpit) {
...@@ -1715,7 +1715,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1715,7 +1715,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
bool act = true; bool act = true;
if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE) if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3) && (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3)
|| !(peffect->handler->current.location & 0x3) || peffect->handler->is_status(STATUS_IS_PUBLIC))) { || !(peffect->handler->current.location & 0x3) || peffect->handler->is_position(POS_FACEUP))) {
if(!(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY)) && clit->triggering_location == LOCATION_HAND if(!(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY)) && clit->triggering_location == LOCATION_HAND
&& (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE)) && peffect->handler->is_has_relation(peffect)) && (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE)) && peffect->handler->is_has_relation(peffect))
|| (peffect->range & LOCATION_HAND))) { || (peffect->range & LOCATION_HAND))) {
...@@ -1776,7 +1776,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free ...@@ -1776,7 +1776,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
bool act = true; bool act = true;
if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE) if(peffect->is_chainable(tp) && peffect->is_activateable(tp, clit->evt, TRUE)
&& (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3) && (peffect->code == EVENT_FLIP && infos.phase == PHASE_DAMAGE || (clit->triggering_location & 0x3)
|| !(peffect->handler->current.location & 0x3) || peffect->handler->is_status(STATUS_IS_PUBLIC))) { || !(peffect->handler->current.location & 0x3) || peffect->handler->is_position(POS_FACEUP))) {
if(!(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY)) && clit->triggering_location == LOCATION_HAND if(!(peffect->is_flag(EFFECT_FLAG_FIELD_ONLY)) && clit->triggering_location == LOCATION_HAND
&& (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE)) && peffect->handler->is_has_relation(peffect)) && (((peffect->type & EFFECT_TYPE_SINGLE) && !(peffect->is_flag(EFFECT_FLAG_SINGLE_RANGE)) && peffect->handler->is_has_relation(peffect))
|| (peffect->range & LOCATION_HAND))) { || (peffect->range & LOCATION_HAND))) {
...@@ -4668,7 +4668,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4668,7 +4668,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
case 10: { case 10: {
effect* peffect = cait->triggering_effect; effect* peffect = cait->triggering_effect;
card* pcard = peffect->handler; card* pcard = peffect->handler;
if((cait->flag & CHAIN_HAND_EFFECT) && !pcard->is_status(STATUS_IS_PUBLIC) && (pcard->current.location == LOCATION_HAND)) if((cait->flag & CHAIN_HAND_EFFECT) && !pcard->is_position(POS_FACEUP) && (pcard->current.location == LOCATION_HAND))
shuffle(pcard->current.controler, LOCATION_HAND); shuffle(pcard->current.controler, LOCATION_HAND);
if(cait->target_cards && cait->target_cards->container.size()) { if(cait->target_cards && cait->target_cards->container.size()) {
for(auto cit = cait->target_cards->container.begin(); cit != cait->target_cards->container.end(); ++cit) for(auto cit = cait->target_cards->container.begin(); cit != cait->target_cards->container.end(); ++cit)
...@@ -5220,16 +5220,16 @@ int32 field::adjust_step(uint16 step) { ...@@ -5220,16 +5220,16 @@ int32 field::adjust_step(uint16 step) {
for(uint32 i = 0; i < player[0].list_hand.size(); ++i) { for(uint32 i = 0; i < player[0].list_hand.size(); ++i) {
card* pcard = player[0].list_hand[i]; card* pcard = player[0].list_hand[i];
int32 pub = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? TRUE : FALSE; int32 pub = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? TRUE : FALSE;
if(!pub && (pcard->status & STATUS_IS_PUBLIC)) if(!pub && pcard->is_position(POS_FACEUP))
core.shuffle_hand_check[0] = TRUE; core.shuffle_hand_check[0] = TRUE;
pcard->set_status(STATUS_IS_PUBLIC, pub); pcard->current.position = pub ? POS_FACEUP : POS_FACEDOWN;
} }
for(uint32 i = 0; i < player[1].list_hand.size(); ++i) { for(uint32 i = 0; i < player[1].list_hand.size(); ++i) {
card* pcard = player[1].list_hand[i]; card* pcard = player[1].list_hand[i];
int32 pub = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? TRUE : FALSE; int32 pub = pcard->is_affected_by_effect(EFFECT_PUBLIC) ? TRUE : FALSE;
if(!pub && (pcard->status & STATUS_IS_PUBLIC)) if(!pub && pcard->is_position(POS_FACEUP))
core.shuffle_hand_check[1] = TRUE; core.shuffle_hand_check[1] = TRUE;
pcard->set_status(STATUS_IS_PUBLIC, pub); pcard->current.position = pub ? POS_FACEUP : POS_FACEDOWN;
} }
if(core.shuffle_hand_check[infos.turn_player]) if(core.shuffle_hand_check[infos.turn_player])
shuffle(infos.turn_player, LOCATION_HAND); shuffle(infos.turn_player, LOCATION_HAND);
......
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