Commit a1c6f14c authored by VanillaSalt's avatar VanillaSalt

fix

parent bf8b5779
......@@ -22,6 +22,7 @@ effect::effect() {
description = 0;
effect_owner = PLAYER_NONE;
card_type = 0;
active_type = 0;
id = 0;
code = 0;
type = 0;
......@@ -405,8 +406,13 @@ int32 effect::is_immuned(effect_set_v* effects) {
effect* peffect;
for (int i = 0; i < effects->count; ++i) {
peffect = effects->at(i);
if(peffect->owner == owner)
return FALSE;
if(type & 0x7f0) {
if(peffect->handler == owner)
return FALSE;
} else {
if(peffect->owner == owner)
return FALSE;
}
if(peffect->value) {
pduel->lua->add_param(this, PARAM_TYPE_EFFECT);
if(peffect->check_value_condition(1))
......
......@@ -49,6 +49,7 @@ public:
uint32 label;
uint32 hint_timing[2];
uint32 card_type;
uint32 active_type;
uint16 field_ref;
uint16 status;
void* label_object;
......
......@@ -450,12 +450,17 @@ int32 scriptlib::effect_get_active_type(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
if((peffect->type & EFFECT_TYPE_ACTIVATE) && (peffect->handler->data.type & TYPE_PENDULUM))
lua_pushinteger(L, TYPE_PENDULUM + TYPE_SPELL);
else if(peffect->type & 0x7f0)
lua_pushinteger(L, peffect->card_type);
else
lua_pushinteger(L, peffect->owner->get_type());
uint32 atype;
if(peffect->type & 0x7f0) {
if(peffect->active_type)
atype = peffect->active_type;
else if((peffect->type & EFFECT_TYPE_ACTIVATE) && (peffect->handler->data.type & TYPE_PENDULUM))
atype = TYPE_PENDULUM + TYPE_SPELL;
else
atype = peffect->handler->get_type();
} else
atype = peffect->owner->get_type();
lua_pushinteger(L, atype);
return 1;
}
int32 scriptlib::effect_is_active_type(lua_State *L) {
......@@ -464,11 +469,14 @@ int32 scriptlib::effect_is_active_type(lua_State *L) {
effect* peffect = *(effect**) lua_touserdata(L, 1);
uint32 tpe = lua_tointeger(L, 2);
uint32 atype;
if((peffect->type & EFFECT_TYPE_ACTIVATE) && (peffect->handler->data.type & TYPE_PENDULUM))
atype = TYPE_PENDULUM + TYPE_SPELL;
else if(peffect->type & 0x7f0)
atype = peffect->card_type;
else
if(peffect->type & 0x7f0) {
if(peffect->active_type)
atype = peffect->active_type;
else if((peffect->type & EFFECT_TYPE_ACTIVATE) && (peffect->handler->data.type & TYPE_PENDULUM))
atype = TYPE_PENDULUM + TYPE_SPELL;
else
atype = peffect->handler->get_type();
} else
atype = peffect->owner->get_type();
lua_pushboolean(L, atype & tpe);
return 1;
......
......@@ -4161,9 +4161,10 @@ int32 field::add_chain(uint16 step) {
negeff->reset_flag = RESET_CHAIN | RESET_EVENT | deffect->get_value();
phandler->add_effect(negeff);
}
clit->triggering_effect->card_type = peffect->handler->get_type();
if((clit->triggering_effect->card_type & 0x5) == 0x5)
clit->triggering_effect->card_type -= TYPE_TRAP;
peffect->card_type = peffect->handler->get_type();
if((peffect->card_type & 0x5) == 0x5)
peffect->card_type -= TYPE_TRAP;
peffect->active_type = peffect->card_type;
clit->chain_count = core.current_chain.size() + 1;
clit->target_cards = 0;
clit->target_player = PLAYER_NONE;
......@@ -4427,25 +4428,27 @@ int32 field::solve_chain(uint16 step, uint32 skip_new) {
return FALSE;
}
case 10: {
card* pcard = cait->triggering_effect->handler;
effect* peffect = cait->triggering_effect;
card* pcard = peffect->handler;
if((cait->flag & CHAIN_HAND_EFFECT) && !pcard->is_status(STATUS_IS_PUBLIC) && (pcard->current.location == LOCATION_HAND))
shuffle(pcard->current.controler, LOCATION_HAND);
if(cait->target_cards && cait->target_cards->container.size()) {
for(auto cit = cait->target_cards->container.begin(); cit != cait->target_cards->container.end(); ++cit)
(*cit)->release_relation(cait->triggering_effect);
(*cit)->release_relation(peffect);
}
if((pcard->data.type & TYPE_EQUIP) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE)
if((pcard->data.type & TYPE_EQUIP) && (peffect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->equiping_target && (pcard->current.location == LOCATION_SZONE))
pcard->set_status(STATUS_LEAVE_CONFIRMED, TRUE);
if(core.duel_options & DUEL_OBSOLETE_RULING) {
if((pcard->data.type & TYPE_FIELD) && (cait->triggering_effect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->is_status(STATUS_LEAVE_CONFIRMED) && pcard->is_has_relation(cait->triggering_effect)) {
if((pcard->data.type & TYPE_FIELD) && (peffect->type & EFFECT_TYPE_ACTIVATE)
&& !pcard->is_status(STATUS_LEAVE_CONFIRMED) && pcard->is_has_relation(peffect)) {
card* fscard = player[1 - pcard->current.controler].list_szone[5];
if(fscard && fscard->is_position(POS_FACEUP))
destroy(fscard, 0, REASON_RULE, 1 - pcard->current.controler);
}
}
pcard->release_relation(cait->triggering_effect);
peffect->active_type = 0;
pcard->release_relation(peffect);
if(cait->target_cards)
pduel->delete_group(cait->target_cards);
for(auto oit = cait->opinfos.begin(); oit != cait->opinfos.end(); ++oit) {
......
......@@ -47,7 +47,7 @@ function c16404809.operation(e,tp,eg,ep,ev,re,r,rp)
local sg=g:FilterSelect(tp,c16404809.filter,1,1,nil)
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleHand(p)
Duel.ShuffleHand(tp)
g:Sub(sg)
end
Duel.SendtoGrave(g,REASON_EFFECT+REASON_REVEAL)
......
......@@ -31,8 +31,7 @@ function c18013090.initial_effect(c)
c:RegisterEffect(e3)
end
function c18013090.tfilter(c)
local code=c:GetCode()
return code==96182448 or code==20932152
return c:IsCode(96182448) or c:IsHasEffect(20932152)
end
function c18013090.atop1(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()~=tp or ep~=tp then return end
......
......@@ -59,5 +59,5 @@ function c18027138.splimit(e,c)
return c:IsLocation(LOCATION_EXTRA)
end
function c18027138.atlimit(e,c)
return not c:IsCode(18027138)
return not c:IsCode(18027139)
end
--ガーディアン・デスサイス
function c18175965.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
......
......@@ -9,12 +9,19 @@ function c20932152.initial_effect(c)
e1:SetCondition(c20932152.spcon)
e1:SetOperation(c20932152.spop)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e2:SetValue(c20932152.synlimit)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(20932152)
c:RegisterEffect(e3)
end
function c20932152.synlimit(e,c)
if not c then return false end
......
......@@ -15,8 +15,7 @@ function c2322421.initial_effect(c)
c:RegisterEffect(e1)
end
function c2322421.tfilter(c)
local code=c:GetCode()
return code==71971554 or code==20932152
return c:IsCode(71971554) or c:IsHasEffect(20932152)
end
function c2322421.filter(c,e,tp)
return c:IsLevelBelow(2) and c:IsRace(RACE_WARRIOR+RACE_MACHINE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -61,7 +61,7 @@ function c26400609.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c26400609.hspop(e,tp,eg,ep,ev,re,r,rp,c)
function c26400609.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
......
......@@ -13,7 +13,7 @@ function c27971137.initial_effect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,27971137)
e2:SetCountLimit(1,27971137)
e2:SetCondition(c27971137.spcon)
e2:SetTarget(c27971137.sptg)
e2:SetOperation(c27971137.spop)
......
......@@ -31,7 +31,7 @@ function c33252803.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c33252803.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetRank(),tc.xyz_number)
local g=Duel.SelectMatchingCard(tp,c33252803.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetRank()+1,tc.xyz_number)
local sc=g:GetFirst()
if sc then
local mg=tc:GetOverlayGroup()
......
......@@ -36,8 +36,7 @@ function c3429238.initial_effect(c)
c:RegisterEffect(e3)
end
function c3429238.tfilter(c)
local code=c:GetCode()
return code==56286179 or code==20932152
return c:IsCode(56286179) or c:IsHasEffect(20932152)
end
function c3429238.datcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1
......
......@@ -3,7 +3,7 @@ function c35329581.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,35329581+EFFECT_COUNT_CODE_OATH)
......
......@@ -28,8 +28,7 @@ function c37993923.initial_effect(c)
c:RegisterEffect(e2)
end
function c37993923.tfilter(c)
local code=c:GetCode()
return code==63977008 or code==20932152
return c:IsCode(63977008) or c:IsHasEffect(20932152)
end
function c37993923.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end
......
......@@ -26,6 +26,7 @@ function c4239451.initial_effect(c)
e3:SetRange(LOCATION_MZONE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetCountLimit(1)
e3:SetCondition(c4239451.adcon2)
e3:SetTarget(c4239451.adtg2)
e3:SetOperation(c4239451.adop2)
c:RegisterEffect(e3)
......@@ -61,6 +62,9 @@ function c4239451.adop1(e,tp,eg,ep,ev,re,r,rp)
tc:RegisterEffect(e2)
end
end
function c4239451.adcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_BATTLE and Duel.GetCurrentChain()==0
end
function c4239451.adtg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c4239451.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c4239451.filter,tp,LOCATION_MZONE,0,1,nil) end
......
......@@ -16,8 +16,7 @@ function c42810973.initial_effect(c)
c:RegisterEffect(e1)
end
function c42810973.tfilter(c)
local code=c:GetCode()
return code==63977008 or code==20932152
return c:IsCode(63977008) or c:IsHasEffect(20932152)
end
function c42810973.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToRemove() end
......
......@@ -18,8 +18,7 @@ function c45037489.initial_effect(c)
c:RegisterEffect(e1)
end
function c45037489.tfilter(c)
local code=c:GetCode()
return code==19642774 or code==20932152
return c:IsCode(19642774) or c:IsHasEffect(20932152)
end
function c45037489.discon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and rp~=tp and tp==Duel.GetTurnPlayer()
......
......@@ -21,6 +21,8 @@ function c45462639.initial_effect(c)
--attackup
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(c45462639.attackup)
c:RegisterEffect(e3)
......@@ -57,7 +59,7 @@ function c45462639.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x3001,2,REASON_COST) end
e:GetHandler():RemoveCounter(tp,0x3001,2,REASON_COST)
end
function c45462639.destarg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c45462639.destarg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end
Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1)
end
......
......@@ -22,8 +22,7 @@ function c46195773.initial_effect(c)
c:RegisterEffect(e2)
end
function c46195773.tfilter(c)
local code=c:GetCode()
return code==67270095 or code==20932152
return c:IsCode(67270095) or c:IsHasEffect(20932152)
end
function c46195773.efilter(e,re)
return re:GetHandler():IsLevelBelow(6)
......
......@@ -62,7 +62,7 @@ function c53804307.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c53804307.hspop(e,tp,eg,ep,ev,re,r,rp,c)
function c53804307.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
......
......@@ -26,8 +26,7 @@ function c59771339.initial_effect(c)
c:RegisterEffect(e2)
end
function c59771339.tfilter(c)
local code=c:GetCode()
return code==63977008 or code==20932152
return c:IsCode(63977008) or c:IsHasEffect(20932152)
end
function c59771339.cfilter(c)
return c:IsSetCard(0x43) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
......
......@@ -14,15 +14,13 @@ function c60800381.initial_effect(c)
c:RegisterEffect(e1)
end
function c60800381.tfilter(c)
local code=c:GetCode()
return code==63977008 or code==20932152
return c:IsCode(63977008) or c:IsHasEffect(20932152)
end
function c60800381.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c60800381.filter(c)
local lv=c:GetLevel()
return lv>0 and lv<=2 and c:IsFaceup()
return c:IsFaceup() and c:IsLevelBelow(2)
end
function c60800381.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -41,7 +41,7 @@ function c63504681.initial_effect(c)
e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e5:SetRange(LOCATION_MZONE)
e5:SetCode(EFFECT_IMMUNE_EFFECT)
e5:SetValue(c63504681.efilter)
e5:SetValue(1)
e5:SetCondition(c63504681.effcon)
e5:SetLabel(3)
c:RegisterEffect(e5)
......@@ -84,9 +84,6 @@ end
function c63504681.effcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetOverlayCount()>=e:GetLabel()
end
function c63504681.efilter(e,te)
return te:GetHandler()~=e:GetHandler()
end
function c63504681.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_ONFIELD,nil)
......
......@@ -37,6 +37,7 @@ function c64726269.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
local sg=Duel.GetMatchingGroup(c64726269.tdfilter,tp,LOCATION_GRAVE,0,nil)
if sg:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(64726269,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local tg=sg:Select(tp,1,1,nil)
Duel.SendtoDeck(tg,nil,0,REASON_EFFECT)
......
......@@ -16,8 +16,7 @@ function c74860293.initial_effect(c)
c:RegisterEffect(e1)
end
function c74860293.tfilter(c)
local code=c:GetCode()
return code==63977008 or code==20932152
return c:IsCode(63977008) or c:IsHasEffect(20932152)
end
function c74860293.con(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
......
......@@ -61,7 +61,7 @@ function c89399912.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c89399912.hspop(e,tp,eg,ep,ev,re,r,rp,c)
function c89399912.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
......
......@@ -62,7 +62,7 @@ function c90411554.hsptg(e,tp,eg,ep,ev,re,r,rp,chk)
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c90411554.hspop(e,tp,eg,ep,ev,re,r,rp,c)
function c90411554.hspop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
......
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