Commit 4e846bba authored by xiaoye's avatar xiaoye

需要两张卡才能防御

parent 397fd75e
......@@ -330,7 +330,6 @@ function VgD.MonsterBattle(c)
c:RegisterEffect(e7)
local e17=e7:Clone()
e17:SetRange(LOCATION_HAND)
e17:SetCost(VgD.SendToGCost)
e17:SetCondition(VgD.SendToGCondition(LOCATION_HAND))
c:RegisterEffect(e17)
local e8=Effect.CreateEffect(c)
......@@ -463,16 +462,6 @@ function VgD.SupportValue(e)
return 0
end
end
function VgD.SendToGCost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,OAFFECT_CODE_SENDTOG) or VgF.IsExistingMatchingCard(nil,tp,LOCATION_GZONE,0,1,nil) or VgF.IsExistingMatchingCard(VgF.IsAbleToGZone,tp,LOCATION_HAND,0,1,c,LOCATION_HAND) end
if Duel.IsPlayerAffectedByEffect(tp,OAFFECT_CODE_SENDTOG) and not VgF.IsExistingMatchingCard(nil,tp,LOCATION_GZONE,0,1,nil) then
local tc=Duel.SelectMatchingCard(tp,VgF.IsAbleToGZone,tp,LOCATION_HAND,0,1,1,c,LOCATION_HAND)
tc=VgF.ReturnCard(tc)
Duel.ConfirmCards(1-tp,tc)
e:SetLabelObject(tc)
end
end
function VgD.SendToGCondition(loc)
return function(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......@@ -482,13 +471,7 @@ function VgD.SendToGCondition(loc)
end
function VgD.SendToGOperation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=e:GetLabelObject()
local g=Group.FromCards(c)
if tc then
tc=VgF.ReturnCard(tc)
g:AddCard(tc)
end
VgF.Sendto(LOCATION_GZONE,g,tp,POS_FACEUP,REASON_EFFECT)
VgF.Sendto(LOCATION_GZONE,c,tp,POS_FACEUP,REASON_EFFECT)
end
function VgD.GToGraveOperation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_GZONE,0)
......
......@@ -723,30 +723,28 @@ OPCODE_ISATTRIBUTE =0x40000104
DOUBLE_DAMAGE =-2147483648
HALF_DAMAGE =-2147483647
--Hint Message --提示消息,显示在窗口的上面
HINTMSG_RELEASE =500
HINTMSG_LEAVEONFIELD =500 --请选择要退场的卡
HINTMSG_DISCARD =501 --请选择要丢弃的手牌
HINTMSG_DESTROY =502 --
HINTMSG_IMPRISON =502 --请选择要收容的卡
HINTMSG_REMOVE =503 --请选择要除外的卡
HINTMSG_TOGRAVE =504 --
HINTMSG_TODROP =504 --请选择要置入弃牌区的卡
HINTMSG_RTOHAND =505 --请选择要返回手牌的卡
HINTMSG_ATOHAND =506 --请选择要加入手牌的卡
HINTMSG_TODECK =507 --请选择要返回卡组的卡
HINTMSG_SUMMON =508 --
HINTMSG_CALL =508 --请选择要Call到圆阵的卡
HINTMSG_SPSUMMON =509 --请选择要特殊召唤的卡
HINTMSG_SET =510 --
HINTMSG_FMATERIAL =511 --
HINTMSG_SMATERIAL =512 --
HINTMSG_DAMAGE =510 --请选择要消耗的费用
HINTMSG_ATKUP =511 --请选择力量上升的卡
HINTMSG_CRITICAL_STRIKE =512 --请选择☆值上升的卡
HINTMSG_FACEUP =514 --请选择表侧表示的卡
HINTMSG_FACEDOWN =515 --请选择里侧表示的卡
HINTMSG_ATTACK =516 --请选择攻击表示的怪兽
HINTMSG_DEFENSE =517 --请选择守备表示的怪兽
HINTMSG_EQUIP =518 --请选择要装备的卡
HINTMSG_REMOVEXYZ =519 --请选择要取除的超量素材
HINTMSG_CONTROL =520 --请选择要改变控制权的怪兽
HINTMSG_DESREPLACE =521 --请选择要代替破坏的卡
HINTMSG_FACEUPATTACK =522 --
HINTMSG_FACEUPDEFENSE =523 --
HINTMSG_FACEDOWNATTACK =524 --
HINTMSG_TO_GZONE =519 --请选择要CALL到防卫者圆阵的卡
HINTMSG_VMONSTER =522 --请选择先导者
HINTMSG_RMONSTER =523 --请选择后防者
HINTMSG_MONSTER =524 --请选择单位
HINTMSG_FACEDOWNDEFENSE =525 --请选择里侧守备表示的怪兽
HINTMSG_CONFIRM =526 --请选择给对方确认的卡
HINTMSG_TOFIELD =527 --请选择要放置到场上的卡
......@@ -779,16 +777,7 @@ HINTMSG_TOTOP =572 --请选择要放置到牌堆顶的卡
HINTMSG_DISABLE =573 --请选择要无效的卡
HINTMSG_OPERATECARD =574 --请选择要操作的卡
HINTMSG_XMATERIAL =513 --请选择要充入魂中的卡
HINTMSG_LEAVEONFIELD =HINTMSG_RELEASE --请选择要退场的卡
HINTMSG_TODROP =HINTMSG_TOGRAVE --请选择要置入弃牌区的卡
HINTMSG_CALL =HINTMSG_SUMMON --请选择要Call到圆阵的卡
HINTMSG_DAMAGE =HINTMSG_SET --请选择要消耗的费用
HINTMSG_ATKUP =HINTMSG_FMATERIAL --请选择力量上升的卡
HINTMSG_CRITICAL_STRIKE =HINTMSG_SMATERIAL --请选择☆值上升的卡
HINTMSG_IMPRISON =HINTMSG_DESTROY --请选择要收容的卡
HINTMSG_VMONSTER =HINTMSG_FACEUPATTACK --请选择先导者
HINTMSG_RMONSTER =HINTMSG_FACEUPDEFENSE --请选择后防者
HINTMSG_MONSTER =HINTMSG_FACEDOWNATTACK --请选择单位
--Select --请选择
SELECT_HEADS =60 --正面
SELECT_TAILS =61 --反面
......@@ -875,10 +864,9 @@ ImprisonFlag =VgID+7 --被收容
--AffectedByEffect
AFFECT_CODE_MIX =VgID --魔合成
AFFECT_CODE_MIX_DIFFERENT_NAME =VgID+1 --魔合成(卡名不同)
AFFECT_CODE_SENDTOG =VgID+2 --需要两张卡才能防御
AFFECT_CODE_BOTH_WING =VgID+2 --你的卡片的白翼能力和黑翼能力两方均有效
AFFECT_CODE_NIGHT =VgID+3 --黑夜
AFFECT_CODE_DEEP_NIGHT =VgID+4 --深渊黑夜
AFFECT_CODE_BOTH_WING =VgID+5 --你的卡片的白翼能力和黑翼能力两方均有效
AFFECT_CODE_OVERLAY_INSTEAD_WHEN_RIDE =10501082 --不执行『选择手牌中的1张卡,舍弃』而是执行『灵魂爆发1』来将卡RIDE
......
......@@ -673,7 +673,7 @@ function VgF.SearchCard(loc_to,loc_from,f,int_max,int_min)
local rc=VgF.GetVMonster(tp)
return VgF.Sendto(loc_to,g,rc)
end
elseif loc_to|0xf800>0 then
elseif bit.band(loc_to,0xf800)>0 then
local g=VgF.SelectMatchingCard(HINTMSG_CALL,e,tp,function (c)
return VgF.GetValueType(f)~="function" or f(c)
end,tp,loc_from,0,int_min,int_max,nil)
......@@ -817,12 +817,12 @@ function VgF.EffectResetOperation(e,tp,eg,ep,ev,re,r,rp)
end
function VgF.IsExistingMatchingCard(f,tp,loc_self,loc_op,int,except_g,...)
local g=Group.CreateGroup()
if loc_self|LOCATION_MZONE>0 then
if bit.band(loc_self,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
loc_self=loc_self-LOCATION_MZONE
if g1:GetCount()>0 then g:Merge(g1) end
end
if loc_op|LOCATION_MZONE>0 then
if bit.band(loc_op,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
loc_op=loc_op-LOCATION_MZONE
if g1:GetCount()>0 then g:Merge(g1) end
......@@ -838,21 +838,21 @@ function VgF.IsExistingMatchingCard(f,tp,loc_self,loc_op,int,except_g,...)
end
function VgF.SelectMatchingCard(hintmsg,e,select_tp,f,tp,loc_self,loc_op,int_min,int_max,except_g,...)
local a=false
if ((select_tp==tp and loc_self|LOCATION_DECK>0) or (select_tp~=tp and loc_op|LOCATION_DECK>0)) and Duel.SelectYesNo(select_tp,VgF.Stringid(VgID,13)) then
if ((select_tp==tp and bit.band(loc_self,LOCATION_DECK)>0) or (select_tp~=tp and bit.band(loc_op,LOCATION_DECK)>0)) and Duel.SelectYesNo(select_tp,VgF.Stringid(VgID,13)) then
local g=Duel.GetFieldGroup(select_tp,LOCATION_DECK,0)
Duel.DisableShuffleCheck()
Duel.ConfirmCards(select_tp,g)
a=true
end
local g=Group.CreateGroup()
if loc_self|LOCATION_MZONE>0 then
if bit.band(loc_self,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(function (c)
return c:IsCanBeEffectTarget(e) and c:IsFaceup()
end,tp,LOCATION_MZONE,0,nil)
loc_self=loc_self-LOCATION_MZONE
if g1:GetCount()>0 then g:Merge(g1) end
end
if loc_op|LOCATION_MZONE>0 then
if bit.band(loc_op,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(function (c)
return c:IsCanBeEffectTarget(e) and c:IsFaceup()
end,tp,0,LOCATION_MZONE,nil)
......@@ -883,12 +883,12 @@ function VgF.GetMatchingGroupCount(f,tp,loc_self,loc_op,except_g,...)
end
function VgF.GetMatchingGroup(f,tp,loc_self,loc_op,except_g,...)
local g=Group.CreateGroup()
if loc_self|LOCATION_MZONE>0 then
if bit.band(loc_self,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
loc_self=loc_self-LOCATION_MZONE
if g1:GetCount()>0 then g:Merge(g1) end
end
if loc_op|LOCATION_MZONE>0 then
if bit.band(loc_op,LOCATION_MZONE)>0 then
local g1=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
loc_op=loc_op-LOCATION_MZONE
if g1:GetCount()>0 then g:Merge(g1) end
......
local cm,m,o=GetID()
function cm.initial_effect(c)
vgf.VgCard(c)
vgd.EffectTypeTrigger(c,m,nil,EFFECT_TYPE_SINGLE,EVENT_SPSUMMON_SUCCESS,cm.op)
end
--对手要从手牌将卡CALL到G上之际,不将2张以上同时CALL的话则不能CALL出场。
function cm.op(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_ACTIVATE_COST)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(0,1)
e1:SetTarget(cm.costtg)
e1:SetCost(cm.costchk)
e1:SetOperation(cm.costop)
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
function cm.costtg(e,re,tp)
e:SetLabelObject(re:GetHandler())
return re:IsHasCategory(CATEGORY_DEFENDER) and re:GetHandler():IsLocation(LOCATION_HAND) and re:GetHandlerPlayer()==tp and not vgf.IsExistingMatchingCard(nil,tp,LOCATION_GZONE,0,1,nil)
end
function cm.costchk(e,re,tp)
return vgf.IsExistingMatchingCard(vgf.IsAbleToGZone,tp,LOCATION_HAND,0,1,re:GetHandler(),LOCATION_HAND)
end
function cm.costop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetLabelObject()
local g=vgf.SelectMatchingCard(HINTMSG_TO_GZONE,e,tp,vgf.IsAbleToGZone,tp,LOCATION_HAND,0,1,1,c,LOCATION_HAND)
vgf.Sendto(LOCATION_GZONE,g,tp,POS_FACEUP,REASON_EFFECT)
end
\ No newline at end of file
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