Commit 8774c043 authored by VanillaSalt's avatar VanillaSalt

fix

parent 11f110f7
......@@ -545,6 +545,8 @@ void Game::MainLoop() {
driver->endScene();
if(closeSignal.Wait(0))
CloseDuelWindow();
if(!device->isWindowActive())
ignore_chain = false;
fps++;
cur_time = timer->getTime();
if(cur_time < fps * 17 - 20)
......
......@@ -224,6 +224,18 @@ uint32 card::get_code() {
}
return code;
}
uint32 card::get_another_code() {
effect_set eset;
filter_effect(EFFECT_ADD_CODE, &eset);
if(!eset.count)
return 0;
uint32 otcode = eset.get_last()->get_value(this);
if(get_code() != otcode)
return otcode;
if(data.alias == otcode)
return data.code;
return 0;
}
int32 card::is_set_card(uint32 set_code) {
uint32 code = get_code();
uint32 setcode;
......
......@@ -132,6 +132,7 @@ public:
uint32 get_infos(byte* buf, int32 query_flag, int32 use_cache = TRUE);
uint32 get_info_location();
uint32 get_code();
uint32 get_another_code();
int32 is_set_card(uint32 set_code);
uint32 get_type();
int32 get_base_attack(uint8 swap = FALSE);
......
......@@ -262,6 +262,7 @@ public:
#define EFFECT_REVERSE_UPDATE 108 //
#define EFFECT_SWAP_AD 109 //
#define EFFECT_SWAP_BASE_AD 110 //
#define EFFECT_ADD_CODE 113 //
#define EFFECT_CHANGE_CODE 114 //
#define EFFECT_ADD_TYPE 115 //
#define EFFECT_REMOVE_TYPE 116 //
......
......@@ -1584,6 +1584,9 @@ int32 field::is_player_can_discard_deck_as_cost(uint8 playerid, int32 count) {
effect_set eset;
filter_field_effect(EFFECT_TO_GRAVE_REDIRECT, &eset);
for(int32 i = 0; i < eset.count; ++i) {
uint32 redirect = eset[i]->get_value();
if((redirect & LOCATION_REMOVED) && player[playerid].list_main.back()->is_affected_by_effect(EFFECT_CANNOT_REMOVE))
continue;
uint8 p = eset[i]->get_handler_player();
if((eset[i]->flag & EFFECT_FLAG_IGNORE_RANGE) || (p == playerid && eset[i]->s_range & LOCATION_DECK) || (p != playerid && eset[i]->o_range & LOCATION_DECK))
return FALSE;
......@@ -1653,6 +1656,15 @@ int32 field::is_player_can_sset(uint8 playerid, card * pcard) {
}
return TRUE;
}
int32 field::is_player_can_spsummon(uint8 playerid) {
effect_set eset;
filter_player_effect(playerid, EFFECT_CANNOT_SPECIAL_SUMMON, &eset);
for(int32 i = 0; i < eset.count; ++i) {
if(!eset[i]->target)
return FALSE;
}
return TRUE;
}
int32 field::is_player_can_spsummon(effect * peffect, uint32 sumtype, uint8 sumpos, uint8 playerid, uint8 toplayer, card * pcard) {
effect_set eset;
sumtype |= SUMMON_TYPE_SPECIAL;
......
......@@ -363,6 +363,7 @@ public:
int32 is_player_can_summon(uint32 sumtype, uint8 playerid, card* pcard);
int32 is_player_can_mset(uint32 sumtype, uint8 playerid, card* pcard);
int32 is_player_can_sset(uint8 playerid, card* pcard);
int32 is_player_can_spsummon(uint8 playerid);
int32 is_player_can_spsummon(effect* peffect, uint32 sumtype, uint8 sumpos, uint8 playerid, uint8 toplayer, card* pcard);
int32 is_player_can_flipsummon(uint8 playerid, card* pcard);
int32 is_player_can_spsummon_monster(uint8 playerid, uint8 toplayer, uint8 sumpos, card_data* pdata);
......
......@@ -18,6 +18,11 @@ int32 scriptlib::card_get_code(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
lua_pushinteger(L, pcard->get_code());
uint32 otcode = pcard->get_another_code();
if(otcode) {
lua_pushinteger(L, otcode);
return 2;
}
return 1;
}
int32 scriptlib::card_get_origin_code(lua_State *L) {
......@@ -387,7 +392,7 @@ int32 scriptlib::card_is_code(lua_State *L) {
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
uint32 tcode = lua_tointeger(L, 2);
if(pcard->get_code() == tcode)
if(pcard->get_code() == tcode || pcard->get_another_code() == tcode)
lua_pushboolean(L, 1);
else
lua_pushboolean(L, 0);
......
......@@ -2694,19 +2694,24 @@ int32 scriptlib::duel_is_player_can_summon(lua_State * L) {
return 1;
}
int32 scriptlib::duel_is_player_can_spsummon(lua_State * L) {
check_param_count(L, 4);
check_param_count(L, 1);
int32 playerid = lua_tointeger(L, 1);
int32 sumtype = lua_tointeger(L, 2);
int32 sumpos = lua_tointeger(L, 3);
int32 toplayer = lua_tointeger(L, 4);
check_param(L, PARAM_TYPE_CARD, 5);
card* pcard = *(card**) lua_touserdata(L, 5);
if(playerid != 0 && playerid != 1) {
lua_pushboolean(L, 0);
return 1;
}
duel* pduel = interpreter::get_duel_info(L);
lua_pushboolean(L, pduel->game_field->is_player_can_spsummon(pduel->game_field->core.reason_effect, sumtype, sumpos, playerid, toplayer, pcard));
if(lua_gettop(L) == 1)
lua_pushboolean(L, pduel->game_field->is_player_can_spsummon(playerid));
else {
check_param_count(L, 5);
check_param(L, PARAM_TYPE_CARD, 5);
int32 sumtype = lua_tointeger(L, 2);
int32 sumpos = lua_tointeger(L, 3);
int32 toplayer = lua_tointeger(L, 4);
card* pcard = *(card**) lua_touserdata(L, 5);
lua_pushboolean(L, pduel->game_field->is_player_can_spsummon(pduel->game_field->core.reason_effect, sumtype, sumpos, playerid, toplayer, pcard));
}
return 1;
}
int32 scriptlib::duel_is_player_can_flipsummon(lua_State * L) {
......
......@@ -2887,6 +2887,8 @@ int32 field::process_battle_command(uint16 step) {
case 9: {
if(returns.ivalue[0])
core.units.begin()->step = 7;
else
adjust_all();
return FALSE;
}
case 10: {
......@@ -2947,6 +2949,7 @@ int32 field::process_battle_command(uint16 step) {
}
core.units.begin()->step = -1;
reset_phase(PHASE_DAMAGE);
adjust_all();
return FALSE;
}
if((core.sub_attacker && core.sub_attacker->is_position(POS_FACEUP) && core.sub_attacker->current.location == LOCATION_MZONE)
......
......@@ -18,6 +18,13 @@ function c13857930.initial_effect(c)
e3:SetTarget(c13857930.target)
e3:SetOperation(c13857930.activate)
c:RegisterEffect(e3)
--add code
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(EFFECT_ADD_CODE)
e4:SetValue(17732278)
c:RegisterEffect(e4)
end
function c13857930.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler()==Duel.GetAttacker() or e:GetHandler()==Duel.GetAttackTarget()
......
......@@ -11,12 +11,12 @@ function c1539051.initial_effect(c)
c:RegisterEffect(e1)
end
function c1539051.gfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1f) and c:IsType(TYPE_MONSTER)
return c:IsFaceup() and c:IsSetCard(0x1f)
end
function c1539051.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(c1539051.gfilter,tp,LOCATION_MZONE,0,nil)
local ct=g:GetClassCount(Card.GetCode)
local ct=c1539051.count_unique_code(g)
e:SetLabel(ct)
return ct>0 and Duel.IsPlayerCanDraw(tp,ct)
end
......@@ -27,6 +27,21 @@ end
function c1539051.activate(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local g=Duel.GetMatchingGroup(c1539051.gfilter,tp,LOCATION_MZONE,0,nil)
local ct=g:GetClassCount(Card.GetCode)
local ct=c1539051.count_unique_code(g)
Duel.Draw(p,ct,REASON_EFFECT)
end
function c1539051.count_unique_code(g)
local check={}
local count=0
local tc=g:GetFirst()
while tc do
for i,code in ipairs({tc:GetCode()}) do
if not check[code] then
check[code]=true
count=count+1
end
end
tc=g:GetNext()
end
return count
end
......@@ -29,6 +29,6 @@ function c16135253.operation(e,tp,eg,ep,ev,re,r,rp)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(16135253,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_ATTACK)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
......@@ -26,9 +26,9 @@ function c16556849.filter(c,atk)
end
function c16556849.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and c16556849.filter(chkc,e:GetHandler():GetAttack()) end
if chk==0 then return Duel.IsExistingTarget(c16556849.filter,tp,0,LOCATION_MZONE,1,nil,e:GetHandler():GetAttack()) end
if chk==0 then return Duel.IsExistingTarget(c16556849.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e:GetHandler():GetAttack()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,c16556849.filter,tp,0,LOCATION_MZONE,1,1,nil,e:GetHandler():GetAttack())
local g=Duel.SelectTarget(tp,c16556849.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,e:GetHandler():GetAttack())
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c16556849.op(e,tp,eg,ep,ev,re,r,rp)
......
......@@ -5,6 +5,7 @@ function c20858318.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c20858318.con)
e1:SetTarget(c20858318.tg)
e1:SetOperation(c20858318.op)
c:RegisterEffect(e1)
end
......@@ -18,11 +19,13 @@ function c20858318.con(e,tp,eg,ep,ev,re,r,rp)
and Duel.IsExistingMatchingCard(c20858318.cfilter,tp,LOCATION_MZONE,0,1,nil,48768179)
and Duel.IsExistingMatchingCard(c20858318.cfilter,tp,LOCATION_MZONE,0,1,nil,74153887)
end
function c20858318.filter(c)
return c:IsFaceup() and c:IsSetCard(0x1a)
function c20858318.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
Duel.SetTargetCard(g)
end
function c20858318.op(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c20858318.filter,tp,LOCATION_MZONE,0,nil)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
local tc=g:GetFirst()
while tc do
tc:RegisterFlagEffect(20858318,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
......@@ -41,7 +44,7 @@ function c20858318.op(e,tp,eg,ep,ev,re,r,rp)
e2:SetCondition(c20858318.rdcon)
e2:SetOperation(c20858318.rdop)
e2:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e2,tp)
Duel.RegisterEffect(e2,tp)
end
function c20858318.affected(e,c)
return c:GetFlagEffect(20858318)~=0
......
--ライフ·ストリーム·ドラゴン
function c25165047.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.FilterBoolFunction(Card.IsCode,2403771),1)
aux.AddSynchroProcedure2(c,nil,aux.FilterBoolFunction(Card.IsCode,2403771))
c:EnableReviveLimit()
--change lp
local e1=Effect.CreateEffect(c)
......
......@@ -25,7 +25,7 @@ function c27770341.initial_effect(c)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e4:SetCode(EVENT_DISCARD)
e4:SetOperation(c27770341.addcount1)
e4:SetOperation(c27770341.addcount)
Duel.RegisterEffect(e4,0)
end
end
......@@ -34,19 +34,15 @@ function c27770341.resetcount(e,tp,eg,ep,ev,re,r,rp)
c27770341[1]=0
end
function c27770341.addcount(e,tp,eg,ep,ev,re,r,rp)
local c=eg:GetFirst()
while c~=nil do
local p=c:GetControler()
if c:GetPreviousRaceOnField()==RACE_DRAGON then c27770341[p]=c27770341[p]+1 end
c=eg:GetNext()
end
end
function c27770341.addcount1(e,tp,eg,ep,ev,re,r,rp)
local c=eg:GetFirst()
while c~=nil do
local p=c:GetControler()
if c:GetOriginalRace()==RACE_DRAGON then c27770341[p]=c27770341[p]+1 end
c=eg:GetNext()
local tc=eg:GetFirst()
while tc do
local p=tc:GetReasonPlayer()
local pl=tc:GetPreviousLocation()
if (pl==LOCATION_MZONE and tc:GetPreviousRaceOnField()==RACE_DRAGON)
or (pl==LOCATION_HAND and tc:GetOriginalRace()==RACE_DRAGON) then
c27770341[p]=c27770341[p]+1
end
tc=eg:GetNext()
end
end
function c27770341.activate(e,tp,eg,ep,ev,re,r,rp)
......
--焔紫竜ピュラリス
function c37038993.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
aux.AddSynchroProcedure2(c,nil,aux.NonTuner(nil))
c:EnableReviveLimit()
--synchro summon success
local e1=Effect.CreateEffect(c)
......
......@@ -4,12 +4,16 @@ function c43040603.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c43040603.condition)
e1:SetCost(c43040603.cost)
e1:SetTarget(c43040603.target)
e1:SetOperation(c43040603.operation)
c:RegisterEffect(e1)
end
function c43040603.filter(c,e,tp)
function c43040603.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerCanSpecialSummon(tp)
end
function c43040603.filter(c)
return c:IsSummonableCard()
end
function c43040603.cost(e,tp,eg,ep,ev,re,r,rp,chk)
......@@ -19,7 +23,7 @@ function c43040603.cost(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c43040603.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(c43040603.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
and Duel.IsExistingMatchingCard(c43040603.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK)
end
function c43040603.operation(e,tp,eg,ep,ev,re,r,rp)
......
--フォーミュラ·シンクロン
function c50091196.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
aux.AddSynchroProcedure2(c,nil,aux.NonTuner(nil))
c:EnableReviveLimit()
--synchro summon success
local e1=Effect.CreateEffect(c)
......
......@@ -46,20 +46,21 @@ function c54704216.operation(e,tp,eg,ep,ev,re,r,rp)
c:CreateRelation(tc,RESET_EVENT+0x1fe0000)
e:GetLabelObject():SetLabelObject(tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_OWNER_RELATE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_SZONE)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESET_EVENT+0x1fc0000)
e1:SetCondition(c54704216.rcon)
tc:RegisterEffect(e1,true)
e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e1:SetTarget(c54704216.efftg)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
tc:RegisterEffect(e2,true)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
c:RegisterEffect(e2)
end
end
function c54704216.rcon(e)
return e:GetOwner():IsRelateToCard(e:GetHandler())
function c54704216.efftg(e,c)
return e:GetHandler():IsRelateToCard(c)
end
function c54704216.descon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -20,7 +20,7 @@ end
function c5818294.negcon(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return g and g:IsExists(c5818294.tfilter,1,nil,tp)
return g and g:IsExists(c5818294.tfilter,1,nil,tp) and Duel.IsChainDisablable(ev)
end
function c5818294.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end
......
......@@ -4,16 +4,20 @@ function c58577036.initial_effect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(c58577036.condition)
e1:SetTarget(c58577036.target)
e1:SetOperation(c58577036.operation)
c:RegisterEffect(e1)
end
function c58577036.filter(c,e,tp)
function c58577036.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerCanSpecialSummon(tp)
end
function c58577036.filter(c)
return c:IsSummonableCard()
end
function c58577036.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(c58577036.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
and Duel.IsExistingMatchingCard(c58577036.filter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK)
end
function c58577036.operation(e,tp,eg,ep,ev,re,r,rp)
......
--TG レシプロ·ドラゴン·フライ
function c62560742.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1)
aux.AddSynchroProcedure2(c,nil,aux.NonTuner(nil))
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
......
......@@ -13,17 +13,16 @@ function c62701967.initial_effect(c)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(62701967,0))
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetRange(LOCATION_MZONE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLE_DESTROYING)
e2:SetLabel(300)
e2:SetCondition(c62701967.atkcon)
e2:SetOperation(c62701967.operation)
c:RegisterEffect(e2)
end
function c62701967.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,nil,RACE_DINOSAUR) end
local sg=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,nil,RACE_DINOSAUR)
if chk==0 then return Duel.CheckReleaseGroup(tp,Card.IsRace,1,e:GetHandler(),RACE_DINOSAUR) end
local sg=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,e:GetHandler(),RACE_DINOSAUR)
Duel.Release(sg,REASON_COST)
end
function c62701967.operation(e,tp,eg,ep,ev,re,r,rp)
......@@ -38,7 +37,8 @@ function c62701967.operation(e,tp,eg,ep,ev,re,r,rp)
end
end
function c62701967.atkcon(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
return eg:GetCount()==1 and tc:GetReasonCard()==e:GetHandler()
and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return c:IsFaceup() and c:IsRelateToBattle()
and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE) and bc:IsType(TYPE_MONSTER)
end
......@@ -31,8 +31,8 @@ end
function c63583431.cfilter(c)
return c:IsFaceup() and c:IsSetCard(0x59)
end
function c63583431.damcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c63583431.cfilter,tp,LOCATION_MZONE,0,2,nil)
function c63583431.damcon(e)
return Duel.IsExistingMatchingCard(c63583431.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,2,nil)
end
function c63583431.damval(e,re,val,r,rp,rc)
if bit.band(r,REASON_EFFECT)~=0 then return 0 end
......
......@@ -19,7 +19,7 @@ function c70630741.initial_effect(c)
end
function c70630741.condition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE)
return not c:IsLocation(LOCATION_DECK) and c:IsReason(REASON_BATTLE)
end
function c70630741.filter(c,tp)
return c:IsFaceup() and c:GetOwner()==tp and c:IsControlerCanBeChanged()
......
--神海竜ギシルノドン
function c76891401.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(c76891401.synfilter),1)
aux.AddSynchroProcedure2(c,nil,aux.NonTuner(c76891401.synfilter))
c:EnableReviveLimit()
--atk change
local e1=Effect.CreateEffect(c)
......
......@@ -17,6 +17,13 @@ function c78734254.initial_effect(c)
e2:SetTarget(c78734254.target)
e2:SetOperation(c78734254.activate)
c:RegisterEffect(e2)
--add code
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e4:SetCode(EFFECT_ADD_CODE)
e4:SetValue(17955766)
c:RegisterEffect(e4)
end
function c78734254.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
......
--μϪ
--異界の棘紫獣
function c80208323.initial_effect(c)
--special summon
local e1=Effect.CreateEffect(c)
......@@ -18,7 +18,7 @@ function c80208323.spfilter(c,tp)
return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:GetPreviousControler()==tp and c:IsType(TYPE_MONSTER)
end
function c80208323.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c80208323.spfilter,1,nil,tp)
return not eg:IsContains(e:GetHandler()) and eg:IsExists(c80208323.spfilter,1,nil,tp)
end
function c80208323.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,80208323)==0 end
......
......@@ -18,7 +18,7 @@ end
function c80368942.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(c80368942.gfilter,tp,LOCATION_GRAVE,0,nil)
local ct=g:GetClassCount(Card.GetOriginalCode)
local ct=c80368942.count_unique_code(g)
e:SetLabel(ct)
return ct>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>=ct
and Duel.IsExistingMatchingCard(c80368942.spfilter,tp,LOCATION_DECK,0,ct,nil,e,tp)
......@@ -27,7 +27,7 @@ function c80368942.target(e,tp,eg,ep,ev,re,r,rp,chk)
end
function c80368942.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c80368942.gfilter,tp,LOCATION_GRAVE,0,nil)
local ct=g:GetClassCount(Card.GetOriginalCode)
local ct=c80368942.count_unique_code(g)
if ct==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<ct then return end
local sg=Duel.GetMatchingGroup(c80368942.spfilter,tp,LOCATION_DECK,0,nil,e,tp)
if sg:GetCount()<ct then return end
......@@ -35,3 +35,18 @@ function c80368942.activate(e,tp,eg,ep,ev,re,r,rp)
local spg=sg:Select(tp,ct,ct,nil)
Duel.SpecialSummon(spg,0,tp,tp,false,false,POS_FACEUP)
end
function c80368942.count_unique_code(g)
local check={}
local count=0
local tc=g:GetFirst()
while tc do
for i,code in ipairs({tc:GetCode()}) do
if not check[code] then
check[code]=true
count=count+1
end
end
tc=g:GetNext()
end
return count
end
--Sin パラドクス·ドラゴン
function c8310162.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsCode,74509280),aux.NonTuner(Card.IsSetCard,0x23),1)
aux.AddSynchroProcedure2(c,aux.FilterBoolFunction(Card.IsCode,74509280),aux.NonTuner(Card.IsSetCard,0x23))
c:EnableReviveLimit()
c:SetUniqueOnField(1,1,8310162)
--special summon
......
......@@ -14,7 +14,7 @@ function c87043568.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c87043568.operation(e,tp,eg,ep,ev,re,r,rp)
......@@ -55,7 +55,9 @@ function c87043568.eqlimit(e,c)
end
function c87043568.atkcon(e,tp,eg,ep,ev,re,r,rp)
local a=Duel.GetAttacker()
local ph=Duel.GetCurrentPhase()
return a==e:GetHandler():GetEquipTarget()
and (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and not Duel.IsDamageCalculated()
end
function c87043568.cfilter(c)
return c:IsType(TYPE_MONSTER) and c:IsAttackBelow(1000) and c:IsAbleToGraveAsCost()
......
......@@ -32,7 +32,9 @@ function c88289295.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
end
function c88289295.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not Duel.GetControl(tc,tp,PHASE_END,1) then
local ct=1
if Duel.GetTurnPlayer()~=tp then ct=2 end
if tc:IsFaceup() and tc:IsRelateToEffect(e) and not Duel.GetControl(tc,tp,PHASE_END,ct) then
if not tc:IsImmuneToEffect(e) and tc:IsAbleToChangeControler() then
Duel.Destroy(tc,REASON_EFFECT)
end
......
......@@ -46,18 +46,18 @@ function c88341502.activate(e,tp,eg,ep,ev,re,r,rp)
e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetLabelObject(tc)
Duel.RegisterEffect(e3,tp)
tc:RegisterFlagEffect(88341502,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,1)
tc:RegisterFlagEffect(88341502,RESET_EVENT+0x1020000+RESET_PHASE+PHASE_END,0,1)
end
end
function c88341502.damcon(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
local tc=e:GetLabelObject()
local bc=tc:GetBattleTarget()
return tc==e:GetLabelObject() and tc:IsRelateToBattle() and tc:GetFlagEffect(88341502)~=0
return eg:IsContains(tc) and tc:GetFlagEffect(88341502)~=0
and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE)
end
function c88341502.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local def=eg:GetFirst():GetBattleTarget():GetBaseDefence()
local def=e:GetLabelObject():GetBattleTarget():GetBaseDefence()
if def<0 then def=0 end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(def)
......
......@@ -352,6 +352,7 @@ EFFECT_SET_BASE_DEFENCE =107 --
EFFECT_REVERSE_UPDATE =108 --
EFFECT_SWAP_AD =109 --
EFFECT_SWAP_BASE_AD =110 --
EFFECT_ADD_CODE =113 --
EFFECT_CHANGE_CODE =114 --
EFFECT_ADD_TYPE =115 --
EFFECT_REMOVE_TYPE =116 --
......
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