Commit 89b03ef9 authored by argon.sun's avatar argon.sun

new

parent 9edd2ed8
......@@ -25,12 +25,12 @@ class effect;
struct tevent {
card* trigger_card;
uint32 event_code;
group* event_cards;
uint32 event_value;
uint8 event_player;
effect* reason_effect;
uint32 event_code;
uint32 event_value;
uint32 reason;
uint8 event_player;
uint8 reason_player;
};
struct optarget {
......
......@@ -239,6 +239,7 @@ static const struct luaL_Reg effectlib[] = {
{ "IsHasCategory", scriptlib::effect_is_has_category },
{ "IsHasType", scriptlib::effect_is_has_type },
{ "IsActivatable", scriptlib::effect_is_activatable },
{ "GetActivateLocation", scriptlib::effect_get_activate_location },
{ NULL, NULL }
};
......
......@@ -503,3 +503,14 @@ int32 scriptlib::effect_is_activatable(lua_State *L) {
lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event));
return 1;
}
int32 scriptlib::effect_get_activate_location(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
if(peffect->type & (EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O | EFFECT_TYPE_QUICK_F))
lua_pushinteger(L, peffect->handler->current.location);
else
lua_pushinteger(L, peffect->s_range);
return 1;
}
\ No newline at end of file
......@@ -2090,6 +2090,8 @@ int32 field::process_instant_event() {
if(!peffect->is_condition_check(peffect->handler->current.controler, *elit))
continue;
peffect->handler->create_relation(peffect);
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
newchain.evt = *elit;
......@@ -2108,6 +2110,8 @@ int32 field::process_instant_event() {
if(!peffect->is_condition_check(peffect->handler->current.controler, *elit))
continue;
peffect->handler->create_relation(peffect);
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
newchain.evt = *elit;
......@@ -2126,6 +2130,8 @@ int32 field::process_instant_event() {
peffect = pr.first->second;
if(peffect->is_activateable(peffect->handler->current.controler, *elit)) {
peffect->handler->create_relation(peffect);
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
newchain.evt = *elit;
......@@ -2201,6 +2207,8 @@ int32 field::process_single_event() {
if(!peffect->is_condition_check(peffect->handler->current.controler, e))
continue;
peffect->handler->create_relation(peffect);
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
chain newchain;
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
......
......@@ -238,6 +238,7 @@ public:
static int32 effect_is_has_category(lua_State *L);
static int32 effect_is_has_type(lua_State *L);
static int32 effect_is_activatable(lua_State *L);
static int32 effect_get_activate_location(lua_State *L);
//Group functions
static int32 group_new(lua_State *L);
......
......@@ -95,7 +95,7 @@ function c14745409.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterFlagEffect(tp,14745409,RESET_PHASE+PHASE_END,0,1)
end
function c14745409.eqfilter(c)
return c:IsFaceup() and c:IsSetCard(0x7a) and c:IsRace(RACE_WARRIOR)
return c:IsFaceup() and c:IsSetCard(0x107a) and c:IsRace(RACE_WARRIOR)
end
function c14745409.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c14745409.eqfilter(chkc) end
......
--Spellbook Library of the Heliosphere
function c20822520.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c20822520.condition)
e1:SetCost(c20822520.cost)
e1:SetTarget(c20822520.target)
e1:SetOperation(c20822520.activate)
c:RegisterEffect(e1)
if not c20822520.global_check then
c20822520.global_check=true
c20822520[0]=true
c20822520[1]=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(c20822520.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge2:SetOperation(c20822520.clear)
Duel.RegisterEffect(ge2,0)
end
end
function c20822520.checkop(e,tp,eg,ep,ev,re,r,rp)
if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and not re:GetHandler():IsSetCard(0x106e) then
c20822520[rp]=false
end
end
function c20822520.clear(e,tp,eg,ep,ev,re,r,rp)
c20822520[0]=true
c20822520[1]=true
end
function c20822520.cfilter(c)
return c:IsType(TYPE_SPELL) and c:IsSetCard(0x106e)
end
function c20822520.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c20822520.cfilter,tp,LOCATION_GRAVE,0,1,nil)
end
function c20822520.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,20822520)==0 and c20822520[tp] end
--oath effects
Duel.RegisterFlagEffect(tp,20822520,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(1,0)
e1:SetValue(c20822520.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c20822520.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and not re:GetHandler():IsSetCard(0x106e)
end
function c20822520.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<2 then return false end
local g=Duel.GetDecktopGroup(tp,2)
return g:FilterCount(Card.IsAbleToHand,nil)>0
end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c20822520.filter(c)
return c:IsType(TYPE_SPELL) and c:IsSetCard(0x106e) and c:IsAbleToHand()
end
function c20822520.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.ConfirmDecktop(p,2)
local g=Duel.GetDecktopGroup(p,2)
if g:GetCount()>0 then
local sg=g:Filter(c20822520.filter,nil)
if sg:GetFirst():IsAbleToHand() then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
Duel.ConfirmCards(1-p,sg)
Duel.ShuffleHand(p)
else
Duel.SendtoGrave(sg,REASON_EFFECT)
end
Duel.ShuffleDeck(p)
end
end
--Abyss Dweller
function c21044178.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,4),2)
c:EnableReviveLimit()
--atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetRange(LOCATION_MZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetCondition(c21044178.atkcon)
e1:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER))
e1:SetValue(500)
c:RegisterEffect(e1)
--activate limit
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(21044178,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c21044178.cost)
e2:SetOperation(c21044178.operation)
c:RegisterEffect(e2)
end
function c21044178.atkcon(e)
return e:GetHandler():GetOverlayGroup():IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_WATER)
end
function c21044178.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c21044178.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetTargetRange(0,1)
e1:SetValue(c21044178.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END+RESET_OPPO_TURN,1)
Duel.RegisterEffect(e1,tp)
end
function c21044178.aclimit(e,re,tp)
return re:GetActivateLocation()==LOCATION_GRAVE
end
--Mermail Abyssmander
function c21767650.initial_effect(c)
--lvup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(21767650,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_GRAVE)
e1:SetCost(c21767650.lvcost)
e1:SetTarget(c21767650.lvtg)
e1:SetOperation(c21767650.lvop)
c:RegisterEffect(e1)
end
function c21767650.filter(c)
return c:IsFaceup() and c:IsSetCard(0x74) and not c:IsType(TYPE_XYZ)
end
function c21767650.lvcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
end
function c21767650.lvtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c21767650.filter,tp,LOCATION_MZONE,0,1,nil) end
local opt=Duel.SelectOption(tp,aux.Stringid(21767650,1),aux.Stringid(21767650,2))
e:SetLabel(opt)
end
function c21767650.lvop(e,tp,eg,ep,ev,re,r,rp)
local opt=e:GetLabel()
local g=Duel.GetMatchingGroup(c21767650.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(opt+1)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
--Spellbook Star Hall
function c56321639.initial_effect(c)
c:EnableCounterPermit(0x3001)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Add counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c56321639.ctcon)
e2:SetOperation(c56321639.ctop)
c:RegisterEffect(e2)
--atkup
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_SZONE)
e3:SetTargetRange(LOCATION_MZONE,0)
e3:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_SPELLCASTER))
e3:SetValue(c56321639.atkval)
c:RegisterEffect(e3)
--search
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(56321639,0))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e4:SetCode(EVENT_LEAVE_FIELD)
e4:SetCondition(c56321639.thcon)
e4:SetTarget(c56321639.thtg)
e4:SetOperation(c56321639.thop)
c:RegisterEffect(e4)
end
function c56321639.ctcon(e,tp,eg,ep,ev,re,r,rp)
local c=re:GetHandler()
return e:GetHandler()~=re:GetHandler() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and c:IsSetCard(0x106e)
end
function c56321639.ctop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():AddCounter(0x3001,1)
end
function c56321639.atkval(e,c)
return e:GetHandler():GetCounter(0x3001)*100
end
function c56321639.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ct=c:GetCounter(0x3001)
e:SetLabel(ct)
return ct>0 and c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_DESTROY)
end
function c56321639.filter(c,lv)
return c:IsLevelBelow(lv) and c:IsRace(RACE_SPELLCASTER) and c:IsAbleToHand()
end
function c56321639.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c56321639.filter,tp,LOCATION_DECK,0,1,nil,e:GetLabel()) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c56321639.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c56321639.filter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel())
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
Duel.ShuffleHand(tp)
end
end
--Giant Soldier of Steel
function c57043117.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,c57043117.xyzfilter,2)
c:EnableReviveLimit()
--immune
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_IMMUNE_EFFECT)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(c57043117.efilter)
c:RegisterEffect(e1)
--def
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DEFCHANGE)
e2:SetDescription(aux.Stringid(57043117,0))
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetCountLimit(1)
e2:SetHintTiming(TIMING_DAMAGE_STEP)
e2:SetCost(c57043117.cost)
e2:SetOperation(c57043117.operation)
c:RegisterEffect(e2)
end
function c57043117.xyzfilter(c)
return c:GetLevel()==3 and c:IsRace(RACE_ROCK)
end
function c57043117.efilter(e,te)
return te:IsActiveType(TYPE_MONSTER)
end
function c57043117.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c57043117.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and c:IsFaceup() then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_COPY_INHERIT)
e1:SetCode(EFFECT_UPDATE_DEFENCE)
e1:SetValue(1000)
e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END)
c:RegisterEffect(e1)
if Duel.GetFlagEffect(tp,57043117)==0 then
Duel.RegisterFlagEffect(tp,57043117,RESET_PHASE+PHASE_END,0,1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CHANGE_DAMAGE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,0)
e2:SetValue(c57043117.damval)
e2:SetReset(RESET_PHASE+PHASE_END,1)
Duel.RegisterEffect(e2,tp)
end
end
end
function c57043117.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT)~=0 and rp~=e:GetOwnerPlayer() then return 0
else return val end
end
--Red Dragon Ninja
function c58165765.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(58165765,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCost(c58165765.cost)
e1:SetTarget(c58165765.target)
e1:SetOperation(c58165765.operation)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
function c58165765.cfilter(c)
return (c:IsSetCard(0x2b) or c:IsSetCard(0x61)) and c:IsAbleToRemoveAsCost()
end
function c58165765.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c58165765.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c58165765.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c58165765.filter(c)
return c:IsFacedown() and c:IsDestructable()
end
function c58165765.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and c58165765.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c58165765.filter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c58165765.filter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetChainLimit(c58165765.limit(g:GetFirst()))
end
function c58165765.limit(c)
return function (e,lp,tp)
return e:GetHandler()~=c
end
end
function c58165765.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and tc:IsFacedown() then
Duel.ConfirmCards(tp,tc)
Duel.BreakEffect()
if tc:IsAbleToDeck() then
local opt=Duel.SelectOption(tp,aux.Stringid(58165765,1),aux.Stringid(58165765,2))
if opt==0 then
Duel.SendtoDeck(tc,nil,0,REASON_EFFECT)
else
Duel.SendtoDeck(tc,nil,1,REASON_EFFECT)
end
end
end
end
--Attack the Moon!
function c83715234.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(83715234,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_CHANGE_POS)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CHAIN_UNIQUE)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(c83715234.descon)
e2:SetTarget(c83715234.destg)
e2:SetOperation(c83715234.desop)
c:RegisterEffect(e2)
end
function c83715234.cfilter(c)
local np=c:GetPosition()
local pp=c:GetPreviousPosition()
return c:IsRace(RACE_ROCK) and not c:IsStatus(STATUS_CONTINUOUS_POS) and ((np<3 and pp>3) or (pp<3 and np>3))
end
function c83715234.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c83715234.cfilter,1,nil)
end
function c83715234.desfilter(c)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsDestructable()
end
function c83715234.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and c83715234.desfilter(chkc) end
if chk==0 then return e:GetHandler():IsRelateToEffect(e)
and Duel.IsExistingTarget(c83715234.desfilter,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c83715234.desfilter,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c83715234.desop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
--Slushy
function c84650463.initial_effect(c)
--send to grave
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(84650463,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetTarget(c84650463.target)
e1:SetOperation(c84650463.operation)
c:RegisterEffect(e1)
--spsummon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(84650463,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c84650463.spcon)
e2:SetCost(c84650463.spcost)
e2:SetTarget(c84650463.sptg)
e2:SetOperation(c84650463.spop)
c:RegisterEffect(e2)
end
function c84650463.tgfilter(c)
return c:IsCode(84650463) and c:IsAbleToGrave()
end
function c84650463.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c84650463.tgfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function c84650463.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c84650463.tgfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoGrave(g,REASON_EFFECT)
end
end
function c84650463.cfilter(c)
return c:IsCode(84650463) and c:IsFaceup()
end
function c84650463.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetMatchingGroupCount(c84650463.cfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil)==3
end
function c84650463.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,84650463)==0 and e:GetHandler():IsAbleToRemoveAsCost() end
Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST)
Duel.RegisterFlagEffect(tp,84650463,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c84650463.filter(c,e,tp)
return c:IsLevelAbove(5) and c:IsRace(RACE_SEASERPENT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c84650463.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c84650463.filter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c84650463.filter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,c84650463.filter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler(),e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0)
end
function c84650463.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
--Ignoble Knight of Black Laundsallyn
function c95772051.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(95772051,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCost(c95772051.spcost)
e1:SetTarget(c95772051.sptg)
e1:SetOperation(c95772051.spop)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(95772051,1))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCost(c95772051.thcost)
e2:SetTarget(c95772051.thtg)
e2:SetOperation(c95772051.thop)
c:RegisterEffect(e2)
--only 1 can exists
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_SUMMON)
e3:SetCondition(c95772051.excon)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_FLIP_SUMMON)
c:RegisterEffect(e4)
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e5:SetCode(EFFECT_SPSUMMON_CONDITION)
e5:SetValue(c95772051.splimit)
c:RegisterEffect(e5)
local e6=Effect.CreateEffect(c)
e6:SetType(EFFECT_TYPE_SINGLE)
e6:SetCode(EFFECT_SELF_DESTROY)
e6:SetCondition(c95772051.descon)
c:RegisterEffect(e6)
end
function c95772051.spfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_NORMAL) and c:IsAbleToRemoveAsCost()
end
function c95772051.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c95772051.spfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c95772051.spfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
end
function c95772051.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c95772051.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function c95772051.thfilter(c)
return c:IsSetCard(0x207a) and c:IsAbleToHand()
end
function c95772051.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,95772051)==0 and Duel.CheckReleaseGroup(tp,Card.IsSetCard,1,nil,0x107a) end
local g=Duel.SelectReleaseGroup(tp,Card.IsSetCard,1,1,nil,0x107a)
Duel.Release(g,REASON_COST)
Duel.RegisterFlagEffect(tp,95772051,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c95772051.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c95772051.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function c95772051.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c95772051.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function c95772051.exfilter(c,fid)
return c:IsFaceup() and c:GetCode()==95772051 and (fid==nil or c:GetFieldID()<fid)
end
function c95772051.excon(e)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(c95772051.exfilter,c:GetControler(),LOCATION_ONFIELD,0,1,nil)
end
function c95772051.splimit(e,se,sp,st,spos,tgp)
if bit.band(spos,POS_FACEDOWN)~=0 then return true end
return not Duel.IsExistingMatchingCard(c95772051.exfilter,tgp,LOCATION_ONFIELD,0,1,nil)
end
function c95772051.descon(e)
local c=e:GetHandler()
return Duel.IsExistingMatchingCard(c95772051.exfilter,c:GetControler(),LOCATION_ONFIELD,0,1,nil,c:GetFieldID())
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