Commit a24a58cb authored by DailyShana's avatar DailyShana

Effect.IsActivated()

parent 5a5923e6
...@@ -1068,6 +1068,9 @@ int32 card::add_effect(effect* peffect) { ...@@ -1068,6 +1068,9 @@ int32 card::add_effect(effect* peffect) {
} }
indexer.insert(make_pair(peffect, it)); indexer.insert(make_pair(peffect, it));
peffect->handler = this; peffect->handler = this;
if((peffect->type & 0x7e0)
|| (pduel->game_field->core.reason_effect && (pduel->game_field->core.reason_effect->status & EFFECT_STATUS_ACTIVATED)))
peffect->status |= EFFECT_STATUS_ACTIVATED;
if (peffect->in_range(current.location, current.sequence) && (peffect->type & EFFECT_TYPE_FIELD)) if (peffect->in_range(current.location, current.sequence) && (peffect->type & EFFECT_TYPE_FIELD))
pduel->game_field->add_effect(peffect); pduel->game_field->add_effect(peffect);
if (current.controler != PLAYER_NONE && check_target) { if (current.controler != PLAYER_NONE && check_target) {
......
...@@ -90,6 +90,7 @@ public: ...@@ -90,6 +90,7 @@ public:
//status //status
#define EFFECT_STATUS_AVAILABLE 0x0001 #define EFFECT_STATUS_AVAILABLE 0x0001
#define EFFECT_STATUS_ACTIVATED 0x0002
#define EFFECT_COUNT_CODE_OATH 0x10000000 #define EFFECT_COUNT_CODE_OATH 0x10000000
#define EFFECT_COUNT_CODE_DUEL 0x20000000 #define EFFECT_COUNT_CODE_DUEL 0x20000000
......
...@@ -709,6 +709,9 @@ void field::add_effect(effect* peffect, uint8 owner_player) { ...@@ -709,6 +709,9 @@ void field::add_effect(effect* peffect, uint8 owner_player) {
peffect->effect_owner = owner_player; peffect->effect_owner = owner_player;
peffect->id = infos.field_id++; peffect->id = infos.field_id++;
} }
if((peffect->type & 0x7e0)
|| (core.reason_effect && (core.reason_effect->status & EFFECT_STATUS_ACTIVATED)))
peffect->status |= EFFECT_STATUS_ACTIVATED;
peffect->card_type = peffect->owner->data.type; peffect->card_type = peffect->owner->data.type;
effect_container::iterator it; effect_container::iterator it;
if (!(peffect->type & EFFECT_TYPE_ACTIONS)) { if (!(peffect->type & EFFECT_TYPE_ACTIONS)) {
......
...@@ -265,6 +265,7 @@ static const struct luaL_Reg effectlib[] = { ...@@ -265,6 +265,7 @@ static const struct luaL_Reg effectlib[] = {
{ "IsHasCategory", scriptlib::effect_is_has_category }, { "IsHasCategory", scriptlib::effect_is_has_category },
{ "IsHasType", scriptlib::effect_is_has_type }, { "IsHasType", scriptlib::effect_is_has_type },
{ "IsActivatable", scriptlib::effect_is_activatable }, { "IsActivatable", scriptlib::effect_is_activatable },
{ "IsActivated", scriptlib::effect_is_activated },
{ "GetActivateLocation", scriptlib::effect_get_activate_location }, { "GetActivateLocation", scriptlib::effect_get_activate_location },
{ NULL, NULL } { NULL, NULL }
}; };
......
...@@ -526,6 +526,13 @@ int32 scriptlib::effect_is_activatable(lua_State *L) { ...@@ -526,6 +526,13 @@ int32 scriptlib::effect_is_activatable(lua_State *L) {
lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event)); lua_pushboolean(L, peffect->is_activateable(playerid, peffect->pduel->game_field->nil_event));
return 1; return 1;
} }
int32 scriptlib::effect_is_activated(lua_State * L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
lua_pushboolean(L, (peffect->status & EFFECT_STATUS_ACTIVATED));
return 1;
}
int32 scriptlib::effect_get_activate_location(lua_State *L) { int32 scriptlib::effect_get_activate_location(lua_State *L) {
check_param_count(L, 1); check_param_count(L, 1);
......
...@@ -265,6 +265,7 @@ public: ...@@ -265,6 +265,7 @@ public:
static int32 effect_is_has_category(lua_State *L); static int32 effect_is_has_category(lua_State *L);
static int32 effect_is_has_type(lua_State *L); static int32 effect_is_has_type(lua_State *L);
static int32 effect_is_activatable(lua_State *L); static int32 effect_is_activatable(lua_State *L);
static int32 effect_is_activated(lua_State *L);
static int32 effect_get_activate_location(lua_State *L); static int32 effect_get_activate_location(lua_State *L);
//Group functions //Group functions
......
...@@ -38,7 +38,7 @@ function c15939229.sumsuc(e,tp,eg,ep,ev,re,r,rp) ...@@ -38,7 +38,7 @@ function c15939229.sumsuc(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD) e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetCode(EFFECT_CANNOT_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,1) e1:SetTargetRange(1,1)
e1:SetValue(c15939229.aclimit) e1:SetValue(c15939229.aclimit)
e1:SetReset(RESET_PHASE+PHASE_END) e1:SetReset(RESET_PHASE+PHASE_END)
...@@ -46,7 +46,6 @@ function c15939229.sumsuc(e,tp,eg,ep,ev,re,r,rp) ...@@ -46,7 +46,6 @@ function c15939229.sumsuc(e,tp,eg,ep,ev,re,r,rp)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_DISABLE) e2:SetCode(EFFECT_DISABLE)
e2:SetProperty(EFFECT_FLAG_CONTINUOUS)
e2:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD) e2:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD)
e2:SetTarget(c15939229.disable) e2:SetTarget(c15939229.disable)
e2:SetReset(RESET_PHASE+RESET_END) e2:SetReset(RESET_PHASE+RESET_END)
......
...@@ -246,7 +246,7 @@ EFFECT_FLAG_IGNORE_RANGE =0x0020 --影响所有区域的卡(禁止令 大宇 ...@@ -246,7 +246,7 @@ EFFECT_FLAG_IGNORE_RANGE =0x0020 --影响所有区域的卡(禁止令 大宇
EFFECT_FLAG_ABSOLUTE_TARGET =0x0040 --Target Range不会因为控制权的改变而改变 EFFECT_FLAG_ABSOLUTE_TARGET =0x0040 --Target Range不会因为控制权的改变而改变
EFFECT_FLAG_IGNORE_IMMUNE =0x0080 --无视效果免疫 EFFECT_FLAG_IGNORE_IMMUNE =0x0080 --无视效果免疫
EFFECT_FLAG_SET_AVAILABLE =0x0100 --影响场上里侧的卡/裡側狀態可發動 EFFECT_FLAG_SET_AVAILABLE =0x0100 --影响场上里侧的卡/裡側狀態可發動
EFFECT_FLAG_CONTINUOUS =0x0200 --由不入連鎖的效果產生的全局效果 EFFECT_FLAG_CONTINUOUS =0x0200 --N/A
EFFECT_FLAG_CANNOT_DISABLE =0x0400 --不会被无效 EFFECT_FLAG_CANNOT_DISABLE =0x0400 --不会被无效
EFFECT_FLAG_PLAYER_TARGET =0x0800 --以玩家为对象 EFFECT_FLAG_PLAYER_TARGET =0x0800 --以玩家为对象
EFFECT_FLAG_BOTH_SIDE =0x1000 --双方都能使用(部分场地,弹压) EFFECT_FLAG_BOTH_SIDE =0x1000 --双方都能使用(部分场地,弹压)
......
...@@ -1252,9 +1252,8 @@ function Auxiliary.damcon1(e,tp,eg,ep,ev,re,r,rp) ...@@ -1252,9 +1252,8 @@ function Auxiliary.damcon1(e,tp,eg,ep,ev,re,r,rp)
end end
--filter for the immune effetc of qli monsters --filter for the immune effetc of qli monsters
function Auxiliary.qlifilter(e,te) function Auxiliary.qlifilter(e,te)
if te:IsActiveType(TYPE_MONSTER) if te:IsActiveType(TYPE_MONSTER)
and (te:IsHasType(0x7e0) or (te:IsHasProperty(EFFECT_FLAG_FIELD_ONLY) and not te:IsHasProperty(EFFECT_FLAG_CONTINUOUS)) and (te:IsActivated() or te:IsHasProperty(EFFECT_FLAG_OWNER_RELATE)) then
or te:IsHasProperty(EFFECT_FLAG_OWNER_RELATE)) then
local lv=e:GetHandler():GetLevel() local lv=e:GetHandler():GetLevel()
local ec=te:GetOwner() local ec=te:GetOwner()
if ec:IsType(TYPE_XYZ) then if ec:IsType(TYPE_XYZ) then
......
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