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 {
EFFECT_FLAG_CLIENT_HINT = 0x4000000,
// EFFECT_FLAG_CHAIN_UNIQUE = 0x8000000,
EFFECT_FLAG_LIMIT_ZONE = 0x10000000,
EFFECT_FLAG_COUNT_SS_ONCE = 0x20000000,
// EFFECT_FLAG_COF = 0x20000000,
// EFFECT_FLAG_CVAL_CHECK = 0x40000000,
EFFECT_FLAG_IMMEDIATELY_APPLY = 0x80000000,
};
......
......@@ -562,8 +562,8 @@ public:
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 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_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget, uint8 confirm);
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, effect* reason_effect);
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(uint16 step, effect* reason_effect, uint8 reason_player, group* targets, uint32 zone);
......
......@@ -597,9 +597,9 @@ int32 scriptlib::duel_sets(lua_State *L) {
} else
luaL_error(L, "Parameter %d should be \"Card\" or \"Group\".", 2);
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
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);
}
int32 scriptlib::duel_create_token(lua_State *L) {
......
......@@ -2301,7 +2301,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
}
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) {
case 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
pduel->write_buffer32(target->data.code);
pduel->write_buffer32(target->get_info_location());
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();
if(core.current_chain.size() == 0) {
adjust_all();
......@@ -2358,7 +2358,7 @@ int32 field::sset(uint16 step, uint8 setplayer, uint8 toplayer, card * target, u
}
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) {
case 0: {
card_set* set_cards = new card_set;
......@@ -2515,7 +2515,7 @@ int32 field::sset_g(uint16 step, uint8 setplayer, uint8 toplayer, group* ptarget
case 7: {
returns.ivalue[0] = core.operated_set.size();
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();
if(core.current_chain.size() == 0) {
adjust_all();
......
......@@ -395,7 +395,7 @@ int32 field::process() {
return pduel->bufferlen;
}
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();
else
it->step++;
......@@ -409,7 +409,7 @@ int32 field::process() {
return pduel->bufferlen;
}
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);
core.units.pop_front();
} else
......@@ -4359,7 +4359,7 @@ int32 field::add_chain(uint16 step) {
set_spsummon_counter(clit.triggering_player, true, true);
if(clit.opinfos[0x200].op_player == PLAYER_ALL)
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];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
......@@ -4605,32 +4605,30 @@ 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])
set_spsummon_counter(1 - cait->triggering_player);
//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];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
uint32 sumplayer = optarget.op_param;
if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto opit = optarget.op_cards->container.begin();
if((*opit)->spsummon_code)
core.spsummon_once_map[sumplayer][(*opit)->spsummon_code]++;
++opit;
if((*opit)->spsummon_code)
core.spsummon_once_map[1 - sumplayer][(*opit)->spsummon_code]++;
}
auto& optarget = cait->opinfos[0x200];
if(optarget.op_cards) {
if(optarget.op_player == PLAYER_ALL) {
uint32 sumplayer = optarget.op_param;
if(core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) {
auto opit = optarget.op_cards->container.begin();
check_card_counter(*opit, 3, sumplayer);
if((*opit)->spsummon_code)
core.spsummon_once_map[sumplayer][(*opit)->spsummon_code]++;
++opit;
check_card_counter(*opit, 3, 1 - sumplayer);
} else {
uint32 sumplayer = cait->triggering_player;
if(optarget.op_player == 1)
sumplayer = 1 - sumplayer;
for(auto& ptarget : optarget.op_cards->container) {
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && ptarget->spsummon_code)
core.spsummon_once_map[sumplayer][ptarget->spsummon_code]++;
check_card_counter(ptarget, 3, sumplayer);
}
if((*opit)->spsummon_code)
core.spsummon_once_map[1 - sumplayer][(*opit)->spsummon_code]++;
}
auto opit = optarget.op_cards->container.begin();
check_card_counter(*opit, 3, sumplayer);
++opit;
check_card_counter(*opit, 3, 1 - sumplayer);
} else {
uint32 sumplayer = cait->triggering_player;
if(optarget.op_player == 1)
sumplayer = 1 - sumplayer;
for(auto& ptarget : optarget.op_cards->container) {
if((core.global_flag & GLOBALFLAG_SPSUMMON_ONCE) && ptarget->spsummon_code)
core.spsummon_once_map[sumplayer][ptarget->spsummon_code]++;
check_card_counter(ptarget, 3, sumplayer);
}
}
}
......
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