diff --git a/deprecated_functions.lua b/deprecated_functions.lua index 907420f08c..04ee204068 100644 --- a/deprecated_functions.lua +++ b/deprecated_functions.lua @@ -34,6 +34,20 @@ end --Functions deprecated since version 41.0: make_deprecated_function_no_replacement("Duel.GetEnvironment", "You should use Duel.IsEnvironment to check if a field spell is active on the field.") make_deprecated_function_no_replacement("Duel.GetTributeCount", "You should use Duel.CheckTribute and relative functions to check if a monster can be tribute summoned.") +make_deprecated_function_alias("Auxiliary.selfbanishcost","Cost.SelfBanish") +make_deprecated_function_alias("Auxiliary.SelfBanishCost","Cost.SelfBanish") +make_deprecated_function_alias("Auxiliary.DiscardCost","Cost.Discard") +make_deprecated_function_alias("Auxiliary.dxmcostgen","Cost.Detach") +make_deprecated_function_alias("Auxiliary.selfreleasecost","Cost.SelfRelease") +make_deprecated_function_alias("Auxiliary.SelfReleaseCost","Cost.SelfRelease") +make_deprecated_function_alias("Auxiliary.SelfTributeCost","Cost.SelfRelease") +make_deprecated_function_alias("Auxiliary.SelfToGraveCost","Cost.SelfToGrave") +make_deprecated_function_alias("Auxiliary.SelfToHandCost","Cost.SelfToHand") +make_deprecated_function_alias("Auxiliary.SelfToDeckCost","Cost.SelfToDeck") +make_deprecated_function_alias("Auxiliary.SelfToExtraCost","Cost.SelfToExtra") +make_deprecated_function_alias("Auxiliary.SelfDiscardCost","Cost.SelfDiscard") +make_deprecated_function_alias("Auxiliary.SelfDiscardToGraveCost","Cost.SelfDiscardToGrave") +make_deprecated_function_alias("Auxiliary.SelfRevealCost","Cost.SelfReveal") --Functions deprecated since version 40.0 and deleted in 41.0: make_deleted_replaced_function("Auxiliary.AskAny","Duel.AskAny") diff --git a/pre-release/c101301042.lua b/pre-release/c101301042.lua index 3bad0231da..83050ba322 100644 --- a/pre-release/c101301042.lua +++ b/pre-release/c101301042.lua @@ -43,7 +43,7 @@ function s.initial_effect(c) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(s.ctcon) - e5:SetCost(aux.dxmcostgen(1,1,nil)) + e5:SetCost(Cost.Detach(1)) e5:SetTarget(s.cttg) e5:SetOperation(s.ctop) c:RegisterEffect(e5,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/pre-release/c101301043.lua b/pre-release/c101301043.lua index f492d602eb..a69cef9132 100644 --- a/pre-release/c101301043.lua +++ b/pre-release/c101301043.lua @@ -14,7 +14,7 @@ function s.initial_effect(c) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsSetCard,1,nil,{SET_ZUBABA,SET_GAGAGA,SET_GOGOGO,SET_DODODO}) end) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/pre-release/c101301044.lua b/pre-release/c101301044.lua index cf4dbfe6c6..2ed899670d 100644 --- a/pre-release/c101301044.lua +++ b/pre-release/c101301044.lua @@ -15,7 +15,7 @@ function s.initial_effect(c) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN) e1:SetCondition(s.atkcon) - e1:SetCost(aux.dxmcostgen(2,2,nil)) + e1:SetCost(Cost.Detach(2)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c111011904.lua b/unofficial/c111011904.lua index 508facd114..314a064e54 100644 --- a/unofficial/c111011904.lua +++ b/unofficial/c111011904.lua @@ -24,7 +24,7 @@ function s.initial_effect(c) e2:SetHintTiming(0,TIMING_STANDBY_PHASE+TIMINGS_CHECK_MONSTER) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.actg) e2:SetOperation(s.acop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000041.lua b/unofficial/c511000041.lua index 855daf0ebc..594caf441f 100644 --- a/unofficial/c511000041.lua +++ b/unofficial/c511000041.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.cacon) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.catg) e2:SetOperation(s.caop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000183.lua b/unofficial/c511000183.lua index f030c76668..935d0587f2 100644 --- a/unofficial/c511000183.lua +++ b/unofficial/c511000183.lua @@ -30,7 +30,7 @@ function s.initial_effect(c) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_CHAINING) e3:SetCondition(s.negcon) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.negtg) e3:SetOperation(s.negop) c:RegisterEffect(e3,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000230.lua b/unofficial/c511000230.lua index d4e9f16ff1..474adf6a53 100644 --- a/unofficial/c511000230.lua +++ b/unofficial/c511000230.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLED) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000231.lua b/unofficial/c511000231.lua index 1155847452..1b6178a616 100644 --- a/unofficial/c511000231.lua +++ b/unofficial/c511000231.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLED) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000232.lua b/unofficial/c511000232.lua index cc9210266e..1c05b9c671 100644 --- a/unofficial/c511000232.lua +++ b/unofficial/c511000232.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLED) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000233.lua b/unofficial/c511000233.lua index 3d44723202..d82dbbe0be 100644 --- a/unofficial/c511000233.lua +++ b/unofficial/c511000233.lua @@ -10,7 +10,7 @@ function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLED) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511000277.lua b/unofficial/c511000277.lua index c2ca4b57d2..a08d676179 100644 --- a/unofficial/c511000277.lua +++ b/unofficial/c511000277.lua @@ -93,7 +93,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.damcon) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) e1:SetLabel(e:GetLabel()) diff --git a/unofficial/c511000369.lua b/unofficial/c511000369.lua index 3014f7b419..adb64b4604 100644 --- a/unofficial/c511000369.lua +++ b/unofficial/c511000369.lua @@ -43,7 +43,7 @@ function s.initial_effect(c) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetCountLimit(1) e4:SetRange(LOCATION_MZONE) - e4:SetCost(aux.dxmcostgen(1,1,nil)) + e4:SetCost(Cost.Detach(1)) e4:SetOperation(s.regop) c:RegisterEffect(e4,false,REGISTER_FLAG_DETACH_XMAT) --Cannot be destroyed by battle diff --git a/unofficial/c511000675.lua b/unofficial/c511000675.lua index 184eecfec3..5eea23d8ae 100644 --- a/unofficial/c511000675.lua +++ b/unofficial/c511000675.lua @@ -12,7 +12,7 @@ function s.initial_effect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511001371.lua b/unofficial/c511001371.lua index f4744a822d..9f115aaceb 100644 --- a/unofficial/c511001371.lua +++ b/unofficial/c511001371.lua @@ -31,7 +31,7 @@ function s.initial_effect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCountLimit(1) e3:SetRange(LOCATION_MZONE) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.cttg) e3:SetOperation(s.ctop) --destroy diff --git a/unofficial/c511001372.lua b/unofficial/c511001372.lua index f1018b2b36..165380f8b4 100644 --- a/unofficial/c511001372.lua +++ b/unofficial/c511001372.lua @@ -30,7 +30,7 @@ function s.initial_effect(c) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.target) e3:SetOperation(s.operation) --win diff --git a/unofficial/c511001374.lua b/unofficial/c511001374.lua index bd70e27cac..5567c5f4a3 100644 --- a/unofficial/c511001374.lua +++ b/unofficial/c511001374.lua @@ -19,7 +19,7 @@ function s.initial_effect(c) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(TIMING_BATTLE_PHASE,TIMING_BATTLE_PHASE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.efftg) e2:SetOperation(s.effop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511001429.lua b/unofficial/c511001429.lua index d250601761..7b8ef42b91 100644 --- a/unofficial/c511001429.lua +++ b/unofficial/c511001429.lua @@ -21,7 +21,7 @@ function s.initial_effect(c) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.tg) e2:SetOperation(s.op) --indes diff --git a/unofficial/c511001430.lua b/unofficial/c511001430.lua index 24ddadf97a..83f15ecd93 100644 --- a/unofficial/c511001430.lua +++ b/unofficial/c511001430.lua @@ -25,7 +25,7 @@ function s.initial_effect(c) e2:SetCode(511001265) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.damcon) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511001431.lua b/unofficial/c511001431.lua index b919ae9cc5..6ba1c9c1b5 100644 --- a/unofficial/c511001431.lua +++ b/unofficial/c511001431.lua @@ -30,7 +30,7 @@ function s.initial_effect(c) e3:SetCategory(CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.distg) e3:SetOperation(s.disop) local e4=Effect.CreateEffect(c) diff --git a/unofficial/c511001777.lua b/unofficial/c511001777.lua index 0b57a5f818..b260ce984f 100644 --- a/unofficial/c511001777.lua +++ b/unofficial/c511001777.lua @@ -45,7 +45,7 @@ function s.initial_effect(c) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(s.spcon) - e5:SetCost(aux.dxmcostgen(1,1,nil)) + e5:SetCost(Cost.Detach(1)) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) -- diff --git a/unofficial/c511002091.lua b/unofficial/c511002091.lua index 5ee7023469..0efa4fc14a 100644 --- a/unofficial/c511002091.lua +++ b/unofficial/c511002091.lua @@ -17,7 +17,7 @@ function s.initial_effect(c) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.damcon) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511002111.lua b/unofficial/c511002111.lua index 379dec65f9..d15550a097 100644 --- a/unofficial/c511002111.lua +++ b/unofficial/c511002111.lua @@ -21,7 +21,7 @@ function s.initial_effect(c) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.discon) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511002482.lua b/unofficial/c511002482.lua index bc3c5e3a50..e68f08f882 100644 --- a/unofficial/c511002482.lua +++ b/unofficial/c511002482.lua @@ -20,7 +20,7 @@ function s.initial_effect(c) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.target) e2:SetOperation(s.operation) local e3=Effect.CreateEffect(c) diff --git a/unofficial/c511002727.lua b/unofficial/c511002727.lua index c23555db18..e1a8235692 100644 --- a/unofficial/c511002727.lua +++ b/unofficial/c511002727.lua @@ -34,7 +34,7 @@ function s.initial_effect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e4:SetCondition(function(e,tp) return Duel.GetBattleDamage(tp)>=Duel.GetLP(tp) end) - e4:SetCost(aux.dxmcostgen(1,1,nil)) + e4:SetCost(Cost.Detach(1)) e4:SetOperation(s.damop) c:RegisterEffect(e4,false,REGISTER_FLAG_DETACH_XMAT) end diff --git a/unofficial/c511002737.lua b/unofficial/c511002737.lua index 6f92a9e34b..3b4d822b9a 100644 --- a/unofficial/c511002737.lua +++ b/unofficial/c511002737.lua @@ -15,7 +15,7 @@ function s.initial_effect(c) e1:SetCode(511001265) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.damcon) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511002866.lua b/unofficial/c511002866.lua index dc659cff9b..14adac5e5c 100644 --- a/unofficial/c511002866.lua +++ b/unofficial/c511002866.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.target) e2:SetOperation(s.operation) --destroy @@ -33,7 +33,7 @@ function s.initial_effect(c) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.descon) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.destg) e3:SetOperation(s.desop) -- diff --git a/unofficial/c511002870.lua b/unofficial/c511002870.lua index 8d38eb1ac8..4d7a6dcb90 100644 --- a/unofficial/c511002870.lua +++ b/unofficial/c511002870.lua @@ -19,7 +19,7 @@ function s.initial_effect(c) e2:SetCategory(CATEGORY_DISABLE+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.disatkchtg) e2:SetOperation(s.disatkchop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511002871.lua b/unofficial/c511002871.lua index 75fbb87bd5..eb813e2fa6 100644 --- a/unofficial/c511002871.lua +++ b/unofficial/c511002871.lua @@ -34,7 +34,7 @@ function s.initial_effect(c) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_CHAINING) e3:SetCondition(s.condition) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.target) e3:SetOperation(s.operation) local e4=Effect.CreateEffect(c) diff --git a/unofficial/c511002872.lua b/unofficial/c511002872.lua index 691cee7860..b7399ef5ba 100644 --- a/unofficial/c511002872.lua +++ b/unofficial/c511002872.lua @@ -33,7 +33,7 @@ function s.initial_effect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCountLimit(1) e3:SetRange(LOCATION_MZONE) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.destg) e3:SetOperation(s.desop) local e4=Effect.CreateEffect(c) diff --git a/unofficial/c511002896.lua b/unofficial/c511002896.lua index 4be2a095c5..ee19b4655b 100644 --- a/unofficial/c511002896.lua +++ b/unofficial/c511002896.lua @@ -15,7 +15,7 @@ function s.initial_effect(c) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and Duel.IsBattlePhase() and not (Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated()) end) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511003236.lua b/unofficial/c511003236.lua index d7a3f4f34f..a94bb0be04 100644 --- a/unofficial/c511003236.lua +++ b/unofficial/c511003236.lua @@ -17,7 +17,7 @@ function s.initial_effect(c) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) e1:SetCountLimit(1) e1:SetCondition(s.atkcon) - e1:SetCost(aux.dxmcostgen(1,1)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010007.lua b/unofficial/c511010007.lua index 34d0152e5d..050959bdb3 100644 --- a/unofficial/c511010007.lua +++ b/unofficial/c511010007.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCondition(s.atkcon) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010009.lua b/unofficial/c511010009.lua index 27aa7d6ce0..6e5d2043e5 100644 --- a/unofficial/c511010009.lua +++ b/unofficial/c511010009.lua @@ -34,7 +34,7 @@ function s.initial_effect(c) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.dacon) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetOperation(s.daop) c:RegisterEffect(e3,false,REGISTER_FLAG_DETACH_XMAT) --Cannot be destroyed by battle, except by "Number" monsters diff --git a/unofficial/c511010103.lua b/unofficial/c511010103.lua index 93a1ad32e0..c4f5e64272 100644 --- a/unofficial/c511010103.lua +++ b/unofficial/c511010103.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetCode(511001265) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010105.lua b/unofficial/c511010105.lua index baee901b48..e68f8c7257 100644 --- a/unofficial/c511010105.lua +++ b/unofficial/c511010105.lua @@ -20,7 +20,7 @@ function s.initial_effect(c) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(TIMING_BATTLE_PHASE) e2:SetCondition(function() return Duel.IsBattlePhase() end) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010107.lua b/unofficial/c511010107.lua index 2ff8db24b3..08d13a74c6 100644 --- a/unofficial/c511010107.lua +++ b/unofficial/c511010107.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010165.lua b/unofficial/c511010165.lua index fcc6359717..3fbe1fd080 100644 --- a/unofficial/c511010165.lua +++ b/unofficial/c511010165.lua @@ -20,7 +20,7 @@ function s.initial_effect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511010192.lua b/unofficial/c511010192.lua index 2d00ffbcc3..6768936c57 100644 --- a/unofficial/c511010192.lua +++ b/unofficial/c511010192.lua @@ -35,7 +35,7 @@ function s.initial_effect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.distg) e3:SetOperation(s.disop) local e4=Effect.CreateEffect(c) diff --git a/unofficial/c511010196.lua b/unofficial/c511010196.lua index fc70c478ed..e2f9f48ffd 100644 --- a/unofficial/c511010196.lua +++ b/unofficial/c511010196.lua @@ -28,7 +28,7 @@ function s.initial_effect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_MZONE) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) local e4=Effect.CreateEffect(c) diff --git a/unofficial/c511010205.lua b/unofficial/c511010205.lua index b81cf386c9..26ff4d3db2 100644 --- a/unofficial/c511010205.lua +++ b/unofficial/c511010205.lua @@ -36,7 +36,7 @@ function s.initial_effect(c) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_MZONE) - e4:SetCost(aux.dxmcostgen(1,1,nil)) + e4:SetCost(Cost.Detach(1)) e4:SetCondition(s.atkcon) e4:SetTarget(s.atktg) e4:SetOperation(s.atkop) diff --git a/unofficial/c511010207.lua b/unofficial/c511010207.lua index 1694eb0566..a89e54935a 100644 --- a/unofficial/c511010207.lua +++ b/unofficial/c511010207.lua @@ -21,7 +21,7 @@ function s.initial_effect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetOperation(s.negop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) --Double Snare diff --git a/unofficial/c511010238.lua b/unofficial/c511010238.lua index 1394cb0b5a..3ed821ae1a 100644 --- a/unofficial/c511010238.lua +++ b/unofficial/c511010238.lua @@ -22,7 +22,7 @@ function s.initial_effect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) local e3=Effect.CreateEffect(c) diff --git a/unofficial/c511010239.lua b/unofficial/c511010239.lua index 3ddae69c59..6df2553159 100644 --- a/unofficial/c511010239.lua +++ b/unofficial/c511010239.lua @@ -33,7 +33,7 @@ function s.initial_effect(c) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e3:SetHintTiming(TIMING_DAMAGE_STEP) e3:SetCondition(s.atkcon) - e3:SetCost(aux.dxmcostgen(1,1,nil)) + e3:SetCost(Cost.Detach(1)) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) -- diff --git a/unofficial/c511027117.lua b/unofficial/c511027117.lua index 83c8e803da..33b304119a 100644 --- a/unofficial/c511027117.lua +++ b/unofficial/c511027117.lua @@ -19,7 +19,7 @@ function s.initial_effect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.diszatg) e2:SetOperation(s.diszaop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/unofficial/c511050008.lua b/unofficial/c511050008.lua index 1828c53ee0..09efeda766 100644 --- a/unofficial/c511050008.lua +++ b/unofficial/c511050008.lua @@ -11,7 +11,7 @@ function s.initial_effect(c) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) - e1:SetCost(aux.dxmcostgen(1,1,nil)) + e1:SetCost(Cost.Detach(1)) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) diff --git a/unofficial/c511600090.lua b/unofficial/c511600090.lua index 2fdc2374af..2884b7848e 100644 --- a/unofficial/c511600090.lua +++ b/unofficial/c511600090.lua @@ -39,7 +39,7 @@ function s.initial_effect(c) e5:SetCategory(CATEGORY_TODECK) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) - e5:SetCost(aux.PayLPCost(1/2)) + e5:SetCost(Cost.PayLP(1/2)) e5:SetTarget(s.tdtg) e5:SetOperation(s.tdop) c:RegisterEffect(e5) diff --git a/unofficial/c513000060.lua b/unofficial/c513000060.lua index aa739c769b..1827aeaebf 100644 --- a/unofficial/c513000060.lua +++ b/unofficial/c513000060.lua @@ -41,7 +41,7 @@ function s.initial_effect(c) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.spcon) - e4:SetCost(aux.dxmcostgen(1,1,nil)) + e4:SetCost(Cost.Detach(1)) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) local e5=Effect.CreateEffect(c) diff --git a/unofficial/c513000063.lua b/unofficial/c513000063.lua index 8c1254c2e1..7c37855b54 100644 --- a/unofficial/c513000063.lua +++ b/unofficial/c513000063.lua @@ -21,7 +21,7 @@ function s.initial_effect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) - e2:SetCost(aux.dxmcostgen(1,1,nil)) + e2:SetCost(Cost.Detach(1)) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2,false,REGISTER_FLAG_DETACH_XMAT) diff --git a/utility.lua b/utility.lua index 1ca23b825a..74332cab3a 100644 --- a/utility.lua +++ b/utility.lua @@ -1443,93 +1443,64 @@ function Auxiliary.PuzzleOp(e,tp) Duel.SetLP(0,0) end - function Auxiliary.StatChangeDamageStepCondition() return not (Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated()) end ---Default cost function for "You can Tribute this card; .." -function Auxiliary.selfreleasecost(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return c:IsReleasable() end - Duel.Release(c,REASON_COST) -end +--Functions for commonly used costs: +Cost={} ---Default cost function for "You can banish this card; .." -function Auxiliary.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfBanish(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() end Duel.Remove(c,POS_FACEUP,REASON_COST) end - -Auxiliary.selfbanishcost=aux.bfgcost -Auxiliary.SelfBanishCost=aux.bfgcost -Auxiliary.SelfReleaseCost=aux.selfreleasecost -Auxiliary.SelfTributeCost=aux.selfreleasecost - -function Auxiliary.SelfToGraveCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfTribute(e,tp,eg,ep,ev,re,r,rp,chk) + local c=e:GetHandler() + if chk==0 then return c:IsReleasable() end + Duel.Release(c,REASON_COST) +end +function Cost.SelfToGrave(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() end Duel.SendtoGrave(c,REASON_COST) end -function Auxiliary.SelfToHandCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfToHand(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHandAsCost() end Duel.SendtoHand(c,nil,REASON_COST) end -function Auxiliary.SelfToDeckCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfToDeck(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToDeckAsCost() end Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_COST) end -function Auxiliary.SelfToExtraCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfToExtra(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToExtraAsCost() end Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_COST) end -function Auxiliary.SelfDiscardCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfDiscard(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() end Duel.SendtoGrave(c,REASON_DISCARD|REASON_COST) end -function Auxiliary.SelfDiscardToGraveCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfDiscardToGrave(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() and c:IsAbleToGraveAsCost() end Duel.SendtoGrave(c,REASON_DISCARD|REASON_COST) end -function Auxiliary.SelfRevealCost(e,tp,eg,ep,ev,re,r,rp,chk) +function Cost.SelfReveal(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsPublic() end Duel.ConfirmCards(1-tp,c) Duel.ShuffleHand(tp) end +--Aliases for historical reasons: +Cost.SelfRelease=Cost.SelfTribute +Auxiliary.bfgcost=Cost.SelfBanish -function Auxiliary.PayLPCost(lp_value,pay_until) - if not pay_until then - if lp_value>=1 then - --Pay X LP, where X is any number equal to or higher than 1 - return function(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.CheckLPCost(tp,lp_value) end - Duel.PayLPCost(tp,lp_value) - end - else - --Pay a fraction of your LP (half, one third, etc) - return function(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return true end - Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)*lp_value)) - end - end - else - --Pay LP so that you have X left - return function(e,tp,eg,ep,ev,re,r,rp,chk) - local pay_lp_value=math.floor(Duel.GetLP(tp)-lp_value) - if chk==0 then return pay_lp_value>0 and Duel.CheckLPCost(tp,pay_lp_value) end - Duel.PayLPCost(tp,pay_lp_value) - end - end -end - -function Auxiliary.DiscardCost(filter,other,count) +function Cost.Discard(filter,other,count) count=count or 1 filter=filter and aux.AND(filter,Card.IsDiscardable) or Card.IsDiscardable return function(e,tp,eg,ep,ev,re,r,rp,chk) @@ -1538,7 +1509,6 @@ function Auxiliary.DiscardCost(filter,other,count) Duel.DiscardHand(tp,filter,count,count,REASON_COST|REASON_DISCARD,exclude) end end - -- "Detach Xyz Material Cost Generator" -- Generates a function to be used by Effect.SetCost in order to detach -- a number of Xyz Materials from the Effect's handler. @@ -1548,7 +1518,7 @@ end -- `op` optional function that gets called by passing the effect and the operated -- group of just detached materials in order to do some additional handling with -- them. -function Auxiliary.dxmcostgen(min,max,op) +function Cost.Detach(min,max,op) max=max or min do --Perform some sanity checks, simplifies debugging local max_type=type(max) @@ -1579,23 +1549,31 @@ function Auxiliary.dxmcostgen(min,max,op) end end - -Cost={} - -Cost.SelfBanish=aux.bfgcost -Cost.SelfRelease=aux.selfreleasecost -Cost.SelfTribute=aux.selfreleasecost -Cost.SelfToGrave=aux.SelfToGraveCost -Cost.SelfToHand=aux.SelfToHandCost -Cost.SelfToDeck=aux.SelfToDeckCost -Cost.SelfToExtra=aux.SelfToExtraCost -Cost.SelfDiscard=aux.SelfDiscardCost -Cost.SelfDiscardToGrave=aux.SelfDiscardToGraveCost -Cost.SelfReveal=aux.SelfRevealCost - -Cost.Detach=aux.dxmcostgen -Cost.Discard=aux.DiscardCost -Cost.PayLP=aux.PayLPCost +--Default cost for "You can pay X LP;" +function Cost.PayLP(lp_value,pay_until) + if not pay_until then + if lp_value>=1 then + --Pay X LP, where X is any number equal to or higher than 1 + return function(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.CheckLPCost(tp,lp_value) end + Duel.PayLPCost(tp,lp_value) + end + else + --Pay a fraction of your LP (half, one third, etc) + return function(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return true end + Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)*lp_value)) + end + end + else + --Pay LP so that you have X left + return function(e,tp,eg,ep,ev,re,r,rp,chk) + local pay_lp_value=math.floor(Duel.GetLP(tp)-lp_value) + if chk==0 then return pay_lp_value>0 and Duel.CheckLPCost(tp,pay_lp_value) end + Duel.PayLPCost(tp,pay_lp_value) + end + end +end function Cost.SoftOncePerChain(flag) return function(e,tp,eg,ep,ev,re,r,rp,chk) @@ -1629,6 +1607,7 @@ function Cost.AND(...) end end + function Card.EquipByEffectLimit(e,c) if e:GetOwner()~=c then return false end local eff={c:GetCardEffect(89785779+EFFECT_EQUIP_LIMIT)}