Skip to content

Commit

Permalink
field: change signature of group raise_event (#666)
Browse files Browse the repository at this point in the history
* field: update draw(uint16 step, ...

* field: change signature of group raise_event

* remove (card*)0
  • Loading branch information
salix5 authored Nov 22, 2024
1 parent 6b9b241 commit 94dcb8a
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 104 deletions.
4 changes: 2 additions & 2 deletions card.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1650,10 +1650,10 @@ void card::xyz_overlay(card_set* materials) {
}
if(leave_grave.size() || leave_deck.size()) {
if(leave_grave.size()) {
pduel->game_field->raise_event(&leave_grave, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
pduel->game_field->raise_event(leave_grave, EVENT_LEAVE_GRAVE, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
}
if(leave_deck.size()) {
pduel->game_field->raise_event(&leave_deck, EVENT_LEAVE_DECK, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
pduel->game_field->raise_event(leave_deck, EVENT_LEAVE_DECK, pduel->game_field->core.reason_effect, REASON_XYZ + REASON_MATERIAL, pduel->game_field->core.reason_player, 0, 0);
}
pduel->game_field->process_single_event();
pduel->game_field->process_instant_event();
Expand Down
2 changes: 1 addition & 1 deletion field.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ class field {
int32 execute_operation(uint16 step, effect* peffect, uint8 triggering_player);
int32 execute_target(uint16 step, effect* peffect, uint8 triggering_player);
void raise_event(card* event_card, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
void raise_event(card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
void raise_event(const card_set& event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
void raise_single_event(card* trigger_card, card_set* event_cards, uint32 event_code, effect* reason_effect, uint32 reason, uint8 reason_player, uint8 event_player, uint32 event_value);
int32 check_event(uint32 code, tevent* pe = nullptr);
int32 check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, int32 neglect_cost, int32 copy_info, tevent* pe = nullptr);
Expand Down
12 changes: 6 additions & 6 deletions libduel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ int32 scriptlib::duel_swap_sequence(lua_State *L) {
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->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();
}
Expand Down Expand Up @@ -1147,7 +1147,7 @@ int32 scriptlib::duel_raise_event(lua_State *L) {
if(pcard)
pduel->game_field->raise_event(pcard, code, peffect, r, rp, ep, ev);
else
pduel->game_field->raise_event(&pgroup->container, code, peffect, r, rp, ep, ev);
pduel->game_field->raise_event(pgroup->container, code, peffect, r, rp, ep, ev);
pduel->game_field->process_instant_event();
return lua_yield(L, 0);
}
Expand Down Expand Up @@ -1373,7 +1373,7 @@ int32 scriptlib::duel_equip_complete(lua_State *L) {
for(auto& equip_target : etargets)
pduel->game_field->raise_single_event(equip_target, &pduel->game_field->core.equiping_cards, EVENT_EQUIP,
pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, PLAYER_NONE, 0);
pduel->game_field->raise_event(&pduel->game_field->core.equiping_cards, EVENT_EQUIP,
pduel->game_field->raise_event(pduel->game_field->core.equiping_cards, EVENT_EQUIP,
pduel->game_field->core.reason_effect, 0, pduel->game_field->core.reason_player, PLAYER_NONE, 0);
pduel->game_field->core.hint_timing[0] |= TIMING_EQUIP;
pduel->game_field->core.hint_timing[1] |= TIMING_EQUIP;
Expand Down Expand Up @@ -1620,7 +1620,7 @@ int32 scriptlib::duel_shuffle_setcard(lua_State *L) {
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->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(int32 i = 0; i < ct; ++i) {
Expand Down Expand Up @@ -1778,7 +1778,7 @@ int32 scriptlib::duel_break_effect(lua_State *L) {
check_action_permission(L);
duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->break_effect();
pduel->game_field->raise_event((card*)0, EVENT_BREAK_EFFECT, 0, 0, PLAYER_NONE, PLAYER_NONE, 0);
pduel->game_field->raise_event(nullptr, EVENT_BREAK_EFFECT, 0, 0, PLAYER_NONE, PLAYER_NONE, 0);
pduel->game_field->process_instant_event();
return lua_yield(L, 0);
}
Expand Down Expand Up @@ -1908,7 +1908,7 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
if(pcard)
pduel->game_field->raise_event(pcard, event_code, reason_effect, REASON_EFFECT, reason_player, sumplayer, 0);
else
pduel->game_field->raise_event(&pgroup->container, event_code, reason_effect, REASON_EFFECT, reason_player, sumplayer, 0);
pduel->game_field->raise_event(pgroup->container, event_code, reason_effect, REASON_EFFECT, reason_player, sumplayer, 0);
pduel->game_field->process_instant_event();
return 0;
}
Expand Down
Loading

0 comments on commit 94dcb8a

Please sign in to comment.