Skip to content

Commit 8d88519

Browse files
add POS_REVEAL and EFFECT_REVEAL_ONFIELD (#841)
* Support public reveal position flag * Emit public reveal flag in card positions * Limit public reveal flag to field positions * add EFFECT_REVEAL_ONFIELD (#843) --------- Co-authored-by: salix5 <salix5566@gmail.com>
1 parent e19401a commit 8d88519

7 files changed

Lines changed: 23 additions & 17 deletions

File tree

card.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ int32_t card::get_infos(byte* buf, uint32_t query_flag, int32_t use_cache) {
172172
buffer_write<uint32_t>(p, data.code);
173173
}
174174
if (query_flag & QUERY_POSITION) {
175-
uint32_t tdata = get_info_location();
175+
uint32_t tdata = get_public_info_location();
176176
buffer_write<uint32_t>(p, tdata);
177177
if (q_cache.info_location != tdata) {
178178
q_cache.clear_cache();
@@ -401,6 +401,12 @@ uint32_t card::get_info_location() const {
401401
return c | (l << 8) | (s << 16) | (ss << 24);
402402
}
403403
}
404+
uint32_t card::get_public_info_location() {
405+
uint32_t info = get_info_location();
406+
if((current.location & LOCATION_ONFIELD) && is_affected_by_effect(EFFECT_REVEAL_ONFIELD))
407+
info |= (static_cast<uint32_t>(POS_REVEAL) << 24);
408+
return info;
409+
}
404410
// get the printed code on card
405411
uint32_t card::get_original_code() const {
406412
return data.get_original_code();

card.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ class card {
220220

221221
int32_t get_infos(byte* buf, uint32_t query_flag, int32_t use_cache = TRUE);
222222
uint32_t get_info_location() const;
223+
uint32_t get_public_info_location();
223224
uint32_t get_original_code() const;
224225
std::tuple<uint32_t, uint32_t> get_original_code_rule() const;
225226
uint32_t get_code();

common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ inline bool check_playerid(int32_t playerid) {
7272
#define POS_FACEDOWN 0xa
7373
#define POS_ATTACK 0x3
7474
#define POS_DEFENSE 0xc
75+
#define POS_REVEAL 0x80
7576
//Flip effect flags
7677
#define NO_FLIP_EFFECT 0x10000
7778

effect.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,8 @@ int32_t effect::is_target(card* pcard) {
504504
if((type & EFFECT_TYPE_TARGET) && !(type & EFFECT_TYPE_FIELD)) {
505505
return is_fit_target_function(pcard);
506506
}
507-
if(!is_flag(EFFECT_FLAG_SET_AVAILABLE) && (pcard->current.location & LOCATION_ONFIELD)
508-
&& !pcard->is_position(POS_FACEUP))
507+
if(!is_flag(EFFECT_FLAG_SET_AVAILABLE) && code != EFFECT_REVEAL_ONFIELD
508+
&& (pcard->current.location & LOCATION_ONFIELD) && !pcard->is_position(POS_FACEUP))
509509
return FALSE;
510510
if(!is_flag(EFFECT_FLAG_IGNORE_RANGE)) {
511511
if(pcard->is_treated_as_not_on_field())

effect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ const std::map<uint64_t, uint64_t> category_checklist{
534534
#define EFFECT_SYNCHRO_LEVEL_EX 373
535535
#define EFFECT_RITUAL_LEVEL_EX 374
536536
#define EFFECT_DOUBLE_XMATERIAL 375
537+
#define EFFECT_REVEAL_ONFIELD 376
537538

538539
//#define EVENT_STARTUP 1000
539540
#define EVENT_FLIP 1001

field.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ void field::move_card(uint8_t playerid, card* pcard, uint8_t location, uint8_t s
307307
}
308308
if(preplayer == playerid) {
309309
refresh_player_info(playerid);
310-
pduel->write_buffer32(pcard->get_info_location());
310+
pduel->write_buffer32(pcard->get_public_info_location());
311311
pduel->write_buffer32(pcard->current.reason);
312312
} else {
313313
refresh_player_info(preplayer);
@@ -437,23 +437,23 @@ void field::swap_card(card* pcard1, card* pcard2, uint8_t new_sequence1, uint8_t
437437
pduel->write_buffer8(MSG_MOVE);
438438
pduel->write_buffer32(pcard1->data.code);
439439
pduel->write_buffer32(info1);
440-
pduel->write_buffer32(pcard1->get_info_location());
440+
pduel->write_buffer32(pcard1->get_public_info_location());
441441
pduel->write_buffer32(0);
442442
pduel->write_buffer8(MSG_MOVE);
443443
pduel->write_buffer32(pcard2->data.code);
444444
pduel->write_buffer32(info2);
445-
pduel->write_buffer32(pcard2->get_info_location());
445+
pduel->write_buffer32(pcard2->get_public_info_location());
446446
pduel->write_buffer32(0);
447447
} else {
448448
pduel->write_buffer8(MSG_MOVE);
449449
pduel->write_buffer32(pcard2->data.code);
450450
pduel->write_buffer32(info2);
451-
pduel->write_buffer32(pcard2->get_info_location());
451+
pduel->write_buffer32(pcard2->get_public_info_location());
452452
pduel->write_buffer32(0);
453453
pduel->write_buffer8(MSG_MOVE);
454454
pduel->write_buffer32(pcard1->data.code);
455455
pduel->write_buffer32(info1);
456-
pduel->write_buffer32(pcard1->get_info_location());
456+
pduel->write_buffer32(pcard1->get_public_info_location());
457457
pduel->write_buffer32(0);
458458
}
459459
}

operations.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,7 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
28692869
target->set_status(STATUS_SUMMONING, TRUE);
28702870
pduel->write_buffer8(MSG_SPSUMMONING);
28712871
pduel->write_buffer32(target->data.code);
2872-
pduel->write_buffer32(target->get_info_location());
2872+
pduel->write_buffer32(target->get_public_info_location());
28732873
return FALSE;
28742874
}
28752875
case 6: {
@@ -3102,10 +3102,7 @@ int32_t field::special_summon_rule(uint16_t step, uint8_t sumplayer, card* targe
31023102
pcard->set_status(STATUS_SUMMONING, TRUE);
31033103
pduel->write_buffer8(MSG_SPSUMMONING);
31043104
pduel->write_buffer32(pcard->data.code);
3105-
pduel->write_buffer8(pcard->current.controler);
3106-
pduel->write_buffer8(pcard->current.location);
3107-
pduel->write_buffer8(pcard->current.sequence);
3108-
pduel->write_buffer8(pcard->current.position);
3105+
pduel->write_buffer32(pcard->get_public_info_location());
31093106
if(pgroup->it != pgroup->container.end())
31103107
core.units.begin()->step = 22;
31113108
return FALSE;
@@ -3307,7 +3304,7 @@ int32_t field::special_summon_step(uint16_t step, group* targets, card* target,
33073304
case 2: {
33083305
pduel->write_buffer8(MSG_SPSUMMONING);
33093306
pduel->write_buffer32(target->data.code);
3310-
pduel->write_buffer32(target->get_info_location());
3307+
pduel->write_buffer32(target->get_public_info_location());
33113308
return FALSE;
33123309
}
33133310
case 3: {
@@ -4156,7 +4153,7 @@ int32_t field::send_to(uint16_t step, group * targets, effect * reason_effect, u
41564153
}
41574154
move_card(playerid, pcard, dest, seq);
41584155
pcard->current.position = pcard->sendto_param.position;
4159-
pduel->write_buffer32(pcard->get_info_location());
4156+
pduel->write_buffer32(pcard->get_public_info_location());
41604157
pduel->write_buffer32(pcard->current.reason);
41614158
}
41624159
if(core.global_flag & GLOBALFLAG_DECK_REVERSE_CHECK) {
@@ -4211,7 +4208,7 @@ int32_t field::send_to(uint16_t step, group * targets, effect * reason_effect, u
42114208
}
42124209
move_card(pcard->current.controler, pcard, LOCATION_SZONE, seq);
42134210
pcard->current.position = POS_FACEUP;
4214-
pduel->write_buffer32(pcard->get_info_location());
4211+
pduel->write_buffer32(pcard->get_public_info_location());
42154212
pduel->write_buffer32(pcard->current.reason);
42164213
pcard->set_status(STATUS_LEAVE_CONFIRMED, FALSE);
42174214
pcard->set_status(STATUS_FLIP_SUMMONING, FALSE);
@@ -4698,7 +4695,7 @@ int32_t field::move_to_field(uint16_t step, card* target, uint32_t enable, uint3
46984695
move_card(playerid, target, location, target->temp.sequence, pzone);
46994696
target->current.position = returns.ivalue[0];
47004697
target->set_status(STATUS_LEAVE_CONFIRMED, FALSE);
4701-
pduel->write_buffer32(target->get_info_location());
4698+
pduel->write_buffer32(target->get_public_info_location());
47024699
pduel->write_buffer32(target->current.reason);
47034700
if(target->current.location != LOCATION_MZONE) {
47044701
if(target->equiping_cards.size()) {

0 commit comments

Comments
 (0)