Commit 4f327baa authored by Argon's avatar Argon

fix

parent 52a45a19
......@@ -267,6 +267,7 @@ struct processor {
uint8 flipsummon_state_count[2];
uint8 spsummon_state_count[2];
uint8 attack_state_count[2];
uint8 battle_phase_count[2];
uint8 phase_action;
uint32 hint_timing[2];
std::unordered_map<uint32, std::pair<uint32, uint32> > summon_counter;
......
......@@ -3081,6 +3081,9 @@ int32 scriptlib::duel_get_activity_count(lua_State *L) {
case 5:
lua_pushinteger(L, pduel->game_field->core.attack_state_count[playerid]);
break;
case 6:
lua_pushinteger(L, pduel->game_field->core.battle_phase_count[playerid]);
break;
default:
lua_pushinteger(L, 0);
break;
......@@ -3185,7 +3188,7 @@ int32 scriptlib::duel_get_custom_activity_count(lua_State *L) {
lua_pushinteger(L, val & 0xffff);
else
lua_pushinteger(L, (val >> 16) & 0xffff);
return 0;
return 1;
}
int32 scriptlib::duel_venom_swamp_check(lua_State *L) {
check_param_count(L, 2);
......
......@@ -2197,7 +2197,6 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
pcard->summon_player = sumplayer;
pcard->summon_info = (peffect->get_value(pcard) & 0xff00ffff) | SUMMON_TYPE_SPECIAL | ((uint32)pcard->current.location << 16);
move_to_field(pcard, sumplayer, sumplayer, LOCATION_MZONE, POS_FACEUP);
core.spsummon_state_count[sumplayer]++;
CheckCounter(pcard, 3, sumplayer);
return FALSE;
}
......@@ -2210,6 +2209,8 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
pduel->write_buffer8(pcard->current.location);
pduel->write_buffer8(pcard->current.sequence);
pduel->write_buffer8(pcard->current.position);
if(pcard->owner != pcard->current.controler)
set_control(pcard, pcard->current.controler, 0, 0);
if(pgroup->it != pgroup->container.end())
core.units.begin()->step = 22;
return FALSE;
......@@ -2217,6 +2218,7 @@ int32 field::special_summon_rule(uint16 step, uint8 sumplayer, card * target) {
case 25: {
group* pgroup = core.units.begin()->ptarget;
card_set cset;
core.spsummon_state_count[sumplayer]++;
for(auto cit = pgroup->container.begin(); cit != pgroup->container.end(); ++cit) {
(*cit)->set_status(STATUS_SUMMONING, TRUE);
if(!(*cit)->is_affected_by_effect(EFFECT_CANNOT_DISABLE_SPSUMMON)) {
......
......@@ -3994,6 +3994,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
core.flipsummon_state_count[p] = 0;
core.spsummon_state_count[p] = 0;
core.attack_state_count[p] = 0;
core.battle_phase_count[p] = 0;
core.summon_count[p] = 0;
core.extra_summon[p] = 0;
}
......@@ -4125,6 +4126,7 @@ int32 field::process_turn(uint16 step, uint8 turn_player) {
}
infos.phase = PHASE_BATTLE;
core.phase_action = FALSE;
core.battle_phase_count[infos.turn_player]++;
pduel->write_buffer8(MSG_NEW_PHASE);
pduel->write_buffer8(infos.phase);
pduel->write_buffer8(MSG_HINT);
......
......@@ -10,20 +10,9 @@ function c10118318.initial_effect(c)
e1:SetTarget(c10118318.target)
e1:SetOperation(c10118318.activate)
c:RegisterEffect(e1)
if not c10118318.global_check then
c10118318.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c10118318.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c10118318.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),10118318,RESET_PHASE+PHASE_END,0,1)
end
function c10118318.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,10118318)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -22,20 +22,9 @@ function c12444060.initial_effect(c)
e2:SetTarget(c12444060.destg)
e2:SetOperation(c12444060.desop)
c:RegisterEffect(e2)
if not c12444060.global_check then
c12444060.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c12444060.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c12444060.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),12444060,RESET_PHASE+PHASE_END,0,1)
end
function c12444060.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,12444060)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -29,17 +29,6 @@ function c12670770.initial_effect(c)
e3:SetTarget(c12670770.sptg)
e3:SetOperation(c12670770.spop)
c:RegisterEffect(e3)
if not c12670770.global_check then
c12670770.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c12670770.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c12670770.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),12670770,RESET_PHASE+PHASE_END,0,1)
end
function c12670770.filter1(c)
return c:IsFaceup() and c:IsCode(70095154)
......@@ -102,7 +91,7 @@ function c12670770.spfilter(c,e,tp)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c12670770.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,12670770)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -17,7 +17,7 @@ function c12836042.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)<=1
end
function c12836042.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCurrentPhase()==PHASE_MAIN1
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0
and Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0
and e:GetHandler():IsReleasable() end
local e1=Effect.CreateEffect(e:GetHandler())
......
......@@ -11,23 +11,12 @@ function c13683298.initial_effect(c)
e1:SetTarget(c13683298.target)
e1:SetOperation(c13683298.operation)
c:RegisterEffect(e1)
if not c13683298.global_check then
c13683298.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c13683298.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c13683298.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),13683298,RESET_PHASE+PHASE_END,0,1)
end
function c13683298.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE)
end
function c13683298.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,13683298)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -14,17 +14,6 @@ function c19667590.initial_effect(c)
e1:SetTarget(c19667590.sptg)
e1:SetOperation(c19667590.spop)
c:RegisterEffect(e1)
if not c19667590.global_check then
c19667590.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c19667590.checkop)
Duel.RegisterEffect(ge1,0)
end
end
function c19667590.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),19667590,RESET_PHASE+PHASE_END,0,1)
end
function c19667590.cfilter(c,tp)
return c:IsFaceup() and c:GetSummonPlayer()==tp and c:IsSetCard(0x59)
......@@ -33,7 +22,7 @@ function c19667590.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c19667590.cfilter,1,nil,tp)
end
function c19667590.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,19667590)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -13,41 +13,17 @@ function c35629124.initial_effect(c)
e1:SetTarget(c35629124.sptg)
e1:SetOperation(c35629124.spop)
c:RegisterEffect(e1)
if not c35629124.global_check then
c35629124.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c35629124.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge2:SetOperation(c35629124.checkop2)
Duel.RegisterEffect(ge2,0)
end
end
function c35629124.checkop(e,tp,eg,ep,ev,re,r,rp)
local p1=nil
local p2=nil
local tc=eg:GetFirst()
while tc do
if not tc:IsRace(RACE_DRAGON) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,35629124,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,35629124,RESET_PHASE+PHASE_END,0,1) end
Duel.AddCustomActivityCounter(35629124,ACTIVITY_SPSUMMON,c35629124.counterfilter)
end
function c35629124.checkop2(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterFlagEffect(Duel.GetTurnPlayer(),35629124,RESET_PHASE+PHASE_END,0,1)
function c35629124.counterfilter(c)
return c:IsRace(0xffffff-RACE_DRAGON)
end
function c35629124.spcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_RETURN)
end
function c35629124.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,35629124)==0 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0
and Duel.GetCustomActivityCount(35629124,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -12,33 +12,16 @@ function c45286019.initial_effect(c)
e1:SetTarget(c45286019.sptg)
e1:SetOperation(c45286019.spop)
c:RegisterEffect(e1)
if not c45286019.global_check then
c45286019.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(c45286019.checkop)
Duel.RegisterEffect(ge1,0)
end
Duel.AddCustomActivityCounter(45286019,ACTIVITY_SPSUMMON,c45286019.counterfilter)
end
function c45286019.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local p1=false
local p2=false
while tc do
if not tc:IsSetCard(0x72) then
if tc:GetSummonPlayer()==0 then p1=true else p2=true end
end
tc=eg:GetNext()
end
if p1 then Duel.RegisterFlagEffect(0,45286019,RESET_PHASE+PHASE_END,0,1) end
if p2 then Duel.RegisterFlagEffect(1,45286019,RESET_PHASE+PHASE_END,0,1) end
function c45286019.counterfilter(c)
return c:IsSetCard(0x72)
end
function c45286019.spcon(e,tp,eg,ep,ev,re,r,rp)
return re:GetHandler():IsSetCard(0x72)
end
function c45286019.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,45286019)==0 end
if chk==0 then return Duel.GetCustomActivityCount(45286019,tp,ACTIVITY_SPSUMMON)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
......
......@@ -11,7 +11,7 @@ function c54977057.initial_effect(c)
c:RegisterEffect(e1)
end
function c54977057.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 and Duel.GetCurrentPhase()~=PHASE_MAIN2 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 and Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
......
......@@ -29,7 +29,7 @@ function c76263644.initial_effect(c)
c:RegisterEffect(e3)
end
function c76263644.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetCurrentPhase()==PHASE_MAIN1 end
if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_BP)
......
......@@ -13,7 +13,7 @@ function c98672567.initial_effect(c)
c:RegisterEffect(e1)
end
function c98672567.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1 and not Duel.CheckPhaseActivity()
return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 and not Duel.CheckPhaseActivity()
end
function c98672567.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -25,7 +25,7 @@ function c99899504.initial_effect(c)
c:RegisterEffect(e2)
end
function c99899504.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1
return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0
end
function c99899504.spfilter(c,e,tp)
return c:IsCode(26293219) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -668,6 +668,7 @@ DUEL_SIMPLE_AI =0x40 --AI
--
ACTIVITY_SUMMON =1
ACTIVITY_NORMALSUMMON =2
ACTIVITY_FLIPSUMMON =3
ACTIVITY_SPSUMMON =4
ACTIVITY_SPSUMMON =3
ACTIVITY_FLIPSUMMON =4
ACTIVITY_ATTACK =5
ACTIVITY_BATTLE_PHASE =6
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