Commit 0b543c29 authored by Fluorohydride's avatar Fluorohydride

new effect support

parent c3c55bea
......@@ -353,6 +353,7 @@ public:
#define EFFECT_MATCH_KILL 300
#define EFFECT_SYNCHRO_CHECK 310
#define EFFECT_QP_ACT_IN_NTPHAND 311
#define EFFECT_MUST_BE_SMATERIAL 312
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -1502,6 +1502,12 @@ void field::attack_all_target_check() {
}
int32 field::check_synchro_material(card* pcard, int32 findex1, int32 findex2, int32 min, int32 max) {
card* tuner;
if(core.global_flag & GLOBALFLAG_MUST_BE_SMATERIAL) {
effect_set eset;
filter_player_effect(pcard->current.controler, EFFECT_MUST_BE_SMATERIAL, &eset);
if(eset.count)
return check_tuner_material(pcard, eset[0]->handler, findex1, findex2, min, max);
}
for(uint8 p = 0; p < 2; ++p) {
for(int32 i = 0; i < 5; ++i) {
tuner = player[p].list_mzone[i];
......
......@@ -547,6 +547,7 @@ public:
#define GLOBALFLAG_SCRAP_CHIMERA 0x4
#define GLOBALFLAG_DELAYED_QUICKEFFECT 0x8
#define GLOBALFLAG_DETACH_EVENT 0x10
#define GLOBALFLAG_MUST_BE_SMATERIAL 0x20
//
#define PROCESSOR_NONE 0
#define PROCESSOR_WAITING 0x10000
......
......@@ -2051,6 +2051,14 @@ int32 scriptlib::duel_check_tuner_material(lua_State *L) {
card* pcard = *(card**) lua_touserdata(L, 1);
card* tuner = *(card**) lua_touserdata(L, 2);
duel* pduel = pcard->pduel;
if(pduel->game_field->core.global_flag & GLOBALFLAG_MUST_BE_SMATERIAL) {
effect_set eset;
pduel->game_field->filter_player_effect(pcard->current.controler, EFFECT_MUST_BE_SMATERIAL, &eset);
if(eset.count && eset[0]->handler != tuner) {
lua_pushboolean(L, false);
return 1;
}
}
if(!lua_isnil(L, 3))
check_param(L, PARAM_TYPE_FUNCTION, 3);
if(!lua_isnil(L, 4))
......
......@@ -3573,6 +3573,20 @@ int32 field::select_synchro_material(int16 step, uint8 playerid, card * pcard, i
switch(step) {
case 0: {
core.select_cards.clear();
if(core.global_flag & GLOBALFLAG_MUST_BE_SMATERIAL) {
effect_set eset;
filter_player_effect(pcard->current.controler, EFFECT_MUST_BE_SMATERIAL, &eset);
if(eset.count) {
core.select_cards.push_back(eset[0]->handler);
pduel->restore_assumes();
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(playerid);
pduel->write_buffer32(512);
add_process(PROCESSOR_SELECT_CARD, 0, 0, 0, playerid, 0x10001);
return FALSE;
}
}
card* tuner;
effect* peffect;
for(uint8 p = 0; p < 2; ++p) {
......
......@@ -443,6 +443,8 @@ EFFECT_BP_TWICE =296
EFFECT_UNIQUE_CHECK =297
EFFECT_MATCH_KILL =300
EFFECT_SYNCHRO_CHECK =310
EFFECT_QP_ACT_IN_NTPHAND =311
EFFECT_MUST_BE_SMATERIAL =312
EVENT_STARTUP =1000
EVENT_FLIP =1001
......@@ -629,6 +631,7 @@ GLOBALFLAG_BRAINWASHING_CHECK =0x2
GLOBALFLAG_SCRAP_CHIMERA =0x4
GLOBALFLAG_DELAYED_QUICKEFFECT =0x8
GLOBALFLAG_DETACH_EVENT =0x10
GLOBALFLAG_MUST_BE_SMATERIAL =0x20
--
DUEL_TEST_MODE =0x01
DUEL_ATTACK_FIRST_TURN =0x02
......
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