Commit da2d7dc2 authored by DailyShana's avatar DailyShana

make some numbers intuitive

card types, location, reset
parent 9a1c407d
......@@ -47,7 +47,7 @@ bool card::card_operation_sort(card* c1, card* c2) {
return c1->overlay_target->current.sequence < c2->overlay_target->current.sequence;
else return c1->current.sequence < c2->current.sequence;
} else {
if(c1->current.location & 0x71)
if(c1->current.location & (LOCATION_DECK | LOCATION_EXTRA | LOCATION_GRAVE | LOCATION_REMOVED))
return c1->current.sequence > c2->current.sequence;
else
return c1->current.sequence < c2->current.sequence;
......@@ -1841,9 +1841,11 @@ void card::reset(uint32 id, uint32 reset_type) {
if (rrm->second & 0xffff0000 & id)
relations.erase(rrm);
}
if(id & 0xc7c0000)
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_OVERLAY | RESET_MSCHANGE))
clear_relate_effect();
if(id & 0xdfc0000) {
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_OVERLAY | RESET_MSCHANGE | RESET_LEAVE | RESET_TOFIELD)) {
indestructable_effects.clear();
announced_cards.clear();
attacked_cards.clear();
......@@ -1852,17 +1854,20 @@ void card::reset(uint32 id, uint32 reset_type) {
attacked_count = 0;
attack_all_target = TRUE;
}
if(id & 0xdfe0000) {
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_OVERLAY | RESET_MSCHANGE | RESET_LEAVE | RESET_TOFIELD | RESET_TURN_SET)) {
battled_cards.clear();
reset_effect_count();
auto pr = field_effect.equal_range(EFFECT_DISABLE_FIELD);
for(; pr.first != pr.second; ++pr.first)
pr.first->second->value = 0;
}
if(id & 0xd7e0000) {
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_OVERLAY | RESET_MSCHANGE | RESET_TOFIELD | RESET_TURN_SET)) {
counters.clear();
}
if(id & 0x3fe0000) {
if(id & (RESET_TODECK | RESET_TOHAND | RESET_TOGRAVE | RESET_REMOVE | RESET_TEMP_REMOVE
| RESET_LEAVE | RESET_TOFIELD | RESET_TURN_SET | RESET_CONTROL)) {
auto pr = field_effect.equal_range(EFFECT_USE_EXTRA_MZONE);
for(; pr.first != pr.second; ++pr.first)
pr.first->second->value = pr.first->second->value & 0xffff;
......@@ -3094,7 +3099,8 @@ int32 card::is_can_be_special_summoned(effect* reason_effect, uint32 sumtype, ui
if(current.location == LOCATION_REMOVED && (current.position & POS_FACEDOWN))
return FALSE;
if(is_affected_by_effect(EFFECT_REVIVE_LIMIT) && !is_status(STATUS_PROC_COMPLETE)) {
if((!nolimit && (current.location & 0x38)) || (!nocheck && !nolimit && (current.location & 0x3)))
if((!nolimit && (current.location & (LOCATION_GRAVE | LOCATION_REMOVED | LOCATION_SZONE)))
|| (!nocheck && !nolimit && (current.location & (LOCATION_DECK | LOCATION_HAND))))
return FALSE;
if(!nolimit && (data.type & TYPE_PENDULUM) && current.location == LOCATION_EXTRA && (current.position & POS_FACEUP))
return FALSE;
......
......@@ -2080,9 +2080,9 @@ int32 scriptlib::duel_get_chain_info(lua_State *L) {
lua_pushinteger(L, ch->chain_id);
break;
case CHAININFO_TYPE:
if((ch->triggering_effect->card_type & 0x7) == (TYPE_TRAP | TYPE_MONSTER))
if((ch->triggering_effect->card_type & (TYPE_MONSTER | TYPE_SPELL | TYPE_TRAP)) == (TYPE_TRAP | TYPE_MONSTER))
lua_pushinteger(L, TYPE_MONSTER);
else lua_pushinteger(L, (ch->triggering_effect->card_type & 0x7));
else lua_pushinteger(L, (ch->triggering_effect->card_type & (TYPE_MONSTER | TYPE_SPELL | TYPE_TRAP)));
break;
case CHAININFO_EXTTYPE:
lua_pushinteger(L, ch->triggering_effect->card_type);
......
......@@ -153,7 +153,7 @@ extern "C" DECL_DLLEXPORT void new_card(ptr pduel, uint32 code, uint8 owner, uin
}
extern "C" DECL_DLLEXPORT void new_tag_card(ptr pduel, uint32 code, uint8 owner, uint8 location) {
duel* ptduel = (duel*)pduel;
if(owner > 1 || !(location & 0x41))
if(owner > 1 || !(location & (LOCATION_DECK | LOCATION_EXTRA)))
return;
card* pcard = ptduel->new_card(code);
switch(location) {
......
......@@ -3910,7 +3910,7 @@ int32 field::add_chain(uint16 step) {
luaL_unref(pduel->lua->lua_state, LUA_REGISTRYINDEX, ch_lim.function);
core.chain_limit.clear();
peffect->card_type = phandler->get_type();
if((peffect->card_type & 0x5) == 0x5)
if((peffect->card_type & (TYPE_TRAP | TYPE_MONSTER)) == (TYPE_TRAP | TYPE_MONSTER))
peffect->card_type -= TYPE_TRAP;
peffect->set_active_type();
peffect->active_handler = peffect->handler->overlay_target;
......
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