Commit d8d6ed6e authored by VanillaSalt's avatar VanillaSalt

add duel_rule

parent cb52dcb1
......@@ -260,6 +260,7 @@ struct processor {
uint8 extra_summon[2];
int32 spe_effect[2];
int32 duel_options;
int32 duel_rule;
uint32 copy_reset;
uint8 copy_reset_count;
uint32 last_control_changed_id;
......
......@@ -71,6 +71,10 @@ extern "C" DECL_DLLEXPORT ptr create_duel(uint32 seed) {
extern "C" DECL_DLLEXPORT void start_duel(ptr pduel, int options) {
duel* pd = (duel*)pduel;
pd->game_field->core.duel_options |= options;
if(options & DUEL_OBSOLETE_RULING)
pd->game_field->core.duel_rule = 1;
else
pd->game_field->core.duel_rule = 3;
pd->game_field->core.shuffle_hand_check[0] = FALSE;
pd->game_field->core.shuffle_hand_check[1] = FALSE;
pd->game_field->core.shuffle_deck_check[0] = FALSE;
......
......@@ -3822,10 +3822,10 @@ int32 field::move_to_field(uint16 step, card * target, uint32 enable, uint32 ret
if(!is_equip && location == LOCATION_SZONE && (target->data.type & TYPE_FIELD) && (target->data.type & TYPE_SPELL)) {
card* pcard = get_field_card(playerid, LOCATION_SZONE, 5);
if(pcard) {
if(core.duel_options & DUEL_OBSOLETE_RULING)
destroy(pcard, 0, REASON_RULE, pcard->current.controler);
else // new ruling
if(core.duel_rule >= 3)
send_to(pcard, 0, REASON_RULE, pcard->current.controler, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
else
destroy(pcard, 0, REASON_RULE, pcard->current.controler);
adjust_all();
}
} else if(!is_equip && location == LOCATION_SZONE && (target->data.type & TYPE_PENDULUM)) {
......
......@@ -1873,7 +1873,7 @@ int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_free
return FALSE;
}
case 8: {
if(!(core.duel_options & DUEL_OBSOLETE_RULING) || (infos.phase != PHASE_MAIN1 && infos.phase != PHASE_MAIN2))
if((core.duel_rule >= 2) || (infos.phase != PHASE_MAIN1 && infos.phase != PHASE_MAIN2))
return FALSE;
// Obsolete ignition effect ruling
tevent e;
......@@ -4011,7 +4011,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
}
case 2: {
// Draw, new ruling
if((core.duel_options & DUEL_OBSOLETE_RULING) || (infos.turn_id > 1)) {
if((core.duel_rule >= 3) || (infos.turn_id > 1)) {
int32 count = get_draw_count(infos.turn_player);
if(count > 0) {
draw(0, REASON_RULE, turn_player, turn_player, count);
......@@ -4588,7 +4588,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if((peffect->type & EFFECT_TYPE_ACTIVATE) && pcard->is_has_relation(*cait)) {
pcard->set_status(STATUS_ACTIVATED, TRUE);
pcard->enable_field_effect(true);
if(core.duel_options & DUEL_OBSOLETE_RULING) {
if(core.duel_rule <= 2) {
if(pcard->data.type & TYPE_FIELD) {
card* fscard = player[1 - pcard->current.controler].list_szone[5];
if(fscard && fscard->is_position(POS_FACEUP))
......@@ -4713,7 +4713,7 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if((pcard->data.type & TYPE_EQUIP) && (peffect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->equiping_target && pcard->is_has_relation(*cait))
destroy(pcard, 0, REASON_RULE, PLAYER_NONE);
if(core.duel_options & DUEL_OBSOLETE_RULING) {
if(core.duel_rule <= 2) {
if((pcard->data.type & TYPE_FIELD) && (peffect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->is_status(STATUS_LEAVE_CONFIRMED) && pcard->is_has_relation(*cait)) {
card* fscard = player[1 - pcard->current.controler].list_szone[5];
......
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