Commit d9838175 authored by VanillaSalt's avatar VanillaSalt

fix

parent c6feec6a
......@@ -326,17 +326,18 @@ int32 card::get_attack(uint8 swap) {
for (int32 i = 0; i < eset.count; ++i) {
switch (eset[i]->code) {
case EFFECT_UPDATE_ATTACK:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !(eset[i]->flag & EFFECT_FLAG_SINGLE_RANGE))
if (eset[i]->type & EFFECT_TYPE_SINGLE)
up += eset[i]->get_value(this);
else
upc += eset[i]->get_value(this);
break;
case EFFECT_SET_ATTACK:
base = eset[i]->get_value(this);
up = 0;
if (!(eset[i]->type & EFFECT_TYPE_SINGLE))
up = 0;
break;
case EFFECT_SET_ATTACK_FINAL:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !(eset[i]->flag & EFFECT_FLAG_SINGLE_RANGE)) {
if (eset[i]->type & EFFECT_TYPE_SINGLE) {
base = eset[i]->get_value(this);
up = 0;
upc = 0;
......@@ -348,10 +349,20 @@ int32 card::get_attack(uint8 swap) {
temp.attack = base + up + upc;
else
temp.attack = base - up - upc;
for (int32 i = 0; i < effects.count; ++i) {
if (effects[i]->flag & EFFECT_FLAG_REPEAT) {
base = effects[i]->get_value(this);
up = 0;
upc = 0;
temp.attack = base;
}
}
}
for (int32 i = 0; i < effects.count; ++i) {
final = effects[i]->get_value(this);
temp.attack = final;
if (!(effects[i]->flag & EFFECT_FLAG_REPEAT)) {
final = effects[i]->get_value(this);
temp.attack = final;
}
}
if (final == -1) {
if (!rev)
......@@ -413,17 +424,18 @@ int32 card::get_defence(uint8 swap) {
for (int32 i = 0; i < eset.count; ++i) {
switch (eset[i]->code) {
case EFFECT_UPDATE_DEFENCE:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !(eset[i]->flag & EFFECT_FLAG_SINGLE_RANGE))
if (eset[i]->type & EFFECT_TYPE_SINGLE)
up += eset[i]->get_value(this);
else
upc += eset[i]->get_value(this);
break;
case EFFECT_SET_DEFENCE:
base = eset[i]->get_value(this);
up = 0;
if (!(eset[i]->type & EFFECT_TYPE_SINGLE))
up = 0;
break;
case EFFECT_SET_DEFENCE_FINAL:
if ((eset[i]->type & EFFECT_TYPE_SINGLE) && !(eset[i]->flag & EFFECT_FLAG_SINGLE_RANGE)) {
if (eset[i]->type & EFFECT_TYPE_SINGLE) {
base = eset[i]->get_value(this);
up = 0;
upc = 0;
......@@ -435,10 +447,20 @@ int32 card::get_defence(uint8 swap) {
temp.defence = base + up + upc;
else
temp.defence = base - up - upc;
for (int32 i = 0; i < effects.count; ++i) {
if (effects[i]->flag & EFFECT_FLAG_REPEAT) {
base = effects[i]->get_value(this);
up = 0;
upc = 0;
temp.defence = base;
}
}
}
for (int32 i = 0; i < effects.count; ++i) {
final = effects[i]->get_value(this);
temp.defence = final;
if (!(effects[i]->flag & EFFECT_FLAG_REPEAT)) {
final = effects[i]->get_value(this);
temp.defence = final;
}
}
if (final == -1) {
if (!rev)
......@@ -799,8 +821,7 @@ int32 card::add_effect(effect* peffect) {
return 0;
card* check_target = this;
if (peffect->type & EFFECT_TYPE_SINGLE) {
if((peffect->code == EFFECT_SET_ATTACK || peffect->code == EFFECT_SET_ATTACK_FINAL)
&& !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
if(peffect->code == EFFECT_SET_ATTACK && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
for(it = single_effect.begin(); it != single_effect.end();) {
rm = it++;
if((rm->second->code == EFFECT_SET_ATTACK || rm->second->code == EFFECT_SET_ATTACK_FINAL)
......@@ -808,8 +829,15 @@ int32 card::add_effect(effect* peffect) {
remove_effect(rm->second);
}
}
if((peffect->code == EFFECT_SET_DEFENCE || peffect->code == EFFECT_SET_DEFENCE_FINAL)
&& !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
if(peffect->code == EFFECT_SET_ATTACK_FINAL && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
for(it = single_effect.begin(); it != single_effect.end();) {
rm = it++;
if((rm->second->code == EFFECT_UPDATE_ATTACK || rm->second->code == EFFECT_SET_ATTACK
|| rm->second->code == EFFECT_SET_ATTACK_FINAL) && !(rm->second->flag & EFFECT_FLAG_SINGLE_RANGE))
remove_effect(rm->second);
}
}
if(peffect->code == EFFECT_SET_DEFENCE && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
for(it = single_effect.begin(); it != single_effect.end();) {
rm = it++;
if((rm->second->code == EFFECT_SET_DEFENCE || rm->second->code == EFFECT_SET_DEFENCE_FINAL)
......@@ -817,6 +845,14 @@ int32 card::add_effect(effect* peffect) {
remove_effect(rm->second);
}
}
if(peffect->code == EFFECT_SET_DEFENCE_FINAL && !(peffect->flag & EFFECT_FLAG_SINGLE_RANGE)) {
for(it = single_effect.begin(); it != single_effect.end();) {
rm = it++;
if((rm->second->code == EFFECT_UPDATE_DEFENCE || rm->second->code == EFFECT_SET_DEFENCE
|| rm->second->code == EFFECT_SET_DEFENCE_FINAL) && !(rm->second->flag & EFFECT_FLAG_SINGLE_RANGE))
remove_effect(rm->second);
}
}
it = single_effect.insert(make_pair(peffect->code, peffect));
} else if (peffect->type & EFFECT_TYPE_FIELD)
it = field_effect.insert(make_pair(peffect->code, peffect));
......
......@@ -26,11 +26,12 @@ function c12744567.initial_effect(c)
c:RegisterEffect(e2)
end
function c12744567.filter(c)
return not c:IsType(TYPE_TOKEN) and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
return not c:IsType(TYPE_TOKEN) and c:IsAbleToChangeControler()
and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
end
function c12744567.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c12744567.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c12744567.filter,tp,0,LOCATION_MZONE,1,nil) end
if chk==0 then return e:GetHandler():IsType(TYPE_XYZ) and Duel.IsExistingTarget(c12744567.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c12744567.filter,tp,0,LOCATION_MZONE,1,1,nil)
end
......
......@@ -47,7 +47,7 @@ function c22134079.tdop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c22134079.flipop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(22134079,RESET_EVENT+0x17a0000,0,0)
e:GetHandler():RegisterFlagEffect(22134079,RESET_EVENT+0x57a0000,0,0)
end
function c22134079.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(22134079)~=0
......
......@@ -28,7 +28,7 @@ function c48739166.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterFlagEffect(tp,48739166,RESET_PHASE+PHASE_END,0,1)
end
function c48739166.filter(c)
return c:IsPosition(POS_FACEUP_ATTACK)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAbleToChangeControler()
and not c:IsType(TYPE_TOKEN) and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
end
function c48739166.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -27,12 +27,12 @@ function c49587034.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetRange(LOCATION_REMOVED)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_OPPO_TURN,4)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,4)
e1:SetCondition(c49587034.thcon)
e1:SetOperation(c49587034.thop)
e1:SetLabel(1)
card:RegisterEffect(e1)
e:GetHandler():RegisterFlagEffect(1082946,RESET_PHASE+PHASE_END+RESET_OPPO_TURN,0,3)
e:GetHandler():RegisterFlagEffect(1082946,RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,3)
c49587034[e:GetHandler()]=e1
end
end
......
......@@ -24,12 +24,14 @@ end
function c55713623.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local atk=tc:GetBaseAttack()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(atk/2)
e1:SetValue(c55713623.atkval)
tc:RegisterEffect(e1)
end
end
function c55713623.atkval(e,c)
return c:GetBaseAttack()/2
end
......@@ -5,7 +5,6 @@ function c5851097.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1c1)
e1:SetOperation(c5851097.activate)
c:RegisterEffect(e1)
--disable spsummon
local e2=Effect.CreateEffect(c)
......@@ -15,10 +14,6 @@ function c5851097.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1)
c:RegisterEffect(e2)
end
function c5851097.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(5851097,0))
......@@ -28,14 +23,13 @@ function c5851097.activate(e,tp,eg,ep,ev,re,r,rp)
e3:SetCondition(c5851097.descon)
e3:SetTarget(c5851097.destg)
e3:SetOperation(c5851097.desop)
e3:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e3,true)
c:RegisterEffect(e3)
end
function c5851097.filter(c,tp)
return c:IsPreviousLocation(LOCATION_DECK+LOCATION_ONFIELD) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp)
end
function c5851097.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c5851097.filter,1,nil,tp)
return eg:IsExists(c5851097.filter,1,nil,tp) and e:GetHandler():IsStatus(STATUS_ACTIVATED)
end
function c5851097.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
......
......@@ -23,7 +23,7 @@ function c60645181.operation(e,tp,eg,ep,ev,re,r,rp)
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(c:GetBaseAttack()*2)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,2)
c:RegisterEffect(e1)
......
......@@ -24,6 +24,7 @@ function c62180201.initial_effect(c)
e4:SetCode(EFFECT_SET_ATTACK_FINAL)
e4:SetRange(LOCATION_MZONE)
e4:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_REPEAT)
e4:SetTarget(c62180201.atktg)
e4:SetValue(c62180201.atkval)
c:RegisterEffect(e4)
......
......@@ -9,11 +9,10 @@ function c63422098.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(0)
e1:SetValue(c63422098.val)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENCE)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
......@@ -21,17 +20,17 @@ function c63422098.initial_effect(c)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetOperation(c63422098.regop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c63422098.val(e,c)
local ct=e:GetHandler():GetFlagEffectLabel(63422098)
if not ct then return 0 end
return ct
end
function c63422098.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetSummonType()==SUMMON_TYPE_SYNCHRO then
local ct=c:GetMaterialCount()-1
e:GetLabelObject():SetValue(ct*200)
e:GetLabelObject():GetLabelObject():SetValue(ct*200)
else
e:GetLabelObject():SetValue(0)
e:GetLabelObject():GetLabelObject():SetValue(0)
c:RegisterFlagEffect(63422098,RESET_EVENT+0x1fe0000,0,0,ct*200)
end
end
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