Commit a6d1bf9e authored by nanahira's avatar nanahira

add EFFECT_FLAG_LIMIT_ZONE

parent 85af02be
...@@ -191,6 +191,19 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -191,6 +191,19 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
&& !pduel->game_field->get_cteffect(this, playerid, FALSE)) && !pduel->game_field->get_cteffect(this, playerid, FALSE))
return FALSE; return FALSE;
} }
uint32 zone = 0xff;
if(!(handler->data.type & (TYPE_FIELD+TYPE_PENDULUM)) && is_flag(EFFECT_FLAG_LIMIT_ZONE)) {
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_cards , PARAM_TYPE_GROUP);
pduel->lua->add_param(e.event_player, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_value, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT);
zone = get_value(7);
if(!zone)
zone = 0xff;
}
if(handler->current.location == LOCATION_SZONE) { if(handler->current.location == LOCATION_SZONE) {
if(handler->is_position(POS_FACEUP)) if(handler->is_position(POS_FACEUP))
return FALSE; return FALSE;
...@@ -200,6 +213,8 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -200,6 +213,8 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
if((handler->data.type & TYPE_SPELL) && (handler->data.type & TYPE_QUICKPLAY)) if((handler->data.type & TYPE_SPELL) && (handler->data.type & TYPE_QUICKPLAY))
return FALSE; return FALSE;
} }
if(!(handler->data.type & (TYPE_FIELD+TYPE_PENDULUM)) && is_flag(EFFECT_FLAG_LIMIT_ZONE) && !(zone & (1u << handler->current.sequence)))
return FALSE;
} else { } else {
if(handler->data.type & TYPE_MONSTER) { if(handler->data.type & TYPE_MONSTER) {
if(!(handler->data.type & TYPE_PENDULUM)) if(!(handler->data.type & TYPE_PENDULUM))
...@@ -208,7 +223,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -208,7 +223,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
&& !pduel->game_field->is_location_useable(playerid, LOCATION_PZONE, 1)) && !pduel->game_field->is_location_useable(playerid, LOCATION_PZONE, 1))
return FALSE; return FALSE;
} else if(!(handler->data.type & TYPE_FIELD) } else if(!(handler->data.type & TYPE_FIELD)
&& pduel->game_field->get_useable_count(handler, playerid, LOCATION_SZONE, playerid, LOCATION_REASON_TOFIELD) <= 0) && pduel->game_field->get_useable_count(handler, playerid, LOCATION_SZONE, playerid, LOCATION_REASON_TOFIELD, zone) <= 0)
return FALSE; return FALSE;
} }
// check activate in hand/in set turn // check activate in hand/in set turn
......
...@@ -187,7 +187,7 @@ enum effect_flag : uint32 { ...@@ -187,7 +187,7 @@ enum effect_flag : uint32 {
// EFFECT_FLAG_AVAILABLE_BD = 0x2000000, // EFFECT_FLAG_AVAILABLE_BD = 0x2000000,
EFFECT_FLAG_CLIENT_HINT = 0x4000000, EFFECT_FLAG_CLIENT_HINT = 0x4000000,
// EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000, // EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000,
// EFFECT_FLAG_NAGA = 0x10000000, EFFECT_FLAG_LIMIT_ZONE = 0x10000000,
// EFFECT_FLAG_COF = 0x20000000, // EFFECT_FLAG_COF = 0x20000000,
// EFFECT_FLAG_CVAL_CHECK = 0x40000000, // EFFECT_FLAG_CVAL_CHECK = 0x40000000,
EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000, EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000,
......
...@@ -645,7 +645,7 @@ int32 field::get_tofield_count(card* pcard, uint8 playerid, uint8 location, uint ...@@ -645,7 +645,7 @@ int32 field::get_tofield_count(card* pcard, uint8 playerid, uint8 location, uint
if (location == LOCATION_MZONE) if (location == LOCATION_MZONE)
flag = (flag | ~zone) & 0x1f; flag = (flag | ~zone) & 0x1f;
else else
flag = (flag >> 8) & 0x1f; flag = ((flag >> 8) | ~zone) & 0x1f;
int32 count = 5 - field_used_count[flag]; int32 count = 5 - field_used_count[flag];
if(location == LOCATION_MZONE) if(location == LOCATION_MZONE)
flag |= (1u << 5) | (1u << 6); flag |= (1u << 5) | (1u << 6);
......
...@@ -4229,9 +4229,22 @@ int32 field::add_chain(uint16 step) { ...@@ -4229,9 +4229,22 @@ int32 field::add_chain(uint16 step) {
} }
} }
if(phandler->current.location == LOCATION_HAND) { if(phandler->current.location == LOCATION_HAND) {
uint32 zone = 0xff;
if(!(phandler->data.type & (TYPE_FIELD+TYPE_PENDULUM)) && peffect->is_flag(EFFECT_FLAG_LIMIT_ZONE)) {
pduel->lua->add_param(clit.triggering_player, PARAM_TYPE_INT);
pduel->lua->add_param(clit.evt.event_cards , PARAM_TYPE_GROUP);
pduel->lua->add_param(clit.evt.event_player, PARAM_TYPE_INT);
pduel->lua->add_param(clit.evt.event_value, PARAM_TYPE_INT);
pduel->lua->add_param(clit.evt.reason_effect , PARAM_TYPE_EFFECT);
pduel->lua->add_param(clit.evt.reason, PARAM_TYPE_INT);
pduel->lua->add_param(clit.evt.reason_player, PARAM_TYPE_INT);
zone = peffect->get_value(7);
if(!zone)
zone = 0xff;
}
phandler->enable_field_effect(false); phandler->enable_field_effect(false);
phandler->set_status(STATUS_ACT_FROM_HAND, TRUE); phandler->set_status(STATUS_ACT_FROM_HAND, TRUE);
move_to_field(phandler, phandler->current.controler, phandler->current.controler, LOCATION_SZONE, POS_FACEUP); move_to_field(phandler, phandler->current.controler, phandler->current.controler, LOCATION_SZONE, POS_FACEUP, FALSE, 0, FALSE, zone);
} else { } else {
phandler->set_status(STATUS_ACT_FROM_HAND, FALSE); phandler->set_status(STATUS_ACT_FROM_HAND, FALSE);
change_position(phandler, 0, phandler->current.controler, POS_FACEUP, 0); change_position(phandler, 0, phandler->current.controler, POS_FACEUP, 0);
......
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