Commit 305e8b1e authored by argon.sun's avatar argon.sun

fix & new scripts

parent 42e641ad
......@@ -3016,6 +3016,46 @@ int DuelClient::ClientAnalyze(char * msg, unsigned int len) {
mainGame->dField.GetCardLocation(ccard, &ccard->curPos, &ccard->curRot, true);
}
}
val = BufferIO::ReadInt8(pbuf); //chains
for(int i = 0; i < val; ++i) {
int code = BufferIO::ReadInt32(pbuf);
int pcc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int pcl = BufferIO::ReadInt8(pbuf);
int pcs = BufferIO::ReadInt8(pbuf);
int subs = BufferIO::ReadInt8(pbuf);
int cc = mainGame->LocalPlayer(BufferIO::ReadInt8(pbuf));
int cl = BufferIO::ReadInt8(pbuf);
int cs = BufferIO::ReadInt8(pbuf);
int desc = BufferIO::ReadInt32(pbuf);
ClientCard* pcard = mainGame->dField.GetCard(pcc, pcl, pcs, subs);
mainGame->dField.current_chain.chain_card = pcard;
mainGame->dField.current_chain.code = code;
mainGame->dField.current_chain.desc = desc;
mainGame->dField.current_chain.controler = cc;
mainGame->dField.current_chain.location = cl;
mainGame->dField.current_chain.sequence = cs;
mainGame->dField.GetChainLocation(cc, cl, cs, &mainGame->dField.current_chain.chain_pos);
mainGame->dField.current_chain.solved = false;
int chc = 0;
for(int i = 0; i < mainGame->dField.chains.size(); ++i) {
if (cl == 0x10 || cl == 0x20) {
if (mainGame->dField.chains[i].controler == cc && mainGame->dField.chains[i].location == cl)
chc++;
} else {
if (mainGame->dField.chains[i].controler == cc && mainGame->dField.chains[i].location == cl && mainGame->dField.chains[i].sequence == cs)
chc++;
}
}
if(cl == LOCATION_HAND)
mainGame->dField.current_chain.chain_pos.X += 0.35;
else
mainGame->dField.current_chain.chain_pos.Y += chc * 0.25f;
mainGame->dField.chains.push_back(mainGame->dField.current_chain);
}
if(val) {
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->dField.last_chain = true;
}
mainGame->gMutex.Unlock();
break;
}
......
......@@ -665,6 +665,7 @@ bool SingleMode::SinglePlayAnalyze(char* msg, unsigned int len) {
mainGame->dField.AddCard(ccard, p, LOCATION_EXTRA, seq);
}
}
BufferIO::ReadInt8(pbuf); //chain count, always 0
SinglePlayReload();
mainGame->dField.RefreshAllCards();
mainGame->gMutex.Unlock();
......
......@@ -116,6 +116,16 @@ void field::reload_field_info() {
pduel->write_buffer8(player[playerid].list_remove.size());
pduel->write_buffer8(player[playerid].list_extra.size());
}
pduel->write_buffer8(core.current_chain.size());
for(auto chit = core.current_chain.begin(); chit != core.current_chain.end(); ++chit) {
effect* peffect = chit->triggering_effect;
pduel->write_buffer32(peffect->handler->data.code);
pduel->write_buffer32(peffect->handler->get_info_location());
pduel->write_buffer8(chit->triggering_controler);
pduel->write_buffer8(chit->triggering_location);
pduel->write_buffer8(chit->triggering_sequence);
pduel->write_buffer32(peffect->description);
}
}
void field::add_card(uint8 playerid, card* pcard, uint8 location, uint8 sequence) {
......
......@@ -316,6 +316,19 @@ extern "C" DECL_DLLEXPORT int32 query_field_info(ptr pduel, byte* buf) {
*buf++ = ptduel->game_field->player[playerid].list_remove.size();
*buf++ = ptduel->game_field->player[playerid].list_extra.size();
}
*buf++ = ptduel->game_field->core.current_chain.size();
for(auto chit = ptduel->game_field->core.current_chain.begin(); chit != ptduel->game_field->core.current_chain.end(); ++chit) {
effect* peffect = chit->triggering_effect;
*((int*)(buf)) = peffect->handler->data.code;
buf += 4;
*((int*)(buf)) = peffect->handler->get_info_location();
buf += 4;
*buf++ = chit->triggering_controler;
*buf++ = chit->triggering_location;
*buf++ = chit->triggering_sequence;
*((int*)(buf)) = peffect->description;
buf += 4;
}
return 0;
}
extern "C" DECL_DLLEXPORT void set_responsei(ptr pduel, int32 value) {
......
--Ninjitsu Art of Shadow Sealing
function c13629812.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1c0)
e1:SetCost(c13629812.cost)
e1:SetTarget(c13629812.target)
e1:SetOperation(c13629812.operation)
c:RegisterEffect(e1)
--Destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetOperation(c13629812.retop)
c:RegisterEffect(e2)
end
function c13629812.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsSetCard,1,nil,0x2b) end
local g=Duel.SelectReleaseGroup(tp,Card.IsSetCard,1,1,nil,0x2b)
Duel.Release(g,REASON_COST)
end
function c13629812.filter(c)
return c:IsAbleToRemove()
end
function c13629812.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c13629812.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c13629812.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c13629812.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0)
end
function c13629812.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
local seq=tc:GetSequence()
if tc:IsControler(1-tp) then seq=seq+16 end
if tc:IsRelateToEffect(e) and Duel.Remove(tc,0,REASON_EFFECT+REASON_TEMPORARY)~=0 then
c:SetCardTarget(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetLabel(seq)
e1:SetCondition(c13629812.discon)
e1:SetOperation(c13629812.disop)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
end
end
function c13629812.discon(e)
return e:GetHandler():GetCardTargetCount()>0
end
function c13629812.disop(e,tp)
return bit.lshift(0x1,e:GetLabel())
end
function c13629812.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetFirstCardTarget()
if tc then
Duel.ReturnToField(tc)
end
end
--Blue Dragon Ninja
function c14568951.initial_effect(c)
--negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(14568951,0))
e1:SetCategory(CATEGORY_DISABLE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1c0)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c14568951.cost)
e1:SetTarget(c14568951.target)
e1:SetOperation(c14568951.operation)
c:RegisterEffect(e1)
end
function c14568951.cfilter1(c)
return c:IsSetCard(0x2b) and c:IsType(TYPE_MONSTER) and c:IsDiscardable()
end
function c14568951.cfilter2(c)
return c:IsSetCard(0x61) and c:IsDiscardable()
end
function c14568951.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c14568951.cfilter1,tp,LOCATION_HAND,0,1,nil)
and Duel.IsExistingMatchingCard(c14568951.cfilter2,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g1=Duel.SelectMatchingCard(tp,c14568951.cfilter1,tp,LOCATION_HAND,0,1,1,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local g2=Duel.SelectMatchingCard(tp,c14568951.cfilter2,tp,LOCATION_HAND,0,1,1,nil)
g1:Merge(g2)
Duel.SendtoGrave(g1,REASON_COST+REASON_DISCARD)
end
function c14568951.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:IsFaceup() end
if chk==0 then return e:GetHandler():IsAttackPos()
and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function c14568951.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.NegateRelatedChain(tc,RESET_TURN_SET)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_ATTACK)
e3:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
tc:RegisterEffect(e3)
end
end
--Noble Arms - Gallatin
function c14745409.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(c14745409.condition)
e1:SetTarget(c14745409.target)
e1:SetOperation(c14745409.operation)
c:RegisterEffect(e1)
--Atk up
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(1000)
c:RegisterEffect(e2)
--Equip limit
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_EQUIP_LIMIT)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetValue(1)
c:RegisterEffect(e3)
--atkdown
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_PHASE+PHASE_STANDBY)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetCondition(c14745409.atkcon)
e4:SetOperation(c14745409.atkop)
c:RegisterEffect(e4)
--equip
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(14745409,0))
e5:SetCategory(CATEGORY_EQUIP)
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CHAIN_UNIQUE)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_TO_GRAVE)
e5:SetCondition(c14745409.eqcon)
e5:SetCost(c14745409.eqcost)
e5:SetTarget(c14745409.eqtg)
e5:SetOperation(c14745409.operation)
c:RegisterEffect(e5)
end
function c14745409.cfilter(c)
return c:IsFaceup() and c:IsCode(14745409)
end
function c14745409.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(c14745409.cfilter,tp,LOCATION_ONFIELD,0,1,nil)
end
function c14745409.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c14745409.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.Equip(tp,e:GetHandler(),tc)
end
end
function c14745409.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()==tp
end
function c14745409.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:GetFlagEffect(14745409)==0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(-200)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
c:RegisterFlagEffect(14745409,RESET_EVENT+0x1fe0000,0,0)
e:SetLabelObject(e1)
e:SetLabel(2)
else
local pe=e:GetLabelObject()
local ct=e:GetLabel()
e:SetLabel(ct+1)
pe:SetValue(ct*-200)
end
end
function c14745409.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) and c:IsReason(REASON_DESTROY)
end
function c14745409.eqcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,14745409)==0 end
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)
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
if chk==0 then return Duel.IsExistingTarget(c14745409.eqfilter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,c14745409.eqfilter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
--Noble Knight Gawayn
function c19680539.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_SPSUM_PARAM)
e1:SetTargetRange(POS_FACEUP_DEFENCE,0)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c19680539.spcon)
c:RegisterEffect(e1)
end
function c19680539.filter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAttribute(ATTRIBUTE_LIGHT)
end
function c19680539.spcon(e,c)
if c==nil then return true end
return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and
Duel.IsExistingMatchingCard(c19680539.filter,c:GetControler(),LOCATION_MZONE,0,1,nil)
end
--Spellbook Library of the Crescent
function c40230018.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(40230018,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c40230018.cost)
e1:SetTarget(c40230018.target)
e1:SetOperation(c40230018.operation)
c:RegisterEffect(e1)
if not c40230018.global_check then
c40230018.global_check=true
c40230018[0]=true
c40230018[1]=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_CHAINING)
ge1:SetOperation(c40230018.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(c40230018.clear)
Duel.RegisterEffect(ge2,0)
end
end
function c40230018.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
c40230018[rp]=false
end
end
function c40230018.clear(e,tp,eg,ep,ev,re,r,rp)
c40230018[0]=true
c40230018[1]=true
end
function c40230018.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,40230018)==0 and c40230018[tp] end
Duel.RegisterFlagEffect(tp,40230018,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(c40230018.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function c40230018.aclimit(e,re,tp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsActiveType(TYPE_SPELL) and not re:GetHandler():IsSetCard(0x106e)
end
function c40230018.filter1(c)
return c:IsSetCard(0x106e) and c:IsType(TYPE_SPELL) and c:IsAbleToHand()
end
function c40230018.filter2(c)
return c:IsSetCard(0x106e) and c:IsType(TYPE_SPELL)
end
function c40230018.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(c40230018.filter1,tp,LOCATION_DECK,0,nil)
return g:GetClassCount(Card.GetCode)>=3
end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK)
end
function c40230018.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c40230018.filter2,tp,LOCATION_DECK,0,nil)
if g:GetClassCount(Card.GetCode)>=3 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg1=g:Select(tp,1,1,nil)
g:Remove(Card.IsCode,nil,sg1:GetFirst():GetCode())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg2=g:Select(tp,1,1,nil)
g:Remove(Card.IsCode,nil,sg2:GetFirst():GetCode())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local sg3=g:Select(tp,1,1,nil)
sg1:Merge(sg2)
sg1:Merge(sg3)
Duel.ConfirmCards(1-tp,sg1)
Duel.ShuffleDeck(tp)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND)
local tg=sg1:Select(1-tp,1,1,nil)
local tc=tg:GetFirst()
if tc:IsAbleToHand() then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
else
Duel.SendtoGrave(tc,REASON_EFFECT)
end
end
end
--Imairuka
function c41952656.initial_effect(c)
--draw
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(41952656,0))
e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DRAW)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c41952656.drcon)
e1:SetTarget(c41952656.drtg)
e1:SetOperation(c41952656.drop)
c:RegisterEffect(e1)
end
function c41952656.drcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_DESTROY) and not c:IsReason(REASON_RULE) and rp==1-tp and c:GetPreviousControler()==tp
end
function c41952656.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1)
end
function c41952656.drop(e,tp,eg,ep,ev,re,r,rp)
if Duel.DiscardDeck(tp,1,REASON_EFFECT)==1 then
local g=Duel.GetOperatedGroup()
if g:GetFirst():IsAttribute(ATTRIBUTE_WATER) then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
end
......@@ -28,20 +28,20 @@ function c5556499.initial_effect(c)
e3:SetOperation(c5556499.hdop)
c:RegisterEffect(e3)
end
function c5556499.spfilter(c,ec)
return c:IsRace(RACE_MACHINE) and (c~=ec or c:IsDiscardable())
function c5556499.spfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsDiscardable()
end
function c5556499.spcon(e,c)
if c==nil then return true end
local g=Duel.GetMatchingGroup(c5556499.spfilter,c:GetControler(),LOCATION_HAND,0,nil,c)
if c:IsHasEffect(EFFECT_TO_GRAVE_REDIRECT) then
local g=Duel.GetMatchingGroup(c5556499.spfilter,c:GetControler(),LOCATION_HAND,0,nil)
if not c:IsAbleToGraveAsCost() then
g:RemoveCard(c)
end
return g:CheckWithSumGreater(Card.GetLevel,8)
end
function c5556499.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=Duel.GetMatchingGroup(c5556499.spfilter,c:GetControler(),LOCATION_HAND,0,nil,c)
if c:IsHasEffect(EFFECT_TO_GRAVE_REDIRECT) then
local g=Duel.GetMatchingGroup(c5556499.spfilter,c:GetControler(),LOCATION_HAND,0,nil)
if not c:IsAbleToGraveAsCost() then
g:RemoveCard(c)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
......
--Prophecy Destroyer
function c56174248.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(56174248,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_GRAVE)
e1:SetCost(c56174248.spcost)
e1:SetTarget(c56174248.sptg)
e1:SetOperation(c56174248.spop)
c:RegisterEffect(e1)
end
function c56174248.rfilter(c)
return c:IsSetCard(0x106e) and c:IsType(TYPE_SPELL) and c:IsAbleToRemoveAsCost()
end
function c56174248.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c56174248.rfilter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c56174248.rfilter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c56174248.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 c56174248.spop(e,tp,eg,ep,ev,re,r,rp,c)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -41,8 +41,9 @@ function c64262809.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c64262809.cfilter,1,nil,tp)
end
function c64262809.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
local exc=(e:GetHandler():IsLocation(LOCATION_HAND) and not e:GetHandler():IsAbleToGraveAsCost()) and e:GetHandler() or nil
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,exc) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD,exc)
end
function c64262809.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
--Advance Zone
function c76224717.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(76224717,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c76224717.condition)
e2:SetCost(c76224717.cost)
e2:SetTarget(c76224717.target1)
e2:SetOperation(c76224717.operation1)
e2:SetLabel(1)
c:RegisterEffect(e2)
--draw
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(76224717,1))
e3:SetCategory(CATEGORY_DRAW)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c76224717.condition)
e3:SetCost(c76224717.cost)
e3:SetTarget(c76224717.target2)
e3:SetOperation(c76224717.operation2)
e3:SetLabel(2)
c:RegisterEffect(e3)
--salvage
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(76224717,2))
e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_SZONE)
e4:SetCondition(c76224717.condition)
e4:SetCost(c76224717.cost)
e4:SetTarget(c76224717.target3)
e4:SetOperation(c76224717.operation3)
e4:SetLabel(3)
c:RegisterEffect(e4)
if not c76224717.global_check then
c76224717.global_check=true
c76224717[0]=0
c76224717[1]=0
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SUMMON_SUCCESS)
ge1:SetOperation(c76224717.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_MSET)
ge2:SetOperation(c76224717.checkop)
Duel.RegisterEffect(ge2,0)
local ge3=Effect.CreateEffect(c)
ge3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge3:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge3:SetOperation(c76224717.clear)
Duel.RegisterEffect(ge3,0)
end
end
function c76224717.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if bit.band(tc:GetSummonType(),SUMMON_TYPE_ADVANCE)==SUMMON_TYPE_ADVANCE then
c76224717[ep]=c76224717[ep]+tc:GetMaterialCount()
end
end
function c76224717.clear(e,tp,eg,ep,ev,re,r,rp)
c76224717[0]=0
c76224717[1]=0
end
function c76224717.condition(e,tp,eg,ep,ev,re,r,rp,chk)
return c76224717[tp]>=e:GetLabel()
end
function c76224717.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,76224717)==0 end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.RegisterFlagEffect(tp,76224717,RESET_PHASE+PHASE_END,EFFECT_FLAG_OATH,1)
end
function c76224717.filter1(c)
return c:IsFacedown() and c:IsDestructable()
end
function c76224717.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and c76224717.filter1(chkc) end
if chk==0 then return Duel.IsExistingTarget(c76224717.filter1,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c76224717.filter1,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c76224717.operation1(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) and tc:IsFacedown() then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c76224717.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function c76224717.operation2(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Draw(p,d,REASON_EFFECT)
end
function c76224717.filter3(c)
return c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end
function c76224717.target3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c76224717.filter3(chkc) end
if chk==0 then return Duel.IsExistingTarget(c76224717.filter3,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,c76224717.filter3,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function c76224717.operation3(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.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
--Lightray Madoor
function c82579942.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(c82579942.spcon)
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_COUNT)
e2:SetCountLimit(1)
e2:SetValue(c82579942.valcon)
c:RegisterEffect(e2)
end
function c82579942.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_REMOVED,0,3,nil,ATTRIBUTE_LIGHT)
end
function c82579942.valcon(e,re,r,rp)
return bit.band(r,REASON_BATTLE)~=0
end
--Revival Golem
function c87347365.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(87347365,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_CHAIN_UNIQUE)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(c87347365.condtion)
e1:SetTarget(c87347365.target)
e1:SetOperation(c87347365.operation)
c:RegisterEffect(e1)
end
function c87347365.condtion(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_DECK)
end
function c87347365.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,87347365)==0 end
local opt=0
local c=e:GetHandler()
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
local b2=c:IsAbleToHand()
if b1 and b2 then
opt=Duel.SelectOption(tp,aux.Stringid(87347365,1),aux.Stringid(87347365,2))+1
elseif b1 then
opt=Duel.SelectOption(tp,aux.Stringid(87347365,1))+1
elseif b2 then
opt=Duel.SelectOption(tp,aux.Stringid(87347365,2))+2
end
e:SetLabel(opt)
if opt==1 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
elseif opt==2 then
e:SetCategory(CATEGORY_TOHAND)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
else
e:SetCategory(0)
end
Duel.RegisterFlagEffect(tp,87347365,RESET_PHASE+PHASE_END,0,1)
end
function c87347365.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if e:GetLabel()==1 then
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)
end
elseif e:GetLabel()==2 then
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c)
end
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