Commit 9010d12a authored by argon.sun's avatar argon.sun

fix

parent 79d60beb
......@@ -687,15 +687,15 @@ void card::enable_field_effect(int32 enabled) {
effect_container::iterator it;
for (it = single_effect.begin(); it != single_effect.end(); ++it) {
if ((it->second->flag & EFFECT_FLAG_SINGLE_RANGE) && (current.location & it->second->range))
it->second->id = pduel->game_field->infos.effect_id++;
it->second->id = pduel->game_field->infos.field_id++;
}
for (it = field_effect.begin(); it != field_effect.end(); ++it) {
if (current.location & it->second->range)
it->second->id = pduel->game_field->infos.effect_id++;
it->second->id = pduel->game_field->infos.field_id++;
}
if(current.location == LOCATION_SZONE) {
for (it = equip_effect.begin(); it != equip_effect.end(); ++it)
it->second->id = pduel->game_field->infos.effect_id++;
it->second->id = pduel->game_field->infos.field_id++;
}
} else
set_status(STATUS_EFFECT_ENABLED, FALSE);
......@@ -743,7 +743,7 @@ int32 card::add_effect(effect* peffect) {
check_target = 0;
} else
return 0;
peffect->id = pduel->game_field->infos.effect_id++;
peffect->id = pduel->game_field->infos.field_id++;
peffect->card_type = data.type;
if(get_status(STATUS_INITIALIZING))
peffect->flag |= EFFECT_FLAG_INITIAL;
......
......@@ -93,8 +93,8 @@ public:
uint8 announce_count;
uint8 attacked_count;
uint16 cardid;
uint16 fieldid;
uint16 fieldid_r;
uint32 fieldid;
uint32 fieldid_r;
uint16 turnid;
uint16 turn_counter;
card* equiping_target;
......
......@@ -107,7 +107,7 @@ int32 effect::is_available() {
int32 res = pduel->lua->check_condition(condition, 1);
if(res) {
if(!(status & EFFECT_STATUS_AVAILABLE))
id = pduel->game_field->infos.effect_id++;
id = pduel->game_field->infos.field_id++;
status |= EFFECT_STATUS_AVAILABLE;
} else
status &= ~EFFECT_STATUS_AVAILABLE;
......
......@@ -36,7 +36,7 @@ public:
uint32 description;
uint32 code;
uint32 flag;
uint16 id;
uint32 id;
uint16 type;
uint16 copy_id;
uint16 range;
......
......@@ -20,7 +20,6 @@ bool chain::chain_operation_sort(chain c1, chain c2) {
}
field::field(duel* pduel) {
this->pduel = pduel;
infos.effect_id = 1;
infos.copy_id = 1;
infos.turn_player = 0;
infos.turn_id = 0;
......@@ -626,7 +625,7 @@ void field::add_effect(effect* peffect, uint8 owner_player) {
peffect->flag |= EFFECT_FLAG_FIELD_ONLY;
peffect->handler = peffect->owner;
peffect->effect_owner = owner_player;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
}
peffect->card_type = peffect->owner->data.type;
effect_container::iterator it;
......@@ -1381,7 +1380,7 @@ int32 field::get_attack_target(card* pcard, card_vector* v, uint8 chain_attack)
pv = &player[1 - p].list_mzone;
for(cit = pv->begin(); cit != pv->end(); ++cit) {
atarget = *cit;
if(!atarget || pcard->announced_cards.count(atarget->fieldid))
if(!atarget || pcard->announced_cards.count(atarget->fieldid_r))
continue;
if(atarget->is_affected_by_effect(EFFECT_IGNORE_BATTLE_TARGET))
continue;
......
......@@ -102,10 +102,9 @@ struct field_effect {
std::set<card*, card_sort> disable_check_set;
};
struct field_info {
int16 effect_id;
int32 field_id;
int16 copy_id;
int16 turn_id;
int16 field_id;
int16 card_id;
uint8 phase;
uint8 turn_player;
......
......@@ -98,6 +98,7 @@ static const struct luaL_Reg cardlib[] = {
{ "GetOwnerTarget", scriptlib::card_get_owner_target },
{ "GetOwnerTargetCount", scriptlib::card_get_owner_target_count },
{ "GetActivateEffect", scriptlib::card_get_activate_effect },
{ "CheckActivateEffect", scriptlib::card_check_activate_effect },
{ "RegisterEffect", scriptlib::card_register_effect },
{ "IsHasEffect", scriptlib::card_is_has_effect },
{ "ResetEffect", scriptlib::card_reset_effect },
......@@ -193,6 +194,7 @@ static const struct luaL_Reg effectlib[] = {
{ "GlobalEffect", scriptlib::effect_newex },
{ "Clone", scriptlib::effect_clone },
{ "Reset", scriptlib::effect_reset },
{ "GetFieldID", scriptlib::effect_get_field_id },
{ "SetDescription", scriptlib::effect_set_description },
{ "SetCode", scriptlib::effect_set_code },
{ "SetRange", scriptlib::effect_set_range },
......
......@@ -397,6 +397,8 @@ int32 scriptlib::card_set_status(lua_State *L) {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
if(pcard->status & STATUS_COPYING_EFFECT)
return 0;
uint32 tstatus = lua_tointeger(L, 2);
int32 enable = lua_toboolean(L, 3);
pcard->set_status(tstatus, enable);
......@@ -699,9 +701,8 @@ int32 scriptlib::card_get_activate_effect(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
card::effect_container::iterator eit;
int32 count = 0;
for(eit = pcard->field_effect.begin(); eit != pcard->field_effect.end(); ++eit) {
for(auto eit = pcard->field_effect.begin(); eit != pcard->field_effect.end(); ++eit) {
if(eit->second->type & EFFECT_TYPE_ACTIVATE) {
interpreter::effect2value(L, eit->second);
count++;
......@@ -709,6 +710,15 @@ int32 scriptlib::card_get_activate_effect(lua_State *L) {
}
return count;
}
int32 scriptlib::card_check_activate_effect(lua_State *L) {
check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
int32 neglect_con = lua_toboolean(L, 2);
int32 neglect_cost = lua_toboolean(L, 3);
duel* pduel = pcard->pduel;
return 1;
}
int32 scriptlib::card_register_effect(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_CARD, 1);
......@@ -1223,7 +1233,7 @@ int32 scriptlib::card_is_chain_attackable(lua_State *L) {
card* attacker = pduel->game_field->core.attacker;
if(pduel->game_field->core.effect_damage_step
|| attacker->is_status(STATUS_BATTLE_DESTROYED)
|| attacker->fieldid != pduel->game_field->core.pre_field[0]
|| attacker->fieldid_r != pduel->game_field->core.pre_field[0]
|| !attacker->is_capable_attack_announce(pduel->game_field->infos.turn_player)
|| attacker->announce_count >= ac) {
lua_pushboolean(L, 0);
......
......@@ -990,11 +990,13 @@ int32 scriptlib::duel_change_attacker(lua_State *L) {
card* attacker = pduel->game_field->core.attacker;
card* attack_target = pduel->game_field->core.attack_target;
attacker->announce_count++;
if(attack_target)
attacker->announced_cards[attack_target->fieldid] = attack_target;
else
attacker->attacked_count++;
if(attack_target) {
attacker->announced_cards[attack_target->fieldid_r] = attack_target;
} else {
attacker->announced_cards[0] = 0;
pduel->game_field->core.attacker = target;
}
pduel->game_field->core.sub_attacker = target;
return 0;
}
int32 scriptlib::duel_replace_attacker(lua_State *L) {
......
......@@ -76,6 +76,13 @@ int32 scriptlib::effect_reset(lua_State *L) {
peffect->handler->remove_effect(peffect);
return 0;
}
int32 scriptlib::effect_get_field_id(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
lua_pushinteger(L, peffect->id);
return 1;
}
int32 scriptlib::effect_set_description(lua_State *L) {
check_param_count(L, 2);
check_param(L, PARAM_TYPE_EFFECT, 1);
......
......@@ -1244,7 +1244,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
tf_count++;
......@@ -1255,7 +1255,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
......@@ -1273,7 +1273,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
......@@ -1285,7 +1285,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
......@@ -1374,7 +1374,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
tf_count++;
......@@ -1385,7 +1385,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
core.select_chains.push_back(newchain);
to_count++;
......@@ -1403,7 +1403,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
......@@ -1415,7 +1415,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
peffect = pr.first->second;
if(!peffect->is_chainable(check_player) || !peffect->is_activateable(check_player, nil_event))
continue;
peffect->id = infos.effect_id++;
peffect->id = infos.field_id++;
newchain.triggering_effect = peffect;
if(check_hint_timing(peffect))
core.spe_effect[check_player]++;
......@@ -2763,15 +2763,22 @@ int32 field::process_battle_command(uint16 step) {
reset_phase(PHASE_DAMAGE);
return FALSE;
}
if(core.sub_attack_target != (card*)0xffffffff && (!core.sub_attack_target || core.sub_attack_target->current.location == LOCATION_MZONE)) {
if((core.sub_attacker && core.sub_attacker->is_position(POS_FACEUP) && core.sub_attacker->current.location == LOCATION_MZONE)
|| ((core.sub_attack_target != (card*)0xffffffff) && (!core.sub_attack_target || core.sub_attack_target->current.location == LOCATION_MZONE))) {
if(core.sub_attacker)
core.attacker = core.sub_attacker;
if(core.sub_attack_target != (card*)0xffffffff)
core.attack_target = core.sub_attack_target;
core.sub_attacker = 0;
core.sub_attack_target = (card*)0xffffffff;
core.attacker->announce_count++;
core.attacker->attacked_count++;
pduel->write_buffer8(MSG_ATTACK);
pduel->write_buffer32(core.attacker->get_info_location());
if(core.sub_attack_target) {
core.attacker->announced_cards[core.sub_attack_target->fieldid_r] = core.sub_attack_target;
core.attacker->attacked_cards[core.sub_attack_target->fieldid_r] = core.sub_attack_target;
pduel->write_buffer32(core.sub_attack_target->get_info_location());
if(core.attack_target) {
core.attacker->announced_cards[core.attack_target->fieldid_r] = core.attack_target;
core.attacker->attacked_cards[core.attack_target->fieldid_r] = core.attack_target;
pduel->write_buffer32(core.attack_target->get_info_location());
} else {
core.attacker->announced_cards[0] = 0;
core.attacker->attacked_cards[0] = 0;
......
......@@ -100,6 +100,7 @@ public:
static int32 card_get_owner_target(lua_State *L);
static int32 card_get_owner_target_count(lua_State *L);
static int32 card_get_activate_effect(lua_State *L);
static int32 card_check_activate_effect(lua_State *L);
static int32 card_register_effect(lua_State *L);
static int32 card_is_has_effect(lua_State *L);
static int32 card_reset_effect(lua_State *L);
......@@ -192,6 +193,7 @@ public:
static int32 effect_newex(lua_State *L);
static int32 effect_clone(lua_State *L);
static int32 effect_reset(lua_State *L);
static int32 effect_get_field_id(lua_State *L);
static int32 effect_set_description(lua_State *L);
static int32 effect_set_code(lua_State *L);
static int32 effect_set_range(lua_State *L);
......
--ミュータント·ハイブレイン
function c11508758.initial_effect(c)
--control
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(11508758,0))
e1:SetCategory(CATEGORY_CONTROL)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c11508758.ctlcon)
e1:SetTarget(c11508758.ctltg)
e1:SetOperation(c11508758.ctlop)
c:RegisterEffect(e1)
end
function c11508758.ctlcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttackTarget()~=nil
end
function c11508758.filter(c)
return c:IsPosition(POS_FACEUP_ATTACK) and c:IsControlerCanBeChanged()
end
function c11508758.ctltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc~=Duel.GetAttackTarget() and c87910978.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c11508758.filter,tp,0,LOCATION_MZONE,1,Duel.GetAttackTarget()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL)
local g=Duel.SelectTarget(tp,c11508758.filter,tp,0,LOCATION_MZONE,1,1,Duel.GetAttackTarget())
Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0)
end
function c11508758.ctlop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() then
if not Duel.GetControl(tc,tp,PHASE_BATTLE,1) then
if not tc:IsImmuneToEffect(e) and tc:IsAbleToChangeControler() then
Duel.Destroy(tc,REASON_EFFECT)
end
else
if tc:IsAttackPos() then
Duel.ChangeAttacker(tc)
end
end
end
end
--機動砦 ストロング·ホールド
function c13955608.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c13955608.target)
e1:SetOperation(c13955608.activate)
c:RegisterEffect(e1)
end
function c13955608.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and
Duel.IsPlayerCanSpecialSummonMonster(tp,13955608,0,0x21,0,2000,4,RACE_ROCK,ATTRIBUTE_EARTH) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c13955608.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0
or not Duel.IsPlayerCanSpecialSummonMonster(tp,13955608,0,0x21,0,2000,4,RACE_ROCK,ATTRIBUTE_EARTH) then return end
c:AddTrapMonsterAttribute(true,ATTRIBUTE_EARTH,RACE_ROCK,4,0,2000)
Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_DEFENCE)
c:TrapMonsterBlock()
--cannot attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetValue(3000)
e1:SetCondition(c13955608.atkcon)
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
end
function c13955608.atkcon(e)
local con=0
for i=0,4 do
local tc=Duel.GetFieldCard(e:GetHandlerPlayer(),LOCATION_MZONE,i)
if tc and tc:IsFaceup() then
local code=tc:GetCode()
if code==13839120 then con=bit.bor(con,1)
elseif code==86445415 then con=bit.bor(con,2)
elseif code==41172955 then con=bit.bor(con,4)
end
if con==7 then return true end
end
end
return false
end
--レアメタル·ドラゴン
function c25236056.initial_effect(c)
c:SetStatus(STATUS_UNSUMMONABLE_CARD,true)
end
--テュアラティン
function c27769400.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(27769400,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(c27769400.spcon)
e1:SetTarget(c27769400.sptg)
e1:SetOperation(c27769400.spop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(27769400,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCondition(c27769400.descon)
e2:SetTarget(c27769400.destg)
e2:SetOperation(c27769400.desop)
c:RegisterEffect(e2)
if not c27769400.global_check then
c27769400.global_check=true
c27769400[0]=Group.CreateGroup()
c27769400[0]:KeepAlive()
c27769400[1]=0
c27769400[2]=false
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_BATTLE)
ge1:SetOperation(c27769400.checkop1)
Duel.RegisterEffect(ge1,0)
end
end
function c27769400.checkop1(e,tp,eg,ep,ev,re,r,rp)
c27769400[0]:Clear()
c27769400[0]:Merge(Duel.GetFieldGroup(Duel.GetTurnPlayer(),0,LOCATION_MZONE))
c27769400[1]=c27769400[0]:GetCount()
c27769400[2]=false
end
function c27769400.spcon(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()==tp or c27769400[1]<2 or c27769400[0]:GetCount()==0 then return false end
local g=eg:Filter(Card.IsLocation,nil,LOCATION_GRAVE)
c27769400[0]:Sub(g)
return c27769400[0]:GetCount()==0
end
function c27769400.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.ConfirmCards(1-tp,e:GetHandler())
Duel.ShuffleHand(tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
end
function c27769400.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
end
end
function c27769400.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1
end
function c27769400.desfilter(c,att)
return c:IsFaceup() and c:IsAttribute(att)
end
function c27769400.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,563)
local rc=Duel.AnnounceAttribute(tp,1,0xff)
Duel.SetTargetParam(rc)
e:GetHandler():SetHint(CHINT_ATTRIBUTE,rc)
local g=Duel.GetMatchingGroup(c27769400.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,rc)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0)
end
function c27769400.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)
local g=Duel.GetMatchingGroup(c27769400.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,rc)
Duel.Destroy(g,REASON_EFFECT)
if c:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(0,1)
e1:SetTarget(c27769400.sumlimit)
e1:SetReset(RESET_EVENT+0x1fe0000)
e1:SetLabel(rc)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
c:RegisterEffect(e2)
end
end
function c27769400.sumlimit(e,c)
return c:IsAttribute(e:GetLabel())
end
--方舟の選別
function c30888983.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c30888983.condition)
e1:SetCost(c30888983.cost)
e1:SetTarget(c30888983.target)
e1:SetOperation(c30888983.activate)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_FLIP_SUMMON)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_SPSUMMON)
c:RegisterEffect(e3)
end
function c30888983.cfilter(c,rc)
return c:IsFaceup() and c:IsRace(rc)
end
function c30888983.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and Duel.IsExistingMatchingCard(c30888983.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,eg:GetFirst():GetRace())
end
function c30888983.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000)
else Duel.PayLPCost(tp,1000) end
end
function c30888983.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
function c30888983.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.NegateSummon(eg:GetFirst())
Duel.Destroy(eg,REASON_EFFECT)
end
......@@ -19,7 +19,7 @@ function c31692182.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c31692182.cfilter,tp,LOCATION_HAND,0,1,1,nil)
Duel.SendtoDeck(g,nil,0,REASON_COST)
end
function c31692182.filter(c)
function c31692182.filter(e,c)
return c:IsType(TYPE_EFFECT) and not c:IsSetCard(0x1d)
end
function c31692182.operation(e,tp,eg,ep,ev,re,r,rp)
......
--ダークビショップデーモン
function c33798491.initial_effect(c)
function c35798491.initial_effect(c)
--maintain
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -7,17 +7,17 @@ function c33798491.initial_effect(c)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetOperation(c33798491.mtop)
e1:SetOperation(c35798491.mtop)
c:RegisterEffect(e1)
--disable and destroy
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_CHAIN_SOLVING)
e2:SetRange(LOCATION_MZONE)
e2:SetOperation(c33798491.disop)
e2:SetOperation(c35798491.disop)
c:RegisterEffect(e2)
end
function c33798491.mtop(e,tp,eg,ep,ev,re,r,rp)
function c35798491.mtop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetTurnPlayer()~=tp then return end
if Duel.CheckLPCost(tp,500) then
Duel.PayLPCost(tp,500)
......@@ -25,14 +25,14 @@ function c33798491.mtop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetHandler(),REASON_RULE)
end
end
function c33798491.filter(c,tp)
function c35798491.filter(c,tp)
return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsSetCard()
end
function c33798491.disop(e,tp,eg,ep,ev,re,r,rp)
function c35798491.disop(e,tp,eg,ep,ev,re,r,rp)
if ep==tp then return end
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
if not tg or not tg:IsExists(c33798491.filter,1,nil,tp) or not Duel.IsChainDisablable(ev) then return false end
if not tg or not tg:IsExists(c35798491.filter,1,nil,tp) or not Duel.IsChainDisablable(ev) then return false end
local rc=re:GetHandler()
local dc=Duel.TossDice(tp,1)
if dc==1 or dc==3 or dc==6 then
......
--キャッスル·ゲート
function c36931229.initial_effect(c)
--battle indestructable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
c:RegisterEffect(e1)
--damage
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(36931229,0))
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(c36931229.condition)
e2:SetCost(c36931229.cost)
e2:SetTarget(c36931229.target)
e2:SetOperation(c36931229.operation)
c:RegisterEffect(e2)
end
function c36931229.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsAttackPos()
end
function c36931229.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(Card.IsLevelBelow,nil,1,nil,5) end
local sg=Duel.SelectReleaseGroup(tp,Card.IsLevelBelow,1,1,nil,5)
e:SetLabel(sg:GetFirst():GetBaseAttack())
Duel.Release(sg,REASON_COST)
end
function c36931229.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(e:GetLabel())
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,e:GetLabel())
end
function c36931229.operation(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
......@@ -25,7 +25,7 @@ function c43711255.initial_effect(c)
c:RegisterEffect(e3)
end
function c43711255.bantg(e,c)
return c:IsCode(e:GetLabelObject():GetLabel()) and (not c:IsOnField() or c:GetRealFieldID()>e:GetHandler():GetRealFieldID())
return c:IsCode(e:GetLabelObject():GetLabel()) and (not c:IsOnField() or c:GetRealFieldID()>e:GetFieldID())
end
function c43711255.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
--聖導騎士イシュザーク
function c57902462.initial_effect(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(57902462,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLED)
e1:SetCondition(c57902462.condition)
e1:SetTarget(c57902462.target)
e1:SetOperation(c57902462.operation)
c:RegisterEffect(e1)
end
function c57902462.condition(e,tp,eg,ep,ev,re,r,rp)
local bc=e:GetHandler():GetBattleTarget()
return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED)
end
function c57902462.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local bc=e:GetHandler():GetBattleTarget()
Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0)
end
function c57902462.operation(e,tp,eg,ep,ev,re,r,rp)
local bc=e:GetHandler():GetBattleTarget()
if bc:IsRelateToBattle() then
Duel.Remove(bc,POS_FACEUP,REASON_EFFECT)
end
end
--闇よりの罠
function c79766336.initial_effect(c)
--copy trap
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0x1e1,0x1e1)
e1:SetCondition(c79766336.condition)
e1:SetCost(c79766336.cost)
e1:SetTarget(c79766336.target)
e1:SetOperation(c79766336.operation)
c:RegisterEffect(e1)
end
function c79766336.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetLP(tp)<=3000
end
function c79766336.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
Duel.PayLPCost(tp,1000)
end
function c79766336.check_effect(ce,e,tp,eg,ep,ev,re,r,rp)
local ecode=ce:GetCode()
if ecode~=EVENT_FREE_CHAIN and not Duel.CheckEvent(ecode) then return false end
local con=ce:GetCondition()
if con and not con(e,tp,eg,ep,ev,re,r,rp) then return false end
local tg=ce:GetTarget()
if tg and not tg(e,tp,eg,ep,ev,re,r,rp,0) then return false end
return true
end
function c79766336.filter(c,e,tp,eg,ep,ev,re,r,rp)
if c:GetType()~=0x4 or c:IsCode(79766336) then return false end
local e1,e2,e3,e4,e5=c:GetActivateEffect()
if e1 and c79766336.check_effect(e1,e,tp,eg,ep,ev,re,r,rp) then return true
elseif e2 and c79766336.check_effect(e2,e,tp,eg,ep,ev,re,r,rp) then return true
elseif e3 and c79766336.check_effect(e3,e,tp,eg,ep,ev,re,r,rp) then return true
elseif e4 and c79766336.check_effect(e4,e,tp,eg,ep,ev,re,r,rp) then return true
elseif e5 and c79766336.check_effect(e5,e,tp,eg,ep,ev,re,r,rp) then return true
end
return false
end
function c79766336.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then
local te=e:GetLabelObject()
local tg=te:GetTarget()
return tg and tg(e,tp,eg,ep,ev,re,r,rp,1,true)
end
if chk==0 then return Duel.IsExistingTarget(c79766336.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,eg,ep,ev,re,r,rp) end
e:SetProperty(EFFECT_FLAG_CARD_TARGET)
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(79766336,0))
local g=Duel.SelectTarget(tp,c79766336.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp)
local e1,e2,e3,e4,e5=g:GetFirst():GetActivateEffect()
local se=nil
if e1 and c79766336.check_effect(e1,e,tp,eg,ep,ev,re,r,rp) then se=e1
elseif e2 and c79766336.check_effect(e2,e,tp,eg,ep,ev,re,r,rp) then se=e2
elseif e3 and c79766336.check_effect(e3,e,tp,eg,ep,ev,re,r,rp) then se=e3
elseif e4 and c79766336.check_effect(e4,e,tp,eg,ep,ev,re,r,rp) then se=e4
elseif e5 and c79766336.check_effect(e5,e,tp,eg,ep,ev,re,r,rp) then se=e5
end
e:SetLabelObject(se)
Duel.ClearTargetCard()
se:GetHandler():CreateEffectRelation(e)
local tg=se:GetTarget()
e:SetCategory(se:GetCategory())
e:SetProperty(se:GetProperty())
if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end
end
function c79766336.operation(e,tp,eg,ep,ev,re,r,rp)
local te=e:GetLabelObject()
if not te then return end
local op=te:GetOperation()
if op then op(e,tp,eg,ep,ev,re,r,rp) end
if te:GetHandler():IsRelateToEffect(e) then
Duel.Remove(te:GetHandler(),POS_FACEUP,REASON_EFFECT)
end
end
--無効
function c80862132.initial_effect(c)
function c80863132.initial_effect(c)
--change effect
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c80862132.condition)
e1:SetOperation(c80862132.activate)
e1:SetCondition(c80863132.condition)
e1:SetOperation(c80863132.activate)
c:RegisterEffect(e1)
end
function c80862132.condition(e,tp,eg,ep,ev,re,r,rp)
function c80863132.condition(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_PLAYER_TARGET) then return false end
if Duel.GetOperationCount(ev)~=1 then return false end
local ex,cg,cc,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DRAW)
return ex and cv>0
end
function c80862132.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeChainOperation(ev,c80862132.repop)
function c80863132.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.ChangeChainOperation(ev,c80863132.repop)
end
function c80862132.repop(e,tp,eg,ep,ev,re,r,rp)
function c80863132.repop(e,tp,eg,ep,ev,re,r,rp)
local ex,cg,cc,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DRAW)
if cp<2 then
Duel.DiscardDeck(cp,cv,REASON_EFFECT)
......
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