Commit 11898b44 authored by nanahira's avatar nanahira

Merge branch 'master' of github.com:Fluorohydride/ygopro-core

parents 687a3711 f95d9084
...@@ -205,7 +205,7 @@ enum effect_flag : uint32 { ...@@ -205,7 +205,7 @@ enum effect_flag : uint32 {
EFFECT_FLAG_CLIENT_HINT = 0x4000000, EFFECT_FLAG_CLIENT_HINT = 0x4000000,
// EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000, // EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000,
EFFECT_FLAG_LIMIT_ZONE = 0x10000000, EFFECT_FLAG_LIMIT_ZONE = 0x10000000,
EFFECT_FLAG_COUNT_SS_ONCE = 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,
}; };
......
...@@ -562,8 +562,8 @@ public: ...@@ -562,8 +562,8 @@ public:
int32 summon(uint16 step, uint8 sumplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone); int32 summon(uint16 step, uint8 sumplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone);
int32 flip_summon(uint16 step, uint8 sumplayer, card* target); int32 flip_summon(uint16 step, uint8 sumplayer, card* target);
int32 mset(uint16 step, uint8 setplayer, card* ptarget, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone); int32 mset(uint16 step, uint8 setplayer, card* ptarget, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone);
int32 sset(uint16 step, uint8 setplayer, uint8 toplayer, card* ptarget, uint32 zone = 0xff); int32 sset(uint16 step, uint8 setplayer, uint8 toplayer, card* ptarget, effect* reason_effect, uint32 zone = 0xff);
int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm); int32 sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm, effect* reason_effect);
int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type); int32 special_summon_rule(uint16 step, uint8 sumplayer, card* target, uint32 summon_type);
int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone); int32 special_summon_step(uint16 step, group* targets, card* target, uint32 zone);
int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone); int32 special_summon(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone);
......
...@@ -597,9 +597,9 @@ int32 scriptlib::duel_sets(lua_State *L) { ...@@ -597,9 +597,9 @@ int32 scriptlib::duel_sets(lua_State *L) {
} else } else
luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2); luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2);
if(pcard) if(pcard)
pduel->game_field->add_process(PROCESSOR_SSET, 0, 0, (group*)pcard, playerid, toplayer, zone); pduel->game_field->add_process(PROCESSOR_SSET, 0, pduel->game_field->core.reason_effect, (group*)pcard, playerid, toplayer, zone);
else else
pduel->game_field->add_process(PROCESSOR_SSET_G, 0, 0, pgroup, playerid, toplayer, confirm); pduel->game_field->add_process(PROCESSOR_SSET_G, 0, pduel->game_field->core.reason_effect, pgroup, playerid, toplayer, confirm);
return lua_yield(L, 0); return lua_yield(L, 0);
} }
int32 scriptlib::duel_create_token(lua_State *L) { int32 scriptlib::duel_create_token(lua_State *L) {
......
...@@ -2301,7 +2301,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2301,7 +2301,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
} }
return TRUE; return TRUE;
} }
int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, uint32 zone) { int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, effect* reason_effect, uint32 zone) {
switch(step) { switch(step) {
case 0: { case 0: {
if(!(target->data.type & TYPE_FIELD) && get_useable_count(target, toplayer, LOCATION_SZONE, setplayer, LOCATION_REASON_TOFIELD, zone ? zone : 0xff) <= 0) if(!(target->data.type & TYPE_FIELD) && get_useable_count(target, toplayer, LOCATION_SZONE, setplayer, LOCATION_REASON_TOFIELD, zone ? zone : 0xff) <= 0)
...@@ -2347,7 +2347,7 @@ int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, u ...@@ -2347,7 +2347,7 @@ int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, u
pduel->write_buffer32(target->data.code); pduel->write_buffer32(target->data.code);
pduel->write_buffer32(target->get_info_location()); pduel->write_buffer32(target->get_info_location());
adjust_instant(); adjust_instant();
raise_event(target, EVENT_SSET, 0, 0, setplayer, setplayer, 0); raise_event(target, EVENT_SSET, reason_effect, 0, setplayer, setplayer, 0);
process_instant_event(); process_instant_event();
if(core.current_chain.size() == 0) { if(core.current_chain.size() == 0) {
adjust_all(); adjust_all();
...@@ -2358,7 +2358,7 @@ int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, u ...@@ -2358,7 +2358,7 @@ int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, u
} }
return TRUE; return TRUE;
} }
int32 field::sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm) { int32 field::sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm, effect* reason_effect) {
switch(step) { switch(step) {
case 0: { case 0: {
card_set* set_cards = new card_set; card_set* set_cards = new card_set;
...@@ -2515,7 +2515,7 @@ int32 field::sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget ...@@ -2515,7 +2515,7 @@ int32 field::sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget
case 7: { case 7: {
returns.ivalue[0] = core.operated_set.size(); returns.ivalue[0] = core.operated_set.size();
adjust_instant(); adjust_instant();
raise_event(&core.operated_set, EVENT_SSET, 0, 0, setplayer, setplayer, 0); raise_event(&core.operated_set, EVENT_SSET, reason_effect, 0, setplayer, setplayer, 0);
process_instant_event(); process_instant_event();
if(core.current_chain.size() == 0) { if(core.current_chain.size() == 0) {
adjust_all(); adjust_all();
......
...@@ -395,7 +395,7 @@ int32 field::process() { ...@@ -395,7 +395,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_SSET: { case PROCESSOR_SSET: {
if (sset(it->step, it->arg1, it->arg2, (card*)(it->ptarget), it->arg3)) if (sset(it->step, it->arg1, it->arg2, (card*)(it->ptarget), it->peffect, it->arg3))
core.units.pop_front(); core.units.pop_front();
else else
it->step++; it->step++;
...@@ -409,7 +409,7 @@ int32 field::process() { ...@@ -409,7 +409,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_SSET_G: { case PROCESSOR_SSET_G: {
if (sset_g(it->step, it->arg1, it->arg2, it->ptarget, it->arg3)) { if (sset_g(it->step, it->arg1, it->arg2, it->ptarget, it->arg3, it->peffect)) {
pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT); pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT);
core.units.pop_front(); core.units.pop_front();
} else } else
...@@ -4359,7 +4359,7 @@ int32 field::add_chain(uint16 step) { ...@@ -4359,7 +4359,7 @@ int32 field::add_chain(uint16 step) {
set_spsummon_counter(clit.triggering_player, true, true); set_spsummon_counter(clit.triggering_player, true, true);
if(clit.opinfos[0x200].op_player == PLAYER_ALL) if(clit.opinfos[0x200].op_player == PLAYER_ALL)
set_spsummon_counter(1 - clit.triggering_player, true, true); set_spsummon_counter(1 - clit.triggering_player, true, true);
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && peffect->is_flag(EFFECT_FLAG_CARD_TARGET | EFFECT_FLAG_COUNT_SS_ONCE)) { if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto& optarget = clit.opinfos[0x200]; auto& optarget = clit.opinfos[0x200];
if(optarget.op_cards) { if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) { if(optarget.op_player == PLAYER_ALL) {
...@@ -4605,7 +4605,6 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4605,7 +4605,6 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
if(cait->opinfos[0x200].op_player == PLAYER_ALL && core.spsummon_state_count_tmp[1 - cait->triggering_player] == core.spsummon_state_count[1 - cait->triggering_player]) if(cait->opinfos[0x200].op_player == PLAYER_ALL && core.spsummon_state_count_tmp[1 - cait->triggering_player] == core.spsummon_state_count[1 - cait->triggering_player])
set_spsummon_counter(1 - cait->triggering_player); set_spsummon_counter(1 - cait->triggering_player);
//sometimes it may add twice, only works for once per turn //sometimes it may add twice, only works for once per turn
if(cait->triggering_effect->is_flag(EFFECT_FLAG_CARD_TARGET | EFFECT_FLAG_COUNT_SS_ONCE)) {
auto& optarget = cait->opinfos[0x200]; auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) { if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) { if(optarget.op_player == PLAYER_ALL) {
...@@ -4635,7 +4634,6 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4635,7 +4634,6 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
} }
} }
} }
}
core.spsummon_state_count_tmp[0] = 0; core.spsummon_state_count_tmp[0] = 0;
core.spsummon_state_count_tmp[1] = 0; core.spsummon_state_count_tmp[1] = 0;
core.chain_solving = FALSE; core.chain_solving = 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