Commit 0d77c959 authored by mercury233's avatar mercury233
parents 8a0195b2 6410407c
...@@ -2225,12 +2225,14 @@ int32 card::remove_counter(uint16 countertype, uint16 count) { ...@@ -2225,12 +2225,14 @@ int32 card::remove_counter(uint16 countertype, uint16 count) {
} }
int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 loc) { int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, uint8 singly, uint32 loc) {
effect_set eset; effect_set eset;
if(!pduel->game_field->is_player_can_place_counter(playerid, this, countertype, count)) if(count > 0) {
return FALSE; if(!pduel->game_field->is_player_can_place_counter(playerid, this, countertype, count))
if(!loc && (!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP))) return FALSE;
return FALSE; if(!loc && (!(current.location & LOCATION_ONFIELD) || !is_position(POS_FACEUP)))
if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED)) return FALSE;
return FALSE; if((countertype & COUNTER_NEED_ENABLE) && is_status(STATUS_DISABLED))
return FALSE;
}
uint32 check = countertype & COUNTER_WITHOUT_PERMIT; uint32 check = countertype & COUNTER_WITHOUT_PERMIT;
if(!check) { if(!check) {
filter_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff), &eset); filter_effect(EFFECT_COUNTER_PERMIT + (countertype & 0xffff), &eset);
...@@ -2238,8 +2240,16 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count, ...@@ -2238,8 +2240,16 @@ int32 card::is_can_add_counter(uint8 playerid, uint16 countertype, uint16 count,
uint32 prange = eset[i]->get_value(); uint32 prange = eset[i]->get_value();
if(loc) if(loc)
check = loc & prange; check = loc & prange;
else else if(current.location & LOCATION_ONFIELD) {
check = current.is_location(prange) && is_position(POS_FACEUP); uint32 filter = TRUE;
if(eset[i]->target) {
pduel->lua->add_param(eset[i], PARAM_TYPE_EFFECT);
pduel->lua->add_param(this, PARAM_TYPE_CARD);
filter = pduel->lua->check_condition(eset[i]->target, 2);
}
check = current.is_location(prange) && is_position(POS_FACEUP) && filter;
} else
check = TRUE;
if(check) if(check)
break; break;
} }
...@@ -3596,14 +3606,16 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) { ...@@ -3596,14 +3606,16 @@ int32 card::is_capable_be_effect_target(effect* peffect, uint8 playerid) {
} }
return TRUE; return TRUE;
} }
int32 card::is_can_be_fusion_material(card* fcard) { int32 card::is_can_be_fusion_material(card* fcard, uint32 summon_type) {
if(is_status(STATUS_FORBIDDEN)) if(is_status(STATUS_FORBIDDEN))
return FALSE; return FALSE;
effect_set eset; effect_set eset;
filter_effect(EFFECT_CANNOT_BE_FUSION_MATERIAL, &eset); filter_effect(EFFECT_CANNOT_BE_FUSION_MATERIAL, &eset);
for(int32 i = 0; i < eset.size(); ++i) for(int32 i = 0; i < eset.size(); ++i) {
if(eset[i]->get_value(fcard)) pduel->lua->add_param(summon_type, PARAM_TYPE_INT);
if(eset[i]->get_value(fcard, 1))
return FALSE; return FALSE;
}
eset.clear(); eset.clear();
filter_effect(EFFECT_EXTRA_FUSION_MATERIAL, &eset); filter_effect(EFFECT_EXTRA_FUSION_MATERIAL, &eset);
if(eset.size()) { if(eset.size()) {
......
...@@ -342,7 +342,7 @@ public: ...@@ -342,7 +342,7 @@ public:
int32 is_control_can_be_changed(int32 ignore_mzone, uint32 zone); int32 is_control_can_be_changed(int32 ignore_mzone, uint32 zone);
int32 is_capable_be_battle_target(card* pcard); int32 is_capable_be_battle_target(card* pcard);
int32 is_capable_be_effect_target(effect* peffect, uint8 playerid); int32 is_capable_be_effect_target(effect* peffect, uint8 playerid);
int32 is_can_be_fusion_material(card* fcard); int32 is_can_be_fusion_material(card* fcard, uint32 summon_type);
int32 is_can_be_synchro_material(card* scard, card* tuner = 0); int32 is_can_be_synchro_material(card* scard, card* tuner = 0);
int32 is_can_be_ritual_material(card* scard); int32 is_can_be_ritual_material(card* scard);
int32 is_can_be_xyz_material(card* scard); int32 is_can_be_xyz_material(card* scard);
......
...@@ -2556,6 +2556,8 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) { ...@@ -2556,6 +2556,8 @@ int32 scriptlib::card_enable_counter_permit(lua_State *L) {
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_COUNTER_PERMIT | countertype; peffect->code = EFFECT_COUNTER_PERMIT | countertype;
peffect->value = prange; peffect->value = prange;
if(lua_gettop(L) > 3 && lua_isfunction(L, 4))
peffect->target = interpreter::get_function_handle(L, 4);
pcard->add_effect(peffect); pcard->add_effect(peffect);
return 0; return 0;
} }
...@@ -2587,11 +2589,13 @@ int32 scriptlib::card_is_can_turn_set(lua_State *L) { ...@@ -2587,11 +2589,13 @@ int32 scriptlib::card_is_can_turn_set(lua_State *L) {
return 1; return 1;
} }
int32 scriptlib::card_is_can_add_counter(lua_State *L) { int32 scriptlib::card_is_can_add_counter(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
uint32 countertype = lua_tointeger(L, 2); uint32 countertype = lua_tointeger(L, 2);
uint32 count = lua_tointeger(L, 3); uint32 count = 0;
if(lua_gettop(L) > 2)
count = lua_tointeger(L, 3);
uint8 singly = FALSE; uint8 singly = FALSE;
if(lua_gettop(L) > 3) if(lua_gettop(L) > 3)
singly = lua_toboolean(L, 4); singly = lua_toboolean(L, 4);
...@@ -2623,7 +2627,10 @@ int32 scriptlib::card_is_can_be_fusion_material(lua_State *L) { ...@@ -2623,7 +2627,10 @@ int32 scriptlib::card_is_can_be_fusion_material(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 2); check_param(L, PARAM_TYPE_CARD, 2);
fcard = *(card**)lua_touserdata(L, 2); fcard = *(card**)lua_touserdata(L, 2);
} }
lua_pushboolean(L, pcard->is_can_be_fusion_material(fcard)); uint32 summon_type = SUMMON_TYPE_FUSION;
if(lua_gettop(L) >= 3)
summon_type = lua_tointeger(L, 3);
lua_pushboolean(L, pcard->is_can_be_fusion_material(fcard, summon_type));
return 1; return 1;
} }
int32 scriptlib::card_is_can_be_synchro_material(lua_State *L) { int32 scriptlib::card_is_can_be_synchro_material(lua_State *L) {
......
...@@ -1351,6 +1351,7 @@ int32 field::check_hint_timing(effect* peffect) { ...@@ -1351,6 +1351,7 @@ int32 field::check_hint_timing(effect* peffect) {
else else
return (peffect->hint_timing[0] & core.hint_timing[1]) || (peffect->hint_timing[1] & core.hint_timing[0]); return (peffect->hint_timing[0] & core.hint_timing[1]) || (peffect->hint_timing[1] & core.hint_timing[0]);
} }
// core.spe_effect[p]: # of optional trigger effects, activate/quick effect with hints
int32 field::process_phase_event(int16 step, int32 phase) { int32 field::process_phase_event(int16 step, int32 phase) {
switch(step) { switch(step) {
case 0: { case 0: {
...@@ -1645,6 +1646,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1645,6 +1646,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
} }
return TRUE; return TRUE;
} }
// core.tmp_chains: used in step 8 (obsolete ignition effect ruling)
int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_freechain, int32 skip_new) { int32 field::process_point_event(int16 step, int32 skip_trigger, int32 skip_freechain, int32 skip_new) {
switch(step) { switch(step) {
case 0: { case 0: {
......
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