Commit 9c5c4a53 authored by DailyShana's avatar DailyShana Committed by GitHub

use TYPE_SPSUMMON to indicate unsummonable cards (#217)

parent a6867db7
...@@ -2888,9 +2888,11 @@ int32 card::check_cost_condition(int32 ecode, int32 playerid, int32 sumtype) { ...@@ -2888,9 +2888,11 @@ int32 card::check_cost_condition(int32 ecode, int32 playerid, int32 sumtype) {
return TRUE; return TRUE;
} }
int32 card::is_summonable_card() { int32 card::is_summonable_card() {
if(!(data.type & TYPE_MONSTER) || (data.type & TYPE_TOKEN)) if(!(data.type & TYPE_MONSTER))
return FALSE; return FALSE;
return !is_affected_by_effect(EFFECT_UNSUMMONABLE_CARD); return !(data.type & (TYPE_RITUAL | TYPE_SPSUMMON
| TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK
| TYPE_TOKEN));
} }
int32 card::is_fusion_summonable_card(uint32 summon_type) { int32 card::is_fusion_summonable_card(uint32 summon_type) {
if(!(data.type & TYPE_FUSION)) if(!(data.type & TYPE_FUSION))
......
...@@ -419,7 +419,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2) ...@@ -419,7 +419,7 @@ inline effect_flag operator|(effect_flag flag1, effect_flag flag2)
#define EFFECT_CANNOT_SELECT_EFFECT_TARGET 333 #define EFFECT_CANNOT_SELECT_EFFECT_TARGET 333
#define EFFECT_ADD_SETCODE 334 #define EFFECT_ADD_SETCODE 334
#define EFFECT_NO_EFFECT_DAMAGE 335 #define EFFECT_NO_EFFECT_DAMAGE 335
#define EFFECT_UNSUMMONABLE_CARD 336 //#define EFFECT_UNSUMMONABLE_CARD 336
#define EFFECT_DISCARD_COST_CHANGE 338 #define EFFECT_DISCARD_COST_CHANGE 338
#define EFFECT_HAND_SYNCHRO 339 #define EFFECT_HAND_SYNCHRO 339
#define EFFECT_ADD_FUSION_CODE 340 #define EFFECT_ADD_FUSION_CODE 340
......
...@@ -179,7 +179,6 @@ static const struct luaL_Reg cardlib[] = { ...@@ -179,7 +179,6 @@ static const struct luaL_Reg cardlib[] = {
{ "IsRelateToBattle", scriptlib::card_is_relate_to_battle }, { "IsRelateToBattle", scriptlib::card_is_relate_to_battle },
{ "CopyEffect", scriptlib::card_copy_effect }, { "CopyEffect", scriptlib::card_copy_effect },
{ "ReplaceEffect", scriptlib::card_replace_effect }, { "ReplaceEffect", scriptlib::card_replace_effect },
{ "EnableUnsummonable", scriptlib::card_enable_unsummonable },
{ "EnableReviveLimit", scriptlib::card_enable_revive_limit }, { "EnableReviveLimit", scriptlib::card_enable_revive_limit },
{ "CompleteProcedure", scriptlib::card_complete_procedure }, { "CompleteProcedure", scriptlib::card_complete_procedure },
{ "IsDisabled", scriptlib::card_is_disabled }, { "IsDisabled", scriptlib::card_is_disabled },
......
...@@ -1862,7 +1862,7 @@ int32 scriptlib::card_replace_effect(lua_State * L) { ...@@ -1862,7 +1862,7 @@ int32 scriptlib::card_replace_effect(lua_State * L) {
lua_pushinteger(L, pcard->replace_effect(code, reset, count)); lua_pushinteger(L, pcard->replace_effect(code, reset, count));
return 1; return 1;
} }
int32 scriptlib::card_enable_unsummonable(lua_State *L) { int32 scriptlib::card_enable_revive_limit(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
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);
...@@ -1870,34 +1870,13 @@ int32 scriptlib::card_enable_unsummonable(lua_State *L) { ...@@ -1870,34 +1870,13 @@ int32 scriptlib::card_enable_unsummonable(lua_State *L) {
if(!pcard->is_status(STATUS_COPYING_EFFECT)) { if(!pcard->is_status(STATUS_COPYING_EFFECT)) {
effect* peffect = pduel->new_effect(); effect* peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
peffect->code = EFFECT_UNSUMMONABLE_CARD; peffect->code = EFFECT_REVIVE_LIMIT;
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->flag[0] = EFFECT_FLAG_CANNOT_DISABLE | EFFECT_FLAG_UNCOPYABLE; peffect->flag[0] = EFFECT_FLAG_CANNOT_DISABLE | EFFECT_FLAG_UNCOPYABLE;
pcard->add_effect(peffect); pcard->add_effect(peffect);
} }
return 0; return 0;
} }
int32 scriptlib::card_enable_revive_limit(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
duel* pduel = pcard->pduel;
if(!pcard->is_status(STATUS_COPYING_EFFECT)) {
effect* peffect1 = pduel->new_effect();
peffect1->owner = pcard;
peffect1->code = EFFECT_UNSUMMONABLE_CARD;
peffect1->type = EFFECT_TYPE_SINGLE;
peffect1->flag[0] = EFFECT_FLAG_CANNOT_DISABLE | EFFECT_FLAG_UNCOPYABLE;
pcard->add_effect(peffect1);
effect* peffect2 = pduel->new_effect();
peffect2->owner = pcard;
peffect2->code = EFFECT_REVIVE_LIMIT;
peffect2->type = EFFECT_TYPE_SINGLE;
peffect2->flag[0] = EFFECT_FLAG_CANNOT_DISABLE | EFFECT_FLAG_UNCOPYABLE;
pcard->add_effect(peffect2);
}
return 0;
}
int32 scriptlib::card_complete_procedure(lua_State *L) { int32 scriptlib::card_complete_procedure(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
......
...@@ -1446,7 +1446,7 @@ int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * ta ...@@ -1446,7 +1446,7 @@ int32 field::equip(uint16 step, uint8 equip_player, card * equip_card, card * ta
int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone) { int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone) {
switch(step) { switch(step) {
case 0: { case 0: {
if(!(target->data.type & TYPE_MONSTER)) if(!target->is_summonable_card())
return TRUE; return TRUE;
if(check_unique_onfield(target, sumplayer, LOCATION_MZONE)) if(check_unique_onfield(target, sumplayer, LOCATION_MZONE))
return TRUE; return TRUE;
...@@ -2013,7 +2013,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) { ...@@ -2013,7 +2013,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone) { int32 field::mset(uint16 step, uint8 setplayer, card* target, effect* proc, uint8 ignore_count, uint8 min_tribute, uint32 zone) {
switch(step) { switch(step) {
case 0: { case 0: {
if(target->is_affected_by_effect(EFFECT_UNSUMMONABLE_CARD)) if(!target->is_summonable_card())
return TRUE; return TRUE;
if(target->current.location != LOCATION_HAND) if(target->current.location != LOCATION_HAND)
return TRUE; return TRUE;
......
...@@ -183,7 +183,6 @@ public: ...@@ -183,7 +183,6 @@ public:
static int32 card_is_relate_to_battle(lua_State *L); static int32 card_is_relate_to_battle(lua_State *L);
static int32 card_copy_effect(lua_State *L); static int32 card_copy_effect(lua_State *L);
static int32 card_replace_effect(lua_State *L); static int32 card_replace_effect(lua_State *L);
static int32 card_enable_unsummonable(lua_State *L);
static int32 card_enable_revive_limit(lua_State *L); static int32 card_enable_revive_limit(lua_State *L);
static int32 card_complete_procedure(lua_State *L); static int32 card_complete_procedure(lua_State *L);
static int32 card_is_disabled(lua_State *L); static int32 card_is_disabled(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