Commit 5c4aa3a0 authored by argon.sun's avatar argon.sun

fix

parent 1a165388
...@@ -24,10 +24,14 @@ int32 scriptlib::card_get_origin_code(lua_State *L) { ...@@ -24,10 +24,14 @@ int32 scriptlib::card_get_origin_code(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->data.alias) if(pcard->data.alias) {
int32 dif = pcard->data.code - pcard->data.alias;
if(dif > -10 && dif < 10)
lua_pushinteger(L, pcard->data.alias); lua_pushinteger(L, pcard->data.alias);
else else
lua_pushinteger(L, pcard->data.code); lua_pushinteger(L, pcard->data.code);
} else
lua_pushinteger(L, pcard->data.code);
return 1; return 1;
} }
int32 scriptlib::card_is_set_card(lua_State *L) { int32 scriptlib::card_is_set_card(lua_State *L) {
...@@ -893,7 +897,7 @@ int32 scriptlib::card_is_relate_to_battle(lua_State *L) { ...@@ -893,7 +897,7 @@ int32 scriptlib::card_is_relate_to_battle(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1); card* pcard = *(card**) lua_touserdata(L, 1);
duel* pduel = pcard->pduel; duel* pduel = pcard->pduel;
if(pcard->fieldid == pduel->game_field->core.pre_field[0] || pcard->fieldid == pduel->game_field->core.pre_field[1]) if(pcard->fieldid_r == pduel->game_field->core.pre_field[0] || pcard->fieldid == pduel->game_field->core.pre_field[1])
lua_pushboolean(L, 1); lua_pushboolean(L, 1);
else else
lua_pushboolean(L, 0); lua_pushboolean(L, 0);
......
...@@ -185,6 +185,7 @@ void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uin ...@@ -185,6 +185,7 @@ void field::destroy(card_set* targets, effect* reason_effect, uint32 reason, uin
pcard->current.reason = reason; pcard->current.reason = reason;
if(reason_effect) if(reason_effect)
pcard->current.reason_effect = reason_effect; pcard->current.reason_effect = reason_effect;
if(reason_player != 5)
pcard->current.reason_player = reason_player; pcard->current.reason_player = reason_player;
p = playerid; p = playerid;
if(!(destination & (LOCATION_HAND + LOCATION_DECK + LOCATION_REMOVED))) if(!(destination & (LOCATION_HAND + LOCATION_DECK + LOCATION_REMOVED)))
...@@ -299,7 +300,6 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -299,7 +300,6 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
switch(step) { switch(step) {
case 0: { case 0: {
card* pcard; card* pcard;
card_set cset;
card_vector cv; card_vector cv;
uint32 drawed = 0; uint32 drawed = 0;
uint32 public_count = 0; uint32 public_count = 0;
...@@ -308,6 +308,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -308,6 +308,8 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
return TRUE; return TRUE;
} }
core.overdraw[playerid] = FALSE; core.overdraw[playerid] = FALSE;
group* drawed_set = new group;
core.units.begin()->ptarget = drawed_set;
for(uint32 i = 0; i < count; ++i) { for(uint32 i = 0; i < count; ++i) {
if(player[playerid].list_main.size() == 0) { if(player[playerid].list_main.size() == 0) {
core.overdraw[playerid] = TRUE; core.overdraw[playerid] = TRUE;
...@@ -334,29 +336,28 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -334,29 +336,28 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
public_count++; public_count++;
} }
cv.push_back(pcard); cv.push_back(pcard);
cset.insert(pcard); drawed_set->container.insert(pcard);
} }
core.hint_timing[playerid] |= TIMING_DRAW + TIMING_TOHAND; core.hint_timing[playerid] |= TIMING_DRAW + TIMING_TOHAND;
adjust_instant(); adjust_instant();
core.units.begin()->arg2 = (core.units.begin()->arg2 & 0xff000000) + drawed; core.units.begin()->arg2 = (core.units.begin()->arg2 & 0xff000000) + drawed;
if(drawed) {
if(core.deck_reversed && player[playerid].list_main.size()) { if(core.deck_reversed && player[playerid].list_main.size()) {
pduel->write_buffer8(MSG_DECK_TOP); pduel->write_buffer8(MSG_DECK_TOP);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(drawed); pduel->write_buffer8(drawed);
pduel->write_buffer32((*player[playerid].list_main.rbegin())->data.code); pduel->write_buffer32((*player[playerid].list_main.rbegin())->data.code);
} }
if(drawed > 0) {
pduel->write_buffer8(MSG_DRAW); pduel->write_buffer8(MSG_DRAW);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(drawed); pduel->write_buffer8(drawed);
for(uint32 i = 0; i < drawed; ++i) for(uint32 i = 0; i < drawed; ++i)
pduel->write_buffer32(cv[i]->data.code); pduel->write_buffer32(cv[i]->data.code);
} if(core.deck_reversed && (public_count < drawed)) {
if(core.deck_reversed && (drawed > 0) && (public_count < drawed)) {
pduel->write_buffer8(MSG_CONFIRM_CARDS); pduel->write_buffer8(MSG_CONFIRM_CARDS);
pduel->write_buffer8(1 - playerid); pduel->write_buffer8(1 - playerid);
pduel->write_buffer8(cset.size()); pduel->write_buffer8(drawed_set->container.size());
for(auto cit = cset.begin(); cit != cset.end(); ++cit) { for(auto cit = drawed_set->container.begin(); cit != drawed_set->container.end(); ++cit) {
pduel->write_buffer32((*cit)->data.code); pduel->write_buffer32((*cit)->data.code);
pduel->write_buffer8((*cit)->current.controler); pduel->write_buffer8((*cit)->current.controler);
pduel->write_buffer8((*cit)->current.location); pduel->write_buffer8((*cit)->current.location);
...@@ -364,23 +365,19 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso ...@@ -364,23 +365,19 @@ int32 field::draw(uint16 step, effect* reason_effect, uint32 reason, uint8 reaso
} }
shuffle(playerid, LOCATION_HAND); shuffle(playerid, LOCATION_HAND);
} }
if(drawed) { for(auto cit = drawed_set->container.begin(); cit != drawed_set->container.end(); ++cit)
for(auto cit = cset.begin(); cit != cset.end(); ++cit)
raise_single_event((*cit), 0, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, 0); raise_single_event((*cit), 0, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, 0);
process_single_event(); process_single_event();
raise_event(&cset, EVENT_DRAW, reason_effect, reason, reason_player, playerid, drawed); raise_event(&drawed_set->container, EVENT_DRAW, reason_effect, reason, reason_player, playerid, drawed);
raise_event(&cset, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, drawed); raise_event(&drawed_set->container, EVENT_TO_HAND, reason_effect, reason, reason_player, playerid, drawed);
process_instant_event(); process_instant_event();
} }
return FALSE; return FALSE;
} }
case 1: { case 1: {
core.operated_set.clear(); group* drawed_set = core.units.begin()->ptarget;
auto clit = player[playerid].list_hand.rbegin(); core.operated_set = drawed_set->container;
for(uint32 i = 0; i < count; ++i) { delete drawed_set;
core.operated_set.insert(*clit);
clit++;
}
returns.ivalue[0] = count; returns.ivalue[0] = count;
return TRUE; return TRUE;
} }
......
...@@ -2919,7 +2919,11 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2919,7 +2919,11 @@ int32 field::process_battle_command(uint16 step) {
core.units.begin()->step = 30; core.units.begin()->step = 30;
return FALSE; return FALSE;
} }
raise_single_event(core.attacker, 0, EVENT_DAMAGE_CALCULATING, 0, 0, 0, 0, 0);
if(core.attack_target)
raise_single_event(core.attack_target, 0, EVENT_DAMAGE_CALCULATING, 0, 0, 0, 0, 1);
raise_event((card*)0, EVENT_DAMAGE_CALCULATING, 0, 0, 0, 0, 0); raise_event((card*)0, EVENT_DAMAGE_CALCULATING, 0, 0, 0, 0, 0);
process_single_event();
process_instant_event(); process_instant_event();
core.new_ochain.clear(); core.new_ochain.clear();
core.new_fchain.clear(); core.new_fchain.clear();
...@@ -3216,7 +3220,6 @@ int32 field::process_battle_command(uint16 step) { ...@@ -3216,7 +3220,6 @@ int32 field::process_battle_command(uint16 step) {
raise_event((card*)0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0); raise_event((card*)0, EVENT_BATTLE_END, 0, 0, PLAYER_NONE, 0, 0);
process_single_event(); process_single_event();
process_instant_event(); process_instant_event();
if(core.new_fchain.size() || core.new_ochain.size())
add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, TRUE); add_process(PROCESSOR_POINT_EVENT, 0, 0, 0, FALSE, TRUE);
core.units.begin()->arg1 = 1; core.units.begin()->arg1 = 1;
return FALSE; return FALSE;
...@@ -4376,6 +4379,7 @@ int32 field::adjust_step(uint16 step) { ...@@ -4376,6 +4379,7 @@ int32 field::adjust_step(uint16 step) {
if(pcard && pcard->is_position(POS_FACEUP) && (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) { if(pcard && pcard->is_position(POS_FACEUP) && (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) {
core.destroy_set.insert(pcard); core.destroy_set.insert(pcard);
pcard->current.reason_effect = peffect; pcard->current.reason_effect = peffect;
pcard->current.reason_player = peffect->get_handler_player();
} }
} }
for(uint8 i = 0; i < 6; ++i) { for(uint8 i = 0; i < 6; ++i) {
...@@ -4383,14 +4387,13 @@ int32 field::adjust_step(uint16 step) { ...@@ -4383,14 +4387,13 @@ int32 field::adjust_step(uint16 step) {
if(pcard && pcard->is_position(POS_FACEUP) && (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) { if(pcard && pcard->is_position(POS_FACEUP) && (peffect = pcard->is_affected_by_effect(EFFECT_SELF_DESTROY))) {
core.destroy_set.insert(pcard); core.destroy_set.insert(pcard);
pcard->current.reason_effect = peffect; pcard->current.reason_effect = peffect;
pcard->current.reason_player = peffect->get_handler_player();
} }
} }
tp = 1 - tp; tp = 1 - tp;
} }
if(core.destroy_set.size()) { if(core.destroy_set.size()) {
destroy(&core.destroy_set, 0, REASON_EFFECT, PLAYER_NONE); destroy(&core.destroy_set, 0, REASON_EFFECT, 5);
for(card_set::iterator cit = core.destroy_set.begin(); cit != core.destroy_set.end(); ++cit)
(*cit)->current.reason_player = (*cit)->current.controler;
} else { } else {
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
} }
......
--地球巨人 ガイア·プレート
function c14258627.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(c14258627.spcon)
e1:SetOperation(c14258627.spop)
c:RegisterEffect(e1)
--atk/def down
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_DAMAGE_CALCULATE)
e2:SetCondition(c14258627.adcon)
e2:SetOperation(c14258627.addown)
c:RegisterEffect(e2)
--maintain
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetOperation(c14258627.mtop)
c:RegisterEffect(e3)
end
function c14258627.filter(c)
return c:IsRace(RACE_ROCK) and c:IsAbleToRemoveAsCost()
end
function c14258627.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c14258627.filter,tp,LOCATION_GRAVE,0,2,nil)
end
function c14258627.spop(e,tp,eg,ep,ev,re,r,rp,c)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c14258627.filter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c14258627.adcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()~=nil
end
function c14258627.addown(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetBattleTarget()
if tc==nil then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetReset(RESET_PHASE+RESET_DAMAGE_CAL)
e1:SetValue(tc:GetAttack()/2)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SET_DEFENCE_FINAL)
e2:SetReset(RESET_PHASE+RESET_DAMAGE_CAL)
e2:SetValue(tc:GetDefence()/2)
tc:RegisterEffect(e2)
end
function c14258627.mtop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()~=tp then return end
if Duel.IsExistingMatchingCard(c14258627.filter,tp,LOCATION_GRAVE,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(14258627,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c14258627.filter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
else
Duel.SendtoGrave(e:GetHandler(),REASON_RULE)
end
end
--交響魔人マエストローク
function c25341652.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,4),2)
c:EnableReviveLimit()
--pos
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(25341652,0))
e1:SetCategory(CATEGORY_POSITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c25341652.poscost)
e1:SetTarget(c25341652.postg)
e1:SetOperation(c25341652.posop)
c:RegisterEffect(e1)
--destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetRange(LOCATION_MZONE)
e2:SetTarget(c25341652.reptg)
e2:SetValue(c25341652.repval)
e2:SetOperation(c25341652.repop)
c:RegisterEffect(e2)
end
function c25341652.poscost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c25341652.postg(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:IsPosition(POS_FACEUP_ATTACK) end
if chk==0 then return Duel.IsExistingTarget(Card.IsPosition,tp,0,LOCATION_MZONE,1,nil,POS_FACEUP_ATTACK) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUPATTACK)
local g=Duel.SelectTarget(tp,Card.IsPosition,tp,0,LOCATION_MZONE,1,1,nil,POS_FACEUP_ATTACK)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
function c25341652.posop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEDOWN_DEFENCE)
end
end
function c25341652.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x6d) and c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT)
end
function c25341652.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c25341652.repfilter,1,nil,tp) end
if Duel.SelectYesNo(tp,aux.Stringid(25341652,1)) then
local g=eg:Filter(c25341652.repfilter,nil,tp)
g:KeepAlive()
e:SetLabelObject(g)
return true
else return false end
end
function c25341652.repval(e,c)
return c25341652.repfilter(c,e:GetHandlerPlayer())
end
function c25341652.repop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject()
local tc=g:GetFirst()
while tc do
tc:RemoveOverlayCard(tp,1,1,REASON_EFFECT)
tc=g:GetNext()
end
g:DeleteGroup()
end
--弦魔人ムズムズリズム
function c26563200.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,3),2)
c:EnableReviveLimit()
--attack up
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(26563200,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetHintTiming(TIMING_DAMAGE_CAL)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(c26563200.atkcon)
e1:SetCost(c26563200.atkcost)
e1:SetTarget(c26563200.atktg)
e1:SetOperation(c26563200.atkop)
c:RegisterEffect(e1)
end
function c26563200.atkcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
if (ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL) or Duel.IsDamageCalculated() then return false end
local tc=Duel.GetAttacker()
return tc:IsControler(tp) and tc:IsRelateToBattle() and tc:IsSetCard(0x6d) and tc:IsType(TYPE_XYZ) and Duel.GetAttackTarget()~=nil
end
function c26563200.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c26563200.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,26563200)==0 end
Duel.RegisterFlagEffect(tp,26563200,RESET_PHASE+PHASE_END,0,1)
end
function c26563200.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttacker()
if tc:IsRelateToBattle() and tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(tc:GetAttack()*2)
tc:RegisterEffect(e1)
end
end
--レインボー·ライフ
function c34002992.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(c34002992.cost)
e1:SetOperation(c34002992.activate)
c:RegisterEffect(e1)
end
function c34002992.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function c34002992.activate(e,tp,eg,ep,ev,re,r,rp)
--damage conversion
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EFFECT_REVERSE_DAMAGE)
e1:SetTargetRange(1,0)
e1:SetValue(1)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end
...@@ -28,6 +28,9 @@ function c36623431.condition1(e,tp,eg,ep,ev,re,r,rp) ...@@ -28,6 +28,9 @@ function c36623431.condition1(e,tp,eg,ep,ev,re,r,rp)
end end
function c36623431.target1(e,tp,eg,ep,ev,re,r,rp,chk) function c36623431.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToHand() end if chk==0 then return e:GetHandler():IsAbleToHand() end
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
e:SetLabel(1)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
...@@ -37,10 +40,11 @@ function c36623431.target1(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -37,10 +40,11 @@ function c36623431.target1(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetValue(0) e1:SetValue(0)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0)
else e:SetLabel(0) end
end end
function c36623431.operation1(e,tp,eg,ep,ev,re,r,rp) function c36623431.operation1(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) then if e:GetLabel()==1 and c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.SendtoHand(c,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c) Duel.ConfirmCards(1-tp,c)
end end
......
...@@ -24,7 +24,7 @@ function c52518793.initial_effect(c) ...@@ -24,7 +24,7 @@ function c52518793.initial_effect(c)
e3:SetValue(c52518793.atkval) e3:SetValue(c52518793.atkval)
c:RegisterEffect(e3) c:RegisterEffect(e3)
local e4=e3:Clone() local e4=e3:Clone()
e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetCode(EFFECT_UPDATE_DEFENCE)
c:RegisterEffect(e4) c:RegisterEffect(e4)
--Destroy replace --Destroy replace
local e5=Effect.CreateEffect(c) local e5=Effect.CreateEffect(c)
......
--太鼓魔人テンテンテンポ
function c52558805.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,3),2)
c:EnableReviveLimit()
--atkchange
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(52558805,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetHintTiming(TIMING_DAMAGE_STEP)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c52558805.atkcon)
e1:SetCost(c52558805.atkcost)
e1:SetTarget(c52558805.atktg)
e1:SetOperation(c52558805.atkop)
c:RegisterEffect(e1)
end
function c52558805.atkcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated()
end
function c52558805.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c52558805.filter(c)
return c:CheckRemoveOverlayCard(tp,1,REASON_EFFECT)
end
function c52558805.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and c52558805.filter(chkc) end
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT)
and Duel.IsExistingTarget(c52558805.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c52558805.filter,tp,0,LOCATION_MZONE,1,1,nil)
end
function c52558805.atkfilter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x6d)
end
function c52558805.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not tc:IsRelateToEffect(e) or tc:GetOverlayCount()==0 then return end
tc:RemoveOverlayCard(tp,1,1,REASON_EFFECT)
local g=Duel.GetMatchingGroup(c52558805.atkfilter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(500)
e1:SetReset(RESET_EVENT+0x1fe0000)
tc:RegisterEffect(e1)
tc=g:GetNext()
end
end
--ギブ&テイク
function c55465441.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c55465441.target)
e1:SetOperation(c55465441.activate)
c:RegisterEffect(e1)
end
function c55465441.filter(c,e,tp)
return c:GetLevel()>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENCE,1-tp)
end
function c55465441.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingTarget(c55465441.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g1=Duel.SelectTarget(tp,c55465441.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
e:SetLabelObject(g2:GetFirst())
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,1,0,0)
end
function c55465441.activate(e,tp,eg,ep,ev,re,r,rp)
local tc1=e:GetLabelObject()
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local tc2=g:GetFirst()
if tc2==tc1 then tc2=g:GetNext() end
if tc2:IsRelateToEffect(e) and Duel.SpecialSummon(tc2,0,tp,1-tp,false,false,POS_FACEUP_DEFENCE)~=0
and tc1:IsFaceup() and tc1:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(tc2:GetLevel())
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
tc1:RegisterEffect(e1)
end
end
--アルカナ ナイトジョーカー
function c6150044.initial_effect(c)
--fusion material
c:EnableReviveLimit()
aux.AddFusionProcCode3(c,25652259,90876561,64788463,false,false)
--negate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(6150044,0))
e1:SetCategory(CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCondition(c6150044.discon)
e1:SetCost(c6150044.discost)
e1:SetTarget(c6150044.distg)
e1:SetOperation(c6150044.disop)
c:RegisterEffect(e1)
end
c6150044.material_count=3
c6150044.material={25652259,90876561,64788463}
function c6150044.discon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return tg and tg:IsContains(c) and Duel.IsChainDisablable(ev)
end
function c6150044.filter(c,tpe)
return c:IsType(tpe) and c:IsDiscardable()
end
function c6150044.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local rtype=bit.band(re:GetActiveType(),0x7)
if chk==0 then return Duel.IsExistingMatchingCard(c6150044.filter,tp,LOCATION_HAND,0,1,nil,rtype) end
Duel.DiscardHand(tp,c6150044.filter,1,1,REASON_COST+REASON_DISCARD,nil,rtype)
end
function c6150044.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function c6150044.disop(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.NegateEffect(ev)
end
--キングス·ナイト
function c64788463.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(64788463,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCondition(c64788463.spcon)
e1:SetTarget(c64788463.sptg)
e1:SetOperation(c64788463.spop)
c:RegisterEffect(e1)
end
function c64788463.cfilter(c)
return c:IsFaceup() and c:IsCode(25652259)
end
function c64788463.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c64788463.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c64788463.filter(c,e,tp)
return c:IsCode(90876561) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c64788463.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c64788463.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function c64788463.spop(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,c64788463.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if g:GetCount()>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
...@@ -18,6 +18,9 @@ end ...@@ -18,6 +18,9 @@ end
function c66499018.target(e,tp,eg,ep,ev,re,r,rp,chk) function c66499018.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)~=0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
local dt=Duel.GetDrawCount(tp)
if dt~=0 then
e:SetLabel(1)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
...@@ -27,10 +30,11 @@ function c66499018.target(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -27,10 +30,11 @@ function c66499018.target(e,tp,eg,ep,ev,re,r,rp,chk)
e1:SetValue(0) e1:SetValue(0)
Duel.RegisterEffect(e1,tp) Duel.RegisterEffect(e1,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
else e:Setlabel(0) end
end end
function c66499018.operation(e,tp,eg,ep,ev,re,r,rp) function c66499018.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then if e:GetLabel()==1 and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
......
...@@ -4,7 +4,7 @@ function c81210420.initial_effect(c) ...@@ -4,7 +4,7 @@ function c81210420.initial_effect(c)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION+CATEGORY_SPECIAL_SUMMON) e1:SetCategory(CATEGORY_POSITION+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_BATTLE_START+TIMING_BATTLE_END) e1:SetHintTiming(0,TIMING_BATTLE_START+TIMING_BATTLE_END)
e1:SetCondition(c81210420.condition) e1:SetCondition(c81210420.condition)
...@@ -21,21 +21,20 @@ end ...@@ -21,21 +21,20 @@ end
function c81210420.spfilter(c,e,tp) function c81210420.spfilter(c,e,tp)
return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEDOWN) return c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEDOWN)
end end
function c81210420.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c81210420.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c81210420.filter(chkc) end if chk==0 then return Duel.IsExistingMatchingCard(c81210420.filter,tp,LOCATION_MZONE,0,1,nil)
if chk==0 then return Duel.IsExistingTarget(c81210420.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and Duel.IsExistingMatchingCard(c81210420.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) and Duel.IsExistingMatchingCard(c81210420.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp)
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=Duel.SelectTarget(tp,c81210420.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK)
end end
function c81210420.activate(e,tp,eg,ep,ev,re,r,rp) function c81210420.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
if not tc:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetMatchingGroup(c81210420.spfilter,tp,LOCATION_DECK,0,nil,e,tp) local g=Duel.GetMatchingGroup(c81210420.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
if g:GetCount()<2 then return end if g:GetCount()<2 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local tc=Duel.SelectMatchingCard(tp,c81210420.filter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if not tc then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,2,2,nil) local sg=g:Select(tp,2,2,nil)
if tc:IsFaceup() then if tc:IsFaceup() then
......
--管魔人メロメロメロディ
function c88942504.initial_effect(c)
--xyz summon
aux.AddXyzProcedure(c,aux.FilterEqualFunction(Card.GetLevel,3),2)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(88942504,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(c88942504.cost)
e1:SetTarget(c88942504.target)
e1:SetOperation(c88942504.operation)
c:RegisterEffect(e1)
end
function c88942504.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function c88942504.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(0x6d) and not c:IsHasEffect(EFFECT_EXTRA_ATTACK)
end
function c88942504.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c88942504.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c88942504.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,c88942504.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function c88942504.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+RESET_END)
e1:SetValue(1)
tc:RegisterEffect(e1)
end
end
...@@ -38,7 +38,7 @@ function c90470931.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -38,7 +38,7 @@ function c90470931.operation(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetCode(EFFECT_EXTRA_ATTACK)
e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetValue(1) e1:SetValue(1)
tc:RegisterEffect(e1) tc:RegisterEffect(e1)
end end
......
...@@ -18,7 +18,7 @@ function c984114.initial_effect(c) ...@@ -18,7 +18,7 @@ function c984114.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c984114.filter(c) function c984114.filter(c)
return c:IsSetCard(0x16) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() return c:IsSetCard(0x16) and c:GetCode()~=984114 and c:IsType(TYPE_MONSTER) and c:IsAbleToHand()
end end
function c984114.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c984114.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c984114.filter(chkc) end if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c984114.filter(chkc) 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