Commit 8551cc72 authored by Fluorohydride's avatar Fluorohydride

Merge pull request #591 from VanillaSalt/patch76

fix
parents 567077e2 590e90a6
......@@ -18,6 +18,9 @@ int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3
bool chain::chain_operation_sort(chain c1, chain c2) {
return c1.triggering_effect->id < c2.triggering_effect->id;
}
bool tevent::operator< (const tevent& v) const {
return std::memcmp(this, &v, sizeof(tevent)) < 0;
}
field::field(duel* pduel) {
this->pduel = pduel;
infos.copy_id = 1;
......
......@@ -33,6 +33,7 @@ struct tevent {
uint32 reason;
uint8 event_player;
uint8 reason_player;
bool operator< (const tevent& v) const;
};
struct optarget {
group* op_cards;
......@@ -142,6 +143,7 @@ struct processor {
typedef std::list<processor_unit> processor_list;
typedef std::set<card*, card_sort> card_set;
typedef std::set<effect*> effect_collection;
typedef std::set<std::pair<effect*, tevent> > delayed_effect_collection;
processor_list units;
processor_list subunits;
......@@ -178,9 +180,9 @@ struct processor {
chain_list flip_chain_b;
chain_list new_ochain_h;
chain_list new_chains;
effect_collection delayed_quick_tmp;
effect_collection delayed_quick_break;
effect_collection delayed_quick;
delayed_effect_collection delayed_quick_tmp;
delayed_effect_collection delayed_quick_break;
delayed_effect_collection delayed_quick;
instant_f_list quick_f_chain;
card_set leave_confirmed;
card_set special_summoning;
......@@ -607,6 +609,7 @@ public:
#define PROCESSOR_CONTROL_ADJUST 76
#define PROCESSOR_PAY_LPCOST 80
#define PROCESSOR_REMOVE_COUNTER 81
#define PROCESSOR_ATTACK_DISABLE 82
#define PROCESSOR_DESTROY_S 100
#define PROCESSOR_RELEASE_S 101
......
......@@ -1454,25 +1454,8 @@ int32 scriptlib::duel_get_attack_target(lua_State *L) {
}
int32 scriptlib::duel_disable_attack(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
card* attacker = pduel->game_field->core.attacker;
if(!attacker
|| (pduel->game_field->infos.phase == PHASE_DAMAGE && attacker->fieldid_r != pduel->game_field->core.pre_field[0] && attacker->fieldid_r != pduel->game_field->core.pre_field[1])
|| (attacker->current.position & POS_FACEDOWN)
|| attacker->is_affected_by_effect(EFFECT_ATTACK_DISABLED)
|| !attacker->is_affect_by_effect(pduel->game_field->core.reason_effect))
lua_pushboolean(L, 0);
else {
effect* peffect = pduel->new_effect();
peffect->code = EFFECT_ATTACK_DISABLED;
peffect->type = EFFECT_TYPE_SINGLE;
attacker->add_effect(peffect);
attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
pduel->game_field->raise_event(attacker, EVENT_ATTACK_DISABLED, pduel->game_field->core.reason_effect,
0, pduel->game_field->core.reason_player, PLAYER_NONE, 0);
pduel->game_field->process_instant_event();
lua_pushboolean(L, 1);
}
return 1;
pduel->game_field->add_process(PROCESSOR_ATTACK_DISABLE, 0, 0, 0, 0, 0);
return lua_yield(L, 0);
}
int32 scriptlib::duel_chain_attack(lua_State *L) {
duel* pduel = interpreter::get_duel_info(L);
......
......@@ -474,6 +474,34 @@ int32 field::process() {
core.units.begin()->step++;
return pduel->bufferlen;
}
case PROCESSOR_ATTACK_DISABLE: {
if(it->step == 0) {
card* attacker = core.attacker;
if(!attacker
|| (infos.phase == PHASE_DAMAGE && attacker->fieldid_r != core.pre_field[0] && attacker->fieldid_r != core.pre_field[1])
|| (attacker->current.position & POS_FACEDOWN)
|| attacker->is_affected_by_effect(EFFECT_ATTACK_DISABLED)
|| !attacker->is_affect_by_effect(core.reason_effect)) {
returns.ivalue[0] = 0;
pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_BOOLEAN);
core.units.pop_front();
} else {
effect* peffect = pduel->new_effect();
peffect->code = EFFECT_ATTACK_DISABLED;
peffect->type = EFFECT_TYPE_SINGLE;
attacker->add_effect(peffect);
attacker->set_status(STATUS_ATTACK_CANCELED, TRUE);
raise_event(attacker, EVENT_ATTACK_DISABLED, core.reason_effect, 0, core.reason_player, PLAYER_NONE, 0);
process_instant_event();
core.units.begin()->step++;
}
} else {
returns.ivalue[0] = 1;
pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_BOOLEAN);
core.units.pop_front();
}
return pduel->bufferlen;
}
case PROCESSOR_DESTROY_S: {
if(it->step == 0) {
add_process(PROCESSOR_DESTROY, 0, it->peffect, it->ptarget, it->arg1, it->arg2);
......@@ -1947,7 +1975,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
newchain.triggering_sequence = peffect->handler->current.sequence;
newchain.triggering_player = priority;
core.select_chains.push_back(newchain);
core.delayed_quick_tmp.erase(peffect);
core.delayed_quick_tmp.erase(make_pair(peffect, *evit));
}
}
pr = effects.quick_o_effect.equal_range(evit->event_code);
......@@ -1963,7 +1991,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
newchain.triggering_sequence = peffect->handler->current.sequence;
newchain.triggering_player = priority;
core.select_chains.push_back(newchain);
core.delayed_quick_tmp.erase(peffect);
core.delayed_quick_tmp.erase(make_pair(peffect, *evit));
}
}
evit++;
......@@ -1998,11 +2026,12 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
}
if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) {
for(auto eit = core.delayed_quick.begin(); eit != core.delayed_quick.end(); ++eit) {
peffect = *eit;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, nil_event, TRUE, FALSE, FALSE)) {
peffect = eit->first;
tevent evt = eit->second;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE, FALSE, FALSE)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
newchain.evt = nil_event;
newchain.evt = evt;
newchain.triggering_controler = peffect->handler->current.controler;
newchain.triggering_effect = peffect;
newchain.triggering_location = peffect->handler->current.location;
......@@ -2069,7 +2098,7 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
if(core.select_chains.size() && returns.ivalue[0] != -1) {
chain newchain = core.select_chains[returns.ivalue[0]];
core.new_chains.push_back(newchain);
core.delayed_quick.erase(newchain.triggering_effect);
core.delayed_quick.erase(make_pair(newchain.triggering_effect, newchain.evt));
newchain.triggering_effect->handler->set_status(STATUS_CHAINING, TRUE);
add_process(PROCESSOR_ADD_CHAIN, 0, 0, 0, 0, 0);
add_process(PROCESSOR_QUICK_EFFECT, 0, 0, 0, FALSE, 1 - priority);
......@@ -2200,13 +2229,13 @@ int32 field::process_instant_event() {
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if((peffect->flag & EFFECT_FLAG_DELAY) && peffect->is_condition_check(peffect->handler->current.controler, *elit))
core.delayed_quick_tmp.insert(peffect);
core.delayed_quick_tmp.insert(make_pair(peffect, *elit));
}
pr = effects.quick_o_effect.equal_range(elit->event_code);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
if((peffect->flag & EFFECT_FLAG_DELAY) && peffect->is_condition_check(peffect->handler->current.controler, *elit))
core.delayed_quick_tmp.insert(peffect);
core.delayed_quick_tmp.insert(make_pair(peffect, *elit));
}
}
for(eit = tp.begin(), evit = tev.begin(); eit != tp.end(); ++eit, ++evit) {
......
......@@ -38,6 +38,7 @@ function c10110717.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c10110717.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,g)
end
end
function c10110717.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -28,8 +28,6 @@ function c12423762.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.ConfirmCards(1-tp,c)
Duel.ShuffleHand(tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function c12423762.spop(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -42,7 +42,7 @@ function c13455953.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c13455953.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
end
function c13455953.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -77,7 +77,7 @@ function c15335853.rmop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c15335853.atfilter(c)
return not c:IsSetCard(0x101b)
return not c:IsSetCard(0x101b) and c:IsType(TYPE_MONSTER)
end
function c15335853.atcon(e)
return Duel.IsExistingMatchingCard(c15335853.atfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil)
......
......@@ -13,17 +13,17 @@ end
function c17490535.condition(e,tp,eg,ep,ev,re,r,rp)
local ec=eg:GetFirst()
return eg:GetCount()==1 and ec:GetPreviousControler()==tp and ec:IsRace(RACE_REPTILE)
and bit.band(ec:GetPreviousRaceOnField(),RACE_REPTILE)~=0
and ec==Duel.GetAttackTarget() and ec:IsLocation(LOCATION_GRAVE) and ec:IsReason(REASON_BATTLE)
end
function c17490535.target(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=eg:GetFirst():GetReasonCard()
if chk==0 then return tc:IsRelateToBattle() and tc:IsControlerCanBeChanged() end
tc:CreateEffectRelation(e)
e:SetLabelObject(tc)
if chk==0 then return tc:IsControler(1-tp) and tc:IsRelateToBattle() and tc:IsControlerCanBeChanged() end
Duel.SetTargetCard(tc)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,tc,1,0,0)
end
function c17490535.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if Duel.GetControl(tc,tp) then
local e1=Effect.CreateEffect(e:GetHandler())
......
......@@ -37,7 +37,6 @@ function c19310321.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,tc,e)
local oc=g:GetFirst()
if g:GetCount()>0 then
Duel.Overlay(tc,g)
end
......
......@@ -27,7 +27,6 @@ function c21785144.initial_effect(c)
e4:SetCategory(CATEGORY_DECKDES)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_MZONE)
e4:SetProperty(EFFECT_FLAG_REPEAT)
e4:SetCountLimit(1)
e4:SetCondition(c21785144.discon)
e4:SetTarget(c21785144.distg)
......
......@@ -18,7 +18,6 @@ function c22624373.initial_effect(c)
e2:SetDescription(aux.Stringid(22624373,1))
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCountLimit(1)
e2:SetCondition(c22624373.discon)
e2:SetTarget(c22624373.distg)
......
......@@ -4,6 +4,7 @@ function c23323812.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_RECOVER)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c23323812.condition)
e1:SetTarget(c23323812.target)
......@@ -17,13 +18,18 @@ end
function c23323812.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c23323812.filter,1,nil,tp)
end
function c23323812.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetAttacker():IsRelateToBattle() end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttacker(),1,0,0)
function c23323812.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local at=Duel.GetAttacker()
if chkc then return chkc==at end
if chk==0 then return at:IsControler(1-tp) and at:IsRelateToBattle() and at:IsCanBeEffectTarget(e) and at:IsDestructable() end
Duel.SetTargetCard(at)
local atk=at:GetAttack()
Duel.SetOperationInfo(0,CATEGORY_DESTROY,at,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,atk)
end
function c23323812.activate(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
if a:IsRelateToBattle() then
local a=Duel.GetFirstTarget()
if a:IsRelateToEffect(e) then
local atk=a:GetAttack()
if Duel.Destroy(a,REASON_EFFECT)~=0 then
Duel.Recover(tp,atk,REASON_EFFECT)
......
......@@ -15,7 +15,6 @@ function c2420921.initial_effect(c)
e2:SetCategory(CATEGORY_DECKDES)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCountLimit(1)
e2:SetCondition(c2420921.discon)
e2:SetTarget(c2420921.distg)
......
......@@ -22,6 +22,5 @@ function c27189308.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
Duel.ConfirmCards(1-tp,sg)
end
end
--素早いマンタ
--スノー・ドラゴン
function c3070049.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
......
......@@ -4,7 +4,7 @@ function c35307484.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(35307484,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CHAIN_UNIQUE+EFFECT_FLAG_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CHAIN_UNIQUE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
......@@ -17,11 +17,11 @@ function c35307484.initial_effect(c)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
end
function c35307484.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x8b) and c:GetCode()~=35307484
function c35307484.cfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x8b) and c:GetCode()~=35307484
end
function c35307484.condition(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c35307484.cfilter,1,nil)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c35307484.cfilter,1,nil,tp)
end
function c35307484.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,35307484)==0 end
......
......@@ -16,7 +16,6 @@ function c44178886.initial_effect(c)
e2:SetDescription(aux.Stringid(44178886,1))
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCountLimit(1)
e2:SetCondition(c44178886.discon)
e2:SetTarget(c44178886.distg)
......
......@@ -30,5 +30,6 @@ function c46044841.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c46044841.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -44,6 +44,7 @@ function c47111934.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not c47111934.check(tp) then return end
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)>0 then
Duel.ConfirmCards(1-tp,c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
......
......@@ -118,5 +118,6 @@ function c52709508.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_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,tc)
end
end
......@@ -14,7 +14,7 @@ end
function c54455435.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE)
and c:GetPreviousControler()==tp and c==Duel.GetAttackTarget()
and c:GetPreviousControler()==tp and c==Duel.GetAttackTarget() and Duel.GetAttacker():IsControler(1-tp)
end
function c54455435.filter(c,e,tp)
return c:IsSetCard(0x10) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
......
......@@ -47,7 +47,7 @@ function c55204071.spcon2(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1
end
function c55204071.spfilter(c,e,tp)
return c:IsSetCard(0x83) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
return c:IsCode(55204071) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c55204071.sptg2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -9,10 +9,9 @@ function c56052205.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(56052205,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_DAMAGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetCondition(c56052205.condition)
e2:SetTarget(c56052205.target)
e2:SetOperation(c56052205.operation)
......@@ -22,14 +21,14 @@ function c56052205.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x12) and c:GetCode()~=56052205
end
function c56052205.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and r==REASON_BATTLE and Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()==nil
return ep~=tp and Duel.GetAttackTarget()==nil
and Duel.IsExistingMatchingCard(c56052205.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c56052205.filter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c56052205.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()~=tp and chkc:IsOnField() and c56052205.filter(chkc) end
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and c56052205.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c56052205.filter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c56052205.filter,tp,0,LOCATION_ONFIELD,1,1,nil)
......
......@@ -65,6 +65,5 @@ function c56321639.thop(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
end
end
......@@ -32,24 +32,28 @@ function c56981417.filter(c)
return c:IsSetCard(0x106e) and c:GetCode()~=56981417 and c:GetType()==TYPE_SPELL and c:CheckActivateEffect(true,true,false)~=nil
end
function c56981417.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c56981417.filter(chkc) end
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc)
end
if chk==0 then return Duel.IsExistingTarget(c56981417.filter,tp,LOCATION_GRAVE,0,1,nil) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
e:SetCategory(0)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c56981417.filter,tp,LOCATION_GRAVE,0,1,1,nil)
end
function c56981417.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) or tc:CheckActivateEffect(true,true,false)==nil then return end
local tpe=tc:GetType()
local te=tc:GetActivateEffect()
local g=Duel.SelectTarget(tp,c56981417.filter,tp,LOCATION_GRAVE,0,1,1,nil)
local te=g:GetFirst():CheckActivateEffect(true,true,false)
e:SetLabelObject(te)
Duel.ClearTargetCard()
g:GetFirst():CreateEffectRelation(e)
local tg=te:GetTarget()
local op=te:GetOperation()
e:SetCategory(te:GetCategory())
e:SetProperty(te:GetProperty())
Duel.ClearTargetCard()
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
Duel.BreakEffect()
end
function c56981417.operation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te:GetHandler():IsRelateToEffect(e) then return end
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
end
......@@ -21,5 +21,6 @@ function c6104968.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstMatchingCard(c6104968.filter,tp,LOCATION_DECK,0,nil,e,tp)
if tc and Duel.SelectYesNo(tp,aux.Stringid(6104968,1)) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,tc)
end
end
......@@ -3,6 +3,7 @@ function c61166988.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c61166988.target)
......@@ -12,7 +13,8 @@ end
function c61166988.filter(c)
return c:IsFaceup() and c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR)
end
function c61166988.target(e,tp,eg,ep,ev,re,r,rp,chk)
function c61166988.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c61166988.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c61166988.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c61166988.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -2,18 +2,16 @@
function c61587183.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(61587183,0))
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(c61587183.condition)
e1:SetTarget(c61587183.target)
e1:SetOperation(c61587183.operation)
c:RegisterEffect(e1)
end
function c61587183.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and r==REASON_BATTLE and eg:GetFirst()==e:GetHandler()
return ep~=tp
end
function c61587183.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end
......@@ -36,8 +34,8 @@ function c61587183.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
e:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET)
else e:SetProperty(EFFECT_FLAG_DAMAGE_STEP) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else e:SetProperty(0) end
end
function c61587183.operation(e,tp,eg,ep,ev,re,r,rp)
if e:GetLabel()==0 then
......
......@@ -11,21 +11,27 @@ function c63422098.initial_effect(c)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(0)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetOperation(c63422098.regop)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENCE)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
--
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetOperation(c63422098.regop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c63422098.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetSummonType()==SUMMON_TYPE_SYNCHRO then
local ct=c:GetMaterialCount()
e:GetLabelObject():SetValue(ct*200-200)
local ct=c:GetMaterialCount()-1
e:GetLabelObject():SetValue(ct*200)
e:GetLabelObject():GetLabelObject():SetValue(ct*200)
else
e:GetLabelObject():SetValue(0)
e:GetLabelObject():GetLabelObject():SetValue(0)
end
end
......@@ -32,5 +32,6 @@ function c64815084.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c64815084.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -2,18 +2,16 @@
function c6967870.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(6967870,0))
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DECKDES)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(c6967870.condition)
e1:SetTarget(c6967870.target)
e1:SetOperation(c6967870.operation)
c:RegisterEffect(e1)
end
function c6967870.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and r==REASON_BATTLE and eg:GetFirst()==e:GetHandler()
return ep~=tp
end
function c6967870.filter(c)
return c:IsType(TYPE_TRAP+TYPE_SPELL) and c:IsDestructable()
......@@ -21,14 +19,14 @@ end
function c6967870.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then
if chkc then return chkc:IsOnField() and c6967870.filter(chkc) end
return Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>1
return Duel.IsPlayerCanDiscardDeck(1-tp,2)
or Duel.IsExistingTarget(c6967870.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
local op=0
if Duel.IsExistingTarget(c6967870.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>1 then
and Duel.IsPlayerCanDiscardDeck(1-tp,2) then
op=Duel.SelectOption(tp,aux.Stringid(6967870,1),aux.Stringid(6967870,2))
elseif Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>1 then
elseif Duel.IsPlayerCanDiscardDeck(1-tp,2) then
Duel.SelectOption(tp,aux.Stringid(6967870,2))
op=1
else
......@@ -40,10 +38,10 @@ function c6967870.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c6967870.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
e:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET)
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
else
Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,1-tp,1)
e:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e:SetProperty(0)
end
end
function c6967870.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -16,7 +16,6 @@ function c7183277.initial_effect(c)
e2:SetCategory(CATEGORY_DECKDES)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCountLimit(1)
e2:SetCondition(c7183277.discon)
e2:SetTarget(c7183277.distg)
......
......@@ -106,6 +106,7 @@ function c74506079.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_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,tc)
end
end
function c74506079.costfilter(c)
......
......@@ -26,14 +26,16 @@ function c74852810.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SelectTarget(tp,c74852810.filter2,tp,LOCATION_MZONE,0,1,1,nil)
end
function c74852810.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc1=e:GetLabelObject()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc2=g:GetFirst()
if tc1==tc2 then tc2=g:GetNext() end
if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
local mg=tc1:GetOverlayGroup()
if mg:GetCount()>0 then
Duel.Overlay(tc2,mg)
end
if tc1:IsFacedown() or not tc1:IsRelateToEffect(e) then return end
local og=tc1:GetOverlayGroup()
if og:GetCount()==0 then return end
if Duel.SendtoGrave(og,REASON_EFFECT)~=0 and tc2:IsFaceup() and tc2:IsRelateToEffect(e) and c:IsRelateToEffect(e) then
c:CancelToGrave()
Duel.Overlay(tc2,Group.FromCards(c))
end
end
......@@ -39,8 +39,8 @@ function c76573247.seqop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveSequence(e:GetHandler(),nseq)
end
end
function c76573247.dircon(e,tp)
function c76573247.dircon(e)
local p=1-e:GetHandlerPlayer()
local seq=4-e:GetHandler():GetSequence()
return Duel.GetFieldCard(e:GetOwnerPlayer(),LOCATION_MZONE,seq)==nil
and Duel.GetFieldCard(e:GetOwnerPlayer(),LOCATION_SZONE,seq)==nil
return Duel.GetFieldCard(p,LOCATION_MZONE,seq)==nil and Duel.GetFieldCard(p,LOCATION_SZONE,seq)==nil
end
......@@ -6,7 +6,6 @@ function c83725008.initial_effect(c)
e1:SetDescription(aux.Stringid(83725008,0))
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_MZONE)
e1:SetProperty(EFFECT_FLAG_REPEAT)
e1:SetCountLimit(1)
e1:SetCondition(c83725008.lpcon)
e1:SetTarget(c83725008.lptg)
......
......@@ -28,5 +28,6 @@ function c87483942.spop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c87483942.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,ft,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -23,7 +23,7 @@ function c90616316.initial_effect(c)
c:RegisterEffect(e2)
end
function c90616316.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetPreviousLocation()==LOCATION_HAND and bit.band(r,REASON_DISCARD)~=0
return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,REASON_DISCARD)~=0
end
function c90616316.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......@@ -31,8 +31,10 @@ function c90616316.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c90616316.spop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEDOWN_DEFENCE)
Duel.ConfirmCards(1-tp,c)
end
end
function c90616316.cfilter(c)
......
......@@ -36,8 +36,8 @@ end
function c92394653.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToHand() end
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,1,nil)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(1-tp,Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
end
function c92394653.operation(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -19,7 +19,6 @@ function c95503687.initial_effect(c)
e2:SetDescription(aux.Stringid(95503687,1))
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_REPEAT)
e2:SetCountLimit(1)
e2:SetCondition(c95503687.discon)
e2:SetTarget(c95503687.distg)
......
......@@ -26,7 +26,7 @@ function c97904474.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:GetPreviousControler()==tp
and c==Duel.GetAttackTarget() and bc:IsFaceup() and bc:IsRelateToBattle()
and c==Duel.GetAttackTarget() and bc:IsFaceup() and bc:IsControler(1-tp) and bc:IsRelateToBattle()
end
function c97904474.eqtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
......
--聖蛇の息吹
function c98850929.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(98850929,0))
e1:SetDescription(aux.Stringid(98850929,4))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c98850929.condition1)
e1:SetCost(c98850929.cost)
e1:SetTarget(c98850929.target1)
e1:SetTarget(c98850929.target)
e1:SetOperation(c98850929.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(98850929,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCondition(c98850929.condition2)
e2:SetCost(c98850929.cost)
e2:SetTarget(c98850929.target2)
e2:SetOperation(c98850929.operation)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(98850929,2))
e3:SetCategory(CATEGORY_TOHAND)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_ACTIVATE)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetCondition(c98850929.condition3)
e3:SetCost(c98850929.cost)
e3:SetTarget(c98850929.target3)
e3:SetOperation(c98850929.operation)
c:RegisterEffect(e3)
end
function c98850929.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_FUSION+TYPE_RITUAL+TYPE_SYNCHRO+TYPE_XYZ)
......@@ -40,57 +17,74 @@ end
function c98850929.typecast(c)
return bit.band(c:GetType(),TYPE_FUSION+TYPE_RITUAL+TYPE_SYNCHRO+TYPE_XYZ)
end
function c98850929.condition1(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c98850929.cfilter,tp,LOCATION_MZONE,0,nil)
return g:GetClassCount(c98850929.typecast)>=2
end
function c98850929.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,98850929)==0 end
Duel.RegisterFlagEffect(tp,98850929,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
end
function c98850929.filter1(c)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
function c98850929.filter1(c,e)
return c:IsFaceup() and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e)
end
function c98850929.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE+LOCATION_REMOVED) and chkc:IsControler(tp) and c98850929.filter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98850929.filter1,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c98850929.filter1,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
end
function c98850929.condition2(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c98850929.cfilter,tp,LOCATION_MZONE,0,nil)
return g:GetClassCount(c98850929.typecast)>=3
function c98850929.filter2(c,e)
return c:IsType(TYPE_TRAP) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e)
end
function c98850929.filter2(c)
return c:IsType(TYPE_TRAP) and c:IsAbleToHand()
function c98850929.filter3(c,e)
return c:IsType(TYPE_SPELL) and c:GetCode()~=98850929 and c:IsAbleToHand() and c:IsCanBeEffectTarget(e)
end
function c98850929.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c98850929.filter2(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98850929.filter2,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c98850929.filter2,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
end
function c98850929.condition3(e,tp,eg,ep,ev,re,r,rp)
function c98850929.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c98850929.cfilter,tp,LOCATION_MZONE,0,nil)
return g:GetClassCount(c98850929.typecast)>=4
end
function c98850929.filter3(c)
return c:IsType(TYPE_SPELL) and c:GetCode()~=98850929 and c:IsAbleToHand()
end
function c98850929.target3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c98850929.filter3(chkc) end
if chk==0 then return Duel.IsExistingTarget(c98850929.filter3,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c98850929.filter3,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0)
local ct=g:GetClassCount(c98850929.typecast)
local g1=Duel.GetMatchingGroup(c98850929.filter1,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e)
local g2=Duel.GetMatchingGroup(c98850929.filter2,tp,LOCATION_GRAVE,0,nil,e)
local g3=Duel.GetMatchingGroup(c98850929.filter3,tp,LOCATION_GRAVE,0,nil,e)
if chk==0 then return (ct>1 and g1:GetCount()>0) or (ct>2 and g2:GetCount()>0) or (ct>3 and g3:GetCount()>0) end
local tg=Group.CreateGroup()
local off=0
repeat
local ops={}
local opval={}
off=1
if ct>1 and g1:GetCount()>0 then
ops[off]=aux.Stringid(98850929,0)
opval[off-1]=1
off=off+1
end
if ct>2 and g2:GetCount()>0 then
ops[off]=aux.Stringid(98850929,1)
opval[off-1]=2
off=off+1
end
if ct>3 and g3:GetCount()>0 then
ops[off]=aux.Stringid(98850929,2)
opval[off-1]=3
off=off+1
end
local op=Duel.SelectOption(tp,table.unpack(ops))
if opval[op]==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g1:Select(tp,1,1,nil)
tg:Merge(sg)
g1:Clear()
elseif opval[op]==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g2:Select(tp,1,1,nil)
tg:Merge(sg)
g2:Clear()
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local sg=g3:Select(tp,1,1,nil)
tg:Merge(sg)
g3:Clear()
end
until off<3 or not Duel.SelectYesNo(tp,aux.Stringid(98850929,3))
Duel.SetTargetCard(tg)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,tg,tg:GetCount(),0,0)
end
function c98850929.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if sg:GetCount()>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,sg)
end
end
......@@ -58,7 +58,7 @@ function c9888196.destg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c9888196.desop1(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
if tc:IsRelateToEffect(e) and tc:IsFacedown() then
Duel.Destroy(tc,REASON_EFFECT)
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment