Commit 5ecddba2 authored by sidschingis's avatar sidschingis

Merge remote-tracking branch 'upstream/master'

Conflicts:
	script/c56995655.lua
	script/c68786330.lua
	script/c77334267.lua
	script/c847915.lua
parents 2abcc29c 7d8e25b5
This diff is collapsed.
......@@ -12,6 +12,7 @@
#include "effect.h"
#include "interpreter.h"
#include <iostream>
#include <cstring>
int32 field::field_used_count[32] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5};
......@@ -19,7 +20,7 @@ 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;
return memcmp(this, &v, sizeof(tevent)) < 0;
}
field::field(duel* pduel) {
this->pduel = pduel;
......@@ -1319,6 +1320,8 @@ void field::add_unique_card(card* pcard) {
void field::remove_unique_card(card* pcard) {
uint8 con = pcard->current.controler;
if(con == PLAYER_NONE)
return;
if(pcard->unique_pos[0])
core.unique_cards[con].erase(pcard);
if(pcard->unique_pos[1])
......
......@@ -8,6 +8,7 @@
#ifndef FIELD_H_
#define FIELD_H_
#include "memory.h"
#include "common.h"
#include "effectset.h"
#include <vector>
......
......@@ -36,6 +36,8 @@ function c10591919.opa(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c10591919.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if not tc then return end
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -44,7 +46,7 @@ function c10591919.opa(e,tp,eg,ep,ev,re,r,rp)
e1:SetOperation(c10591919.desop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetCountLimit(1)
g:GetFirst():RegisterEffect(e1)
tc:RegisterEffect(e1)
end
function c10591919.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
......
......@@ -60,7 +60,7 @@ function c11458071.tgfilter(c)
return c:IsFaceup() and c:IsAbleToRemove()
end
function c11458071.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chk:IsLocation(LOCATION_MZONE) and c11458071.tgfilter(chkc) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c11458071.tgfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c11458071.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c11458071.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -31,7 +31,7 @@ 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 chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c14005031.filter(chkc) 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)
......
......@@ -18,7 +18,7 @@ function c14506878.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,c14506878.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 c14506878.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -11,13 +11,13 @@ function c14618326.initial_effect(c)
c:RegisterEffect(e1)
end
function c14618326.filter(c)
return c:IsFacedown() or c:IsType(TYPE_TRAP)
return c:IsType(TYPE_TRAP) or (c:IsFacedown() and c:IsLocation(LOCATION_SZONE) and c:GetSequence()~=5)
end
function c14618326.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and c14618326.filter(chkc) end
if chkc then return chkc:IsOnField() and c14618326.filter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c14618326.filter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil)
local g=Duel.SelectTarget(tp,c14618326.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if g:GetCount()>0 and g:GetFirst():IsFaceup() then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
......
......@@ -35,10 +35,7 @@ function c16037007.distg(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function c16037007.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) then
if re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)>0 then
if Duel.IsExistingMatchingCard(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(16037007,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
......
......@@ -86,6 +86,7 @@ function c16259549.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if not g then return end
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()~=2 then return end
Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
......
......@@ -21,7 +21,9 @@ function c16693254.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(16693254,1))
local g=Duel.SelectMatchingCard(tp,c16693254.filter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
end
end
......@@ -30,7 +30,7 @@ function c1804528.desop(e,tp,eg,ep,ev,re,r,rp)
local dg=g1:RandomSelect(1-tp,1)
Duel.SendtoGrave(dg,REASON_EFFECT+REASON_DISCARD)
else
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_DESTROY)
local dg=g2:Select(1-tp,1,1,nil)
Duel.Destroy(dg,REASON_EFFECT)
end
......
......@@ -31,7 +31,7 @@ function c18096222.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and c18096222.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c18096222.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c18096222.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SelectTarget(tp,c18096222.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c18096222.operation(e,tp,eg,ep,ev,re,r,rp)
......@@ -62,8 +62,12 @@ function c18096222.eqlimit(e,c)
return c:GetControler()==e:GetOwnerPlayer() and c:IsType(TYPE_DUAL)
end
function c18096222.dacon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_DESTROY)
and e:GetHandler():GetEquipTarget()~=nil
local c=e:GetHandler()
local ec=c:GetEquipTarget()
if c:IsReason(REASON_LOST_TARGET) then
ec=c:GetPreviousEquipTarget()
end
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_DESTROY) and ec~=nil
end
function c18096222.dafilter(c)
return c:IsFaceup() and c:IsType(TYPE_DUAL) and not c:IsDualState()
......
......@@ -21,7 +21,7 @@ function c18318842.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.DiscardHand(tp,c18318842.filter,1,1,REASON_COST+REASON_DISCARD)
end
function c18318842.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chk:IsAbleToHand() end
if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
......
......@@ -34,7 +34,7 @@ function c1896112.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local g1=Duel.SelectTarget(tp,c1896112.filter,tp,LOCATION_REMOVED,0,1,ft1,nil,e,tp)
local ft2=Duel.GetLocationCount(1-tp,LOCATION_MZONE)
if ft2>2 then ft2=2 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON)
local g2=Duel.SelectTarget(1-tp,c1896112.filter,1-tp,LOCATION_REMOVED,0,1,ft2,nil,e,1-tp)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,g1:GetCount(),0,0)
......
......@@ -27,11 +27,14 @@ function c24845628.initial_effect(c)
e4:SetCode(EFFECT_UNRELEASABLE_NONSUM)
c:RegisterEffect(e4)
local e5=e3:Clone()
e5:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
e5:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
c:RegisterEffect(e5)
local e6=e3:Clone()
e6:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
e6:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
c:RegisterEffect(e6)
local e7=e3:Clone()
e7:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
c:RegisterEffect(e7)
--search
local e7=Effect.CreateEffect(c)
e7:SetDescription(aux.Stringid(24845628,0))
......
......@@ -61,7 +61,7 @@ function c25343017.filter(c)
return c:IsRace(RACE_PSYCHO) and c:IsAbleToRemove()
end
function c25343017.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chk:IsControler(tp) and c25343017.filter(chkc) end
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c25343017.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c25343017.cfilter,tp,LOCATION_GRAVE,0,1,nil,e,PLAYER_NONE) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c25343017.filter,tp,LOCATION_GRAVE,0,1,1,nil)
......
......@@ -55,7 +55,7 @@ function c25460258.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SendtoGrave(g1,REASON_COST)
end
function c25460258.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chk:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil)
......
......@@ -26,7 +26,7 @@ function c26495087.tgfilter(c,ty)
end
function c26495087.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
if e:GetLabel()==0 then g=Duel.SelectMatchingCard(1-tp,c26495087.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_MONSTER)
elseif e:GetLabel()==1 then g=Duel.SelectMatchingCard(1-tp,c26495087.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_SPELL)
else g=Duel.SelectMatchingCard(1-tp,c26495087.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_TRAP) end
......
......@@ -22,7 +22,10 @@ function c27655513.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,2,tp,LOCATION_DECK)
end
function c27655513.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,c27655513.filter,tp,LOCATION_DECK,0,2,2,nil)
Duel.SendtoGrave(g,REASON_EFFECT)
local g=Duel.GetMatchingGroup(c27655513.filter,tp,LOCATION_DECK,0,nil)
if g:GetCount()>1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:Select(tp,2,2,nil)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
end
......@@ -2,8 +2,7 @@
function c27971137.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(27971137,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetOperation(c27971137.atkop)
c:RegisterEffect(e1)
......@@ -22,14 +21,12 @@ function c27971137.initial_effect(c)
end
function c27971137.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
end
function c27971137.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsReason(REASON_DESTROY)
......
......@@ -32,7 +32,7 @@ function c28529976.filter(c,lv,e,tp)
return c:GetLevel()<=lv and c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c28529976.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.CheckReleaseGroup(tp,c28529976.cfilter,1,nil,e,tp) end
local rg=Duel.SelectReleaseGroup(tp,c28529976.cfilter,1,1,nil,e,tp)
e:SetLabel(rg:GetFirst():GetLevel()+3)
......@@ -62,5 +62,5 @@ function c28529976.descon2(e,tp,eg,ep,ev,re,r,rp)
return tc and eg:IsContains(tc)
end
function c28529976.desop2(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(), REASON_EFFECT)
Duel.Destroy(e:GetHandler(),REASON_EFFECT)
end
......@@ -18,7 +18,7 @@ function c31440542.ctltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectTarget(tp,c31440542.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,g:GetCount(),0,0)
end
function c31440542.ctlop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
......
......@@ -14,7 +14,7 @@ function c32441317.filter(c)
return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsAbleToExtra()
end
function c32441317.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c32441317.filter(chk) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c32441317.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c32441317.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c32441317.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -29,10 +29,20 @@ function c32919136.initial_effect(c)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(c32919136.descon)
c:RegisterEffect(e3)
--equip limit
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_EQUIP_LIMIT)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e4:SetValue(c32919136.eqlimit)
c:RegisterEffect(e4)
end
function c32919136.filter(c)
return c:IsFaceup() and c:IsControlerCanBeChanged()
end
function c32919136.eqlimit(e,c)
return e:GetHandlerPlayer()~=c:GetControler() or e:GetHandler():GetEquipTarget()==c
end
function c32919136.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 c32919136.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......@@ -42,22 +52,11 @@ function c32919136.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c32919136.eqlimit(e,c)
return e:GetOwner()==c
end
function c32919136.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Equip(tp,c,tc)
--Add Equip limit
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c32919136.eqlimit)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_SET_CONTROL)
......
......@@ -46,7 +46,9 @@ function c34086406.operation2(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(34086406,3))
local g=Duel.SelectMatchingCard(tp,Card.IsType,tp,LOCATION_DECK,0,1,1,nil,TYPE_MONSTER)
local tc=g:GetFirst()
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
if tc then
Duel.ShuffleDeck(tp)
Duel.MoveSequence(tc,0)
Duel.ConfirmDecktop(tp,1)
end
end
......@@ -20,7 +20,7 @@ function c40424929.damcost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.RegisterFlagEffect(tp,40424929,RESET_PHASE+PHASE_END,0,1)
end
function c40424929.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end
local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)
Duel.SetTargetPlayer(1-tp)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ct*200)
......
......@@ -59,7 +59,7 @@ function c40607210.tgfilter(c,ty)
end
function c40607210.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
if e:GetLabel()==0 then g=Duel.SelectMatchingCard(1-tp,c40607210.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_MONSTER)
elseif e:GetLabel()==1 then g=Duel.SelectMatchingCard(1-tp,c40607210.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_SPELL)
else g=Duel.SelectMatchingCard(1-tp,c40607210.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_TRAP) end
......
......@@ -37,7 +37,7 @@ function c41147577.poscost(e,tp,eg,ep,ev,re,r,rp,chk)
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c41147577.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil)
......
......@@ -29,7 +29,7 @@ function c41309158.poscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ
end
function c41309158.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsDefencePos() end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsDefencePos() end
if chk==0 then return Duel.IsExistingTarget(Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENCE)
Duel.SelectTarget(tp,Card.IsDefencePos,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -34,7 +34,7 @@ function c42548470.activate(e,tp,eg,ep,ev,re,r,rp)
local lv2=tc2:GetLevel()
if lv1==lv2 then return end
if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TARGET)
local sg=g:Select(1-tp,1,1,nil)
if sg:GetFirst()==tc1 then
local e1=Effect.CreateEffect(e:GetHandler())
......
......@@ -30,6 +30,8 @@ function c45898858.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c45898858.filter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP)
g:GetFirst():CompleteProcedure()
end
end
......@@ -21,10 +21,20 @@ function c45986603.initial_effect(c)
e2:SetTarget(c45986603.rectg)
e2:SetOperation(c45986603.recop)
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(c45986603.eqlimit)
c:RegisterEffect(e3)
end
function c45986603.filter(c)
return c:IsFaceup() and c:IsControlerCanBeChanged()
end
function c45986603.eqlimit(e,c)
return e:GetHandlerPlayer()~=c:GetControler() or e:GetHandler():GetEquipTarget()==c
end
function c45986603.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 c45986603.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......@@ -34,22 +44,11 @@ function c45986603.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c45986603.eqlimit(e,c)
return e:GetOwner()==c
end
function c45986603.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.Equip(tp,c,tc)
--Add Equip limit
local e1=Effect.CreateEffect(tc)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(c45986603.eqlimit)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_SET_CONTROL)
......
......@@ -46,6 +46,8 @@ end
function c46239604.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c46239604.filter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil)
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
if g:GetCount()>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
......@@ -24,7 +24,7 @@ end
function c47247413.activate(e,tp,eg,ep,ev,re,r,rp)
local g=eg:Filter(c47247413.filter,nil,e,1-tp)
if g:GetCount()==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK)
local rg=g:Select(1-tp,1,1,nil)
Duel.ConfirmCards(tp,rg)
Duel.SendtoDeck(rg,nil,2,REASON_EFFECT)
......
......@@ -37,7 +37,7 @@ function c51808422.spcon(e,c)
Duel.IsExistingMatchingCard(c51808422.spfilter,c:GetControler(),LOCATION_MZONE,0,2,nil)
end
function c51808422.filter(c,e,tp)
return c:IsSetCard(0x100d) and c:GetLevel()<=4 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
return c:IsSetCard(0x100d) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c51808422.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c51808422.filter(chkc,e,tp) end
......
......@@ -70,7 +70,7 @@ function c53839837.tgfilter(c,ty)
end
function c53839837.tgop(e,tp,eg,ep,ev,re,r,rp)
local g=nil
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
if e:GetLabel()==0 then g=Duel.SelectMatchingCard(1-tp,c53839837.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_MONSTER)
elseif e:GetLabel()==1 then g=Duel.SelectMatchingCard(1-tp,c53839837.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_SPELL)
else g=Duel.SelectMatchingCard(1-tp,c53839837.tgfilter,1-tp,LOCATION_DECK,0,1,1,nil,TYPE_TRAP) end
......
......@@ -27,13 +27,12 @@ function c56995655.op(e,tp,eg,ep,ev,re,r,rp)
if not c:IsRelateToEffect(e) then return end
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local op=Duel.SelectOption(tp,70,71,72)
Duel.ConfirmCards(tp,tc)
Duel.ShuffleHand(1-tp)
if (op==0 and tc:IsType(TYPE_MONSTER)) or (op==1 and tc:IsType(TYPE_SPELL)) or (op==2 and tc:IsType(TYPE_TRAP)) then
Duel.Damage(1-tp,700,REASON_EFFECT)
end
if not tc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE)
local op=Duel.SelectOption(tp,70,71,72)
Duel.ConfirmCards(tp,tc)
Duel.ShuffleHand(1-tp)
if (op==0 and tc:IsType(TYPE_MONSTER)) or (op==1 and tc:IsType(TYPE_SPELL)) or (op==2 and tc:IsType(TYPE_TRAP)) then
Duel.Damage(1-tp,700,REASON_EFFECT)
end
end
......@@ -33,7 +33,7 @@ function c58820853.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,c58820853.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
......
......@@ -83,7 +83,7 @@ function c59170782.spfilter(c,e,tp)
return c:IsSetCard(0x74) and c:GetCode()~=59170782 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c59170782.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chk:IsLocation(LOCATION_GRAVE) and c59170782.spfilter(chkc,e,tp) end
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c59170782.spfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c59170782.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
......@@ -3,7 +3,7 @@ function c59297550.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(59297550,0))
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_NO_TURN_RESET+EFFECT_FLAG_CHAIN_UNIQUE)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_NO_TURN_RESET)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
......@@ -23,7 +23,8 @@ function c59297550.filter(c,e,tp)
end
function c59297550.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsFaceup() and c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
if chk==0 then return c:IsFaceup() and c:IsRelateToEffect(e) and not c:IsStatus(STATUS_CHAINING)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c59297550.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
......
......@@ -14,11 +14,14 @@ function c59344077.condition(e,tp,eg,ep,ev,re,r,rp)
end
function c59344077.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsType,tp,0,LOCATION_HAND,nil,TYPE_SPELL)
if g:GetCount()>0 and Duel.IsChainNegatable(Duel.GetCurrentChain()) and Duel.SelectYesNo(1-tp,aux.Stringid(59344077,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD)
local sg=Duel.SelectMatchingCard(1-tp,Card.IsType,tp,0,LOCATION_HAND,1,1,nil,TYPE_SPELL)
if g:GetCount()>0 and Duel.SelectYesNo(1-tp,aux.Stringid(59344077,0)) then
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_DISCARD)
local sg=g:Select(1-tp,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT+REASON_DISCARD)
return
if Duel.IsChainDisablable(0) then
Duel.NegateEffect(0)
return
end
end
Duel.NegateActivation(ev)
if re:GetHandler():IsRelateToEffect(re) then
......
......@@ -19,7 +19,7 @@ function c62560742.filter(c)
return c:IsFaceup() and c:IsSetCard(0x27) and c:IsType(TYPE_SYNCHRO)
end
function c62560742.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c62560742.filter(chk) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c62560742.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c62560742.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(62560742,2))
local g=Duel.SelectTarget(tp,c62560742.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler())
......
......@@ -26,7 +26,7 @@ function c62950604.filter(c)
return c:IsRace(RACE_PSYCHO) and c:IsAbleToRemove()
end
function c62950604.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chk:IsControler(tp) and c62950604.filter(chkc) end
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c62950604.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c62950604.filter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c62950604.filter,tp,LOCATION_GRAVE,0,1,1,nil)
......
......@@ -5,7 +5,7 @@ function c67030233.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c67030233.syncon)
e1:SetOperation(c67030233.synop)
......
......@@ -21,10 +21,15 @@ end
function c69408987.posop(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
if Duel.ChangePosition(a,POS_FACEUP_DEFENCE)~=0 then
e:GetHandler():CreateRelation(a,RESET_EVENT+0x1fe0000)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,3)
e1:SetCondition(c69408987.poscon2)
a:RegisterEffect(e1)
end
end
function c69408987.poscon2(e)
return e:GetOwner():IsRelateToCard(e:GetHandler())
end
......@@ -56,10 +56,10 @@ function c71541986.spop(e,tp,eg,ep,ev,re,r,rp)
e4:SetCode(EFFECT_UNRELEASABLE_SUM)
e4:SetValue(1)
e4:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e4)
tc:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_UNRELEASABLE_NONSUM)
c:RegisterEffect(e5)
tc:RegisterEffect(e5)
tc=sg:GetNext()
end
Duel.SpecialSummonComplete()
......
......@@ -4,16 +4,17 @@ function c74458486.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetHintTiming(TIMING_DAMAGE_CAL)
e1:SetCondition(c74458486.condition)
e1:SetTarget(c74458486.target)
e1:SetOperation(c74458486.activate)
c:RegisterEffect(e1)
end
function c74458486.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_DAMAGE and not Duel.IsDamageCalculated()
local phase=Duel.GetCurrentPhase()
return (phase==PHASE_DAMAGE or phase==PHASE_DAMAGE_CAL) and not Duel.IsDamageCalculated()
and Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()
end
function c74458486.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
......
......@@ -35,7 +35,7 @@ function c75840616.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,c75840616.filter,tp,LOCATION_DECK,0,1,1,nil)
local tc=g:GetFirst()
if not tc:IsAbleToGrave() or (tc:IsAbleToHand() and Duel.SelectYesNo(tp,aux.Stringid(75840616,1))) then
if tc and tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectYesNo(tp,aux.Stringid(75840616,1))) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
else
......
......@@ -32,6 +32,6 @@ function c77334267.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c77334267.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(sg,REASON_EFFECT)
end
\ No newline at end of file
local dg=g:Filter(Card.IsRelateToEffect,nil,e)
Duel.Destroy(dg,REASON_EFFECT)
end
......@@ -11,19 +11,40 @@ function c77631175.initial_effect(c)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(c77631175.reptg)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(77631175,1))
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(77631175)
e2:SetTarget(c77631175.target)
e2:SetOperation(c77631175.operation)
c:RegisterEffect(e2)
end
function c77631175.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end
if Duel.SelectYesNo(tp,aux.Stringid(77631175,0)) then
local c=e:GetHandler()
c:RemoveOverlayCard(tp,1,1,REASON_EFFECT)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
Duel.Damage(1-tp,500,REASON_EFFECT)
Duel.RaiseSingleEvent(c,77631175,e,0,0,0,0)
return true
else return false end
end
function c77631175.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(500)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500)
end
function c77631175.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1ff0000)
c:RegisterEffect(e1)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
......@@ -5,7 +5,7 @@ function c7841112.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c7841112.syncon)
e1:SetOperation(c7841112.synop)
......
......@@ -15,15 +15,12 @@ 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 chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and c78610936.filter(chkc) 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
Duel.SetChainLimit(aux.FALSE)
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)
......@@ -34,13 +31,14 @@ function c78610936.activate(e,tp,eg,ep,ev,re,r,rp)
if not tc:IsRelateToEffect(e) then return end
local mg=tc:GetOverlayGroup()
if Duel.SendtoDeck(tc,nil,0,REASON_EFFECT)>0 then
local g=mg:Filter(c78610936.spfilter,nil,e,tp)
local ft=Duel.GetLocationCount(1-tp,LOCATION_MZONE)
if ft>0 and mg:GetCount()>0 then
if mg:GetCount()>ft then
if ft>0 and g:GetCount()>0 then
if g:GetCount()>ft then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
mg=mg:Select(tp,ft,ft,nil)
g=g:Select(tp,ft,ft,nil)
end
local tc=mg:GetFirst()
local tc=g:GetFirst()
while tc do
Duel.SpecialSummonStep(tc,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE)
local e1=Effect.CreateEffect(e:GetHandler())
......@@ -49,7 +47,7 @@ function c78610936.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetValue(-1)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
tc=mg:GetNext()
tc=g:GetNext()
end
Duel.SpecialSummonComplete()
end
......
......@@ -12,13 +12,9 @@ end
function c78783370.condition(e,tp,eg,ep,ev,re,r,rp)
if re:IsActiveType(TYPE_SPELL+TYPE_TRAP) and not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return false end
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE)
if ex then return true end
if ex and (cp==tp or cp==PLAYER_ALL) then return true end
ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
if not ex then return false end
if cp~=PLAYER_ALL then return Duel.IsPlayerAffectedByEffect(cp,EFFECT_REVERSE_RECOVER)
else return Duel.IsPlayerAffectedByEffect(0,EFFECT_REVERSE_RECOVER)
or Duel.IsPlayerAffectedByEffect(1,EFFECT_REVERSE_RECOVER)
end
return ex and (cp==tp or cp==PLAYER_ALL) and Duel.IsPlayerAffectedByEffect(tp,EFFECT_REVERSE_RECOVER)
end
function c78783370.operation(e,tp,eg,ep,ev,re,r,rp)
local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID)
......
......@@ -12,14 +12,14 @@ function c80485722.initial_effect(c)
end
function c80485722.destg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if tc==c then tc=Duel.GetAttackTarget() end
if chk==0 then return tc and tc:IsFaceup() and tc:IsAttribute(ATTRIBUTE_DARK) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0)
local bc=c:GetBattleTarget()
if chk==0 then return bc and bc:IsFaceup() and bc:IsAttribute(ATTRIBUTE_DARK) end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,bc,1,0,0)
end
function c80485722.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetAttacker()
if tc==c then tc=Duel.GetAttackTarget() end
if tc:IsRelateToBattle() then Duel.Destroy(tc,REASON_EFFECT) end
local bc=c:GetBattleTarget()
if bc:IsRelateToBattle() then
Duel.Destroy(bc,REASON_EFFECT)
end
end
......@@ -28,7 +28,9 @@ function c80764541.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return Duel.IsExistingTarget(c80764541.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c80764541.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
if not Duel.CheckLPCost(1-tp,1000) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
end
function c80764541.desop(e,tp,eg,ep,ev,re,r,rp)
if Duel.CheckLPCost(1-tp,1000) and Duel.SelectYesNo(1-tp,aux.Stringid(80764541,1)) then
......
......@@ -43,8 +43,7 @@ function c847915.actcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c847915.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c847915.dfilter(c,tp)
return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x48)
and c:GetPreviousControler()==tp
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x48)
end
function c847915.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c847915.dfilter,1,nil,tp)
......
......@@ -23,10 +23,10 @@ function c86016245.drcon(e,tp,eg,ep,ev,re,r,rp)
local bc=tc:GetBattleTarget()
return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 and eg:GetCount()==1
and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE)
and bc:IsRelateToBattle() and bc:IsLevelBelow(2)
and bc:IsRelateToBattle() and bc:IsControler(tp) and bc:IsLevelBelow(2)
end
function c86016245.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(2)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2)
......
......@@ -50,7 +50,6 @@ function c87911394.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
local atk=tc:GetAttack()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_DISABLE)
......@@ -62,6 +61,8 @@ function c87911394.atkop(e,tp,eg,ep,ev,re,r,rp)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc:RegisterEffect(e2)
Duel.AdjustInstantly(tc)
local atk=tc:GetAttack()
if c:IsFaceup() and c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -32,9 +32,9 @@ function c9156135.filter(c)
end
function c9156135.addct(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and c9156135.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c9156135.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,c9156135.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SelectTarget(tp,c9156135.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x3001)
end
function c9156135.addc(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -32,11 +32,13 @@ function c91822647.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c91822647.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
if g:GetFirst():IsRelateToEffect(e) and g:GetNext():IsRelateToEffect(e) then
Duel.SendtoDeck(g,nil,2,REASON_EFFECT)
local tg=g:Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()==2 then
Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,c91822647.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and sg:GetCount()>0 then
if sg:GetCount()>0 then
Duel.BreakEffect()
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
......
......@@ -24,7 +24,7 @@ function c92933195.handop(e,tp,eg,ep,ev,re,r,rp)
end
local ht2=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)
if ht2>=5 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE)
local sg=Duel.SelectMatchingCard(1-tp,aux.TRUE,1-tp,LOCATION_HAND,0,ht2-4,ht2-4,nil)
g:Merge(sg)
end
......
......@@ -5,7 +5,7 @@ function c93157004.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c93157004.syncon)
e1:SetOperation(c93157004.synop)
......
......@@ -14,7 +14,7 @@ function c95286165.filter(c)
return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsAbleToExtra()
end
function c95286165.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c95286165.filter(chk) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c95286165.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c95286165.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,c95286165.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -55,7 +55,7 @@ function c9596126.tgfilter(c)
return c:IsFaceup() and c:IsAbleToRemove()
end
function c9596126.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chk:IsLocation(LOCATION_MZONE) and c9596126.tgfilter(chkc) end
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c9596126.tgfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c9596126.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,c9596126.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
......
......@@ -5,7 +5,7 @@ function c97489701.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c97489701.syncon)
e1:SetOperation(c97489701.synop)
......
......@@ -73,7 +73,7 @@ function c99365553.spfilter3(c,e,tp)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c99365553.sptg3(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chk:IsLocation(LOCATION_GRAVE) and c99365553.spfilter3(chkc,e,tp) end
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c99365553.spfilter3(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(c99365553.spfilter3,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
......
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