Commit 6969a86b authored by nanahira's avatar nanahira

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

parents e7572c70 fadc016f
...@@ -3770,6 +3770,8 @@ int32 card::is_capable_be_battle_target(card* pcard) { ...@@ -3770,6 +3770,8 @@ int32 card::is_capable_be_battle_target(card* pcard) {
int32 card::is_capable_be_effect_target(effect* reason_effect, uint8 playerid) { int32 card::is_capable_be_effect_target(effect* reason_effect, uint8 playerid) {
if(is_status(STATUS_SUMMONING) || is_status(STATUS_BATTLE_DESTROYED)) if(is_status(STATUS_SUMMONING) || is_status(STATUS_BATTLE_DESTROYED))
return FALSE; return FALSE;
if(current.location & (LOCATION_DECK | LOCATION_EXTRA | LOCATION_HAND))
return FALSE;
effect_set eset; effect_set eset;
filter_effect(EFFECT_CANNOT_BE_EFFECT_TARGET, &eset); filter_effect(EFFECT_CANNOT_BE_EFFECT_TARGET, &eset);
for(int32 i = 0; i < eset.size(); ++i) { for(int32 i = 0; i < eset.size(); ++i) {
......
...@@ -355,50 +355,53 @@ int32 effect::is_action_check(uint8 playerid) { ...@@ -355,50 +355,53 @@ int32 effect::is_action_check(uint8 playerid) {
return TRUE; return TRUE;
} }
// check functions: condition, cost(chk=0), target(chk=0) // check functions: condition, cost(chk=0), target(chk=0)
int32 effect::is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) { int32 effect::is_activate_ready(effect* reason_effect, uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) {
if (!neglect_cond && condition) { if(!neglect_cond && condition) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT); pduel->lua->add_param(reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_cards , PARAM_TYPE_GROUP); pduel->lua->add_param(e.event_cards, PARAM_TYPE_GROUP);
pduel->lua->add_param(e.event_player, PARAM_TYPE_INT); pduel->lua->add_param(e.event_player, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_value, PARAM_TYPE_INT); pduel->lua->add_param(e.event_value, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT); pduel->lua->add_param(e.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT); pduel->lua->add_param(e.reason, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT);
if (!pduel->lua->check_condition(condition, 8)) { if(!pduel->lua->check_condition(condition, 8)) {
return FALSE; return FALSE;
} }
} }
if(!neglect_cost && cost && !(type & EFFECT_TYPE_CONTINUOUS)) { if(!neglect_cost && cost && !(type & EFFECT_TYPE_CONTINUOUS)) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT); pduel->lua->add_param(reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_cards , PARAM_TYPE_GROUP); pduel->lua->add_param(e.event_cards, PARAM_TYPE_GROUP);
pduel->lua->add_param(e.event_player, PARAM_TYPE_INT); pduel->lua->add_param(e.event_player, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_value, PARAM_TYPE_INT); pduel->lua->add_param(e.event_value, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT); pduel->lua->add_param(e.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT); pduel->lua->add_param(e.reason, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT);
pduel->lua->add_param((ptr)0, PARAM_TYPE_INT); pduel->lua->add_param((ptr)0, PARAM_TYPE_INT);
if (!pduel->lua->check_condition(cost, 9)) { if(!pduel->lua->check_condition(cost, 9)) {
return FALSE; return FALSE;
} }
} }
if(!neglect_target && target) { if(!neglect_target && target) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT); pduel->lua->add_param(reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT); pduel->lua->add_param(playerid, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_cards , PARAM_TYPE_GROUP); pduel->lua->add_param(e.event_cards, PARAM_TYPE_GROUP);
pduel->lua->add_param(e.event_player, PARAM_TYPE_INT); pduel->lua->add_param(e.event_player, PARAM_TYPE_INT);
pduel->lua->add_param(e.event_value, PARAM_TYPE_INT); pduel->lua->add_param(e.event_value, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_effect , PARAM_TYPE_EFFECT); pduel->lua->add_param(e.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(e.reason, PARAM_TYPE_INT); pduel->lua->add_param(e.reason, PARAM_TYPE_INT);
pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT); pduel->lua->add_param(e.reason_player, PARAM_TYPE_INT);
pduel->lua->add_param((ptr)0, PARAM_TYPE_INT); pduel->lua->add_param((ptr)0, PARAM_TYPE_INT);
if (!pduel->lua->check_condition(target, 9)) { if(!pduel->lua->check_condition(target, 9)) {
return FALSE; return FALSE;
} }
} }
return TRUE; return TRUE;
} }
int32 effect::is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond, int32 neglect_cost, int32 neglect_target) {
return is_activate_ready(this, playerid, e, neglect_cond, neglect_cost, neglect_target);
}
// check functions: condition // check functions: condition
int32 effect::is_condition_check(uint8 playerid, const tevent& e) { int32 effect::is_condition_check(uint8 playerid, const tevent& e) {
card* phandler = get_handler(); card* phandler = get_handler();
......
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
int32 check_count_limit(uint8 playerid); int32 check_count_limit(uint8 playerid);
int32 is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE, int32 neglect_loc = FALSE, int32 neglect_faceup = FALSE); int32 is_activateable(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE, int32 neglect_loc = FALSE, int32 neglect_faceup = FALSE);
int32 is_action_check(uint8 playerid); int32 is_action_check(uint8 playerid);
int32 is_activate_ready(effect* reason_effect, uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activate_ready(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
int32 is_condition_check(uint8 playerid, const tevent& e); int32 is_condition_check(uint8 playerid, const tevent& e);
int32 is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE); int32 is_activate_check(uint8 playerid, const tevent& e, int32 neglect_cond = FALSE, int32 neglect_cost = FALSE, int32 neglect_target = FALSE);
......
...@@ -1827,10 +1827,13 @@ int32 field::get_summon_count_limit(uint8 playerid) { ...@@ -1827,10 +1827,13 @@ int32 field::get_summon_count_limit(uint8 playerid) {
} }
int32 field::get_draw_count(uint8 playerid) { int32 field::get_draw_count(uint8 playerid) {
effect_set eset; effect_set eset;
filter_player_effect(infos.turn_player, EFFECT_DRAW_COUNT, &eset); filter_player_effect(playerid, EFFECT_DRAW_COUNT, &eset);
int32 count = player[playerid].draw_count; int32 count = player[playerid].draw_count;
if(eset.size()) for(int32 i = 0; i < eset.size(); ++i) {
count = eset.get_last()->get_value(); int32 c = eset[i]->get_value();
if(c > count)
count = c;
}
return count; return count;
} }
void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* material) { void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* material) {
......
...@@ -1888,7 +1888,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1888,7 +1888,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
if(is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT)) if(is_player_affected_by_effect(sumplayer, EFFECT_DEVINE_LIGHT))
positions = POS_FACEUP; positions = POS_FACEUP;
if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM)) { if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
positions = (uint8)proc->s_range; positions = (uint8)proc->s_range & POS_FACEUP;
if(proc->o_range) if(proc->o_range)
targetplayer = 1 - sumplayer; targetplayer = 1 - sumplayer;
} }
...@@ -2367,7 +2367,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint ...@@ -2367,7 +2367,7 @@ int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint
uint8 targetplayer = setplayer; uint8 targetplayer = setplayer;
uint8 positions = POS_FACEDOWN_DEFENSE; uint8 positions = POS_FACEDOWN_DEFENSE;
if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM)) { if(proc && proc->is_flag(EFFECT_FLAG_SPSUM_PARAM)) {
positions = (uint8)proc->s_range; positions = (uint8)proc->s_range & POS_FACEDOWN;
if(proc->o_range) if(proc->o_range)
targetplayer = 1 - setplayer; targetplayer = 1 - setplayer;
} }
......
...@@ -957,11 +957,11 @@ int32 field::check_event(uint32 code, tevent * pe) { ...@@ -957,11 +957,11 @@ int32 field::check_event(uint32 code, tevent * pe) {
} }
int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, int32 neglect_cost, int32 copy_info, tevent* pe) { int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, int32 neglect_cost, int32 copy_info, tevent* pe) {
if(peffect->code == EVENT_FREE_CHAIN) { if(peffect->code == EVENT_FREE_CHAIN) {
return peffect->is_activate_ready(playerid, nil_event, neglect_con, neglect_cost, FALSE); return peffect->is_activate_ready(core.reason_effect, playerid, nil_event, neglect_con, neglect_cost, FALSE);
} }
for(const auto& ev : core.point_event) { for(const auto& ev : core.point_event) {
if(ev.event_code == peffect->code && if(ev.event_code == peffect->code &&
peffect->is_activate_ready(playerid, ev, neglect_con, neglect_cost, FALSE)) { peffect->is_activate_ready(core.reason_effect, playerid, ev, neglect_con, neglect_cost, FALSE)) {
if(pe) if(pe)
*pe = ev; *pe = ev;
if(copy_info && !pduel->lua->no_action && core.current_chain.size()) { if(copy_info && !pduel->lua->no_action && core.current_chain.size()) {
...@@ -972,7 +972,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i ...@@ -972,7 +972,7 @@ int32 field::check_event_c(effect* peffect, uint8 playerid, int32 neglect_con, i
} }
for(const auto& ev : core.instant_event) { for(const auto& ev : core.instant_event) {
if(ev.event_code == peffect->code && if(ev.event_code == peffect->code &&
peffect->is_activate_ready(playerid, ev, neglect_con, neglect_cost, FALSE)) { peffect->is_activate_ready(core.reason_effect, playerid, ev, neglect_con, neglect_cost, FALSE)) {
if(pe) if(pe)
*pe = ev; *pe = ev;
if(copy_info && !pduel->lua->no_action && core.current_chain.size()) { if(copy_info && !pduel->lua->no_action && core.current_chain.size()) {
......
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