Commit 91cd8cce authored by salix5's avatar salix5

EVENT_DESTROYED

Now it will be raised at the end of damage step if the monster is battle
destroyed.
parent 60cdcb78
......@@ -297,6 +297,48 @@ int32 card::is_set_card(uint32 set_code) {
}
return FALSE;
}
int32 card::is_pre_set_card(uint32 set_code) {
uint32 code = previous.code;
uint64 setcode;
if (code == data.code) {
setcode = data.setcode;
} else {
card_data dat;
::read_card(code, &dat);
setcode = dat.setcode;
}
uint32 settype = set_code & 0xfff;
uint32 setsubtype = set_code & 0xf000;
while(setcode) {
if ((setcode & 0xfff) == settype && (setcode & 0xf000 & setsubtype) == setsubtype)
return TRUE;
setcode = setcode >> 16;
}
//add set code
effect_set eset;
filter_effect(EFFECT_ADD_SETCODE, &eset);
for(int32 i = 0; i < eset.size(); ++i) {
uint32 value = eset[i]->get_value(this);
if ((value & 0xfff) == settype && (value & 0xf000 & setsubtype) == setsubtype)
return TRUE;
}
//another code
uint32 code2 = previous.code2;
uint64 setcode2;
if (code2 != 0) {
card_data dat;
::read_card(code2, &dat);
setcode2 = dat.setcode;
} else {
return FALSE;
}
while(setcode2) {
if ((setcode2 & 0xfff) == settype && (setcode2 & 0xf000 & setsubtype) == setsubtype)
return TRUE;
setcode2 = setcode2 >> 16;
}
return FALSE;
}
uint32 card::get_type() {
if(assume_type == ASSUME_TYPE)
return assume_value;
......
......@@ -144,6 +144,7 @@ public:
uint32 get_code();
uint32 get_another_code();
int32 is_set_card(uint32 set_code);
int32 is_pre_set_card(uint32 set_code);
uint32 get_type();
int32 get_base_attack(uint8 swap = FALSE);
int32 get_attack();
......
......@@ -20,6 +20,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetOriginalCode", scriptlib::card_get_origin_code },
{ "GetOriginalCodeRule", scriptlib::card_get_origin_code_rule },
{ "IsSetCard", scriptlib::card_is_set_card },
{ "IsPreviousSetCard", scriptlib::card_is_pre_set_card },
{ "GetType", scriptlib::card_get_type },
{ "GetOriginalType", scriptlib::card_get_origin_type },
{ "GetLevel", scriptlib::card_get_level },
......
......@@ -69,6 +69,14 @@ int32 scriptlib::card_is_set_card(lua_State *L) {
lua_pushboolean(L, pcard->is_set_card(set_code));
return 1;
}
int32 scriptlib::card_is_pre_set_card(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 set_code = lua_tointeger(L, 2);
lua_pushboolean(L, pcard->is_pre_set_card(set_code));
return 1;
}
int32 scriptlib::card_get_type(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
......
......@@ -3412,7 +3412,7 @@ int32 field::send_to(uint16 step, group * targets, effect * reason_effect, uint3
released.insert(pcard);
raise_single_event(pcard, 0, EVENT_RELEASE, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
if(pcard->current.reason & REASON_DESTROY) {
if(pcard->current.reason & REASON_DESTROY && !pcard->is_status(STATUS_BATTLE_DESTROYED)) {
destroyed.insert(pcard);
raise_single_event(pcard, 0, EVENT_DESTROYED, pcard->current.reason_effect, pcard->current.reason, pcard->current.reason_player, 0, 0);
}
......
......@@ -3759,6 +3759,7 @@ int32 field::process_battle_command(uint16 step) {
&& !((core.attacker->current.reason & REASON_EFFECT + REASON_DESTROY) == REASON_EFFECT + REASON_DESTROY)) {
raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYING, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 1);
raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0);
raise_single_event(core.attacker, 0, EVENT_DESTROYED, 0, core.attacker->current.reason, core.attack_target->current.controler, 0, 0);
ing.insert(core.attack_target);
ed.insert(core.attacker);
}
......@@ -3767,13 +3768,16 @@ int32 field::process_battle_command(uint16 step) {
&& !((core.attack_target->current.reason & REASON_EFFECT + REASON_DESTROY) == REASON_EFFECT + REASON_DESTROY)) {
raise_single_event(core.attacker, 0, EVENT_BATTLE_DESTROYING, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 0);
raise_single_event(core.attack_target, 0, EVENT_BATTLE_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1);
raise_single_event(core.attack_target, 0, EVENT_DESTROYED, 0, core.attack_target->current.reason, core.attacker->current.controler, 0, 1);
ing.insert(core.attacker);
ed.insert(core.attack_target);
}
if(ing.size())
raise_event(&ing, EVENT_BATTLE_DESTROYING, 0, 0, 0, 0, 0);
if(ed.size())
if(ed.size()) {
raise_event(&ed, EVENT_BATTLE_DESTROYED, 0, 0, 0, 0, 0);
raise_event(&ed, EVENT_DESTROYED, 0, 0, 0, 0, 0);
}
raise_single_event(core.attacker, 0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 0);
if(core.attack_target)
raise_single_event(core.attack_target, 0, EVENT_DAMAGE_STEP_END, 0, 0, 0, 0, 1);
......
......@@ -22,6 +22,7 @@ public:
static int32 card_get_origin_code(lua_State *L);
static int32 card_get_origin_code_rule(lua_State *L);
static int32 card_is_set_card(lua_State *L);
static int32 card_is_pre_set_card(lua_State *L);
static int32 card_get_type(lua_State *L);
static int32 card_get_origin_type(lua_State *L);
static int32 card_get_level(lua_State *L);
......
......@@ -7,17 +7,18 @@ function c12469386.initial_effect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetRange(LOCATION_GRAVE)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_DESTROY)
e1:SetCode(EVENT_DESTROYED)
e1:SetCondition(c12469386.spcon)
e1:SetTarget(c12469386.sptg)
e1:SetOperation(c12469386.spop)
c:RegisterEffect(e1)
end
function c12469386.filter(c,tp)
return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsLevelAbove(5) and c:IsRace(RACE_PLANT)
return c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
and c:GetPreviousLevelOnField()>=5 and bit.band(c:GetPreviousRaceOnField(),RACE_PLANT)~=0
end
function c12469386.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c12469386.filter,1,nil,tp)
return eg:IsExists(c12469386.filter,1,e:GetHandler(),tp)
end
function c12469386.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -15,7 +15,7 @@ function c176392.initial_effect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c176392.spcon)
e2:SetTarget(c176392.sptg)
e2:SetOperation(c176392.spop)
......@@ -37,8 +37,11 @@ end
function c176392.repval(e,c)
return c:IsFaceup() and c:IsSetCard(0x1d) and c~=e:GetHandler()
end
function c176392.spfilter(c)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0x1d)
end
function c176392.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()==PHASE_END and eg:IsExists(c176392.rfilter,1,nil)
return Duel.GetCurrentPhase()==PHASE_END and eg:IsExists(c176392.spfilter,1,nil)
end
function c176392.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -10,9 +10,8 @@ function c17896384.initial_effect(c)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c17896384.ctcon)
e2:SetOperation(c17896384.ctop)
c:RegisterEffect(e2)
......@@ -29,7 +28,7 @@ function c17896384.initial_effect(c)
c:RegisterEffect(e3)
end
function c17896384.ctfilter(c)
return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_SPELLCASTER)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_SPELLCASTER)~=0
end
function c17896384.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c17896384.ctfilter,1,nil)
......
......@@ -15,7 +15,7 @@ function c20057949.initial_effect(c)
c20057949[1]=false
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_DESTROY)
ge1:SetCode(EVENT_DESTROYED)
ge1:SetOperation(c20057949.checkop1)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
......@@ -28,10 +28,8 @@ end
function c20057949.checkop1(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
local pos=tc:GetPosition()
if Duel.GetCurrentPhase()==PHASE_DAMAGE then pos=tc:GetBattlePosition() end
if tc:IsLocation(LOCATION_MZONE) and tc:IsSetCard(0x31) and bit.band(pos,POS_FACEUP)~=0 then
c20057949[tc:GetControler()]=true
if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_FACEUP) and tc:IsPreviousSetCard(0x31) then
c20057949[tc:GetPreviousControler()]=true
end
tc=eg:GetNext()
end
......
......@@ -19,7 +19,7 @@ function c25518020.initial_effect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetRange(LOCATION_SZONE)
e3:SetCode(EVENT_DESTROY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c25518020.ctcon)
e3:SetOperation(c25518020.ctop)
c:RegisterEffect(e3)
......@@ -36,7 +36,7 @@ function c25518020.initial_effect(c)
c:RegisterEffect(e4)
end
function c25518020.ctfilter(c)
return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_MACHINE)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_MACHINE)~=0
end
function c25518020.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c25518020.ctfilter,1,nil)
......
......@@ -13,7 +13,7 @@ function c29307554.initial_effect(c)
c29307554.global_check=true
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_DESTROY)
ge1:SetCode(EVENT_DESTROYED)
ge1:SetOperation(c29307554.checkop)
Duel.RegisterEffect(ge1,0)
end
......@@ -23,7 +23,7 @@ function c29307554.checkop(e,tp,eg,ep,ev,re,r,rp)
local p1=false
local p2=false
while tc do
if tc:IsLocation(LOCATION_MZONE) and tc:IsDefencePos() then
if tc:IsPreviousLocation(LOCATION_MZONE) and tc:IsPreviousPosition(POS_DEFENCE) then
if tc:GetReasonPlayer()==0 and tc:IsControler(1) then p1=true end
if tc:GetReasonPlayer()==1 and tc:IsControler(0) then p2=true end
end
......
......@@ -19,6 +19,7 @@ end
function c29843091.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)<3 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,29843092,0xf,0x4011,0,1000,2,RACE_BEAST,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENCE,1-tp) then return end
local g=Group.CreateGroup()
for i=1,3 do
local token=Duel.CreateToken(tp,29843091+i)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE) then
......@@ -29,17 +30,42 @@ function c29843091.activate(e,tp,eg,ep,ev,re,r,rp)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetValue(1)
token:RegisterEffect(e1,true)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DESTROY)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetOperation(c29843091.damop)
e2:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e2,true)
g:AddCard(token)
end
end
g:KeepAlive()
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DESTROYED)
e2:SetLabelObject(g)
e2:SetCondition(c29843091.damcon)
e2:SetOperation(c29843091.damop)
Duel.RegisterEffect(e2,tp)
Duel.SpecialSummonComplete()
end
function c29843091.dfilter(c,g)
return g:IsContains(c)
end
function c29843091.damcon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if eg:IsExists(c29843091.dfilter,1,nil,g) then
return true
else
if not g:IsExists(Card.IsLocation,1,nil,LOCATION_MZONE) then
g:DeleteGroup()
e:Reset()
end
return false
end
end
function c29843091.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(tp,300,REASON_EFFECT)
local g=e:GetLabelObject()
local tc=eg:GetFirst()
while tc do
if g:IsContains(tc) then
Duel.Damage(tc:GetPreviousControler(),300,REASON_EFFECT)
g:RemoveCard(tc)
end
tc=eg:GetNext()
end
end
......@@ -20,15 +20,25 @@ function c30069398.operation(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,30069399)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROY)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROYED)
e1:SetLabelObject(token)
e1:SetCondition(c30069398.damcon)
e1:SetOperation(c30069398.damop)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1,true)
Duel.RegisterEffect(e1,tp)
end
Duel.SpecialSummonComplete()
end
function c30069398.damcon(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
if eg:IsContains(tok) then
return true
else
if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end
return false
end
end
function c30069398.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(tp,300,REASON_EFFECT)
local tok=e:GetLabelObject()
Duel.Damage(tok:GetPreviousControler(),300,REASON_EFFECT)
end
......@@ -17,7 +17,7 @@ function c35448319.initial_effect(c)
e2:SetDescription(aux.Stringid(35448319,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(c35448319.spcon)
e2:SetTarget(c35448319.sptg)
......@@ -46,7 +46,7 @@ function c35448319.operation(e,tp,eg,ep,ev,re,r,rp,chk)
end
end
function c35448319.spfilter(c)
return c:IsOnField() and c:IsRace(RACE_PLANT)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_PLANT)~=0
end
function c35448319.spcon(e,tp,eg,ep,ev,re,r,rp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c35448319.spfilter,1,nil)
......
......@@ -7,7 +7,7 @@ function c37115575.initial_effect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CHAIN_UNIQUE)
e1:SetCode(EVENT_DESTROY)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCondition(c37115575.spcon)
e1:SetCost(c37115575.spcost)
......@@ -80,8 +80,8 @@ function c37115575.excon(e)
return Duel.IsExistingMatchingCard(c37115575.exfilter,0,LOCATION_MZONE,LOCATION_MZONE,1,nil)
end
function c37115575.cfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
and c:IsSetCard(0x23) and c:GetCode()~=37115575
return c:IsControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousCodeOnField()~=37115575
and c:IsPreviousSetCard(0x23) and not c:IsReason(REASON_RULE)
end
function c37115575.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c37115575.cfilter,1,nil,tp)
......
......@@ -28,9 +28,8 @@ function c39118197.initial_effect(c)
e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
e4:SetCategory(CATEGORY_ATKCHANGE)
e4:SetCode(EVENT_DESTROY)
e4:SetCode(EVENT_DESTROYED)
e4:SetCondition(c39118197.atkcon)
e4:SetTarget(c39118197.atktg)
e4:SetOperation(c39118197.atkop)
c:RegisterEffect(e4)
end
......@@ -47,19 +46,19 @@ function c39118197.posop(e,tp,eg,ep,ev,re,r,rp)
end
end
function c39118197.filter(c)
return c:IsFaceup() and c:IsSetCard(0x11) and c:IsLocation(LOCATION_MZONE)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0x11)
end
function c39118197.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c39118197.filter,1,nil)
end
function c39118197.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
end
function c39118197.atkop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(400)
e:GetHandler():RegisterEffect(e1)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESET_EVENT+0x1ff0000)
e1:SetValue(400)
c:RegisterEffect(e1)
end
end
......@@ -25,20 +25,46 @@ end
function c42956963.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(1-tp,LOCATION_MZONE)<3 then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,42956964,0x45,0x4011,2000,2000,6,RACE_FIEND,ATTRIBUTE_DARK,POS_FACEUP_ATTACK,1-tp) then return end
local g=Group.CreateGroup()
for i=1,3 do
local token=Duel.CreateToken(tp,42956964)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_ATTACK) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROY)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(c42956963.damop)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1,true)
g:AddCard(token)
end
end
g:KeepAlive()
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DESTROYED)
e2:SetLabelObject(g)
e2:SetCondition(c42956963.damcon)
e2:SetOperation(c42956963.damop)
Duel.RegisterEffect(e2,tp)
Duel.SpecialSummonComplete()
end
function c42956963.dfilter(c,g)
return g:IsContains(c)
end
function c42956963.damcon(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
if eg:IsExists(c42956963.dfilter,1,nil,g) then
return true
else
if not g:IsExists(Card.IsLocation,1,nil,LOCATION_MZONE) then
g:DeleteGroup()
e:Reset()
end
return false
end
end
function c42956963.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(tp,800,REASON_EFFECT)
local g=e:GetLabelObject()
local tc=eg:GetFirst()
while tc do
if g:IsContains(tc) then
Duel.Damage(tc:GetPreviousControler(),800,REASON_EFFECT)
g:RemoveCard(tc)
end
tc=eg:GetNext()
end
end
......@@ -25,7 +25,8 @@ end
function c48210156.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local fid=e:GetHandler():GetFieldID()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
......@@ -36,12 +37,18 @@ function c48210156.spop(e,tp,eg,ep,ev,re,r,rp)
e2:SetCode(EFFECT_SET_DEFENCE_FINAL)
tc:RegisterEffect(e2)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_DESTROY)
e3:SetLabel(tp)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(c48210156.damcon)
e3:SetOperation(c48210156.damop)
e3:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e3)
Duel.RegisterEffect(e3,tp)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EVENT_DESTROY)
e4:SetLabelObject(e3)
e4:SetOperation(c48210156.checkop)
e4:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e4)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
......@@ -51,10 +58,20 @@ function c48210156.spop(e,tp,eg,ep,ev,re,r,rp)
e1:SetTarget(c48210156.splimit)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
Duel.SpecialSummonComplete()
end
function c48210156.splimit(e,c)
return c:GetRace()~=RACE_FIEND
end
function c48210156.checkop(e,tp,eg,ep,ev,re,r,rp)
local e3=e:GetLabelObject()
e3:SetLabel(1)
end
function c48210156.damcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabel()==1
end
function c48210156.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(e:GetLabel(),1000,REASON_EFFECT)
Duel.Damage(tp,1000,REASON_EFFECT)
e:SetLabel(0)
e:Reset()
end
......@@ -8,9 +8,8 @@ function c5973663.initial_effect(c)
--add counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c5973663.ctcon)
e2:SetOperation(c5973663.ctop)
c:RegisterEffect(e2)
......@@ -49,7 +48,7 @@ function c5973663.initial_effect(c)
c:RegisterEffect(e5)
end
function c5973663.ctfilter(c)
return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_PLANT)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_PLANT)~=0
end
function c5973663.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c5973663.ctfilter,1,nil)
......
......@@ -5,7 +5,7 @@ function c60102563.initial_effect(c)
e1:SetDescription(aux.Stringid(60102563,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_DESTROY)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c60102563.atkcon)
e1:SetTarget(c60102563.atktg)
......@@ -13,7 +13,7 @@ function c60102563.initial_effect(c)
c:RegisterEffect(e1)
end
function c60102563.cfilter(c)
return c:IsOnField() and c:IsFaceup() and c:IsRace(RACE_BEAST)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and bit.band(c:GetPreviousRaceOnField(),RACE_BEAST)~=0
end
function c60102563.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c60102563.cfilter,1,nil)
......
......@@ -8,9 +8,8 @@ function c74329404.initial_effect(c)
--counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c74329404.ctcon)
e2:SetOperation(c74329404.ctop)
c:RegisterEffect(e2)
......@@ -31,7 +30,7 @@ function c74329404.initial_effect(c)
c:RegisterEffect(e4)
end
function c74329404.ctfilter(c,tp)
return c:IsFaceup() and c:IsSetCard(0xc008) and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0xc008)
end
function c74329404.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c74329404.ctfilter,1,nil,tp)
......
......@@ -14,7 +14,7 @@ function c81167171.initial_effect(c)
c81167171[1]=false
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_DESTROY)
ge1:SetCode(EVENT_BATTLE_DESTROYED)
ge1:SetOperation(c81167171.checkop1)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
......@@ -27,8 +27,8 @@ end
function c81167171.checkop1(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
while tc do
if tc:IsLocation(LOCATION_MZONE) and tc:IsSetCard(0x3008) and tc:IsReason(REASON_BATTLE) then
c81167171[tc:GetControler()]=true
if tc:IsPreviousSetCard(0x3008) then
c81167171[tc:GetPreviousControler()]=true
end
tc=eg:GetNext()
end
......
......@@ -25,19 +25,26 @@ function c82994509.operation(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,82994510)
if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROY)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(c82994509.handes)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1,true)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetLabelObject(token)
e1:SetCondition(c82994509.handcon)
e1:SetOperation(c82994509.handop)
Duel.RegisterEffect(e1,tp)
end
Duel.SpecialSummonComplete()
end
function c82994509.handes(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsReason(REASON_BATTLE) and c:GetReasonCard():IsRace(RACE_PLANT) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT)
function c82994509.handcon(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
if eg:IsContains(tok) and tok:GetReasonCard():IsRace(RACE_PLANT) then
return true
else
if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end
return false
end
end
function c82994509.handop(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
Duel.DiscardHand(tok:GetPreviousControler(),nil,1,1,REASON_EFFECT)
end
......@@ -27,8 +27,7 @@ function c847915.initial_effect(c)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_SZONE)
e4:SetCode(EVENT_DESTROY)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCode(EVENT_DESTROYED)
e4:SetCondition(c847915.descon)
e4:SetOperation(c847915.desop)
c:RegisterEffect(e4)
......@@ -43,7 +42,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:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x48)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0x48)
end
function c847915.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c847915.dfilter,1,nil,tp)
......
......@@ -20,17 +20,24 @@ function c86801871.spop(e,tp,eg,ep,ev,re,r,rp)
local token=Duel.CreateToken(tp,86801872)
if Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_DESTROY)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetLabelObject(token)
e1:SetCondition(c86801871.damcon)
e1:SetOperation(c86801871.damop)
e1:SetReset(RESET_EVENT+0x1fe0000)
token:RegisterEffect(e1,true)
Duel.RegisterEffect(e1,tp)
end
Duel.SpecialSummonComplete()
end
function c86801871.damop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsReason(REASON_BATTLE) then
Duel.Damage(1-tp,500,REASON_EFFECT)
function c86801871.damcon(e,tp,eg,ep,ev,re,r,rp)
local tok=e:GetLabelObject()
if eg:IsContains(tok) then
return true
else
if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end
return false
end
end
function c86801871.damop(e,tp,eg,ep,ev,re,r,rp)
Duel.Damage(1-tp,500,REASON_EFFECT)
end
......@@ -5,7 +5,7 @@ function c87473172.initial_effect(c)
e1:SetDescription(aux.Stringid(87473172,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD)
e1:SetCode(EVENT_DESTROY)
e1:SetCode(EVENT_DESTROYED)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c87473172.atkcon)
e1:SetTarget(c87473172.atktg)
......@@ -13,7 +13,8 @@ function c87473172.initial_effect(c)
c:RegisterEffect(e1)
end
function c87473172.cfilter(c,tp)
return c:IsOnField() and c:IsFaceup() and c:IsControler(tp) and c:IsRace(RACE_WINDBEAST)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
and bit.band(c:GetPreviousRaceOnField(),RACE_WINDBEAST)~=0
end
function c87473172.atkcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c87473172.cfilter,1,nil,tp)
......
......@@ -11,14 +11,15 @@ function c92035412.initial_effect(c)
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c92035412.spcon)
e2:SetTarget(c92035412.sptg)
e2:SetOperation(c92035412.spop)
c:RegisterEffect(e2)
end
function c92035412.cfilter(c,tp)
return c:IsSetCard(0x30) and c:IsType(TYPE_EQUIP) and c:IsFaceup() and c:IsControler(tp)
return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0x30)
and bit.band(c:GetPreviousTypeOnField(),TYPE_EQUIP)~=0
end
function c92035412.spcon(e,tp,eg,ep,ev,re,r,rp)
local ct=eg:FilterCount(c92035412.cfilter,nil,tp)
......
......@@ -7,9 +7,8 @@ function c99342953.initial_effect(c)
--counter
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_SZONE)
e2:SetCode(EVENT_DESTROY)
e2:SetCode(EVENT_DESTROYED)
e2:SetCondition(c99342953.ctcon)
e2:SetOperation(c99342953.ctop)
c:RegisterEffect(e2)
......@@ -27,7 +26,7 @@ function c99342953.initial_effect(c)
c:RegisterEffect(e3)
end
function c99342953.ctfilter(c)
return c:IsFaceup() and c:IsSetCard(0xc) and c:IsLocation(LOCATION_MZONE)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(0xc)
end
function c99342953.ctcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c99342953.ctfilter,1,nil)
......
......@@ -481,7 +481,7 @@ EFFECT_NO_EFFECT_DAMAGE =335 --玩家已受到"效果傷害變成0"的效果影
EVENT_STARTUP =1000 --游戏开始时
EVENT_FLIP =1001 --翻转时
EVENT_FREE_CHAIN =1002 --自由时点(强脱等,还有昴星团等诱发即时效果)
EVENT_DESTROY =1010 --破坏时
EVENT_DESTROY =1010 --被破坏时(移動前)
EVENT_REMOVE =1011 --除外时
EVENT_TO_HAND =1012 --加入手牌时
EVENT_TO_DECK =1013 --回卡组时
......@@ -500,7 +500,7 @@ EVENT_CHAIN_DISABLED =1025 --连锁被无效时(效果无效)
EVENT_CHAIN_END =1026 --连锁串结束时
EVENT_CHAINING =1027 --效果发动时
EVENT_BECOME_TARGET =1028 --成为效果对象时
EVENT_DESTROYED =1029 --破坏确定
EVENT_DESTROYED =1029 --被破坏
EVENT_ADJUST =1040 --调整(御前试合)
EVENT_SUMMON_SUCCESS =1100 --通常召唤成功时
EVENT_FLIP_SUMMON_SUCCESS =1101 --翻转召唤成功时
......
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