Commit c7c79ebf authored by VanillaSalt's avatar VanillaSalt

fix

parent cb602dc4
......@@ -369,6 +369,9 @@ public:
#define EFFECT_QP_ACT_IN_NTPHAND 311
#define EFFECT_MUST_BE_SMATERIAL 312
#define EFFECT_SPSUMMON_PROC_G 320
#define EFFECT_SUMMON_COUNT_LIMIT 330
#define EFFECT_SPSUMMON_COUNT_LIMIT 331
#define EFFECT_FLIP_SUMMON_COUNT_LIMIT 332
#define EVENT_STARTUP 1000
#define EVENT_FLIP 1001
......
......@@ -1777,6 +1777,15 @@ int32 field::is_player_can_summon(uint32 sumtype, uint8 playerid, card * pcard)
if (pduel->lua->check_condition(eset[i]->target, 4))
return FALSE;
}
eset.clear();
filter_player_effect(playerid, EFFECT_SUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v <= 0)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_mset(uint32 sumtype, uint8 playerid, card * pcard) {
......@@ -1816,6 +1825,15 @@ int32 field::is_player_can_spsummon(uint8 playerid) {
if(!eset[i]->target)
return FALSE;
}
eset.clear();
filter_player_effect(playerid, EFFECT_SPSUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v <= 0)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_spsummon(effect * peffect, uint32 sumtype, uint8 sumpos, uint8 playerid, uint8 toplayer, card * pcard) {
......@@ -1851,6 +1869,15 @@ int32 field::is_player_can_flipsummon(uint8 playerid, card * pcard) {
if (pduel->lua->check_condition(eset[i]->target, 3))
return FALSE;
}
eset.clear();
filter_player_effect(playerid, EFFECT_FLIP_SUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v <= 0)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_spsummon_monster(uint8 playerid, uint8 toplayer, uint8 sumpos, card_data * pdata) {
......@@ -1873,6 +1900,42 @@ int32 field::is_player_can_release(uint8 playerid, card * pcard) {
}
return TRUE;
}
int32 field::is_player_can_summon_count(uint8 playerid, uint32 count) {
effect_set eset;
filter_player_effect(playerid, EFFECT_SUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v < count)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_spsummon_count(uint8 playerid, uint32 count) {
effect_set eset;
filter_player_effect(playerid, EFFECT_SPSUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v < count)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_flipsummon_count(uint8 playerid, uint32 count) {
effect_set eset;
filter_player_effect(playerid, EFFECT_FLIP_SUMMON_COUNT_LIMIT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
pduel->lua->add_param(core.reason_effect, PARAM_TYPE_EFFECT);
pduel->lua->add_param(playerid, PARAM_TYPE_INT);
int32 v = eset[i]->get_value(2);
if(v < count)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_place_counter(uint8 playerid, card * pcard, uint16 countertype, uint16 count) {
effect_set eset;
filter_player_effect(playerid, EFFECT_CANNOT_PLACE_COUNTER, &eset);
......
......@@ -378,6 +378,9 @@ public:
int32 is_player_can_spsummon(effect* peffect, uint32 sumtype, uint8 sumpos, uint8 playerid, uint8 toplayer, card* pcard);
int32 is_player_can_flipsummon(uint8 playerid, card* pcard);
int32 is_player_can_spsummon_monster(uint8 playerid, uint8 toplayer, uint8 sumpos, card_data* pdata);
int32 is_player_can_summon_count(uint8 playerid, uint32 count);
int32 is_player_can_spsummon_count(uint8 playerid, uint32 count);
int32 is_player_can_flipsummon_count(uint8 playerid, uint32 count);
int32 is_player_can_release(uint8 playerid, card* pcard);
int32 is_player_can_place_counter(uint8 playerid, card* pcard, uint16 countertype, uint16 count);
int32 is_player_can_remove_counter(uint8 playerid, card* pcard, uint8 s, uint8 o, uint16 countertype, uint16 count, uint32 reason);
......
......@@ -464,6 +464,9 @@ static const struct luaL_Reg duellib[] = {
{ "IsPlayerCanSpecialSummon", scriptlib::duel_is_player_can_spsummon },
{ "IsPlayerCanFlipSummon", scriptlib::duel_is_player_can_flipsummon },
{ "IsPlayerCanSpecialSummonMonster", scriptlib::duel_is_player_can_spsummon_monster },
{ "IsPlayerCanSummonCount", scriptlib::duel_is_player_can_summon_count },
{ "IsPlayerCanSpecialSummonCount", scriptlib::duel_is_player_can_spsummon_count },
{ "IsPlayerCanFlipSummonCount", scriptlib::duel_is_player_can_flipsummon_count },
{ "IsPlayerCanRelease", scriptlib::duel_is_player_can_release },
{ "IsPlayerCanRemove", scriptlib::duel_is_player_can_remove },
{ "IsPlayerCanSendtoHand", scriptlib::duel_is_player_can_send_to_hand },
......
......@@ -2884,6 +2884,42 @@ int32 scriptlib::duel_is_player_can_spsummon_monster(lua_State * L) {
lua_pushboolean(L, pduel->game_field->is_player_can_spsummon_monster(playerid, toplayer, pos, &dat));
return 1;
}
int32 scriptlib::duel_is_player_can_summon_count(lua_State * L) {
check_param_count(L, 2);
int32 playerid = lua_tointeger(L, 1);
int32 count = lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0);
return 1;
}
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_player_can_summon_count(playerid, count));
return 1;
}
int32 scriptlib::duel_is_player_can_spsummon_count(lua_State * L) {
check_param_count(L, 2);
int32 playerid = lua_tointeger(L, 1);
int32 count = lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0);
return 1;
}
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_player_can_spsummon_count(playerid, count));
return 1;
}
int32 scriptlib::duel_is_player_can_flipsummon_count(lua_State * L) {
check_param_count(L, 2);
int32 playerid = lua_tointeger(L, 1);
int32 count = lua_tointeger(L, 2);
if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0);
return 1;
}
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_player_can_flipsummon_count(playerid, count));
return 1;
}
int32 scriptlib::duel_is_player_can_release(lua_State * L) {
check_param_count(L, 2);
int32 playerid = lua_tointeger(L, 1);
......
......@@ -464,6 +464,10 @@ public:
static int32 duel_is_player_can_spsummon(lua_State *L);
static int32 duel_is_player_can_flipsummon(lua_State *L);
static int32 duel_is_player_can_spsummon_monster(lua_State *L);
static int32 duel_is_player_can_summon_count(lua_State *L);
static int32 duel_is_player_can_spsummon_count(lua_State *L);
static int32 duel_is_player_can_flipsummon_count(lua_State *L);
static int32 duel_is_player_can_release(lua_State *L);
static int32 duel_is_player_can_remove(lua_State *L);
static int32 duel_is_player_can_send_to_hand(lua_State *L);
......
......@@ -9,24 +9,17 @@ function c23516703.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EFFECT_CANNOT_SUMMON)
e2:SetCode(EFFECT_SUMMON_COUNT_LIMIT)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
e2:SetTarget(c23516703.tg)
e2:SetValue(c23516703.sumval)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e3:SetCode(EFFECT_SPSUMMON_COUNT_LIMIT)
c:RegisterEffect(e3)
local e4=e2:Clone()
e4:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
e4:SetCode(EFFECT_FLIP_SUMMON_COUNT_LIMIT)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD)
e5:SetRange(LOCATION_SZONE)
e5:SetCode(23516703)
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e5:SetTargetRange(1,1)
c:RegisterEffect(e5)
if not c23516703.global_check then
c23516703.global_check=true
c23516703[0]=0
......@@ -53,8 +46,8 @@ function c23516703.initial_effect(c)
Duel.RegisterEffect(ge4,0)
end
end
function c23516703.tg(e,sc,sp,st)
return c23516703[sp]>=2
function c23516703.sumval(e,se,sp)
return 2-c23516703[sp]
end
function c23516703.checkop(e,tp,eg,ep,ev,re,r,rp)
local s1=false
......
......@@ -33,7 +33,7 @@ end
function c23536866.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(c23536866.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return (not Duel.IsPlayerAffectedByEffect(tp,23516703) or c23516703[tp]==0)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and mg:GetCount()>1
and Duel.IsExistingMatchingCard(c23536866.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end
local exg=Duel.GetMatchingGroup(c23536866.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
......@@ -51,7 +51,6 @@ function c23536866.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c23536866.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,23516703) and c23516703[tp]>0 then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c23536866.filter2,nil,e,tp)
if g:GetCount()<2 then return end
......
......@@ -45,7 +45,7 @@ function c57734012.filter2(c,e,tp,no)
return c.xyz_number==no and c:IsSetCard(0x1048) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
end
function c57734012.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return (not Duel.IsPlayerAffectedByEffect(tp,23516703) or c23516703[tp]==0)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and Duel.GetFlagEffect(tp,57734012)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c57734012.filter1,tp,LOCATION_GRAVE+LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE+LOCATION_EXTRA)
......
......@@ -26,7 +26,7 @@ end
function c61314842.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(c61314842.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return (not Duel.IsPlayerAffectedByEffect(tp,23516703) or c23516703[tp]==0)
if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and mg:GetCount()>1
and Duel.IsExistingMatchingCard(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end
local exg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
......
......@@ -4,10 +4,10 @@ function c68087897.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetCode(EFFECT_SPSUMMON_COUNT_LIMIT)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1)
e1:SetTarget(c68087897.sumlimit)
e1:SetValue(c68087897.spval)
c:RegisterEffect(e1)
--reg
local e2=Effect.CreateEffect(c)
......@@ -17,8 +17,8 @@ function c68087897.initial_effect(c)
e2:SetOperation(c68087897.spreg)
c:RegisterEffect(e2)
end
function c68087897.sumlimit(e,c,sump,sumtype,sumpos,targetp)
return e:GetHandler():GetFlagEffect(68087897+sump)~=0
function c68087897.spval(e,se,sp)
return 1-e:GetHandler():GetFlagEffect(68087897+sp)
end
function c68087897.filter(c,tp)
return c:GetSummonPlayer()==tp
......
......@@ -28,11 +28,11 @@ function c94977269.initial_effect(c)
--disable summon
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e4:SetCode(EFFECT_SPSUMMON_COUNT_LIMIT)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e4:SetTargetRange(1,1)
e4:SetTarget(c94977269.splimit2)
e4:SetValue(c94977269.spval)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -164,8 +164,8 @@ end
function c94977269.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
function c94977269.splimit2(e,c,sump,sumtype,sumpos,targetp)
return e:GetHandler():GetFlagEffect(94977269+sump)>0
function c94977269.spval(e,se,sp)
return 1-e:GetHandler():GetFlagEffect(94977269+sp)
end
function c94977269.checkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -459,6 +459,9 @@ EFFECT_SYNCHRO_CHECK =310
EFFECT_QP_ACT_IN_NTPHAND =311
EFFECT_MUST_BE_SMATERIAL =312
EFFECT_SPSUMMON_PROC_G =320
EFFECT_SUMMON_COUNT_LIMIT =330
EFFECT_SPSUMMON_COUNT_LIMIT =331
EFFECT_FLIP_SUMMON_COUNT_LIMIT =332
EVENT_STARTUP =1000
EVENT_FLIP =1001
......
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