Commit ae8adc53 authored by mercury233's avatar mercury233
parents fdc826fa 13e0a39e
...@@ -268,7 +268,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -268,7 +268,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
} }
if(phandler->current.location == LOCATION_OVERLAY) if(phandler->current.location == LOCATION_OVERLAY)
return FALSE; return FALSE;
if((type & EFFECT_TYPE_FIELD) && (phandler->current.controler != playerid) && !is_flag(EFFECT_FLAG_BOTH_SIDE)) if((type & EFFECT_TYPE_FIELD) && (phandler->current.controler != playerid) && !is_flag(EFFECT_FLAG_BOTH_SIDE | EFFECT_FLAG_EVENT_PLAYER))
return FALSE; return FALSE;
if(phandler->is_status(STATUS_FORBIDDEN)) if(phandler->is_status(STATUS_FORBIDDEN))
return FALSE; return FALSE;
......
...@@ -184,14 +184,14 @@ enum effect_flag : uint32 { ...@@ -184,14 +184,14 @@ enum effect_flag : uint32 {
EFFECT_FLAG_OWNER_RELATE = 0x1000000, EFFECT_FLAG_OWNER_RELATE = 0x1000000,
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_NAGA = 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,
}; };
enum effect_flag2 : uint32 { enum effect_flag2 : uint32 {
EFFECT_FLAG2_NAGA = 0x0001, // EFFECT_FLAG2_NAGA = 0x0001,
EFFECT_FLAG2_COF = 0x0002, EFFECT_FLAG2_COF = 0x0002,
}; };
inline effect_flag operator|(effect_flag flag1, effect_flag flag2) inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
......
...@@ -609,6 +609,8 @@ public: ...@@ -609,6 +609,8 @@ public:
#define CHAIN_HAND_EFFECT 0x04 #define CHAIN_HAND_EFFECT 0x04
#define CHAIN_CONTINUOUS_CARD 0x08 #define CHAIN_CONTINUOUS_CARD 0x08
#define CHAIN_ACTIVATING 0x10 #define CHAIN_ACTIVATING 0x10
#define CHAIN_HAND_TRIGGER 0x20
#define CHAIN_DECK_EFFECT 0x40
#define CHAININFO_CHAIN_COUNT 0x01 #define CHAININFO_CHAIN_COUNT 0x01
#define CHAININFO_TRIGGERING_EFFECT 0x02 #define CHAININFO_TRIGGERING_EFFECT 0x02
#define CHAININFO_TRIGGERING_PLAYER 0x04 #define CHAININFO_TRIGGERING_PLAYER 0x04
......
...@@ -3619,44 +3619,30 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) { ...@@ -3619,44 +3619,30 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) {
check_param_count(L, 1); check_param_count(L, 1);
int32 chaincount = lua_tointeger(L, 1); int32 chaincount = lua_tointeger(L, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
int32 res = 0; chain* ch = pduel->game_field->get_chain(chaincount);
if(chaincount < 0 || chaincount > (int32)pduel->game_field->core.current_chain.size()) if(!ch)
res = FALSE; return 0;
else { if(ch->flag & CHAIN_DECK_EFFECT)
effect* peffect; lua_pushboolean(L, 0);
if(chaincount == 0) else
peffect = pduel->game_field->core.current_chain.back().triggering_effect; lua_pushboolean(L, 1);
else
peffect = pduel->game_field->core.current_chain[chaincount - 1].triggering_effect;
if(peffect->is_flag(EFFECT_FLAG2_NAGA))
res = FALSE;
else
res = TRUE;
}
lua_pushboolean(L, res);
return 1; return 1;
} }
int32 scriptlib::duel_is_chain_disablable(lua_State * L) { int32 scriptlib::duel_is_chain_disablable(lua_State * L) {
check_param_count(L, 1); check_param_count(L, 1);
int32 chaincount = lua_tointeger(L, 1); int32 chaincount = lua_tointeger(L, 1);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
int32 res = 0; if(pduel->game_field->core.chain_solving) {
if(chaincount < 0 || chaincount > (int32)pduel->game_field->core.current_chain.size()) lua_pushboolean(L, pduel->game_field->is_chain_disablable(chaincount));
res = FALSE; return 1;
else {
effect* peffect;
if(chaincount == 0)
peffect = pduel->game_field->core.current_chain.back().triggering_effect;
else
peffect = pduel->game_field->core.current_chain[chaincount - 1].triggering_effect;
if(peffect->is_flag(EFFECT_FLAG2_NAGA))
res = FALSE;
else
res = TRUE;
if(pduel->game_field->core.chain_solving)
res = pduel->game_field->is_chain_disablable(chaincount);
} }
lua_pushboolean(L, res); chain* ch = pduel->game_field->get_chain(chaincount);
if(!ch)
return 0;
if(ch->flag & CHAIN_DECK_EFFECT)
lua_pushboolean(L, 0);
else
lua_pushboolean(L, 1);
return 1; return 1;
} }
int32 scriptlib::duel_check_chain_target(lua_State *L) { int32 scriptlib::duel_check_chain_target(lua_State *L) {
......
...@@ -29,7 +29,7 @@ int32 field::negate_chain(uint8 chaincount) { ...@@ -29,7 +29,7 @@ int32 field::negate_chain(uint8 chaincount) {
} }
pduel->write_buffer8(MSG_CHAIN_NEGATED); pduel->write_buffer8(MSG_CHAIN_NEGATED);
pduel->write_buffer8(chaincount); pduel->write_buffer8(chaincount);
if(pchain.triggering_effect->is_flag(EFFECT_FLAG2_NAGA)) if(pchain.flag & CHAIN_DECK_EFFECT)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
...@@ -48,7 +48,7 @@ int32 field::disable_chain(uint8 chaincount) { ...@@ -48,7 +48,7 @@ int32 field::disable_chain(uint8 chaincount) {
core.current_chain[chaincount - 1].disable_player = core.reason_player; core.current_chain[chaincount - 1].disable_player = core.reason_player;
pduel->write_buffer8(MSG_CHAIN_DISABLED); pduel->write_buffer8(MSG_CHAIN_DISABLED);
pduel->write_buffer8(chaincount); pduel->write_buffer8(chaincount);
if(pchain.triggering_effect->is_flag(EFFECT_FLAG2_NAGA)) if(pchain.flag & CHAIN_DECK_EFFECT)
return FALSE; return FALSE;
return TRUE; return TRUE;
} }
...@@ -3984,12 +3984,14 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3984,12 +3984,14 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
for(auto cit = param->targets->container.begin(); cit != param->targets->container.end(); ++cit) { for(auto cit = param->targets->container.begin(); cit != param->targets->container.end(); ++cit) {
card* pcard = *cit; card* pcard = *cit;
if(!(pcard->data.type & TYPE_TOKEN))
pcard->enable_field_effect(true);
uint8 nloc = pcard->current.location; uint8 nloc = pcard->current.location;
if(nloc == LOCATION_HAND) if(nloc == LOCATION_HAND)
pcard->reset(RESET_TOHAND, RESET_EVENT); pcard->reset(RESET_TOHAND, RESET_EVENT);
else if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA)
pcard->reset(RESET_TODECK, RESET_EVENT); pcard->reset(RESET_TODECK, RESET_EVENT);
else if(nloc == LOCATION_GRAVE) if(nloc == LOCATION_GRAVE)
pcard->reset(RESET_TOGRAVE, RESET_EVENT); pcard->reset(RESET_TOGRAVE, RESET_EVENT);
if(nloc == LOCATION_REMOVED || ((pcard->data.type & TYPE_TOKEN) && pcard->sendto_param.location == LOCATION_REMOVED)) { if(nloc == LOCATION_REMOVED || ((pcard->data.type & TYPE_TOKEN) && pcard->sendto_param.location == LOCATION_REMOVED)) {
if(pcard->current.reason & REASON_TEMPORARY) if(pcard->current.reason & REASON_TEMPORARY)
...@@ -4036,22 +4038,21 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -4036,22 +4038,21 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
} }
} }
pcard->clear_card_target(); pcard->clear_card_target();
if(!(pcard->data.type & TYPE_TOKEN)) { if(nloc == LOCATION_HAND) {
pcard->enable_field_effect(true); tohand.insert(pcard);
if(nloc == LOCATION_HAND) { raise_single_event(pcard, 0, EVENT_TO_HAND, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
tohand.insert(pcard); }
raise_single_event(pcard, 0, EVENT_TO_HAND, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) {
} else if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) { todeck.insert(pcard);
todeck.insert(pcard); raise_single_event(pcard, 0, EVENT_TO_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
raise_single_event(pcard, 0, EVENT_TO_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); }
} else if(nloc == LOCATION_GRAVE) { if(nloc == LOCATION_GRAVE) {
if(pcard->current.reason & REASON_RETURN) { if(pcard->current.reason & REASON_RETURN) {
retgrave.insert(pcard); retgrave.insert(pcard);
raise_single_event(pcard, 0, EVENT_RETURN_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_RETURN_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} else { } else {
tograve.insert(pcard); tograve.insert(pcard);
raise_single_event(pcard, 0, EVENT_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0); raise_single_event(pcard, 0, EVENT_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
} }
} }
if(nloc == LOCATION_REMOVED || ((pcard->data.type & TYPE_TOKEN) && pcard->sendto_param.location == LOCATION_REMOVED)) { if(nloc == LOCATION_REMOVED || ((pcard->data.type & TYPE_TOKEN) && pcard->sendto_param.location == LOCATION_REMOVED)) {
...@@ -4328,6 +4329,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4328,6 +4329,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
&& !(peffect && (peffect->value & TYPE_TRAP)) && ret != 2) && !(peffect && (peffect->value & TYPE_TRAP)) && ret != 2)
resetflag |= RESET_MSCHANGE; resetflag |= RESET_MSCHANGE;
target->reset(resetflag, RESET_EVENT); target->reset(resetflag, RESET_EVENT);
target->clear_card_target();
} }
if(!(target->current.location & LOCATION_ONFIELD)) if(!(target->current.location & LOCATION_ONFIELD))
target->clear_relate_effect(); target->clear_relate_effect();
...@@ -4404,7 +4406,6 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret, ...@@ -4404,7 +4406,6 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
} }
if((target->previous.location == LOCATION_SZONE) && target->equiping_target) if((target->previous.location == LOCATION_SZONE) && target->equiping_target)
target->unequip(); target->unequip();
target->clear_card_target();
if(target->current.location == LOCATION_MZONE) { if(target->current.location == LOCATION_MZONE) {
effect_set eset; effect_set eset;
filter_player_effect(0, EFFECT_MUST_USE_MZONE, &eset, FALSE); filter_player_effect(0, EFFECT_MUST_USE_MZONE, &eset, FALSE);
......
This diff is collapsed.
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