Commit 4b2230a7 authored by argon.sun's avatar argon.sun

Merge branch 'master' of github.com:Fluorohydride/ygopro

parents 89910b3e 8d9f0195
......@@ -1662,7 +1662,8 @@ int32 card::is_setable_mzone(uint8 playerid, uint8 ignore_count, effect* peffect
}
eset.clear();
int32 res = filter_set_procedure(playerid, &eset, ignore_count);
if((peffect && res < 0) || (!peffect && (!res || res == -2) && !eset.count) ) {
if((peffect && res < 0) || (!peffect && (!res || res == -2) && !eset.count)
|| (peffect && (eset.count == 0) && !pduel->game_field->is_player_can_mset(peffect->get_value(), playerid, this))) {
pduel->game_field->restore_lp_cost();
return FALSE;
}
......
......@@ -2001,7 +2001,7 @@ int32 field::special_summon(uint16 step, effect * reason_effect, uint8 reason_pl
raise_single_event(*cit, 0, EVENT_SPSUMMON_SUCCESS, (*cit)->current.reason_effect, 0, (*cit)->current.reason_player, (*cit)->summon_player, 0);
int32 summontype = (*cit)->summon_type & 0xff000000;
if(summontype && (*cit)->material_cards.size()) {
int32 matreason = (summontype == SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype == SUMMON_TYPE_RITUAL) ? REASON_RITUAL : 0;
int32 matreason = (summontype == SUMMON_TYPE_FUSION) ? REASON_FUSION : (summontype == SUMMON_TYPE_RITUAL) ? REASON_RITUAL : (summontype == SUMMON_TYPE_XYZ) ? REASON_XYZ : 0;
for(auto mit = (*cit)->material_cards.begin(); mit != (*cit)->material_cards.end(); ++mit)
raise_single_event(*mit, 0, EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
raise_event(&((*cit)->material_cards), EVENT_BE_MATERIAL, core.reason_effect, matreason, core.reason_player, (*cit)->summon_player, 0);
......
......@@ -21,8 +21,8 @@ function c12735388.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c12735388.discon)
e3:SetOperation(c12735388.disop)
e3:SetCondition(c12735388.discon1)
e3:SetOperation(c12735388.disop1)
c:RegisterEffect(e3)
end
function c12735388.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......@@ -38,20 +38,36 @@ function c12735388.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c12735388.discon(e,tp,eg,ep,ev,re,r,rp)
function c12735388.discon1(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
return ec and (ec==Duel.GetAttacker() or ec==Duel.GetAttackTarget()) and ec:GetBattleTarget():IsFaceup()
return ec and (ec==Duel.GetAttacker() or ec==Duel.GetAttackTarget())
end
function c12735388.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetEquipTarget():GetBattleTarget()
local e1=Effect.CreateEffect(e:GetHandler())
function c12735388.disop1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetEquipTarget():GetBattleTarget()
c:CreateRelation(tc,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
e1:SetCondition(c12735388.discon2)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_SZONE)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE)
tc:RegisterEffect(e2)
e2:SetOperation(c12735388.disop2)
e2:SetLabelObject(tc)
c:RegisterEffect(e2)
end
function c12735388.discon2(e)
return e:GetOwner():IsRelateToCard(e:GetHandler())
end
function c12735388.disop2(e,tp,eg,ep,ev,re,r,rp)
local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
if loc==LOCATION_MZONE and re:GetHandler()==e:GetLabelObject() then
Duel.NegateEffect(ev)
end
end
......@@ -26,7 +26,7 @@ function c131182.initial_effect(c)
c:RegisterEffect(e4)
--spsummon
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_BATTLE_DESTROYED)
e5:SetOperation(c131182.battleop)
c:RegisterEffect(e5)
......
......@@ -7,7 +7,7 @@ function c1412158.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(1412158,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e1:SetCondition(c1412158.atkcon)
......
......@@ -2,6 +2,7 @@
function c20057949.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
......@@ -45,42 +46,33 @@ function c20057949.condition(e,tp,eg,ep,ev,re,r,rp)
end
function c20057949.activate(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetLabel(Duel.GetTurnCount())
e1:SetCondition(c20057949.spcon1)
e1:SetOperation(c20057949.spop1)
e1:SetReset(RESET_PHASE+PHASE_END,3)
e1:SetCondition(c20057949.spcon)
e1:SetTarget(c20057949.sptg)
e1:SetOperation(c20057949.spop)
if Duel.GetTurnPlayer()==tp then
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,2)
else
e1:SetReset(RESET_PHASE+PHASE_END+RESET_SELF_TURN,1)
end
Duel.RegisterEffect(e1,tp)
end
function c20057949.filter(c,e,tp)
return c:IsSetCard(0x31) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c20057949.spcon1(e,tp,eg,ep,ev,re,r,rp)
function c20057949.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnCount()~=e:GetLabel() and Duel.GetTurnPlayer()==tp
end
function c20057949.spop1(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c20057949.filter,tp,LOCATION_HAND,0,1,nil,e,tp)
and Duel.SelectYesNo(tp,aux.Stringid(20057949,0)) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(20057949,1))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetTarget(c20057949.sptg2)
e1:SetOperation(c20057949.spop2)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c20057949.filter(c,e,tp)
return c:IsSetCard(0x31) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c20057949.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND)
function c20057949.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c20057949.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function c20057949.spop2(e,tp,eg,ep,ev,re,r,rp)
function c20057949.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
if ft>2 then ft=2 end
......
......@@ -24,6 +24,7 @@ function c34029630.initial_effect(c)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetCountLimit(1)
e3:SetCondition(c34029630.condition)
e3:SetTarget(c34029630.target2)
e3:SetOperation(c34029630.operation)
c:RegisterEffect(e3)
......@@ -46,7 +47,7 @@ function c34029630.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
local c=e:GetHandler()
c:AddCounter(0x3001,3)
if c:IsCanRemoveCounter(tp,0x3001,1,REASON_EFFECT)
if Duel.GetTurnPlayer()==tp and c:IsCanRemoveCounter(tp,0x3001,1,REASON_EFFECT)
and Duel.IsExistingTarget(c34029630.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler())
and Duel.SelectYesNo(tp,aux.Stringid(34029630,0)) then
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
......@@ -66,6 +67,9 @@ function c34029630.operation(e,tp,eg,ep,ev,re,r,rp)
tc:AddCounter(0x3001,1)
end
end
function c34029630.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c34029630.filter(c)
return c:IsFaceup() and c:IsCanAddCounter(0x3001,1)
end
......
......@@ -27,7 +27,7 @@ function c34149830.condition(e,tp,eg,ep,ev,re,r,rp)
and ((tc:IsDefencePos() and tc:GetDefence()<bc:GetAttack()) or (tc:IsAttackPos() and tc:GetAttack()<=bc:GetAttack()))
end
function c34149830.spfilter(c,e,tp)
return c:GetLevel()==4 and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c34149830.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING)
......
......@@ -21,7 +21,7 @@ function c59509952.initial_effect(c)
--redirect
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_TO_GRAVE_REDIRECT)
e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e3:SetCondition(c59509952.recon)
e3:SetValue(LOCATION_DECK)
c:RegisterEffect(e3)
......@@ -45,7 +45,7 @@ function c59509952.spcon(e,c)
end
function c59509952.recon(e)
local c=e:GetHandler()
return c:IsOnField() and c:IsFaceup()
return c:IsFaceup() and c:GetDestination()==LOCATION_GRAVE
end
function c59509952.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1
......
......@@ -17,28 +17,14 @@ function c61314842.xyzfilter(c,mg)
if c.xyz_count~=2 then return false end
return c:IsXyzSummonable(mg)
end
function c61314842.mfilter1(c,exg)
return exg:IsExists(c61314842.mfilter2,1,nil,c)
end
function c61314842.mfilter2(c,mc)
return c.xyz_filter(mc)
end
function c61314842.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local mg=Duel.GetMatchingGroup(c61314842.filter,tp,LOCATION_GRAVE,0,nil,e,tp)
if chk==0 then return (not Duel.IsPlayerAffectedByEffect(tp,23516703) or c23516703[tp]==0)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and mg:GetCount()>1
and Duel.IsExistingMatchingCard(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end
local exg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg1=mg:FilterSelect(tp,c61314842.mfilter1,1,1,nil,exg)
local tc1=sg1:GetFirst()
local exg2=exg:Filter(c61314842.mfilter2,nil,tc1)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingTarget(c61314842.filter,tp,LOCATION_GRAVE,0,2,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg2=mg:FilterSelect(tp,c61314842.mfilter1,1,1,tc1,exg2)
sg1:Merge(sg2)
Duel.SetTargetCard(sg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg1,2,0,0)
local g=Duel.SelectTarget(tp,c61314842.filter,tp,LOCATION_GRAVE,0,2,2,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0)
end
function c61314842.filter2(c,e,tp)
return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......@@ -48,12 +34,14 @@ function c61314842.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c61314842.filter2,nil,e,tp)
if g:GetCount()<2 then return end
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.BreakEffect()
local xyzg=Duel.GetMatchingGroup(c61314842.xyzfilter,tp,LOCATION_EXTRA,0,nil,g)
if xyzg:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xyz=xyzg:Select(tp,1,1,nil):GetFirst()
Duel.XyzSummon(tp,xyz,g)
xyz:SetMaterial(g)
Duel.Overlay(xyz,g)
Duel.SpecialSummon(xyz,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -7,7 +7,7 @@ function c75923050.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(75923050,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE)
e1:SetCondition(c75923050.atkcon)
......
......@@ -24,5 +24,6 @@ function c76972801.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
Duel.RegisterEffect(e2,tp)
end
......@@ -26,5 +26,5 @@ function c7935043.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.RegisterEffect(e1,tp)
end
function c7935043.tg(e,c)
return c:GetLevel()<=3 and c:IsAttribute(ATTRIBUTE_WATER)
return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER)
end
......@@ -23,7 +23,7 @@ function c86016245.drcon(e,tp,eg,ep,ev,re,r,rp)
local bc=tc:GetBattleTarget()
return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 and eg:GetCount()==1
and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE)
and bc:IsRelateToBattle() and bc:IsType(TYPE_NORMAL) and bc:IsLevelBelow(2)
and bc:IsRelateToBattle() and bc:IsLevelBelow(2)
end
function c86016245.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) 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