Commit 2e2f392d authored by DailyShana's avatar DailyShana

update

parent 779170a6
......@@ -3406,11 +3406,11 @@ int32 card::is_capable_send_to_grave(uint8 playerid) {
int32 card::is_capable_send_to_hand(uint8 playerid) {
if(is_status(STATUS_LEAVE_CONFIRMED))
return FALSE;
if((current.location == LOCATION_EXTRA) && (data.type & (TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK)))
if((current.location == LOCATION_EXTRA) && is_extra_deck_monster())
return FALSE;
if(is_affected_by_effect(EFFECT_CANNOT_TO_HAND))
return FALSE;
if(data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK) && !is_capable_send_to_deck(playerid))
if(is_extra_deck_monster() && !is_capable_send_to_deck(playerid))
return FALSE;
if(!pduel->game_field->is_player_can_send_to_hand(playerid, this))
return FALSE;
......@@ -3419,7 +3419,7 @@ int32 card::is_capable_send_to_hand(uint8 playerid) {
int32 card::is_capable_send_to_deck(uint8 playerid) {
if(is_status(STATUS_LEAVE_CONFIRMED))
return FALSE;
if((current.location == LOCATION_EXTRA) && (data.type & (TYPE_FUSION + TYPE_SYNCHRO + TYPE_XYZ + TYPE_LINK)))
if((current.location == LOCATION_EXTRA) && is_extra_deck_monster())
return FALSE;
if(is_affected_by_effect(EFFECT_CANNOT_TO_DECK))
return FALSE;
......@@ -3428,7 +3428,7 @@ int32 card::is_capable_send_to_deck(uint8 playerid) {
return TRUE;
}
int32 card::is_capable_send_to_extra(uint8 playerid) {
if(!(data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_PENDULUM | TYPE_LINK)))
if(!is_extra_deck_monster() && !(data.type & TYPE_PENDULUM))
return FALSE;
if(is_affected_by_effect(EFFECT_CANNOT_TO_DECK))
return FALSE;
......@@ -3466,7 +3466,7 @@ int32 card::is_capable_cost_to_grave(uint8 playerid) {
int32 card::is_capable_cost_to_hand(uint8 playerid) {
uint32 redirect = 0;
uint32 dest = LOCATION_HAND;
if(data.type & (TYPE_TOKEN | TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK))
if(data.type & (TYPE_TOKEN) || is_extra_deck_monster())
return FALSE;
if(current.location == LOCATION_HAND)
return FALSE;
......@@ -3489,7 +3489,7 @@ int32 card::is_capable_cost_to_hand(uint8 playerid) {
int32 card::is_capable_cost_to_deck(uint8 playerid) {
uint32 redirect = 0;
uint32 dest = LOCATION_DECK;
if(data.type & (TYPE_TOKEN | TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK))
if(data.type & (TYPE_TOKEN) || is_extra_deck_monster())
return FALSE;
if(current.location == LOCATION_DECK)
return FALSE;
......@@ -3512,7 +3512,7 @@ int32 card::is_capable_cost_to_deck(uint8 playerid) {
int32 card::is_capable_cost_to_extra(uint8 playerid) {
uint32 redirect = 0;
uint32 dest = LOCATION_DECK;
if(!(data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)))
if(!is_extra_deck_monster())
return FALSE;
if(current.location == LOCATION_EXTRA)
return FALSE;
......
......@@ -188,6 +188,7 @@ public:
explicit card(duel* pd);
~card();
static bool card_operation_sort(card* c1, card* c2);
const bool is_extra_deck_monster() { return !!(data.type & 0x4802040); }
uint32 get_infos(byte* buf, int32 query_flag, int32 use_cache = TRUE);
uint32 get_info_location();
......
......@@ -162,7 +162,7 @@ void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence
return;
if (!is_location_useable(playerid, location, sequence))
return;
if((pcard->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)) && (location & (LOCATION_HAND | LOCATION_DECK))) {
if(pcard->is_extra_deck_monster() && (location & (LOCATION_HAND | LOCATION_DECK))) {
location = LOCATION_EXTRA;
pcard->sendto_param.position = POS_FACEDOWN_DEFENSE;
}
......@@ -300,7 +300,7 @@ void field::move_card(uint8 playerid, card* pcard, uint8 location, uint8 sequenc
return;
uint8 preplayer = pcard->current.controler;
uint8 presequence = pcard->current.sequence;
if((pcard->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)) && (location & (LOCATION_HAND | LOCATION_DECK))) {
if(pcard->is_extra_deck_monster() && (location & (LOCATION_HAND | LOCATION_DECK))) {
location = LOCATION_EXTRA;
pcard->sendto_param.position = POS_FACEDOWN_DEFENSE;
}
......@@ -991,7 +991,7 @@ void field::swap_deck_and_grave(uint8 playerid) {
player[playerid].list_grave.swap(player[playerid].list_main);
card_vector ex;
for(auto clit = player[playerid].list_main.begin(); clit != player[playerid].list_main.end(); ) {
if((*clit)->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)) {
if((*clit)->is_extra_deck_monster()) {
ex.push_back(*clit);
clit = player[playerid].list_main.erase(clit);
} else
......@@ -3272,7 +3272,7 @@ int32 field::is_player_can_send_to_hand(uint8 playerid, card * pcard) {
if (pduel->lua->check_condition(eset[i]->target, 3))
return FALSE;
}
if((pcard->data.type & (TYPE_FUSION | TYPE_SYNCHRO | TYPE_XYZ | TYPE_LINK)) && !is_player_can_send_to_deck(playerid, pcard))
if(pcard->is_extra_deck_monster() && !is_player_can_send_to_deck(playerid, pcard))
return FALSE;
return TRUE;
}
......
......@@ -2112,7 +2112,7 @@ int32 scriptlib::card_is_able_to_deck_or_extra_as_cost(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 p = pcard->pduel->game_field->core.reason_player;
int32 val = (pcard->data.type & 0x4802040) ? pcard->is_capable_cost_to_extra(p) : pcard->is_capable_cost_to_deck(p);
int32 val = pcard->is_extra_deck_monster() ? pcard->is_capable_cost_to_extra(p) : pcard->is_capable_cost_to_deck(p);
if(val)
lua_pushboolean(L, 1);
else
......
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