Commit 2f0094c1 authored by mercury233's avatar mercury233
parents 04405a0c 9906c04b
...@@ -389,6 +389,9 @@ public: ...@@ -389,6 +389,9 @@ public:
#define SUMMON_TYPE_PENDULUM 0x4a000000 #define SUMMON_TYPE_PENDULUM 0x4a000000
#define SUMMON_TYPE_LINK 0x4c000000 #define SUMMON_TYPE_LINK 0x4c000000
#define SUMMON_TYPE_MAIN 0xf0000000
#define SUMMON_TYPE_LOCATION 0x00ff0000
//Counter //Counter
#define COUNTER_WITHOUT_PERMIT 0x1000 #define COUNTER_WITHOUT_PERMIT 0x1000
//#define COUNTER_NEED_ENABLE 0x2000 //#define COUNTER_NEED_ENABLE 0x2000
...@@ -403,7 +406,7 @@ public: ...@@ -403,7 +406,7 @@ public:
#define ASSUME_ATTACK 7 #define ASSUME_ATTACK 7
#define ASSUME_DEFENSE 8 #define ASSUME_DEFENSE 8
//Summon info //Special Summon effect info
#define SUMMON_INFO_CODE 0x01 #define SUMMON_INFO_CODE 0x01
#define SUMMON_INFO_CODE2 0x02 #define SUMMON_INFO_CODE2 0x02
#define SUMMON_INFO_TYPE 0x04 #define SUMMON_INFO_TYPE 0x04
......
...@@ -24,6 +24,10 @@ typedef signed char int8; ...@@ -24,6 +24,10 @@ typedef signed char int8;
#define ADD_BIT(x,y) ((x)|=(y)) #define ADD_BIT(x,y) ((x)|=(y))
#define REMOVE_BIT(x,y) ((x)&=~(y)) #define REMOVE_BIT(x,y) ((x)&=~(y))
constexpr bool match_all(uint32 x, uint32 y) {
return (x & y) == y;
}
#define OPERATION_SUCCESS 1 #define OPERATION_SUCCESS 1
#define OPERATION_FAIL 0 #define OPERATION_FAIL 0
#define OPERATION_CANCELED -1 #define OPERATION_CANCELED -1
......
...@@ -43,8 +43,6 @@ int32 effect::is_self_destroy_related() { ...@@ -43,8 +43,6 @@ int32 effect::is_self_destroy_related() {
int32 effect::is_can_be_forbidden() { int32 effect::is_can_be_forbidden() {
if (is_flag(EFFECT_FLAG_CANNOT_DISABLE) && !is_flag(EFFECT_FLAG_CANNOT_NEGATE)) if (is_flag(EFFECT_FLAG_CANNOT_DISABLE) && !is_flag(EFFECT_FLAG_CANNOT_NEGATE))
return FALSE; return FALSE;
if (code == EFFECT_CHANGE_CODE)
return FALSE;
return TRUE; return TRUE;
} }
// check if a single/field/equip effect is available // check if a single/field/equip effect is available
......
...@@ -534,10 +534,10 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) { ...@@ -534,10 +534,10 @@ card* field::get_field_card(uint32 playerid, uint32 location, uint32 sequence) {
case LOCATION_PZONE: { case LOCATION_PZONE: {
if(sequence == 0) { if(sequence == 0) {
card* pcard = player[playerid].list_szone[core.duel_rule >= 4 ? 0 : 6]; card* pcard = player[playerid].list_szone[core.duel_rule >= 4 ? 0 : 6];
return pcard && pcard->current.pzone ? pcard : 0; return (pcard && pcard->current.pzone) ? pcard : 0;
} else if(sequence == 1) { } else if(sequence == 1) {
card* pcard = player[playerid].list_szone[core.duel_rule >= 4 ? 4 : 7]; card* pcard = player[playerid].list_szone[core.duel_rule >= 4 ? 4 : 7];
return pcard && pcard->current.pzone ? pcard : 0; return (pcard && pcard->current.pzone) ? pcard : 0;
} else } else
return nullptr; return nullptr;
break; break;
...@@ -1895,7 +1895,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater ...@@ -1895,7 +1895,7 @@ void field::get_ritual_material(uint8 playerid, effect* peffect, card_set* mater
void field::get_fusion_material(uint8 playerid, card_set* material_all, card_set* material_base, uint32 location) { void field::get_fusion_material(uint8 playerid, card_set* material_all, card_set* material_base, uint32 location) {
if(location & LOCATION_MZONE) { if(location & LOCATION_MZONE) {
for(auto& pcard : player[playerid].list_mzone) { for(auto& pcard : player[playerid].list_mzone) {
if(pcard) if(pcard && !pcard->is_status(STATUS_SUMMONING))
material_base->insert(pcard); material_base->insert(pcard);
} }
} }
......
...@@ -1824,14 +1824,14 @@ int32 scriptlib::duel_disable_summon(lua_State *L) { ...@@ -1824,14 +1824,14 @@ int32 scriptlib::duel_disable_summon(lua_State *L) {
sumplayer = pcard->summon_player; sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE); pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_SUMMON_DISABLED, TRUE); pcard->set_status(STATUS_SUMMON_DISABLED, TRUE);
if((pcard->summon_info & SUMMON_TYPE_PENDULUM) != SUMMON_TYPE_PENDULUM) if (!match_all(pcard->summon_info, SUMMON_TYPE_FLIP) && !match_all(pcard->summon_info, SUMMON_TYPE_DUAL))
pcard->set_status(STATUS_PROC_COMPLETE, FALSE); pcard->set_status(STATUS_PROC_COMPLETE, FALSE);
} else { } else {
for(auto& pcard : pgroup->container) { for(auto& pcard : pgroup->container) {
sumplayer = pcard->summon_player; sumplayer = pcard->summon_player;
pcard->set_status(STATUS_SUMMONING, FALSE); pcard->set_status(STATUS_SUMMONING, FALSE);
pcard->set_status(STATUS_SUMMON_DISABLED, TRUE); pcard->set_status(STATUS_SUMMON_DISABLED, TRUE);
if((pcard->summon_info & SUMMON_TYPE_PENDULUM) != SUMMON_TYPE_PENDULUM) if (!match_all(pcard->summon_info, SUMMON_TYPE_FLIP) && !match_all(pcard->summon_info, SUMMON_TYPE_DUAL))
pcard->set_status(STATUS_PROC_COMPLETE, FALSE); pcard->set_status(STATUS_PROC_COMPLETE, FALSE);
} }
} }
......
...@@ -1913,7 +1913,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui ...@@ -1913,7 +1913,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card* target, effect* proc, ui
core.units.begin()->ptr2 = 0; core.units.begin()->ptr2 = 0;
} }
if(target->current.location == LOCATION_MZONE) if(target->current.location == LOCATION_MZONE)
send_to(target, 0, REASON_RULE, sumplayer, sumplayer, LOCATION_GRAVE, 0, 0); send_to(target, 0, REASON_RULE, PLAYER_NONE, sumplayer, LOCATION_GRAVE, 0, 0);
adjust_instant(); adjust_instant();
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0);
return TRUE; return TRUE;
...@@ -2020,7 +2020,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) { ...@@ -2020,7 +2020,7 @@ int32 field::flip_summon(uint16 step, uint8 sumplayer, card * target) {
core.units.begin()->ptr1 = 0; core.units.begin()->ptr1 = 0;
} }
if(target->current.location == LOCATION_MZONE) if(target->current.location == LOCATION_MZONE)
send_to(target, 0, REASON_RULE, sumplayer, sumplayer, LOCATION_GRAVE, 0, 0); send_to(target, 0, REASON_RULE, PLAYER_NONE, sumplayer, LOCATION_GRAVE, 0, 0);
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0);
return TRUE; return TRUE;
} }
...@@ -2902,7 +2902,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -2902,7 +2902,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
core.units.begin()->ptr1 = 0; core.units.begin()->ptr1 = 0;
} }
if(target->current.location == LOCATION_MZONE) if(target->current.location == LOCATION_MZONE)
send_to(target, 0, REASON_RULE, sumplayer, sumplayer, LOCATION_GRAVE, 0, 0); send_to(target, 0, REASON_RULE, PLAYER_NONE, sumplayer, LOCATION_GRAVE, 0, 0);
adjust_instant(); adjust_instant();
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, 0);
return TRUE; return TRUE;
...@@ -3091,7 +3091,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin ...@@ -3091,7 +3091,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card* target, uin
++cit; ++cit;
} }
if(cset.size()) { if(cset.size()) {
send_to(&cset, 0, REASON_RULE, sumplayer, sumplayer, LOCATION_GRAVE, 0, 0); send_to(&cset, 0, REASON_RULE, PLAYER_NONE, sumplayer, LOCATION_GRAVE, 0, 0);
adjust_instant(); adjust_instant();
} }
if(pgroup->container.size() == 0) { if(pgroup->container.size() == 0) {
...@@ -3726,6 +3726,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3 ...@@ -3726,6 +3726,7 @@ int32 field::destroy(uint16 step, group * targets, effect * reason_effect, uint3
pcard->current.reason_player = pcard->temp.reason_player; pcard->current.reason_player = pcard->temp.reason_player;
core.destroy_canceled.insert(pcard); core.destroy_canceled.insert(pcard);
cit = targets->container.erase(cit); cit = targets->container.erase(cit);
continue;
} }
} }
++cit; ++cit;
......
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