Commit e25b3cf2 authored by Huangnan's avatar Huangnan

Merge branch 'new-fusion-curse-of-dragon' into 'master'

Add ラピッド・トリガー  魔道騎竜カース・オブ・ドラゴン to new fusion and hint opponent materials

See merge request !200
parents 757fcae6 6b7c8c0e
--ラピッド・トリガー
local s,id,o=GetID()
function s.initial_effect(c)
--Activate
local e1=FusionSpell.CreateSummonEffect(c,{
pre_select_mat_location=LOCATION_MZONE,
mat_operation_code_map={
{ [LOCATION_ONFIELD|LOCATION_DECK|LOCATION_EXTRA|LOCATION_HAND] = FusionSpell.FUSION_OPERATION_DESTROY },
{ [LOCATION_GRAVE] = FusionSpell.FUSION_OPERATION_BANISH },
{ [0xff] = FusionSpell.FUSION_OPERATION_GRAVE }
},
extra_target=s.extra_target
})
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_DESTROY)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
end
function s.extra_target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
return true
end
--- if tp is affected by any EFFECT_CHAIN_MATERIAL effect, it can not be chained with Stardust Dragon
local chain_material_effects={Duel.IsPlayerAffectedByEffect(tp,EFFECT_CHAIN_MATERIAL)}
if chain_material_effects~=nil and #chain_material_effects>0 and chain_material_effects[1]~=nil then
return
end
--- FIXME
--- if tp is affected by any EFFECT_EXTRA_FUSION_MATERIAL, and the EFFECT_EXTRA_FUSION_MATERIAL target range is out of LOCATION_FIELD, it can not be chained with Stardust Dragon
--- However, current core does not have a method to get the target range of an Effect, fix this once core provides
--- The same for continues EFFECT_EXTRA_FUSION_MATERIAL like 捕食植物トリアンティス and 魔道騎竜カース・オブ・ドラゴン
--- Otherwise, this spell will guarantee to destroy 2+ monsters from monster zone.
local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,0,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,tp,LOCATION_MZONE)
end
---@type FUSION_SPELL_STAGE_X_CALLBACK_FUNCTION
function s.stage_x_operation(e,tc,tp,stage,mg_fuison_spell,mg_all)
if stage==FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH then
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_CANNOT_DIRECT_ATTACK)
e0:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e0,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET)
e1:SetValue(s.bttg)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(s.immval)
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e2,true)
tc:RegisterFlagEffect(0,RESET_EVENT+RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1))
end
end
function s.bttg(e,c)
return not c:IsSummonLocation(LOCATION_EXTRA)
end
function s.immval(e,te)
local tc=te:GetOwner()
return tc~=e:GetHandler() and te:IsActiveType(TYPE_MONSTER) and te:IsActivated()
and te:GetActivateLocation()==LOCATION_MZONE and tc:IsSummonLocation(LOCATION_EXTRA)
end
--魔道騎竜カース・オブ・ドラゴン
local s,id,o=GetID()
function s.initial_effect(c)
aux.AddCodeList(c,66889139)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR),s.matfilter2,true)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetCondition(s.thcon)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
-- If you Fusion Summon a Level 7 Dragon Fusion Monster, you can also banish monsters from your GY as material.
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_EXTRA_FUSION_MATERIAL)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_GRAVE,0)
e2:SetValue(s.mtval)
e2:SetOperation(function() return FusionSpell.FUSION_OPERATION_BANISH end)
c:RegisterEffect(e2)
end
function s.matfilter2(c)
return c:IsLevelAbove(5) and c:IsRace(RACE_DRAGON)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_FUSION)
end
function s.thfilter(c)
return aux.IsCodeListed(c,66889139) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
function s.mtval(e,c)
return c and c:IsRace(RACE_DRAGON) and c:IsLevel(7) and c:IsControler(e:GetHandlerPlayer())
end
\ No newline at end of file
...@@ -2527,6 +2527,7 @@ function FusionSpell.GetSummonOperation( ...@@ -2527,6 +2527,7 @@ function FusionSpell.GetSummonOperation(
if #sg>0 or can_chain_material==true then if #sg>0 or can_chain_material==true then
local materials=Group.CreateGroup() local materials=Group.CreateGroup()
local fusion_effect=nil local fusion_effect=nil
local fusion_succeeded=false
while #materials==0 do while #materials==0 do
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
...@@ -2675,9 +2676,17 @@ function FusionSpell.GetSummonOperation( ...@@ -2675,9 +2676,17 @@ function FusionSpell.GetSummonOperation(
end end
end end
-- before do the operations to the materials, hint the opponent selected materials
local confirm_materials=materials:Filter(Card.IsLocation,nil,LOCATION_HAND|LOCATION_EXTRA|LOCATION_DECK)
if #confirm_materials>0 then
Duel.ConfirmCards(1-tp,confirm_materials)
end
Duel.HintSelection(materials)
local operated_material_count=0
-- perform operations on grouped materials -- perform operations on grouped materials
for operation,grouped_materials in pairs(material_grouped_by_op) do for operation,grouped_materials in pairs(material_grouped_by_op) do
operation(grouped_materials,tp) operated_material_count=operated_material_count+operation(grouped_materials,tp)
end end
-- mark effect as used once. if count limit reached, reset the effect -- mark effect as used once. if count limit reached, reset the effect
...@@ -2688,8 +2697,13 @@ function FusionSpell.GetSummonOperation( ...@@ -2688,8 +2697,13 @@ function FusionSpell.GetSummonOperation(
end end
end end
Duel.BreakEffect() -- check if all materials are moved successfully (ラピッド・トリガー)
Duel.SpecialSummonStep(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,sumpos) fusion_succeeded=(operated_material_count==#materials)
if fusion_succeeded==true then
Duel.BreakEffect()
Duel.SpecialSummonStep(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,sumpos)
end
else else
--- fusion with chain material --- fusion with chain material
fusion_effect:GetOperation()(e,e,tp,tc,materials,sumtype,sumpos) fusion_effect:GetOperation()(e,e,tp,tc,materials,sumtype,sumpos)
...@@ -2698,13 +2712,18 @@ function FusionSpell.GetSummonOperation( ...@@ -2698,13 +2712,18 @@ function FusionSpell.GetSummonOperation(
if fusion_effect:CheckCountLimit(tp)==false then if fusion_effect:CheckCountLimit(tp)==false then
fusion_effect:Reset() fusion_effect:Reset()
end end
-- for chain material effects as of 2025 May it always succeeds
fusion_succeeded=true
end end
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE,materials_from_spell_card,materials) if fusion_succeeded==true then
Duel.SpecialSummonComplete() stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_SUMMON_COMPLETE,materials_from_spell_card,materials)
stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE,materials_from_spell_card,materials) Duel.SpecialSummonComplete()
tc:CompleteProcedure() stage_x_operation(e,tc,tp,FusionSpell.STAGE_BEFORE_PROCEDURE_COMPLETE,materials_from_spell_card,materials)
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH,materials_from_spell_card,materials) tc:CompleteProcedure()
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_SUMMON_OPERATION_FINISH,materials_from_spell_card,materials)
end
end end
end end
stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_ALL_OPERATION_FINISH) stage_x_operation(e,tc,tp,FusionSpell.STAGE_AT_ALL_OPERATION_FINISH)
......
No preview for this file type
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