Commit 9f7ca70f authored by Momobako's avatar Momobako

update_core

parent c85d4da3
......@@ -460,6 +460,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EVENT_CHAINING 1027
#define EVENT_BECOME_TARGET 1028
#define EVENT_DESTROYED 1029
#define EVENT_MOVE 1030
#define EVENT_ADJUST 1040
#define EVENT_SUMMON_SUCCESS 1100
#define EVENT_FLIP_SUMMON_SUCCESS 1101
......
......@@ -705,7 +705,12 @@ int32 scriptlib::duel_move_sequence(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
int32 seq = lua_tonumberint(L, 2);
duel* pduel = pcard->pduel;
pduel->game_field->move_card(pcard->current.controler, pcard, pcard->current.location, seq);
int32 playerid = pcard->current.controler;
pduel->game_field->move_card(playerid, pcard, pcard->current.location, seq);
pduel->game_field->raise_single_event(pcard, 0, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, playerid, 0);
pduel->game_field->raise_event(pcard, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, playerid, 0);
pduel->game_field->process_single_event();
pduel->game_field->process_instant_event();
return 0;
}
int32 scriptlib::duel_swap_sequence(lua_State *L) {
......@@ -731,6 +736,14 @@ int32 scriptlib::duel_swap_sequence(lua_State *L) {
pduel->write_buffer32(pcard2->get_info_location());
pduel->write_buffer32(pcard2->data.code);
pduel->write_buffer32(pcard1->get_info_location());
field::card_set swapped;
swapped.insert(pcard1);
swapped.insert(pcard2);
pduel->game_field->raise_single_event(pcard1, 0, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, player, 0);
pduel->game_field->raise_single_event(pcard2, 0, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, player, 0);
pduel->game_field->raise_event(&swapped, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, player, 0);
pduel->game_field->process_single_event();
pduel->game_field->process_instant_event();
}
return 0;
}
......@@ -1357,10 +1370,15 @@ int32 scriptlib::duel_shuffle_setcard(lua_State *L) {
pduel->write_buffer8(MSG_SHUFFLE_SET_CARD);
pduel->write_buffer8(ct);
for(uint32 i = 0; i < ct; ++i) {
pduel->write_buffer32(ms[i]->get_info_location());
pduel->game_field->player[tp].list_mzone[seq[i]] = ms[i];
ms[i]->current.sequence = seq[i];
card* pcard = ms[i];
pduel->write_buffer32(pcard->get_info_location());
pduel->game_field->player[tp].list_mzone[seq[i]] = pcard;
pcard->current.sequence = seq[i];
pduel->game_field->raise_single_event(pcard, 0, EVENT_MOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, tp, 0);
}
pduel->game_field->raise_event(&pgroup->container, EVENT_MOVE, pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, tp, 0);
pduel->game_field->process_single_event();
pduel->game_field->process_instant_event();
for(uint32 i = 0; i < ct; ++i) {
if(ms[i]->xyz_materials.size())
pduel->write_buffer32(ms[i]->get_info_location());
......
......@@ -425,10 +425,12 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
for (auto cit = drawed_set->begin(); cit != drawed_set->end(); ++cit) {
raise_single_event((*cit), 0, EVENT_DRAW, reason_effect, reason, reason_player, playerid, 0);
raise_single_event((*cit), 0, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, 0);
raise_single_event((*cit), 0, EVENT_MOVE, reason_effect, reason, reason_player, playerid, 0);
}
process_single_event();
raise_event(drawed_set, EVENT_DRAW, reason_effect, reason, reason_player, playerid, drawed);
raise_event(drawed_set, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, drawed);
raise_event(drawed_set, EVENT_MOVE, reason_effect, reason, reason_player, playerid, drawed);
process_instant_event();
}
return FALSE;
......@@ -927,9 +929,12 @@ int32 field::get_control(uint16 step, effect* reason_effect, uint8 reason_player
if(pcard->unique_code && (pcard->unique_location & LOCATION_MZONE))
add_unique_card(pcard);
raise_single_event(pcard, 0, EVENT_CONTROL_CHANGED, reason_effect, REASON_EFFECT, reason_player, playerid, 0);
raise_single_event(pcard, 0, EVENT_MOVE, reason_effect, REASON_EFFECT, reason_player, playerid, 0);
}
if(targets->container.size())
if(targets->container.size()) {
raise_event(&targets->container, EVENT_CONTROL_CHANGED, reason_effect, REASON_EFFECT, reason_player, playerid, 0);
raise_event(&targets->container, EVENT_MOVE, reason_effect, REASON_EFFECT, reason_player, playerid, 0);
}
process_single_event();
process_instant_event();
return FALSE;
......@@ -1118,8 +1123,10 @@ int32 field::swap_control(uint16 step, effect* reason_effect, uint8 reason_playe
if(pcard->unique_code && (pcard->unique_location & LOCATION_MZONE))
add_unique_card(pcard);
raise_single_event(pcard, 0, EVENT_CONTROL_CHANGED, reason_effect, REASON_EFFECT, reason_player, pcard->current.controler, 0);
raise_single_event(pcard, 0, EVENT_MOVE, reason_effect, REASON_EFFECT, reason_player, pcard->current.controler, 0);
}
raise_event(&targets1->container, EVENT_CONTROL_CHANGED, reason_effect, REASON_EFFECT, reason_player, 0, 0);
raise_event(&targets1->container, EVENT_MOVE, reason_effect, REASON_EFFECT, reason_player, 0, 0);
process_single_event();
process_instant_event();
return FALSE;
......@@ -1254,9 +1261,12 @@ int32 field::control_adjust(uint16 step) {
if(pcard->unique_code && (pcard->unique_location & LOCATION_MZONE))
add_unique_card(pcard);
raise_single_event(pcard, 0, EVENT_CONTROL_CHANGED, 0, REASON_RULE, 0, pcard->current.controler, 0);
raise_single_event(pcard, 0, EVENT_MOVE, 0, REASON_RULE, 0, pcard->current.controler, 0);
}
if(core.control_adjust_set[0].size())
if(core.control_adjust_set[0].size()) {
raise_event(&core.control_adjust_set[0], EVENT_CONTROL_CHANGED, 0, 0, 0, 0, 0);
raise_event(&core.control_adjust_set[0], EVENT_MOVE, 0, 0, 0, 0, 0);
}
process_single_event();
process_instant_event();
return FALSE;
......@@ -3970,6 +3980,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
for(auto clit = pcard->xyz_materials.begin(); clit != pcard->xyz_materials.end(); ++clit)
overlays.insert(*clit);
}
raise_single_event(pcard, 0, EVENT_MOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(tohand.size())
raise_event(&tohand, EVENT_TO_HAND, reason_effect, reason, reason_player, 0, 0);
......@@ -3985,6 +3996,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
raise_event(&destroyed, EVENT_DESTROYED, reason_effect, reason, reason_player, 0, 0);
if(retgrave.size())
raise_event(&retgrave, EVENT_RETURN_TO_GRAVE, reason_effect, reason, reason_player, 0, 0);
raise_event(&targets->container, EVENT_MOVE, reason_effect, reason, reason_player, 0, 0);
process_single_event();
process_instant_event();
if(equipings.size())
......@@ -4099,6 +4111,7 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso
remove.insert(pcard);
raise_single_event(pcard, 0, EVENT_REMOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
raise_single_event(pcard, 0, EVENT_MOVE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
core.discarded_set.insert(pcard);
}
if(tohand.size())
......@@ -4109,6 +4122,7 @@ int32 field::discard_deck(uint16 step, uint8 playerid, uint8 count, uint32 reaso
raise_event(&tograve, EVENT_TO_GRAVE, core.reason_effect, reason, core.reason_player, 0, 0);
if(remove.size())
raise_event(&remove, EVENT_REMOVE, core.reason_effect, reason, core.reason_player, 0, 0);
raise_event(&core.discarded_set, EVENT_MOVE, core.reason_effect, reason, core.reason_player, 0, 0);
process_single_event();
process_instant_event();
adjust_instant();
......@@ -4306,6 +4320,12 @@ int32 field::move_to_field(uint16 step, card* target, uint32 enable, uint32 ret,
target->enable_field_effect(true);
if(ret == 1 && target->current.location == LOCATION_MZONE && !(target->data.type & TYPE_MONSTER))
send_to(target, 0, REASON_RULE, PLAYER_NONE, PLAYER_NONE, LOCATION_GRAVE, 0, 0);
else {
raise_single_event(target, 0, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0);
raise_event(target, EVENT_MOVE, target->current.reason_effect, target->current.reason, target->current.reason_player, 0, 0);
process_single_event();
process_instant_event();
}
adjust_disable_check_list();
return FALSE;
}
......
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