Commit 2c8ce759 authored by VanillaSalt's avatar VanillaSalt

fix

parent ef046e2c
......@@ -1941,6 +1941,15 @@ int32 field::is_player_can_discard_hand(uint8 playerid, card * pcard, effect * p
}
return TRUE;
}
int32 field::is_player_can_summon(uint8 playerid) {
effect_set eset;
filter_player_effect(playerid, EFFECT_CANNOT_SUMMON, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
if(!eset[i]->target)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_summon(uint32 sumtype, uint8 playerid, card * pcard) {
effect_set eset;
sumtype |= SUMMON_TYPE_NORMAL;
......
......@@ -390,6 +390,7 @@ public:
int32 is_player_can_discard_deck(uint8 playerid, int32 count);
int32 is_player_can_discard_deck_as_cost(uint8 playerid, int32 count);
int32 is_player_can_discard_hand(uint8 playerid, card* pcard, effect* peffect, uint32 reason);
int32 is_player_can_summon(uint8 playerid);
int32 is_player_can_summon(uint32 sumtype, uint8 playerid, card* pcard);
int32 is_player_can_mset(uint32 sumtype, uint8 playerid, card* pcard);
int32 is_player_can_sset(uint8 playerid, card* pcard);
......
......@@ -2833,17 +2833,22 @@ int32 scriptlib::duel_is_player_can_discard_deck_as_cost(lua_State * L) {
return 1;
}
int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 3);
card* pcard = *(card**) lua_touserdata(L, 3);
check_param_count(L, 1);
int32 playerid = lua_tointeger(L, 1);
int32 sumtype = 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(sumtype, playerid, pcard));
if(lua_gettop(L) == 1)
lua_pushboolean(L, pduel->game_field->is_player_can_summon(playerid));
else {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 3);
int32 sumtype = lua_tointeger(L, 2);
card* pcard = *(card**) lua_touserdata(L, 3);
lua_pushboolean(L, pduel->game_field->is_player_can_summon(sumtype, playerid, pcard));
}
return 1;
}
int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
......
......@@ -16,7 +16,7 @@ function c22404675.initial_effect(c)
e2:SetCode(EVENT_RELEASE)
e2:SetCountLimit(1,22404676)
e2:SetCondition(c22404675.sumcon)
e2:SetTarget(c22404676.sumtg)
e2:SetTarget(c22404675.sumtg)
e2:SetOperation(c22404675.sumop)
c:RegisterEffect(e2)
end
......@@ -58,8 +58,8 @@ end
function c22404675.sumcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsReason(REASON_SUMMON)
end
function c22404676.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SUMMON) end
function c22404675.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanSummon(tp) end
end
function c22404675.sumop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,22404675)~=0 then return end
......
......@@ -45,7 +45,7 @@ function c23740893.sumcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function c23740893.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SUMMON) end
if chk==0 then return Duel.IsPlayerCanSummon(tp) end
end
function c23740893.sumop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetFlagEffect(tp,23740893)~=0 then return end
......
......@@ -73,7 +73,7 @@ function c53485634.sumcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Release(e:GetHandler(),REASON_COST)
end
function c53485634.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SUMMON) end
if chk==0 then return Duel.IsPlayerCanSummon(tp) end
end
function c53485634.sumop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
......
......@@ -30,7 +30,7 @@ function c9126351.initial_effect(c)
e5:SetRange(LOCATION_MZONE)
e5:SetCountLimit(1)
e5:SetCost(c9126351.excost)
e2:SetTarget(c9126352.extg)
e5:SetTarget(c9126351.extg)
e5:SetOperation(c9126351.exop)
c:RegisterEffect(e5)
end
......@@ -69,8 +69,8 @@ function c9126351.excost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoHand(g,nil,REASON_COST)
Duel.RegisterFlagEffect(tp,9126352,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c9126352.extg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SUMMON) end
function c9126351.extg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanSummon(tp) end
end
function c9126351.exop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
......
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