Commit a026c151 authored by DailyShana's avatar DailyShana

add Card.CheckFusionSubstitute

parent c07c2961
......@@ -1982,6 +1982,16 @@ void card::fusion_select(uint8 playerid, group* fusion_m, card* cg, int32 chkf)
peffect = ecit->second;
pduel->game_field->add_process(PROCESSOR_SELECT_FUSION, 0, peffect, fusion_m, playerid + (chkf << 16), (ptr)cg);
}
int32 card::check_fusion_substitute(card* fcard) {
effect_set eset;
filter_effect(EFFECT_FUSION_SUBSTITUTE, &eset);
if(eset.size() == 0)
return FALSE;
for(int32 i = 0; i < eset.size(); ++i)
if(!eset[i]->value || eset[i]->get_value(fcard))
return TRUE;
return FALSE;
}
int32 card::is_equipable(card* pcard) {
effect_set eset;
if(this == pcard || pcard->current.location != LOCATION_MZONE)
......
......@@ -235,6 +235,7 @@ public:
effect* check_control_effect();
int32 fusion_check(group* fusion_m, card* cg, int32 chkf);
void fusion_select(uint8 playerid, group* fusion_m, card* cg, int32 chkf);
int32 check_fusion_substitute(card* fcard);
int32 is_equipable(card* pcard);
int32 is_summonable();
......
......@@ -204,6 +204,7 @@ static const struct luaL_Reg cardlib[] = {
{ "IsCanBeRitualMaterial", scriptlib::card_is_can_be_ritual_material },
{ "IsCanBeXyzMaterial", scriptlib::card_is_can_be_xyz_material },
{ "CheckFusionMaterial", scriptlib::card_check_fusion_material },
{ "CheckFusionSubstitute", scriptlib::card_check_fusion_substitute },
{ "IsImmuneToEffect", scriptlib::card_is_immune_to_effect },
{ "IsCanBeEffectTarget", scriptlib::card_is_can_be_effect_target },
{ "IsCanBeBattleTarget", scriptlib::card_is_can_be_battle_target },
......
......@@ -2028,6 +2028,13 @@ int32 scriptlib::card_check_fusion_material(lua_State *L) {
lua_pushboolean(L, pcard->fusion_check(pgroup, cg, chkf));
return 1;
}
int32 scriptlib::card_check_fusion_substitute(lua_State *L) {
check_param_count(L, 2);
card* pcard = *(card**) lua_touserdata(L, 1);
card* fcard = *(card**) lua_touserdata(L, 2);
lua_pushboolean(L, pcard->check_fusion_substitute(fcard));
return 1;
}
int32 scriptlib::card_is_immune_to_effect(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
......
......@@ -206,6 +206,7 @@ public:
static int32 card_is_can_be_ritual_material(lua_State *L);
static int32 card_is_can_be_xyz_material(lua_State *L);
static int32 card_check_fusion_material(lua_State *L);
static int32 card_check_fusion_substitute(lua_State *L);
static int32 card_is_immune_to_effect(lua_State *L);
static int32 card_is_can_be_effect_target(lua_State *L);
static int32 card_is_can_be_battle_target(lua_State *L);
......
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