Commit 67f4e09f authored by VanillaSalt's avatar VanillaSalt

fix

parent 86c44bbb
...@@ -511,21 +511,30 @@ uint32 card::get_level() { ...@@ -511,21 +511,30 @@ uint32 card::get_level() {
return temp.level; return temp.level;
effect_set effects; effect_set effects;
int32 level = data.level; int32 level = data.level;
temp.level = data.level; temp.level = level;
int32 up = 0, upc = 0; int32 up = 0, upc = 0;
filter_effect(EFFECT_UPDATE_LEVEL, &effects, FALSE); filter_effect(EFFECT_UPDATE_LEVEL, &effects, FALSE);
filter_effect(EFFECT_CHANGE_LEVEL, &effects); filter_effect(EFFECT_CHANGE_LEVEL, &effects, FALSE);
filter_effect(EFFECT_CHANGE_LEVEL_FINAL, &effects);
for (int32 i = 0; i < effects.size(); ++i) { for (int32 i = 0; i < effects.size(); ++i) {
if (effects[i]->code == EFFECT_UPDATE_LEVEL) { switch (effects[i]->code) {
case EFFECT_UPDATE_LEVEL:
if ((effects[i]->type & EFFECT_TYPE_SINGLE) && !(effects[i]->flag & EFFECT_FLAG_SINGLE_RANGE)) if ((effects[i]->type & EFFECT_TYPE_SINGLE) && !(effects[i]->flag & EFFECT_FLAG_SINGLE_RANGE))
up += effects[i]->get_value(this); up += effects[i]->get_value(this);
else else
upc += effects[i]->get_value(this); upc += effects[i]->get_value(this);
} else { break;
case EFFECT_CHANGE_LEVEL:
level = effects[i]->get_value(this);
up = 0;
break;
case EFFECT_CHANGE_LEVEL_FINAL:
level = effects[i]->get_value(this); level = effects[i]->get_value(this);
up = 0; up = 0;
upc = 0;
break;
} }
temp.level = level; temp.level = level + up + upc;
} }
level += up + upc; level += up + upc;
if(level < 1 && (get_type() & TYPE_MONSTER)) if(level < 1 && (get_type() & TYPE_MONSTER))
...@@ -544,21 +553,30 @@ uint32 card::get_rank() { ...@@ -544,21 +553,30 @@ uint32 card::get_rank() {
return temp.level; return temp.level;
effect_set effects; effect_set effects;
int32 rank = data.level; int32 rank = data.level;
temp.level = data.level; temp.level = rank;
int32 up = 0, upc = 0; int32 up = 0, upc = 0;
filter_effect(EFFECT_UPDATE_RANK, &effects, FALSE); filter_effect(EFFECT_UPDATE_RANK, &effects, FALSE);
filter_effect(EFFECT_CHANGE_RANK, &effects); filter_effect(EFFECT_CHANGE_RANK, &effects, FALSE);
filter_effect(EFFECT_CHANGE_RANK_FINAL, &effects);
for (int32 i = 0; i < effects.size(); ++i) { for (int32 i = 0; i < effects.size(); ++i) {
if (effects[i]->code == EFFECT_UPDATE_RANK) { switch (effects[i]->code) {
case EFFECT_UPDATE_RANK:
if ((effects[i]->type & EFFECT_TYPE_SINGLE) && !(effects[i]->flag & EFFECT_FLAG_SINGLE_RANGE)) if ((effects[i]->type & EFFECT_TYPE_SINGLE) && !(effects[i]->flag & EFFECT_FLAG_SINGLE_RANGE))
up += effects[i]->get_value(this); up += effects[i]->get_value(this);
else else
upc += effects[i]->get_value(this); upc += effects[i]->get_value(this);
} else { break;
case EFFECT_CHANGE_RANK:
rank = effects[i]->get_value(this);
up = 0;
break;
case EFFECT_CHANGE_RANK_FINAL:
rank = effects[i]->get_value(this); rank = effects[i]->get_value(this);
up = 0; up = 0;
upc = 0;
break;
} }
temp.level = rank; temp.level = rank + up + upc;
} }
rank += up + upc; rank += up + upc;
if(rank < 1 && (get_type() & TYPE_MONSTER)) if(rank < 1 && (get_type() & TYPE_MONSTER))
......
...@@ -371,6 +371,8 @@ public: ...@@ -371,6 +371,8 @@ public:
#define EFFECT_QP_ACT_IN_NTPHAND 311 #define EFFECT_QP_ACT_IN_NTPHAND 311
#define EFFECT_MUST_BE_SMATERIAL 312 #define EFFECT_MUST_BE_SMATERIAL 312
#define EFFECT_TO_GRAVE_REDIRECT_CB 313 #define EFFECT_TO_GRAVE_REDIRECT_CB 313
#define EFFECT_CHANGE_LEVEL_FINAL 314
#define EFFECT_CHANGE_RANK_FINAL 315
#define EFFECT_SPSUMMON_PROC_G 320 #define EFFECT_SPSUMMON_PROC_G 320
#define EFFECT_SPSUMMON_COUNT_LIMIT 330 #define EFFECT_SPSUMMON_COUNT_LIMIT 330
#define EFFECT_LEFT_SPSUMMON_COUNT 331 #define EFFECT_LEFT_SPSUMMON_COUNT 331
......
...@@ -1393,7 +1393,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1393,7 +1393,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
returns.ivalue[0] = -1; returns.ivalue[0] = -1;
core.units.begin()->step = 1; core.units.begin()->step = 1;
return FALSE; return FALSE;
} else if(tf_count == 1 && to_count == 0 && fc_count == 0 && cn_count == 0) { } else if(tf_count + cn_count == 1 && to_count == 0 && fc_count == 0) {
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
core.units.begin()->step = 1; core.units.begin()->step = 1;
return FALSE; return FALSE;
...@@ -1412,7 +1412,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1412,7 +1412,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
pduel->write_buffer32(25); pduel->write_buffer32(25);
else else
pduel->write_buffer32(26); pduel->write_buffer32(26);
add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, check_player, core.spe_effect[check_player] | (tf_count+cn_count ? 0x10000 : 0)); add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, check_player, core.spe_effect[check_player] | (tf_count + cn_count ? 0x10000 : 0));
core.units.begin()->step = 1; core.units.begin()->step = 1;
return FALSE; return FALSE;
} }
...@@ -1564,7 +1564,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1564,7 +1564,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
returns.ivalue[0] = -1; returns.ivalue[0] = -1;
core.units.begin()->step = 11; core.units.begin()->step = 11;
return FALSE; return FALSE;
} else if(tf_count == 1 && to_count == 0 && fc_count == 0 && cn_count == 0) { } else if(tf_count + cn_count == 1 && to_count == 0 && fc_count == 0) {
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
core.units.begin()->step = 11; core.units.begin()->step = 11;
return FALSE; return FALSE;
...@@ -1583,7 +1583,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1583,7 +1583,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
pduel->write_buffer32(25); pduel->write_buffer32(25);
else else
pduel->write_buffer32(26); pduel->write_buffer32(26);
add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, check_player, core.spe_effect[check_player] | (tf_count+cn_count ? 0x10000 : 0)); add_process(PROCESSOR_SELECT_CHAIN, 0, 0, 0, check_player, core.spe_effect[check_player] | (tf_count + cn_count ? 0x10000 : 0));
core.units.begin()->step = 11; core.units.begin()->step = 11;
return FALSE; return FALSE;
} }
...@@ -2297,8 +2297,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -2297,8 +2297,8 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
if(!infos.priorities[0] || !infos.priorities[1]) if(!infos.priorities[0] || !infos.priorities[1])
add_process(PROCESSOR_QUICK_EFFECT, 1, 0, 0, skip_freechain, 1 - priority); add_process(PROCESSOR_QUICK_EFFECT, 1, 0, 0, skip_freechain, 1 - priority);
else { else {
core.hint_timing[0] = 0; core.hint_timing[0] &= TIMING_DAMAGE_STEP | TIMING_DAMAGE_CAL;
core.hint_timing[1] = 0; core.hint_timing[1] &= TIMING_DAMAGE_STEP | TIMING_DAMAGE_CAL;
core.delayed_quick.clear(); core.delayed_quick.clear();
} }
} }
...@@ -4895,8 +4895,8 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2 ...@@ -4895,8 +4895,8 @@ int32 field::solve_chain(uint16 step, uint32 chainend_arg1, uint32 chainend_arg2
return TRUE; return TRUE;
} }
int32 field::break_effect() { int32 field::break_effect() {
core.hint_timing[0] = 0; core.hint_timing[0] &= TIMING_DAMAGE_STEP | TIMING_DAMAGE_CAL;
core.hint_timing[1] = 0; core.hint_timing[1] &= TIMING_DAMAGE_STEP | TIMING_DAMAGE_CAL;
for (auto chit = core.new_ochain.begin(); chit != core.new_ochain.end();) { for (auto chit = core.new_ochain.begin(); chit != core.new_ochain.end();) {
auto rm = chit++; auto rm = chit++;
effect* peffect = rm->triggering_effect; effect* peffect = rm->triggering_effect;
......
...@@ -25,13 +25,13 @@ end ...@@ -25,13 +25,13 @@ end
function c43661068.activate(e,tp,eg,ep,ev,re,r,rp) function c43661068.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local g=Duel.GetMatchingGroup(c43661068.filter,tp,LOCATION_MZONE,0,nil,tc:GetAttack(),tc:GetDefence()) local g=Duel.GetMatchingGroup(c43661068.filter,tp,LOCATION_MZONE,0,tc,tc:GetAttack(),tc:GetDefence())
local lv=tc:GetLevel() local lv=tc:GetLevel()
local lc=g:GetFirst() local lc=g:GetFirst()
while lc do while lc do
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetCode(EFFECT_CHANGE_LEVEL_FINAL)
e1:SetValue(lv) e1:SetValue(lv)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
lc:RegisterEffect(e1) lc:RegisterEffect(e1)
......
...@@ -13,7 +13,7 @@ function c52340274.filter1(c) ...@@ -13,7 +13,7 @@ function c52340274.filter1(c)
return c:IsFaceup() and c:IsLevelAbove(7) return c:IsFaceup() and c:IsLevelAbove(7)
end end
function c52340274.filter2(c) function c52340274.filter2(c)
return c:IsFaceup() and not c:IsType(TYPE_XYZ) return c:IsFaceup() and c:GetLevel()>0
end end
function c52340274.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c52340274.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c52340274.filter1(chkc) end if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c52340274.filter1(chkc) end
...@@ -25,13 +25,13 @@ end ...@@ -25,13 +25,13 @@ end
function c52340274.activate(e,tp,eg,ep,ev,re,r,rp) function c52340274.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local g=Duel.GetMatchingGroup(c52340274.filter2,tp,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(c52340274.filter2,tp,LOCATION_MZONE,0,tc)
local lc=g:GetFirst() local lc=g:GetFirst()
local lv=tc:GetLevel() local lv=tc:GetLevel()
while lc do while lc do
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetCode(EFFECT_CHANGE_LEVEL_FINAL)
e1:SetValue(lv) e1:SetValue(lv)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
lc:RegisterEffect(e1) lc:RegisterEffect(e1)
......
...@@ -13,7 +13,7 @@ function c88494120.initial_effect(c) ...@@ -13,7 +13,7 @@ function c88494120.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c88494120.condition(e,tp,eg,ep,ev,re,r,rp) function c88494120.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated() return (Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated())
and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1
end end
function c88494120.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c88494120.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
...@@ -32,7 +32,7 @@ function c9831539.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -32,7 +32,7 @@ function c9831539.activate(e,tp,eg,ep,ev,re,r,rp)
local lv=tc1:GetLevel()+tc2:GetLevel() local lv=tc1:GetLevel()+tc2:GetLevel()
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetCode(EFFECT_CHANGE_LEVEL_FINAL)
e1:SetValue(lv) e1:SetValue(lv)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000)
tc1:RegisterEffect(e1) tc1:RegisterEffect(e1)
......
...@@ -459,6 +459,8 @@ EFFECT_SYNCHRO_CHECK =310 --基因组斗士 ...@@ -459,6 +459,8 @@ EFFECT_SYNCHRO_CHECK =310 --基因组斗士
EFFECT_QP_ACT_IN_NTPHAND =311 --对方回合从自己手卡发动(失乐的圣女) EFFECT_QP_ACT_IN_NTPHAND =311 --对方回合从自己手卡发动(失乐的圣女)
EFFECT_MUST_BE_SMATERIAL =312 --必须作为同调素材(波动龙 声子龙) EFFECT_MUST_BE_SMATERIAL =312 --必须作为同调素材(波动龙 声子龙)
EFFECT_TO_GRAVE_REDIRECT_CB =313 -- EFFECT_TO_GRAVE_REDIRECT_CB =313 --
EFFECT_CHANGE_LEVEL_FINAL =314 --
EFFECT_CHANGE_RANK_FINAL =315 --
EFFECT_SPSUMMON_PROC_G =320 --P召唤规则 EFFECT_SPSUMMON_PROC_G =320 --P召唤规则
EFFECT_SPSUMMON_COUNT_LIMIT =330 --特殊召唤次数限制 EFFECT_SPSUMMON_COUNT_LIMIT =330 --特殊召唤次数限制
EFFECT_LEFT_SPSUMMON_COUNT =331 -- EFFECT_LEFT_SPSUMMON_COUNT =331 --
......
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