Commit 7fdecbd9 authored by VanillaSalt's avatar VanillaSalt

fix

for Acid Trap Hole
parent 21e46a9a
...@@ -286,7 +286,9 @@ public: ...@@ -286,7 +286,9 @@ public:
#define POS_FACEDOWN 0xa #define POS_FACEDOWN 0xa
#define POS_ATTACK 0x3 #define POS_ATTACK 0x3
#define POS_DEFENCE 0xc #define POS_DEFENCE 0xc
//Flip effect flags
#define NO_FLIP_EFFECT 0x10000 #define NO_FLIP_EFFECT 0x10000
#define FLIP_SET_AVAILABLE 0x20000
//Types //Types
#define TYPE_MONSTER 0x1 // #define TYPE_MONSTER 0x1 //
#define TYPE_SPELL 0x2 // #define TYPE_SPELL 0x2 //
......
...@@ -213,6 +213,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con ...@@ -213,6 +213,7 @@ int32 effect::is_activateable(uint8 playerid, const tevent& e, int32 neglect_con
// effects with EFFECT_FLAG_SET_AVAILABLE or cards with STATUS_SET_AVAILABLE can be activated while face-down // effects with EFFECT_FLAG_SET_AVAILABLE or cards with STATUS_SET_AVAILABLE can be activated while face-down
if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED)) if((handler->current.location & (LOCATION_ONFIELD | LOCATION_REMOVED))
&& !is_flag(EFFECT_FLAG_SET_AVAILABLE) && !handler->is_status(STATUS_SET_AVAILABLE) && !is_flag(EFFECT_FLAG_SET_AVAILABLE) && !handler->is_status(STATUS_SET_AVAILABLE)
&& (code != EVENT_FLIP || !(e.event_value & (FLIP_SET_AVAILABLE >> 16)))
&& (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED))) && (!handler->is_position(POS_FACEUP) || !handler->is_status(STATUS_EFFECT_ENABLED)))
return FALSE; return FALSE;
if(!(type & (EFFECT_TYPE_FLIP | EFFECT_TYPE_TRIGGER_F)) if(!(type & (EFFECT_TYPE_FLIP | EFFECT_TYPE_TRIGGER_F))
......
...@@ -481,8 +481,8 @@ public: ...@@ -481,8 +481,8 @@ public:
void send_to(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence, uint32 position); void send_to(card_set* targets, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence, uint32 position);
void send_to(card* target, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence, uint32 position); void send_to(card* target, effect* reason_effect, uint32 reason, uint32 reason_player, uint32 playerid, uint32 destination, uint32 sequence, uint32 position);
void move_to_field(card* target, uint32 move_player, uint32 playerid, uint32 destination, uint32 positions, uint32 enable = FALSE, uint32 ret = FALSE, uint32 is_equip = FALSE); void move_to_field(card* target, uint32 move_player, uint32 playerid, uint32 destination, uint32 positions, uint32 enable = FALSE, uint32 ret = FALSE, uint32 is_equip = FALSE);
void change_position(card_set* targets, effect* reason_effect, uint32 reason_player, uint32 au, uint32 ad, uint32 du, uint32 dd, uint32 noflip, uint32 enable = FALSE); void change_position(card_set* targets, effect* reason_effect, uint32 reason_player, uint32 au, uint32 ad, uint32 du, uint32 dd, uint32 flag, uint32 enable = FALSE);
void change_position(card* target, effect* reason_effect, uint32 reason_player, uint32 npos, uint32 noflip, uint32 enable = FALSE); void change_position(card* target, effect* reason_effect, uint32 reason_player, uint32 npos, uint32 flag, uint32 enable = FALSE);
int32 remove_counter(uint16 step, uint32 reason, card* pcard, uint8 rplayer, uint8 s, uint8 o, uint16 countertype, uint16 count); int32 remove_counter(uint16 step, uint32 reason, card* pcard, uint8 rplayer, uint8 s, uint8 o, uint16 countertype, uint16 count);
int32 remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8 rplayer, uint8 s, uint8 o, uint16 min, uint16 max); int32 remove_overlay_card(uint16 step, uint32 reason, card* pcard, uint8 rplayer, uint8 s, uint8 o, uint16 min, uint16 max);
......
...@@ -548,18 +548,19 @@ int32 scriptlib::duel_change_form(lua_State *L) { ...@@ -548,18 +548,19 @@ int32 scriptlib::duel_change_form(lua_State *L) {
} else } else
luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 1); luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 1);
uint32 au = lua_tointeger(L, 2); uint32 au = lua_tointeger(L, 2);
uint32 ad = au, du = au, dd = au, noflip = 0; uint32 ad = au, du = au, dd = au, flag = 0;
uint32 top = lua_gettop(L); uint32 top = lua_gettop(L);
if(top > 2) ad = lua_tointeger(L, 3); if(top > 2) ad = lua_tointeger(L, 3);
if(top > 3) du = lua_tointeger(L, 4); if(top > 3) du = lua_tointeger(L, 4);
if(top > 4) dd = lua_tointeger(L, 5); if(top > 4) dd = lua_tointeger(L, 5);
if(top > 5) noflip = lua_toboolean(L, 6); if(top > 5 && lua_toboolean(L, 6)) flag |= NO_FLIP_EFFECT;
if(top > 6 && lua_toboolean(L, 7)) flag |= FLIP_SET_AVAILABLE;
if(pcard) { if(pcard) {
field::card_set cset; field::card_set cset;
cset.insert(pcard); cset.insert(pcard);
pduel->game_field->change_position(&cset, pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, noflip, TRUE); pduel->game_field->change_position(&cset, pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE);
} else } else
pduel->game_field->change_position(&(pgroup->container), pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, noflip, TRUE); pduel->game_field->change_position(&(pgroup->container), pduel->game_field->core.reason_effect, pduel->game_field->core.reason_player, au, ad, du, dd, flag, TRUE);
pduel->game_field->core.subunits.begin()->type = PROCESSOR_CHANGEPOS_S; pduel->game_field->core.subunits.begin()->type = PROCESSOR_CHANGEPOS_S;
return lua_yield(L, 0); return lua_yield(L, 0);
} }
......
...@@ -280,7 +280,7 @@ void field::move_to_field(card* target, uint32 move_player, uint32 playerid, uin ...@@ -280,7 +280,7 @@ void field::move_to_field(card* target, uint32 move_player, uint32 playerid, uin
target->operation_param = (move_player << 24) + (playerid << 16) + (destination << 8) + positions; target->operation_param = (move_player << 24) + (playerid << 16) + (destination << 8) + positions;
add_process(PROCESSOR_MOVETOFIELD, 0, 0, (group*)target, enable, ret + (is_equip << 8)); add_process(PROCESSOR_MOVETOFIELD, 0, 0, (group*)target, enable, ret + (is_equip << 8));
} }
void field::change_position(card_set* targets, effect* reason_effect, uint32 reason_player, uint32 au, uint32 ad, uint32 du, uint32 dd, uint32 noflip, uint32 enable) { void field::change_position(card_set* targets, effect* reason_effect, uint32 reason_player, uint32 au, uint32 ad, uint32 du, uint32 dd, uint32 flag, uint32 enable) {
group* ng = pduel->new_group(*targets); group* ng = pduel->new_group(*targets);
ng->is_readonly = TRUE; ng->is_readonly = TRUE;
for(auto cit = targets->begin(); cit != targets->end(); ++cit) { for(auto cit = targets->begin(); cit != targets->end(); ++cit) {
...@@ -289,17 +289,15 @@ void field::change_position(card_set* targets, effect* reason_effect, uint32 rea ...@@ -289,17 +289,15 @@ void field::change_position(card_set* targets, effect* reason_effect, uint32 rea
else if(pcard->current.position == POS_FACEDOWN_DEFENCE) pcard->operation_param = dd; else if(pcard->current.position == POS_FACEDOWN_DEFENCE) pcard->operation_param = dd;
else if(pcard->current.position == POS_FACEUP_DEFENCE) pcard->operation_param = du; else if(pcard->current.position == POS_FACEUP_DEFENCE) pcard->operation_param = du;
else pcard->operation_param = ad; else pcard->operation_param = ad;
if(noflip) pcard->operation_param |= flag;
pcard->operation_param |= NO_FLIP_EFFECT;
} }
add_process(PROCESSOR_CHANGEPOS, 0, reason_effect, ng, reason_player, enable); add_process(PROCESSOR_CHANGEPOS, 0, reason_effect, ng, reason_player, enable);
} }
void field::change_position(card* target, effect* reason_effect, uint32 reason_player, uint32 npos, uint32 noflip, uint32 enable) { void field::change_position(card* target, effect* reason_effect, uint32 reason_player, uint32 npos, uint32 flag, uint32 enable) {
group* ng = pduel->new_group(target); group* ng = pduel->new_group(target);
ng->is_readonly = TRUE; ng->is_readonly = TRUE;
target->operation_param = npos; target->operation_param = npos;
if(noflip) target->operation_param |= flag;
target->operation_param |= NO_FLIP_EFFECT;
add_process(PROCESSOR_CHANGEPOS, 0, reason_effect, ng, reason_player, enable); add_process(PROCESSOR_CHANGEPOS, 0, reason_effect, ng, reason_player, enable);
} }
int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 playerid, uint32 count) { int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 playerid, uint32 count) {
...@@ -3756,15 +3754,14 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -3756,15 +3754,14 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
card_set flips; card_set flips;
card_set ssets; card_set ssets;
card_set pos_changed; card_set pos_changed;
uint8 npos, opos, noflip;
card_vector cv(targets->container.begin(), targets->container.end()); card_vector cv(targets->container.begin(), targets->container.end());
if(cv.size() > 1) if(cv.size() > 1)
std::sort(cv.begin(), cv.end(), card::card_operation_sort); std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit) { for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
card* pcard = *cvit; card* pcard = *cvit;
npos = pcard->operation_param & 0xff; uint8 npos = pcard->operation_param & 0xff;
opos = pcard->current.position; uint8 opos = pcard->current.position;
noflip = pcard->operation_param >> 16; uint8 flag = pcard->operation_param >> 16;
if(pcard->is_status(STATUS_SUMMONING) || pcard->overlay_target || !(pcard->current.location & LOCATION_ONFIELD) if(pcard->is_status(STATUS_SUMMONING) || pcard->overlay_target || !(pcard->current.location & LOCATION_ONFIELD)
|| !pcard->is_affect_by_effect(reason_effect) || npos == opos || !pcard->is_affect_by_effect(reason_effect) || npos == opos
|| (!(pcard->data.type & TYPE_TOKEN) && (opos & POS_FACEUP) && (npos & POS_FACEDOWN) && !pcard->is_capable_turn_set(reason_player)) || (!(pcard->data.type & TYPE_TOKEN) && (opos & POS_FACEUP) && (npos & POS_FACEDOWN) && !pcard->is_capable_turn_set(reason_player))
...@@ -3789,7 +3786,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec ...@@ -3789,7 +3786,7 @@ int32 field::change_position(uint16 step, group * targets, effect * reason_effec
if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) { if((opos & POS_FACEDOWN) && (npos & POS_FACEUP)) {
pcard->fieldid = infos.field_id++; pcard->fieldid = infos.field_id++;
if(pcard->current.location == LOCATION_MZONE) { if(pcard->current.location == LOCATION_MZONE) {
raise_single_event(pcard, 0, EVENT_FLIP, reason_effect, 0, reason_player, 0, noflip); raise_single_event(pcard, 0, EVENT_FLIP, reason_effect, 0, reason_player, 0, flag);
flips.insert(pcard); flips.insert(pcard);
} }
if(enable) { if(enable) {
......
...@@ -2325,26 +2325,20 @@ int32 field::process_instant_event() { ...@@ -2325,26 +2325,20 @@ int32 field::process_instant_event() {
int32 field::process_single_event() { int32 field::process_single_event() {
if(core.single_event.size() == 0) if(core.single_event.size() == 0)
return TRUE; return TRUE;
card* starget;
uint32 ev;
effect_set eset;
effect* peffect;
effect_vector tp; effect_vector tp;
effect_vector ntp; effect_vector ntp;
event_list tev; event_list tev;
event_list ntev; event_list ntev;
effect_vector::iterator eit;
event_list::iterator evit;
for(auto elit = core.single_event.begin(); elit != core.single_event.end(); ++elit) { for(auto elit = core.single_event.begin(); elit != core.single_event.end(); ++elit) {
starget = elit->trigger_card; card* starget = elit->trigger_card;
ev = elit->event_code; uint32 ev = elit->event_code;
auto pr = starget->single_effect.equal_range(ev); auto pr = starget->single_effect.equal_range(ev);
const tevent& e = *elit; const tevent& e = *elit;
for(; pr.first != pr.second; ++pr.first) { for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second; effect* peffect = pr.first->second;
if(!(peffect->type & EFFECT_TYPE_ACTIONS)) if(!(peffect->type & EFFECT_TYPE_ACTIONS))
continue; continue;
if((peffect->type & EFFECT_TYPE_FLIP) && e.event_value) if((peffect->type & EFFECT_TYPE_FLIP) && (e.event_value & (NO_FLIP_EFFECT >> 16)))
continue; continue;
//continuous & trigger (single) //continuous & trigger (single)
if(peffect->type & EFFECT_TYPE_CONTINUOUS) { if(peffect->type & EFFECT_TYPE_CONTINUOUS) {
...@@ -2404,6 +2398,8 @@ int32 field::process_single_event() { ...@@ -2404,6 +2398,8 @@ int32 field::process_single_event() {
} }
} }
} }
effect_vector::iterator eit;
event_list::iterator evit;
for(eit = tp.begin(), evit = tev.begin(); eit != tp.end(); ++eit, ++evit) { for(eit = tp.begin(), evit = tev.begin(); eit != tp.end(); ++eit, ++evit) {
core.sub_solving_event.push_back(*evit); core.sub_solving_event.push_back(*evit);
add_process(PROCESSOR_SOLVE_CONTINUOUS, 0, (*eit), 0, (*eit)->get_handler_player(), 0); add_process(PROCESSOR_SOLVE_CONTINUOUS, 0, (*eit), 0, (*eit)->get_handler_player(), 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