Commit a4a4bd4f authored by salix5's avatar salix5

Merge branch 'master' into patch

parents b7ab7ae4 63234eb2
......@@ -1444,7 +1444,7 @@ int32 card::filter_summon_procedure(uint8 playerid, effect_set* peset, uint8 ign
peset->add_item(eset[i]);
if(!pduel->game_field->is_player_can_summon(SUMMON_TYPE_NORMAL, playerid, this))
return FALSE;
int32 rcount = get_summon_tribute_count();
int32 rcount = get_summon_tribute_count(ignore_count);
int32 min = rcount & 0xffff, max = (rcount >> 16) & 0xffff;
if(min > 0 && !pduel->game_field->is_player_can_summon(SUMMON_TYPE_ADVANCE, playerid, this))
return FALSE;
......@@ -1713,7 +1713,7 @@ int32 card::is_can_be_summoned(uint8 playerid, uint8 ignore_count, effect* peffe
pduel->game_field->restore_lp_cost();
return TRUE;
}
int32 card::get_summon_tribute_count() {
int32 card::get_summon_tribute_count(uint8 ignore_count) {
int32 min = 0, max = 0;
int32 minul = 0, maxul = 0;
int32 level = get_level();
......@@ -1739,6 +1739,16 @@ int32 card::get_summon_tribute_count() {
}
min -= minul;
max -= maxul;
int32 playerid = current.controler;
if(!ignore_count && !pduel->game_field->core.extra_summon[playerid]
&& pduel->game_field->core.summon_count[playerid] >= pduel->game_field->get_summon_count_limit(playerid)) {
effect* pextra = is_affected_by_effect(EFFECT_EXTRA_SUMMON_COUNT);
if(pextra && !(pextra->flag & EFFECT_FLAG_FUNC_VALUE)) {
int32 count = pextra->get_value();
if(min < count)
min = count;
}
}
if(min < 0) min = 0;
if(max < min) max = min;
return min + (max << 16);
......
......@@ -212,7 +212,7 @@ public:
int32 is_summonable();
int32 is_summonable(effect* peffect);
int32 is_can_be_summoned(uint8 playerid, uint8 ingore_count, effect* peffect);
int32 get_summon_tribute_count();
int32 get_summon_tribute_count(uint8 ignore_count = 0);
int32 get_set_tribute_count();
int32 is_can_be_flip_summoned(uint8 playerid);
int32 is_special_summonable(uint8 playerid);
......
......@@ -1196,6 +1196,7 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
}
}
int32 ex_count = 0;
int32 ex_sum_max = 0;
for(int i = 0; i < 5; ++i) {
pcard = player[1 - p].list_mzone[i];
if(!(pcard && pcard->is_releasable_by_summon(p, target)))
......@@ -1221,10 +1222,12 @@ int32 field::get_summon_release_list(card* target, card_set* release_list, card_
else
pcard->operation_param = 1;
ex_count++;
if(ex_sum_max < pcard->operation_param)
ex_sum_max = pcard->operation_param;
}
}
if(ex_count)
rcount++;
rcount += ex_sum_max;
return rcount;
}
int32 field::get_summon_count_limit(uint8 playerid) {
......
......@@ -1304,8 +1304,10 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
effect* pextra = core.extra_summon[sumplayer] ? 0 : target->is_affected_by_effect(EFFECT_EXTRA_SUMMON_COUNT);
if(pextra) {
core.temp_var[0] = (ptr)pextra;
if(pextra->value && (core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)))
if((pextra->flag & EFFECT_FLAG_FUNC_VALUE) && (core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)))
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, sumplayer, 91);
else if(!(pextra->flag & EFFECT_FLAG_FUNC_VALUE) && target->material_cards.size() < pextra->get_value())
core.temp_var[0] = 0;
else
returns.ivalue[0] = TRUE;
}
......@@ -1356,7 +1358,7 @@ int32 field::summon(uint16 step, uint8 sumplayer, card * target, effect * proc,
effect* pextra = core.extra_summon[sumplayer] ? 0 : target->is_affected_by_effect(EFFECT_EXTRA_SUMMON_COUNT);
if(pextra) {
core.temp_var[0] = (ptr)pextra;
if(pextra->value && (core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)))
if((pextra->flag & EFFECT_FLAG_FUNC_VALUE) && (core.summon_count[sumplayer] < get_summon_count_limit(sumplayer)))
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, sumplayer, 91);
else
returns.ivalue[0] = TRUE;
......@@ -4210,9 +4212,12 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
rmax += (*cit)->operation_param;
if(rmax < min)
returns.ivalue[0] = TRUE;
else if(!core.release_cards_ex_sum.empty())
else if(!core.release_cards_ex_sum.empty()) {
core.temp_var[0] = 0;
if(rmax == 0 && min == 2)
core.temp_var[0] = 1;
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, playerid, 92);
else
} else
core.units.begin()->step = 2;
return FALSE;
}
......@@ -4221,8 +4226,13 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
core.units.begin()->step = 2;
return FALSE;
}
for(auto cit = core.release_cards_ex_sum.begin(); cit != core.release_cards_ex_sum.end(); ++cit)
core.select_cards.push_back(*cit);
if(core.temp_var[0] == 0)
for(auto cit = core.release_cards_ex_sum.begin(); cit != core.release_cards_ex_sum.end(); ++cit)
core.select_cards.push_back(*cit);
else
for(auto cit = core.release_cards_ex_sum.begin(); cit != core.release_cards_ex_sum.end(); ++cit)
if((*cit)->operation_param == 2)
core.select_cards.push_back(*cit);
pduel->write_buffer8(MSG_HINT);
pduel->write_buffer8(HINT_SELECTMSG);
pduel->write_buffer8(playerid);
......@@ -4260,7 +4270,7 @@ int32 field::select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable,
max -= rmin;
core.units.begin()->arg2 = (max << 16) + min;
if(min <= 0) {
if(max > 0)
if(max > 0 && !core.release_cards.empty())
add_process(PROCESSOR_SELECT_YESNO, 0, 0, 0, playerid, 210);
else
core.units.begin()->step = 6;
......
--Typhoon
function c14883228.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(c14883228.target)
e1:SetOperation(c14883228.activate)
c:RegisterEffect(e1)
--act in hand
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_TRAP_ACT_IN_HAND)
e2:SetCondition(c14883228.handcon)
c:RegisterEffect(e2)
end
function c14883228.cfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c14883228.handcon(e)
local tp=e:GetHandlerPlayer()
return not Duel.IsExistingMatchingCard(c14883228.cfilter,tp,LOCATION_ONFIELD,0,1,nil)
and Duel.IsExistingMatchingCard(c14883228.cfilter,tp,0,LOCATION_ONFIELD,2,nil)
end
function c14883228.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c14883228.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c14883228.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c14883228.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c14883228.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c14883228.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
......@@ -23,7 +23,7 @@ function c16960351.rfilter(c,e,tp)
and Duel.IsExistingMatchingCard(c16960351.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,lv)
end
function c16960351.spfilter(c,e,tp,lv)
return c:GetLevel()==lv and c:IsRace(RACE_PHANTOMDRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
return c:GetLevel()==lv and c:IsRace(RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c16960351.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,c16960351.rfilter,1,nil,e,tp) end
......
--U.A. Stadium
function c19814508.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(19814508,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetTarget(c19814508.target)
e2:SetOperation(c19814508.operation)
c:RegisterEffect(e2)
--atkup
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(19814508,1))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1)
e3:SetCondition(c19814508.atkcon)
e3:SetOperation(c19814508.atkop)
c:RegisterEffect(e3)
end
function c19814508.filter(c)
return c:IsSetCard(0xb2) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c19814508.target(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=eg:GetFirst()
if chk==0 then return tc:IsSetCard(0xb2) and tc:IsControler(tp)
and Duel.IsExistingMatchingCard(c19814508.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c19814508.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c19814508.filter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c19814508.cfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0xb2) and c:IsControler(tp)
end
function c19814508.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c19814508.cfilter,1,nil,tp)
end
function c19814508.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetReset(RESET_EVENT+0x1fe0000)
e3:SetValue(500)
tc:RegisterEffect(e3)
tc=g:GetNext()
end
end
--The Traveler and the Burning Abyss
function c20036055.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,20036055+EFFECT_COUNT_CODE_OATH)
e1:SetTarget(c20036055.sptg)
e1:SetOperation(c20036055.spop)
c:RegisterEffect(e1)
end
function c20036055.filter(c,e,tp,id)
return c:IsSetCard(0xb1) and c:GetTurnID()==id and not c:IsReason(REASON_RETURN) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c20036055.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsCanBeSpecialSummoned(e,0,tp,false,false) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c20036055.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,Duel.GetTurnCount()) end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c20036055.filter,tp,LOCATION_GRAVE,0,1,ft,nil,e,tp,Duel.GetTurnCount())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,g:GetCount(),0,0)
end
function c20036055.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft<=0 then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>ft then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
sg=sg:Select(tp,ft,ft,nil)
end
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENCE)
end
--Graff, Malebranche of the Burning Abyss
function c20758643.initial_effect(c)
--self destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetCondition(c20758643.sdcon)
c:RegisterEffect(e1)
--Special Summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(20758643,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,20758643)
e2:SetCondition(c20758643.sscon)
e2:SetTarget(c20758643.sstg)
e2:SetOperation(c20758643.ssop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(20758643,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,20758643)
e3:SetCondition(c20758643.spcon)
e3:SetTarget(c20758643.sptg)
e3:SetOperation(c20758643.spop)
c:RegisterEffect(e3)
end
function c20758643.sdfilter(c)
return c:IsFaceup() and not c:IsSetCard(0xb1)
end
function c20758643.sdcon(e)
return Duel.IsExistingMatchingCard(c20758643.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c20758643.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c20758643.sscon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c20758643.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c20758643.sstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c20758643.ssop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c20758643.filter,tp,LOCATION_ONFIELD,0,1,nil) then return end
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c20758643.spcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_RETURN)
end
function c20758643.spfilter(c,e,tp)
return c:IsSetCard(0xb1) and not c:IsCode(20758643) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c20758643.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c20758643.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c20758643.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c20758643.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
--Dragon Horn Hunter
function c21970285.initial_effect(c)
--pendulum summon
aux.AddPendulumProcedure(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--atk
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_PZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c21970285.efilter)
e2:SetValue(200)
c:RegisterEffect(e2)
--avoid battle damage
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e3:SetRange(LOCATION_PZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(c21970285.efilter)
e3:SetValue(1)
c:RegisterEffect(e3)
end
function c21970285.efilter(e,c)
return c:IsType(TYPE_NORMAL)
end
......@@ -15,7 +15,7 @@ function c24218047.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
end
function c24218047.filter(c,e,tp)
return c:IsDefenceBelow(1500) and c:IsRace(RACE_PHANTOMDRAGON)
return c:IsDefenceBelow(1500) and c:IsRace(RACE_WYRM)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c24218047.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
--Inspiration
function c25005816.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c25005816.condition)
e1:SetTarget(c25005816.target)
e1:SetOperation(c25005816.activate)
c:RegisterEffect(e1)
end
function c25005816.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c25005816.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
end
function c25005816.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(700)
tc:RegisterEffect(e1)
end
end
--Master Craftsman Gamil
function c25727454.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(25727454,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetRange(LOCATION_HAND)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCondition(c25727454.condition)
e1:SetCost(c25727454.cost)
e1:SetOperation(c25727454.operation)
c:RegisterEffect(e1)
end
function c25727454.condition(e,tp,eg,ep,ev,re,r,rp)
local phase=Duel.GetCurrentPhase()
if phase~=PHASE_DAMAGE or Duel.IsDamageCalculated() then return false end
local a=Duel.GetAttacker()
local d=Duel.GetAttackTarget()
return (a:IsControler(tp) and a:IsRelateToBattle()) or (d and d:IsControler(tp) and d:IsRelateToBattle())
end
function c25727454.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function c25727454.operation(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
if Duel.GetTurnPlayer()~=tp then a=Duel.GetAttackTarget() end
if not a:IsRelateToBattle() or a:IsFacedown() then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(300)
a:RegisterEffect(e1)
end
......@@ -46,7 +46,7 @@ function c39122311.operation(e,tp,eg,ep,ev,re,r,rp)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_RACE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(RACE_PHANTOMDRAGON)
e1:SetValue(RACE_WYRM)
tc:RegisterEffect(e1)
end
end
......
......@@ -14,6 +14,7 @@ function c41440148.sumop(e,tp,eg,ep,ev,re,r,rp)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLevelAbove,7))
e1:SetValue(0x1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,41440148,RESET_PHASE+PHASE_END,0,1)
......
......@@ -65,7 +65,7 @@ function c43202238.spcon(e,tp,eg,ep,ev,re,r,rp)
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function c43202238.spfilter(c,e,tp)
return c:IsRace(RACE_PHANTOMDRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
return c:IsRace(RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c43202238.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -11,7 +11,7 @@ function c43912676.initial_effect(c)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_PHANTOMDRAGON))
e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_WYRM))
e2:SetValue(300)
c:RegisterEffect(e2)
local e3=e2:Clone()
......@@ -31,7 +31,7 @@ function c43912676.initial_effect(c)
c:RegisterEffect(e4)
end
function c43912676.cfilter(c)
return c:IsRace(RACE_PHANTOMDRAGON) and c:IsAbleToRemoveAsCost()
return c:IsRace(RACE_WYRM) and c:IsAbleToRemoveAsCost()
end
function c43912676.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c43912676.cfilter,tp,LOCATION_GRAVE,0,3,nil) end
......
......@@ -12,7 +12,7 @@ function c48800175.initial_effect(c)
end
function c48800175.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST)
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c48800175.filter(c)
return c:IsRace(RACE_DRAGON) and c:IsAttackAbove(3000) and c:IsDefenceBelow(2500) and c:IsAbleToHand()
......
--Swamp Mirrorer
function c50277973.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c50277973.target)
e1:SetOperation(c50277973.activate)
c:RegisterEffect(e1)
end
function c50277973.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local rac=0
local crac=1
for irac=0,23 do
local catt=1
for iatt=0,7 do
if Duel.IsPlayerCanSpecialSummonMonster(tp,50277973,0,0x11,1800,1000,4,crac,catt) then
rac=rac+crac
break
end
catt=catt*2
end
crac=crac*2
end
e:SetLabel(rac)
return rac~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
end
Duel.Hint(HINT_SELECTMSG,tp,563)
local crac=Duel.AnnounceRace(tp,1,e:GetLabel())
local att=0
local catt=1
for iatt=0,7 do
if Duel.IsPlayerCanSpecialSummonMonster(tp,50277973,0,0x11,1800,1000,4,crac,catt) then
att=att+catt
end
catt=catt*2
end
Duel.Hint(HINT_SELECTMSG,tp,562)
catt=Duel.AnnounceAttribute(tp,1,att)
e:SetLabel(crac)
Duel.SetTargetParam(catt)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c50277973.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local rac=e:GetLabel()
local att=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,50277973,0,0x11,1800,1000,4,rac,att) then return end
c:AddTrapMonsterAttribute(TYPE_NORMAL,att,rac,4,1800,1000)
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)
c:TrapMonsterBlock()
end
--Ghosts From the Past
function c51099515.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c51099515.cost)
e1:SetTarget(c51099515.target)
e1:SetOperation(c51099515.activate)
c:RegisterEffect(e1)
end
function c51099515.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToRemoveAsCost()
end
function c51099515.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c51099515.cfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local cg=Duel.SelectMatchingCard(tp,c51099515.cfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(cg,POS_FACEUP,REASON_COST)
end
function c51099515.tfilter(c)
return c:IsFaceup() and c:GetAttack()>0
end
function c51099515.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c51099515.tfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c51099515.tfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c51099515.tfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function c51099515.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
--Card Advance
function c52112003.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c52112003.target)
e1:SetOperation(c52112003.activate)
c:RegisterEffect(e1)
end
function c52112003.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end
end
function c52112003.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.SortDecktop(tp,tp,5)
if Duel.GetFlagEffect(tp,52112003)~=0 then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT)
e1:SetTarget(aux.TargetBoolFunction(Card.IsLevelAbove,5))
e1:SetValue(0x1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.RegisterFlagEffect(tp,52112003,RESET_PHASE+PHASE_END,0,1)
end
--U.A. Mighty Slugger
function c56421754.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,56421754)
e1:SetCondition(c56421754.spcon)
e1:SetOperation(c56421754.spop)
c:RegisterEffect(e1)
--actlimit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EFFECT_CANNOT_ACTIVATE)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(0,1)
e2:SetValue(c56421754.aclimit)
e2:SetCondition(c56421754.actcon)
c:RegisterEffect(e2)
end
function c56421754.spfilter(c)
return c:IsFaceup() and c:IsSetCard(0xb2) and not c:IsCode(56421754) and c:IsAbleToHandAsCost()
end
function c56421754.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c56421754.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function c56421754.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,c56421754.spfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_COST)
end
function c56421754.aclimit(e,re,tp)
return not re:GetHandler():IsImmuneToEffect(e)
end
function c56421754.actcon(e)
return Duel.GetAttacker()==e:GetHandler()
end
......@@ -21,5 +21,5 @@ function c56784842.regop(e,tp,eg,ep,ev,re,r,rp)
c:RegisterEffect(e1)
end
function c56784842.aclimit(e,re,tp)
return re:GetHandler():IsType(TYPE_MONSTER)
return re:GetHandler():IsActiveType(TYPE_MONSTER)
end
--Cir, Malebranche of the Burning Abyss
function c57143342.initial_effect(c)
--self destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetCondition(c57143342.sdcon)
c:RegisterEffect(e1)
--Special Summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(57143342,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,57143342)
e2:SetCondition(c57143342.sscon)
e2:SetTarget(c57143342.sstg)
e2:SetOperation(c57143342.ssop)
c:RegisterEffect(e2)
--spsummon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(57143342,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,57143342)
e3:SetCondition(c57143342.spcon)
e3:SetTarget(c57143342.sptg)
e3:SetOperation(c57143342.spop)
c:RegisterEffect(e3)
end
function c57143342.sdfilter(c)
return c:IsFaceup() and not c:IsSetCard(0xb1)
end
function c57143342.sdcon(e)
return Duel.IsExistingMatchingCard(c57143342.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c57143342.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c57143342.sscon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c57143342.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c57143342.sstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c57143342.ssop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c57143342.filter,tp,LOCATION_ONFIELD,0,1,nil) then return end
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c57143342.spcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_RETURN)
end
function c57143342.spfilter(c,e,tp)
return c:IsSetCard(0xb1) and not c:IsCode(57143342) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c57143342.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c57143342.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c57143342.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c57143342.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c57143342.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
--Doomstar Magician
function c58369990.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(58369990,0))
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetCost(c58369990.cost)
e1:SetTarget(c58369990.target)
e1:SetOperation(c58369990.operation)
c:RegisterEffect(e1)
end
function c58369990.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c58369990.filter(c)
return (c:GetSequence()==6 or c:GetSequence()==7) and c:IsDestructable()
end
function c58369990.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and c58369990.filter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(c58369990.filter,tp,LOCATION_SZONE,LOCATION_SZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c58369990.filter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c58369990.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
\ No newline at end of file
--Avalon
function c82410600.initial_effect(c)
function c82140600.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c82410600.target)
e1:SetOperation(c82410600.activate)
e1:SetTarget(c82140600.target)
e1:SetOperation(c82140600.activate)
c:RegisterEffect(e1)
end
function c82410600.filter(c,e)
function c82140600.filter(c,e)
return c:IsSetCard(0x107a) and c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() and c:IsCanBeEffectTarget(e)
end
function c82410600.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
function c82140600.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c82410600.filter,tp,LOCATION_GRAVE,0,nil,e)
local g=Duel.GetMatchingGroup(c82140600.filter,tp,LOCATION_GRAVE,0,nil,e)
if chk==0 then return g:GetCount()>4
and g:IsExists(Card.IsSetCard,1,nil,0xa7) and g:IsExists(Card.IsSetCard,1,nil,0xa8)
and Duel.IsExistingMatchingCard(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
......@@ -34,7 +34,7 @@ function c82410600.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g1,5,0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,dg:GetCount(),0,0)
end
function c82410600.activate(e,tp,eg,ep,ev,re,r,rp)
function c82140600.activate(e,tp,eg,ep,ev,re,r,rp)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local g=tg:Filter(Card.IsRelateToEffect,nil,e)
if g:GetCount()==5 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then
......
--U.A. Perfect Ace
function c82419869.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,82419869)
e1:SetCondition(c82419869.spcon)
e1:SetOperation(c82419869.spop)
c:RegisterEffect(e1)
--Negate
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(82419869,0))
e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c82419869.discon)
e2:SetCost(c82419869.discost)
e2:SetTarget(c82419869.distg)
e2:SetOperation(c82419869.disop)
c:RegisterEffect(e2)
end
function c82419869.spfilter(c)
return c:IsFaceup() and c:IsSetCard(0xb2) and not c:IsCode(82419869) and c:IsAbleToHandAsCost()
end
function c82419869.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c82419869.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end
function c82419869.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectMatchingCard(tp,c82419869.spfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_COST)
end
function c82419869.discon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
return Duel.IsChainNegatable(ev) and Duel.GetTurnPlayer()~=tp
end
function c82419869.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c82419869.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function c82419869.disop(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateActivation(ev)
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
--Dante, Traveler of the Burning Abyss
function c83531441.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.XyzFilterFunction(c,3),2)
c:EnableReviveLimit()
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(83531441,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c83531441.atkcost)
e1:SetOperation(c83531441.atkop)
c:RegisterEffect(e1)
--to defence
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DAMAGE_STEP_END)
e2:SetCondition(c83531441.poscon)
e2:SetOperation(c83531441.posop)
c:RegisterEffect(e2)
--to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(83531441,1))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCondition(c83531441.thcon)
e3:SetTarget(c83531441.thtg)
e3:SetOperation(c83531441.thop)
c:RegisterEffect(e3)
end
function c83531441.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDiscardDeckAsCost(tp,1) and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)
if ct==1 then
Duel.DiscardDeck(tp,1,REASON_COST)
e:SetLabel(1)
else
local ac=0
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(83531441,2))
if ct==2 then ac=Duel.AnnounceNumber(tp,1,2)
else ac=Duel.AnnounceNumber(tp,1,2,3) end
Duel.DiscardDeck(tp,ac,REASON_COST)
e:SetLabel(ac)
end
end
function c83531441.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local ct=e:GetLabel()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
e1:SetValue(ct*500)
c:RegisterEffect(e1)
end
end
function c83531441.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler()==Duel.GetAttacker() and e:GetHandler():IsRelateToBattle()
end
function c83531441.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsAttackPos() then
Duel.ChangePosition(c,POS_FACEUP_DEFENCE)
end
end
function c83531441.thcon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsReason(REASON_RETURN)
end
function c83531441.filter(c)
return c:IsSetCard(0xb1) and c:IsAbleToHand()
end
function c83531441.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c83531441.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c83531441.filter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c83531441.filter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c83531441.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--輝竜星-ショウフク
function c83755611.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_PHANTOMDRAGON),1)
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_WYRM),1)
c:EnableReviveLimit()
--mat check
local e1=Effect.CreateEffect(c)
......@@ -34,7 +34,7 @@ function c83755611.initial_effect(c)
c:RegisterEffect(e3)
end
function c83755611.matcheck(e,c)
local ct=c:GetMaterial():Filter(Card.IsRace,nil,RACE_PHANTOMDRAGON):GetClassCount(Card.GetOriginalAttribute)
local ct=c:GetMaterial():Filter(Card.IsRace,nil,RACE_WYRM):GetClassCount(Card.GetOriginalAttribute)
e:SetLabel(ct)
end
function c83755611.tdcon(e,tp,eg,ep,ev,re,r,rp)
......
--Scarm, Malebranche of the Burning Abyss
function c84764038.initial_effect(c)
--self destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SELF_DESTROY)
e1:SetCondition(c84764038.sdcon)
c:RegisterEffect(e1)
--Special Summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(84764038,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetRange(LOCATION_HAND)
e2:SetCountLimit(1,84764038)
e2:SetCondition(c84764038.sscon)
e2:SetTarget(c84764038.sstg)
e2:SetOperation(c84764038.ssop)
c:RegisterEffect(e2)
--to grave
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetOperation(c84764038.regop)
c:RegisterEffect(e3)
end
function c84764038.sdfilter(c)
return c:IsFaceup() and not c:IsSetCard(0xb1)
end
function c84764038.sdcon(e)
return Duel.IsExistingMatchingCard(c84764038.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function c84764038.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP)
end
function c84764038.sscon(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c84764038.filter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c84764038.sstg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c84764038.ssop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(c84764038.filter,tp,LOCATION_ONFIELD,0,1,nil) then return end
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
end
function c84764038.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_ONFIELD) then
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(84764038,1))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1,84764038)
e1:SetRange(LOCATION_GRAVE)
e1:SetTarget(c84764038.thtg)
e1:SetOperation(c84764038.thop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c84764038.thfilter(c)
return c:GetLevel()==3 and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_FIEND)
and not c:IsCode(84764038) and c:IsAbleToHand()
end
function c84764038.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c84764038.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c84764038.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c84764038.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -29,11 +29,11 @@ function c86559484.cfilter(c,rac)
end
function c86559484.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c86559484.cfilter,tp,LOCATION_GRAVE,0,1,nil,RACE_DRAGON)
and Duel.IsExistingMatchingCard(c86559484.cfilter,tp,LOCATION_GRAVE,0,1,nil,RACE_PHANTOMDRAGON) end
and Duel.IsExistingMatchingCard(c86559484.cfilter,tp,LOCATION_GRAVE,0,1,nil,RACE_WYRM) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g1=Duel.SelectMatchingCard(tp,c86559484.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,RACE_DRAGON)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g2=Duel.SelectMatchingCard(tp,c86559484.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,RACE_PHANTOMDRAGON)
local g2=Duel.SelectMatchingCard(tp,c86559484.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,RACE_WYRM)
g1:Merge(g2)
Duel.Remove(g1,POS_FACEUP,REASON_COST)
end
......
--Quantum Cat
function c87772572.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c87772572.target)
e1:SetOperation(c87772572.activate)
c:RegisterEffect(e1)
end
function c87772572.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local rac=0
local crac=1
for irac=0,23 do
local catt=1
for iatt=0,7 do
if Duel.IsPlayerCanSpecialSummonMonster(tp,87772572,0,0x11,0,2200,4,crac,catt) then
rac=rac+crac
break
end
catt=catt*2
end
crac=crac*2
end
e:SetLabel(rac)
return rac~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
end
Duel.Hint(HINT_SELECTMSG,tp,563)
local crac=Duel.AnnounceRace(tp,1,e:GetLabel())
local att=0
local catt=1
for iatt=0,7 do
if Duel.IsPlayerCanSpecialSummonMonster(tp,87772572,0,0x11,0,2200,4,crac,catt) then
att=att+catt
end
catt=catt*2
end
Duel.Hint(HINT_SELECTMSG,tp,562)
catt=Duel.AnnounceAttribute(tp,1,att)
e:SetLabel(crac)
Duel.SetTargetParam(catt)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c87772572.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local rac=e:GetLabel()
local att=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,87772572,0,0x11,0,2200,4,rac,att) then return end
c:AddTrapMonsterAttribute(TYPE_NORMAL,att,rac,4,0,2200)
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)
c:TrapMonsterBlock()
end
--Unbreakable Spirit
function c88494120.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCondition(c88494120.condition)
e1:SetTarget(c88494120.target)
e1:SetOperation(c88494120.activate)
c:RegisterEffect(e1)
end
function c88494120.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1
end
function c88494120.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
end
function c88494120.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil)
if g:GetCount()==0 then return end
local mg,atk=g:GetMinGroup(Card.GetAttack)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(atk)
tc:RegisterEffect(e1)
end
end
--Bashing Shield
function c88610708.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c88610708.target)
e1:SetOperation(c88610708.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c88610708.eqlimit)
c:RegisterEffect(e2)
--Atk up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(1000)
c:RegisterEffect(e3)
--no damage
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e4:SetCondition(c88610708.damcon)
e4:SetValue(1)
c:RegisterEffect(e4)
end
function c88610708.eqlimit(e,c)
return bit.band(c:GetSummonType(),SUMMON_TYPE_NORMAL)==SUMMON_TYPE_NORMAL
end
function c88610708.filter(c)
return c:IsFaceup() and bit.band(c:GetSummonType(),SUMMON_TYPE_NORMAL)==SUMMON_TYPE_NORMAL
end
function c88610708.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c88610708.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c88610708.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c88610708.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c88610708.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function c88610708.damcon(e)
return Duel.GetAttacker()==e:GetHandler():GetEquipTarget()
end
......@@ -20,12 +20,12 @@ function c88724332.initial_effect(c)
c:RegisterEffect(e2)
end
function c88724332.target(e,c)
return c:IsPosition(POS_FACEUP_ATTACK) and not c:IsRace(RACE_PHANTOMDRAGON)
return c:IsPosition(POS_FACEUP_ATTACK) and not c:IsRace(RACE_WYRM)
and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
and c:IsPreviousLocation(LOCATION_DECK+LOCATION_EXTRA)
end
function c88724332.deftg(e,c)
return c:IsFaceup() and not c:IsRace(RACE_PHANTOMDRAGON)
return c:IsFaceup() and not c:IsRace(RACE_WYRM)
and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL
and c:IsPreviousLocation(LOCATION_DECK+LOCATION_EXTRA)
end
......
--Stegocyber
function c99733359.initial_effect(c)
--no damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(99733359,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O+EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_GRAVE)
e1:SetCode(EVENT_PRE_BATTLE_DAMAGE)
e1:SetCountLimit(1,99733359)
e1:SetCondition(c99733359.condition)
e1:SetCost(c99733359.cost)
e1:SetTarget(c99733359.target)
e1:SetOperation(c99733359.operation)
c:RegisterEffect(e1)
end
function c99733359.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp
end
function c99733359.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c99733359.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c99733359.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x47e0000)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1,true)
Duel.ChangeBattleDamage(tp,0)
end
end
......@@ -79,7 +79,7 @@ RACE_REPTILE =0x80000 --
RACE_PSYCHO =0x100000 --
RACE_DEVINE =0x200000 --
RACE_CREATORGOD =0x400000 --
RACE_PHANTOMDRAGON =0x800000 --
RACE_WYRM =0x800000 --
--Reason
REASON_DESTROY =0x1 --
REASON_RELEASE =0x2 --
......
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