Commit 1ff6ef26 authored by VanillaSalt's avatar VanillaSalt

fix script

parent 2db8e3e2
......@@ -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;
}
......
......@@ -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
......
......@@ -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
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