Commit b63d8515 authored by salix5's avatar salix5

battle destroy

parent d5708cf8
......@@ -398,6 +398,7 @@ public:
#define STATUS_CONTINUOUS_POS 0x2000000
#define STATUS_IS_PUBLIC 0x4000000
#define STATUS_ACT_FROM_HAND 0x8000000
#define STATUS_SELF_BATTLE 0x10000000
//Counter
#define COUNTER_NEED_PERMIT 0x1000
#define COUNTER_NEED_ENABLE 0x2000
......
......@@ -3484,6 +3484,10 @@ int32 field::process_battle_command(uint16 step) {
core.attack_target->q_cache.defence = dd;
core.attack_target->set_status(STATUS_BATTLE_DESTROYED, FALSE);
pd = core.attack_target->current.controler;
if(pa == pd){
core.attacker->set_status(STATUS_SELF_BATTLE, TRUE);
core.attack_target->set_status(STATUS_SELF_BATTLE, TRUE);
}
if(core.attack_target->is_position(POS_ATTACK)) {
d = da;
if(a > d) {
......@@ -3673,7 +3677,7 @@ int32 field::process_battle_command(uint16 step) {
break_effect();
}
core.damage_calculated = TRUE;
if(core.effect_damage_step && core.current_chain.size() <= 1)
if(core.effect_damage_step)
return TRUE;
return FALSE;
}
......@@ -3785,7 +3789,7 @@ int32 field::process_battle_command(uint16 step) {
//raise_event((card*)0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0);
//process_single_event();
//process_instant_event();
if(!core.effect_damage_step || ((core.effect_damage_step != 3) && (core.current_chain.size() <= 1))) {
if(!core.effect_damage_step || (core.effect_damage_step != 3)) {
//add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, TRUE);
core.units.begin()->arg1 = 1;
} else {
......@@ -3805,7 +3809,7 @@ int32 field::process_battle_command(uint16 step) {
process_single_event();
process_instant_event();
}
if(!core.effect_damage_step || ((core.effect_damage_step != 3) && (core.current_chain.size() <= 1))) {
if(!core.effect_damage_step || (core.effect_damage_step != 3)) {
if(core.new_fchain.size() || core.new_ochain.size())
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, FALSE);
} else {
......@@ -3857,9 +3861,12 @@ int32 field::process_battle_command(uint16 step) {
process_single_event();
process_instant_event();
core.attacker->set_status(STATUS_BATTLE_DESTROYED, FALSE);
if(core.attack_target)
core.attacker->set_status(STATUS_SELF_BATTLE, FALSE);
if(core.attack_target){
core.attack_target->set_status(STATUS_BATTLE_DESTROYED, FALSE);
if(!core.effect_damage_step || ((core.effect_damage_step != 3) && (core.current_chain.size() <= 1))) {
core.attack_target->set_status(STATUS_SELF_BATTLE, FALSE);
}
if(!core.effect_damage_step || (core.effect_damage_step != 3)) {
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, FALSE);
} else {
break_effect();
......@@ -3952,7 +3959,7 @@ int32 field::process_damage_step(uint16 step) {
process_single_event();
process_instant_event();
add_process(PROCESSOR_BATTLE_COMMAND, 26, 0, 0, 0, 0);
if(core.current_chain.size() > 1 || core.units.begin()->arg2) { //skip timing
if(core.units.begin()->arg2) { //skip timing
core.units.begin()->step = 2;
core.effect_damage_step = 3;
add_process(PROCESSOR_BATTLE_COMMAND, 27, 0, 0, 0, 0);
......
......@@ -58,7 +58,7 @@ function c10032958.reg(c,opt)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(c10032958.damcon)
e1:SetCondition(aux.bdgcon)
e1:SetTarget(c10032958.damtg)
e1:SetOperation(c10032958.damop)
e1:SetReset(RESET_EVENT+0x1ff0000)
......@@ -73,11 +73,6 @@ end
function c10032958.atop(e,tp,eg,ep,ev,re,r,rp)
Duel.ChainAttack()
end
function c10032958.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
end
function c10032958.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
......
......@@ -6,14 +6,11 @@ function c11012887.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(c11012887.condition)
e1:SetCondition(aux.bdocon)
e1:SetTarget(c11012887.target)
e1:SetOperation(c11012887.operation)
c:RegisterEffect(e1)
end
function c11012887.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsRelateToBattle()
end
function c11012887.filter(c,e,tp)
return c:IsSetCard(0x22) and c:IsAttackBelow(1700) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
......
......@@ -4,6 +4,7 @@ function c11224103.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdcon)
e1:SetOperation(c11224103.bdop)
c:RegisterEffect(e1)
--immune spell
......
......@@ -5,7 +5,7 @@ function c11682713.initial_effect(c)
e1:SetDescription(aux.Stringid(11682713,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(c11682713.condition)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c11682713.target)
e1:SetOperation(c11682713.operation)
c:RegisterEffect(e1)
......@@ -20,12 +20,6 @@ function c11682713.initial_effect(c)
e2:SetOperation(c11682713.tdop)
c:RegisterEffect(e2)
end
function c11682713.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and c:IsFaceup()
and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER) and bc:IsReason(REASON_BATTLE)
end
function c11682713.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end
end
......
......@@ -6,15 +6,11 @@ function c12079734.initial_effect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(c12079734.condition)
e1:SetCondition(aux.bdocon)
e1:SetTarget(c12079734.target)
e1:SetOperation(c12079734.operation)
c:RegisterEffect(e1)
end
function c12079734.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsRelateToBattle() and c:GetBattleTarget():IsType(TYPE_MONSTER)
end
function c12079734.filter1(c,ec)
return c:IsType(TYPE_UNION) and c:CheckEquipTarget(ec)
end
......
......@@ -49,7 +49,7 @@ function c12174035.operation(e,tp,eg,ep,ev,re,r,rp)
end
end
function c12174035.hdcon(e,tp,eg,ep,ev,re,r,rp)
return eg:GetFirst()==e:GetHandler():GetEquipTarget()
return eg:GetFirst()==e:GetHandler():GetEquipTarget() and not eg:GetFirst():IsStatus(STATUS_SELF_BATTLE)
end
function c12174035.hdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -82,7 +82,7 @@ end
function c12927849.thcon(e,tp,eg,ep,ev,re,r,rp)
local ec=eg:GetFirst()
local bc=ec:GetBattleTarget()
return ec==e:GetHandler():GetEquipTarget() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE)
return ec==e:GetHandler():GetEquipTarget() and not ec:IsStatus(STATUS_SELF_BATTLE) and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
end
function c12927849.thfilter(c)
return c:IsSetCard(0x7e) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
......
......@@ -6,17 +6,11 @@ function c13386503.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCondition(c13386503.spcon)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c13386503.sptg)
e1:SetOperation(c13386503.spop)
c:RegisterEffect(e1)
end
function c13386503.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
if not c:IsRelateToBattle() or c:IsFacedown() then return false end
return bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
end
function c13386503.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local bc=e:GetHandler():GetBattleTarget()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -14,7 +14,7 @@ end
function c13438207.condition(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local bc=tc:GetBattleTarget()
return eg:GetCount()==1 and tc:IsControler(tp) and tc:IsRace(RACE_PLANT)
return tc:IsRelateToBattle() and not tc:IsStatus(STATUS_SELF_BATTLE) and tc:IsControler(tp) and tc:IsRace(RACE_PLANT)
and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE)
end
function c13438207.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -6,7 +6,7 @@ function c13521194.initial_effect(c)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCondition(aux.bdcon1)
e1:SetCondition(aux.bdgcon)
e1:SetTarget(c13521194.damtarget)
e1:SetOperation(c13521194.damoperation)
c:RegisterEffect(e1)
......
......@@ -5,6 +5,7 @@ function c14089428.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdocon)
e1:SetTarget(c14089428.target)
e1:SetOperation(c14089428.operation)
c:RegisterEffect(e1)
......
......@@ -58,7 +58,7 @@ end
function c15013468.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsType(TYPE_MONSTER) and bit.band(bc:GetBattlePosition(),POS_DEFENCE)~=0
return c:IsRelateToBattle() and bit.band(bc:GetBattlePosition(),POS_DEFENCE)~=0
end
function c15013468.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
--レプティレス・スキュラ
function c16909657.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLED)
e1:SetOperation(c16909657.checkop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(16909657,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
......@@ -17,17 +12,10 @@ function c16909657.initial_effect(c)
e2:SetLabelObject(e1)
c:RegisterEffect(e2)
end
function c16909657.checkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local t=Duel.GetAttackTarget()
if ev==1 then t=Duel.GetAttacker() end
e:SetLabelObject(t)
if t then e:SetLabel(t:GetAttack()) end
end
function c16909657.spcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject():GetLabelObject()
local atk=e:GetLabelObject():GetLabel()
return tc and tc:IsLocation(LOCATION_GRAVE) and atk==0
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:GetPreviousAttackOnField()==0
end
function c16909657.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=e:GetLabelObject():GetLabelObject()
......
......@@ -7,16 +7,11 @@ function c17185260.initial_effect(c)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(c17185260.poscon)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c17185260.postg)
e1:SetOperation(c17185260.posop)
c:RegisterEffect(e1)
end
function c17185260.poscon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and c:IsFaceup() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE)
end
function c17185260.filter(c)
return c:IsFaceup() and c:IsCanTurnSet()
end
......
......@@ -6,16 +6,11 @@ function c17706537.initial_effect(c)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCondition(c17706537.damcon)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c17706537.damtg)
e1:SetOperation(c17706537.damop)
c:RegisterEffect(e1)
end
function c17706537.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE)
end
function c17706537.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
......
......@@ -4,6 +4,7 @@ function c17948378.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdocon)
e1:SetOperation(c17948378.regop)
c:RegisterEffect(e1)
--draw
......
......@@ -17,7 +17,7 @@ function c1945387.initial_effect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetCondition(c1945387.drcon)
e2:SetCondition(aux.bdocon)
e2:SetTarget(c1945387.drtg)
e2:SetOperation(c1945387.drop)
c:RegisterEffect(e2)
......@@ -25,10 +25,6 @@ end
function c1945387.splimit(e,se,sp,st)
return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION
end
function c1945387.drcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsRelateToBattle() and c:GetBattleTarget():IsType(TYPE_MONSTER)
end
function c1945387.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
......
......@@ -6,7 +6,7 @@ function c58820853.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(aux.bdcon1)
e1:SetCondition(aux.bdogcon)
e1:SetTarget(c58820853.target)
e1:SetOperation(c58820853.operation)
c:RegisterEffect(e1)
......
......@@ -8,7 +8,7 @@ function c80321197.initial_effect(c)
e1:SetDescription(aux.Stringid(80321197,0))
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCondition(aux.bdcon1)
e1:SetCondition(aux.bdogcon)
e1:SetOperation(c80321197.spop)
c:RegisterEffect(e1)
end
......
......@@ -148,6 +148,7 @@ STATUS_JUST_POS =0x1000000 --
STATUS_CONTINUOUS_POS =0x2000000 --连续变更表示形式?
STATUS_IS_PUBLIC =0x4000000 --公开展示
STATUS_ACT_FROM_HAND =0x8000000 --在手牌发动
STATUS_SELF_BATTLE =0x10000000 --和自己的怪兽戰鬥
--Assume
ASSUME_CODE =1
ASSUME_TYPE =2
......@@ -198,12 +199,12 @@ RESET_MAIN2 =PHASE_MAIN2 --主要阶段2重置
RESET_END =PHASE_END --结束阶段重置
RESET_SELF_TURN =0x0100 --自己回合结束重置
RESET_OPPO_TURN =0x0200 --对方回合结束重置
RESET_PHASE =0x0400 --阶段结束重置(一般和上面那些阶段配合使用
RESET_PHASE =0x0400 --阶段结束重置(一般和上面那些阶段配合使用)
RESET_CHAIN =0x0800 --连锁结束重置
RESET_EVENT =0x1000 --不明(一般和下面这些事件配合使用
RESET_CARD =0x2000
RESET_CODE =0x4000 --卡名改变重置
RESET_COPY =0x8000 --复制效果重置
RESET_EVENT =0x1000 --指定的條件下重置(一般和下面这些事件配合使用)
RESET_CARD =0x2000 --重置Owner為指定卡片的效果
RESET_CODE =0x4000 --重置指定Code的效果
RESET_COPY =0x8000 --重置以复制取得的效果
RESET_DISABLE =0x00010000 --效果无效重置
RESET_TURN_SET =0x00020000 --变里侧重置
RESET_TOGRAVE =0x00040000 --去墓地重置
......@@ -213,7 +214,7 @@ RESET_TOHAND =0x00200000 --回手牌或加入手牌重置
RESET_TODECK =0x00400000 --回卡组重置
RESET_LEAVE =0x00800000 --从场上离开重置
RESET_TOFIELD =0x01000000 --到场上重置
RESET_CONTROL =0x02000000 --控制变更重置
RESET_CONTROL =0x02000000 --控制变更重置
RESET_OVERLAY =0x04000000 --超量叠放重置
--========== Types ========== --效果类型(定义效果触发类型,和codes一起使用)
EFFECT_TYPE_SINGLE =0x0001 --自己状态变化时触发
......
......@@ -952,9 +952,25 @@ function Auxiliary.atrst(e,tp,eg,ep,ev,re,r,rp)
local e1=e:GetLabelObject()
if eg:GetFirst()~=e1:GetHandler() then e1:Reset() end
end
function Auxiliary.bdcon1(e,tp,eg,ep,ev,re,r,rp)
function Auxiliary.bdcon(e,tp,eg,ep,ev,re,r,rp)
--condition of EVENT_BATTLE_DESTROYING
local c=e:GetHandler()
return c:IsRelateToBattle()
end
function Auxiliary.bdocon(e,tp,eg,ep,ev,re,r,rp)
--condition of EVENT_BATTLE_DESTROYING + opponent monster
local c=e:GetHandler()
return c:IsRelateToBattle() and not c:IsStatus(STATUS_SELF_BATTLE)
end
function Auxiliary.bdgcon(e,tp,eg,ep,ev,re,r,rp)
--condition of EVENT_BATTLE_DESTROYING + to_grave
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
end
function Auxiliary.bdogcon(e,tp,eg,ep,ev,re,r,rp)
--condition of EVENT_BATTLE_DESTROYING + opponent monster + to_grave
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsRelateToBattle() and not c:IsStatus(STATUS_SELF_BATTLE) and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER)
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