Commit 918683a3 authored by sidschingis's avatar sidschingis

Merge remote-tracking branch 'upstream/master'

Conflicts:
	script/c35183853.lua
parents 5e2b6c51 39d3291c
......@@ -656,16 +656,21 @@ void card::xyz_overlay(card_set* materials) {
return;
card_set des;
if(materials->size() == 1) {
(*materials->begin())->reset(RESET_LEAVE + RESET_OVERLAY, RESET_EVENT);
xyz_add(*materials->begin(), &des);
card* pcard = *materials->begin();
pcard->reset(RESET_LEAVE + RESET_OVERLAY, RESET_EVENT);
if(pcard->unique_code)
pduel->game_field->remove_unique_card(pcard);
xyz_add(pcard, &des);
} else {
field::card_vector cv;
for(auto cit = materials->begin(); cit != materials->end(); ++cit)
cv.push_back(*cit);
for(auto cit : *materials)
cv.push_back(cit);
std::sort(cv.begin(), cv.end(), card::card_operation_sort);
for(auto cvit = cv.begin(); cvit != cv.end(); ++cvit) {
(*cvit)->reset(RESET_LEAVE + RESET_OVERLAY, RESET_EVENT);
xyz_add(*cvit, &des);
for(auto pcard : cv) {
pcard->reset(RESET_LEAVE + RESET_OVERLAY, RESET_EVENT);
if(pcard->unique_code)
pduel->game_field->remove_unique_card(pcard);
xyz_add(pcard, &des);
}
}
if(des.size())
......
......@@ -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()
......
--Moon Dance Ritual
function c14005031.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1e0)
e1:SetTarget(c14005031.target)
e1:SetOperation(c14005031.activate)
c:RegisterEffect(e1)
--disable
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c14005031.disable)
e2:SetCondition(c14005031.discon)
e2:SetCode(EFFECT_DISABLE)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_LEAVE_FIELD)
e3:SetCondition(c14005031.descon)
e3:SetOperation(c14005031.desop)
c:RegisterEffect(e3)
end
function c14005031.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:GetOverlayCount()==0 and c:IsAttribute(ATTRIBUTE_WIND)
end
function c14005031.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c14005031.filter(chk) end
if chk==0 then return Duel.IsExistingTarget(c14005031.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,c14005031.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c14005031.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
c:SetCardTarget(tc)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(14005031,0))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_REPEAT)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1)
e1:SetCondition(c14005031.matcon)
e1:SetOperation(c14005031.matop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
end
end
function c14005031.disable(e,c)
return c:IsType(TYPE_EFFECT)
end
function c14005031.discon(e)
return e:GetHandler():GetFirstCardTarget()~=nil
end
function c14005031.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
return tc and eg:IsContains(tc)
end
function c14005031.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
function c14005031.matcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFirstCardTarget()~=nil
end
function c14005031.matop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetFirstCardTarget()
if tc then
Duel.Overlay(tc,Group.FromCards(c))
end
end
--Confronting the "C"
function c15721123.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(15721123,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_HAND)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c15721123.spcon)
e1:SetTarget(c15721123.sptg)
e1:SetOperation(c15721123.spop)
c:RegisterEffect(e1)
end
function c15721123.cfilter(c,tp)
return c:GetSummonPlayer()==tp and c:IsPreviousLocation(LOCATION_EXTRA)
end
function c15721123.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c15721123.cfilter,1,nil,1-tp)
end
function c15721123.sptg(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 c15721123.spop(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:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetValue(c15721123.efilter)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
end
end
function c15721123.efilter(e,te)
if not te:IsActiveType(TYPE_MONSTER) then return false end
local c=e:GetHandler()
local ec=te:GetHandler()
if ec:IsHasCardTarget(c) then return true end
return te:IsHasType(EFFECT_TYPE_ACTIONS) and te:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and c:IsRelateToEffect(te)
end
--Mecha Phantom Beast Aerosguin
function c16943770.initial_effect(c)
--level
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(c16943770.lvval)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetCondition(c16943770.indcon)
e2:SetValue(1)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e3)
--token
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(16943770,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetCost(c16943770.spcost)
e4:SetTarget(c16943770.sptg)
e4:SetOperation(c16943770.spop)
c:RegisterEffect(e4)
end
function c16943770.lvval(e,c)
local tp=c:GetControler()
local lv=0
for i=0,4 do
local tc=Duel.GetFieldCard(tp,LOCATION_MZONE,i)
if tc and tc:IsCode(31533705) then lv=lv+tc:GetLevel() end
end
return lv
end
function c16943770.indcon(e)
return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil,TYPE_TOKEN)
end
function c16943770.cfilter(c)
return c:IsSetCard(0x101b) and not c:IsCode(16943770) and c:IsAbleToRemoveAsCost()
end
function c16943770.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c16943770.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c16943770.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c16943770.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,31533705,0x101b,0x4011,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0)
end
function c16943770.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if Duel.IsPlayerCanSpecialSummonMonster(tp,31533705,0x101b,0x4011,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) then
local token=Duel.CreateToken(tp,16943771)
Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -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)
......
--ZW-極星神馬聖鎧
function c2648201.initial_effect(c)
c:SetUniqueOnField(1,0,2648201)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(2648201,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_HAND+LOCATION_MZONE)
e1:SetCondition(c2648201.eqcon)
e1:SetTarget(c2648201.eqtg)
e1:SetOperation(c2648201.eqop)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(2648201,1))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(c2648201.spcon)
e2:SetTarget(c2648201.sptg)
e2:SetOperation(c2648201.spop)
c:RegisterEffect(e2)
end
function c2648201.eqcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():CheckUniqueOnField(tp)
end
function c2648201.filter(c)
return c:IsFaceup() and c:IsSetCard(0x7f)
end
function c2648201.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c2648201.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(c2648201.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c2648201.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c2648201.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsRelateToEffect(e) or not c:CheckUniqueOnField(tp) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c2648201.eqlimit)
c:RegisterEffect(e1)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(1000)
e2:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e2)
end
function c2648201.eqlimit(e,c)
return c:IsSetCard(0x7f)
end
function c2648201.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=c:GetPreviousEquipTarget()
return c:IsReason(REASON_LOST_TARGET) and c:GetPreviousControler()==tp and ec:IsReason(REASON_DESTROY) and ec:GetReasonPlayer()~=tp
end
function c2648201.spfilter(c,e,tp)
return c:IsSetCard(0x7f) and c:IsCanBeSpecialSummoned(e,0,tp,tp,false,false)
end
function c2648201.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c2648201.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c2648201.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c2648201.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c2648201.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
......@@ -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
......
--琰魔竜 レッド・デーモン
function c39765958.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetDescription(aux.Stringid(39765958,0))
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c39765958.descon)
e1:SetCost(c39765958.descost)
e1:SetTarget(c39765958.destg)
e1:SetOperation(c39765958.desop)
c:RegisterEffect(e1)
end
function c39765958.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_MAIN1
end
function c39765958.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c39765958.ftarget)
e1:SetLabel(e:GetHandler():GetFieldID())
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c39765958.ftarget(e,c)
return e:GetLabel()~=c:GetFieldID()
end
function c39765958.dfilter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsDestructable()
end
function c39765958.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c39765958.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
local sg=Duel.GetMatchingGroup(c39765958.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,sg:GetCount(),0,0)
end
function c39765958.desop(e,tp,eg,ep,ev,re,r,rp)
local sg=Duel.GetMatchingGroup(c39765958.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
Duel.Destroy(sg,REASON_EFFECT)
end
--Angel of Zera
function c42216237.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
c:EnableReviveLimit()
--
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(c42216237.atkval)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_REMOVE)
e2:SetOperation(c42216237.spreg)
c:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(42216237,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetRange(LOCATION_REMOVED)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetCondition(c42216237.spcon)
e3:SetCost(c42216237.spcost)
e3:SetTarget(c42216237.sptg)
e3:SetOperation(c42216237.spop)
e3:SetLabelObject(e2)
c:RegisterEffect(e3)
end
function c42216237.atkval(e,c)
return Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_REMOVED)*100
end
function c42216237.spreg(e,tp,eg,ep,ev,re,r,rp)
e:SetLabel(Duel.GetTurnCount())
e:GetHandler():RegisterFlagEffect(42216237,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,2)
end
function c42216237.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and c:GetFlagEffect(42216237)>0
end
function c42216237.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,42216237)==0 end
Duel.RegisterFlagEffect(tp,42216237,RESET_PHASE+PHASE_END,0,1)
end
function c42216237.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
c:ResetFlagEffect(42216237)
end
function c42216237.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
end
end
--Cockadoodledoo
function c42338879.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:SetCondition(c42338879.spcon)
e1:SetOperation(c42338879.spop)
c:RegisterEffect(e1)
--redirect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e2:SetCondition(c42338879.recon)
e2:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e2)
end
function c42338879.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,LOCATION_MZONE)==0
or (Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0))
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
end
function c42338879.spop(e,tp,eg,ep,ev,re,r,rp,c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,LOCATION_MZONE)==0 then
e1:SetValue(3)
else
e1:SetValue(4)
end
e1:SetReset(RESET_EVENT+0xff0000)
c:RegisterEffect(e1)
end
function c42338879.recon(e)
return e:GetHandler():IsFaceup()
end
......@@ -38,14 +38,14 @@ function c42551040.posop(e,tp,eg,ep,ev,re,r,rp)
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
if tc:IsPosition(POS_FACEUP_ATTACK) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENCE)
end
if tc:GetDefence()>0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENCE_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
if tc:GetDefence()>0 then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENCE_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e1)
end
end
end
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)
......
......@@ -13,7 +13,8 @@ function c50457953.initial_effect(c)
c:RegisterEffect(e1)
end
function c50457953.lvfilter(c,lv)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) and c:IsRace(RACE_DRAGON)
local clv=c:GetLevel()
return c:IsFaceup() and clv>0 and clv~=lv and c:IsAttribute(ATTRIBUTE_WATER) and c:IsRace(RACE_DRAGON)
end
function c50457953.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c50457953.lvfilter(chkc,e:GetHandler():GetLevel()) end
......
......@@ -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
--Noble Knight Drystan
function c53550467.initial_effect(c)
--cannot be battle target
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e1:SetCondition(c53550467.con)
e1:SetTarget(c53550467.tg)
e1:SetValue(1)
c:RegisterEffect(e1)
--
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetCondition(c53550467.con)
e2:SetTarget(c53550467.tg)
e2:SetValue(c53550467.efval)
c:RegisterEffect(e2)
--destroy
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(53550467,0))
e3:SetCategory(CATEGORY_DESTROY)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CHAIN_UNIQUE)
e3:SetCode(EVENT_EQUIP)
e3:SetCondition(c53550467.descon)
e3:SetCost(c53550467.descost)
e3:SetTarget(c53550467.destg)
e3:SetOperation(c53550467.desop)
c:RegisterEffect(e3)
end
function c53550467.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x107a)
end
function c53550467.con(e)
return Duel.IsExistingMatchingCard(c53550467.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler())
end
function c53550467.tg(e,c)
return c~=e:GetHandler() and c:IsAttackBelow(1800)
end
function c53550467.efval(e,re,tp)
return e:GetHandlerPlayer()~=tp
end
function c53550467.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsSetCard,1,nil,0x207a)
end
function c53550467.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,53550467)==0 end
Duel.RegisterFlagEffect(tp,53550467,RESET_PHASE+PHASE_END,0,1)
end
function c53550467.desfilter(c)
return c:IsFaceup() and c:IsDestructable()
end
function c53550467.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c53550467.desfilter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c53550467.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c53550467.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Destroy(tc,REASON_EFFECT)
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)
......
......@@ -53,12 +53,15 @@ function c61466310.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
elseif t1 then e:SetLabel(Duel.SelectOption(tp,aux.Stringid(61466310,1)))
else e:SetLabel(Duel.SelectOption(tp,aux.Stringid(61466310,2))+1) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
eg:GetFirst():CreateEffectRelation(e)
end
function c61466310.thop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local ec=eg:GetFirst()
if ec:IsFacedown() or not ec:IsRelateToEffect(e) then return end
local atk=e:GetLabel()==0 and 2400 or 2800
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c61466310.filter2,tp,LOCATION_DECK,0,1,1,nil,atk,eg:GetFirst():GetCode())
local g=Duel.SelectMatchingCard(tp,c61466310.filter2,tp,LOCATION_DECK,0,1,1,nil,atk,ec:GetCode())
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
......
......@@ -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
--No.72 ラインモンスター チャリオッツ・飛車
function c75253697.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.XyzFilterFunction(c,6),2)
c:EnableReviveLimit()
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(75253697,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c75253697.descost)
e1:SetTarget(c75253697.destg)
e1:SetOperation(c75253697.desop)
c:RegisterEffect(e1)
end
function c75253697.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,2,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,2,2,REASON_COST)
end
function c75253697.dfilter(c,pos)
return c:IsPosition(pos) and c:IsDestructable()
end
function c75253697.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(c75253697.dfilter,tp,0,LOCATION_MZONE,1,nil,POS_FACEUP)
and Duel.IsExistingTarget(c75253697.dfilter,tp,0,LOCATION_SZONE,1,nil,POS_FACEDOWN) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,c75253697.dfilter,tp,0,LOCATION_MZONE,1,1,nil,POS_FACEUP)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,c75253697.dfilter,tp,0,LOCATION_SZONE,1,1,nil,POS_FACEDOWN)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0)
end
function c75253697.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()>0 then
Duel.Destroy(tg,REASON_EFFECT)
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CHANGE_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetValue(c75253697.val)
e1:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e1,tp)
end
function c75253697.val(e,re,dam,r,rp,rc)
if bit.band(r,REASON_BATTLE)~=0 then
return dam/2
else return dam end
end
......@@ -44,7 +44,6 @@ function c75498415.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ATTACK)
e2:SetProperty(EFFECT_FLAG_OATH)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(c75498415.ftarget)
e2:SetLabel(g:GetFirst():GetFieldID())
......
......@@ -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
......@@ -30,11 +30,8 @@ function c77334267.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g=Duel.SelectTarget(tp,c77334267.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0)
end
function c77334267.dfilter(c,e)
return c:IsFacedown() and c:IsRelateToEffect(e)
end
function c77334267.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local dg=g:Filter(c77334267.dfilter,nil,e)
Duel.Destroy(dg,REASON_EFFECT)
if g:IsRelateToEffect(e) then
Duel.Destroy(g,REASON_EFFECT)
end
--Xyz Encore
function c78610936.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1e0)
e1:SetTarget(c78610936.target)
e1:SetOperation(c78610936.activate)
c:RegisterEffect(e1)
end
function c78610936.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToExtra() and c:GetOverlayCount()>0
end
function c78610936.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 c78610936.filter(chk) end
if chk==0 then return Duel.IsExistingTarget(c78610936.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c78610936.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
Duel.SetChainLimit(c78610936.chlimit)
end
function c78610936.chlimit(e,ep,tp)
return tp==ep
end
function c78610936.spfilter(c,e,tp)
return c:IsLocation(LOCATION_GRAVE) and c:GetLevel()>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp)
and not c:IsHasEffect(EFFECT_NECRO_VALLEY)
end
function c78610936.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) then return end
local mg=tc:GetOverlayGroup()
if Duel.SendtoDeck(tc,nil,0,REASON_EFFECT)>0 then
local ft=Duel.GetLocationCount(1-tp,LOCATION_MZONE)
if ft>0 and mg:GetCount()>0 then
if mg:GetCount()>ft then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
mg=mg:Select(tp,ft,ft,nil)
end
local tc=mg:GetFirst()
while tc do
Duel.SpecialSummonStep(tc,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(-1)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
tc=mg:GetNext()
end
Duel.SpecialSummonComplete()
end
end
end
--Bujingi Warg
function c80555062.initial_effect(c)
--
local e1=Effect.CreateEffect(c)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(c80555062.target)
e1:SetCondition(c80555062.con)
e1:SetValue(1)
c:RegisterEffect(e1)
end
function c80555062.con(e)
return e:GetHandler():IsDefencePos()
end
function c80555062.target(e,c)
return c~=e:GetHandler() and c:IsSetCard(0x88)
end
......@@ -47,7 +47,7 @@ function c81907872.posop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c81907872.cfilter(c,tp)
return c:IsControler(tp) and c:IsSetCard(0x8d) and c:IsReason(REASON_DESTROY) and c:IsType(TYPE_MONSTER)
return c:IsControler(tp) and c:IsPreviousPosition(POS_FACEUP) and c:IsSetCard(0x8d) and c:IsReason(REASON_DESTROY) and c:IsType(TYPE_MONSTER)
and (not c:IsReason(REASON_BATTLE) or c==Duel.GetAttackTarget())
end
function c81907872.spcon(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -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
--Tour Bus To Forbidden Realms
function c89732524.initial_effect(c)
--flip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(89732524,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP)
e1:SetTarget(c89732524.target)
e1:SetOperation(c89732524.operation)
c:RegisterEffect(e1)
end
function c89732524.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c89732524.filter(c)
return c:IsRace(RACE_FIEND) and not c:IsAttribute(ATTRIBUTE_DARK+ATTRIBUTE_LIGHT) and c:IsAbleToHand()
end
function c89732524.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c89732524.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
......@@ -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
......
......@@ -5,7 +5,7 @@ antialias = 2
errorlog = 1
nickname = Player
gamename = Game
lastdeck = new
lastdeck = 806
textfont = c:/windows/fonts/simsun.ttc 14
numfont = c:/windows/fonts/arialbd.ttf
serverport = 7911
......
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