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
}
if(phandler->current.location == LOCATION_OVERLAY)
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;
if(phandler->is_status(STATUS_FORBIDDEN))
return FALSE;
......
......@@ -184,14 +184,14 @@ enum effect_flag : uint32 {
EFFECT_FLAG_OWNER_RELATE = 0x1000000,
EFFECT_FLAG_AVAILABLE_BD = 0x2000000,
EFFECT_FLAG_CLIENT_HINT = 0x4000000,
EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000,
// EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000,
// EFFECT_FLAG_NAGA = 0x10000000,
// EFFECT_FLAG_COF = 0x20000000,
EFFECT_FLAG_CVAL_CHECK = 0x40000000,
// EFFECT_FLAG_CVAL_CHECK = 0x40000000,
EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000,
};
enum effect_flag2 : uint32 {
EFFECT_FLAG2_NAGA = 0x0001,
// EFFECT_FLAG2_NAGA = 0x0001,
EFFECT_FLAG2_COF = 0x0002,
};
inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
......
......@@ -609,6 +609,8 @@ public:
#define CHAIN_HAND_EFFECT 0x04
#define CHAIN_CONTINUOUS_CARD 0x08
#define CHAIN_ACTIVATING 0x10
#define CHAIN_HAND_TRIGGER 0x20
#define CHAIN_DECK_EFFECT 0x40
#define CHAININFO_CHAIN_COUNT 0x01
#define CHAININFO_TRIGGERING_EFFECT 0x02
#define CHAININFO_TRIGGERING_PLAYER 0x04
......
......@@ -3619,44 +3619,30 @@ int32 scriptlib::duel_is_chain_negatable(lua_State * L) {
check_param_count(L, 1);
int32 chaincount = lua_tointeger(L, 1);
duel* pduel = interpreter::get_duel_info(L);
int32 res = 0;
if(chaincount < 0 || chaincount > (int32)pduel->game_field->core.current_chain.size())
res = FALSE;
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;
}
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;
}
int32 scriptlib::duel_is_chain_disablable(lua_State * L) {
check_param_count(L, 1);
int32 chaincount = lua_tointeger(L, 1);
duel* pduel = interpreter::get_duel_info(L);
int32 res = 0;
if(chaincount < 0 || chaincount > (int32)pduel->game_field->core.current_chain.size())
res = FALSE;
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);
if(pduel->game_field->core.chain_solving) {
lua_pushboolean(L, pduel->game_field->is_chain_disablable(chaincount));
return 1;
}
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;
}
int32 scriptlib::duel_check_chain_target(lua_State *L) {
......
......@@ -29,7 +29,7 @@ int32 field::negate_chain(uint8 chaincount) {
}
pduel->write_buffer8(MSG_CHAIN_NEGATED);
pduel->write_buffer8(chaincount);
if(pchain.triggering_effect->is_flag(EFFECT_FLAG2_NAGA))
if(pchain.flag & CHAIN_DECK_EFFECT)
return FALSE;
return TRUE;
}
......@@ -48,7 +48,7 @@ int32 field::disable_chain(uint8 chaincount) {
core.current_chain[chaincount - 1].disable_player = core.reason_player;
pduel->write_buffer8(MSG_CHAIN_DISABLED);
pduel->write_buffer8(chaincount);
if(pchain.triggering_effect->is_flag(EFFECT_FLAG2_NAGA))
if(pchain.flag & CHAIN_DECK_EFFECT)
return FALSE;
return TRUE;
}
......@@ -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) {
card* pcard = *cit;
if(!(pcard->data.type & TYPE_TOKEN))
pcard->enable_field_effect(true);
uint8 nloc = pcard->current.location;
if(nloc == LOCATION_HAND)
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);
else if(nloc == LOCATION_GRAVE)
if(nloc == LOCATION_GRAVE)
pcard->reset(RESET_TOGRAVE, RESET_EVENT);
if(nloc == LOCATION_REMOVED || ((pcard->data.type & TYPE_TOKEN) && pcard->sendto_param.location == LOCATION_REMOVED)) {
if(pcard->current.reason & REASON_TEMPORARY)
......@@ -4036,22 +4038,21 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
}
}
pcard->clear_card_target();
if(!(pcard->data.type & TYPE_TOKEN)) {
pcard->enable_field_effect(true);
if(nloc == LOCATION_HAND) {
tohand.insert(pcard);
raise_single_event(pcard, 0, EVENT_TO_HAND, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
} else if(nloc == LOCATION_DECK || nloc == LOCATION_EXTRA) {
todeck.insert(pcard);
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(pcard->current.reason & REASON_RETURN) {
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);
} else {
tograve.insert(pcard);
raise_single_event(pcard, 0, EVENT_TO_GRAVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(nloc == LOCATION_HAND) {
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) {
todeck.insert(pcard);
raise_single_event(pcard, 0, EVENT_TO_DECK, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(nloc == LOCATION_GRAVE) {
if(pcard->current.reason & REASON_RETURN) {
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);
} else {
tograve.insert(pcard);
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)) {
......@@ -4328,6 +4329,7 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
&& !(peffect && (peffect->value & TYPE_TRAP)) && ret != 2)
resetflag |= RESET_MSCHANGE;
target->reset(resetflag, RESET_EVENT);
target->clear_card_target();
}
if(!(target->current.location & LOCATION_ONFIELD))
target->clear_relate_effect();
......@@ -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)
target->unequip();
target->clear_card_target();
if(target->current.location == LOCATION_MZONE) {
effect_set eset;
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