Commit 054ce617 authored by argon.sun's avatar argon.sun

new

parent dc4752e2
...@@ -185,6 +185,7 @@ static const struct luaL_Reg cardlib[] = { ...@@ -185,6 +185,7 @@ static const struct luaL_Reg cardlib[] = {
{ "CancelToGrave", scriptlib::card_cancel_to_grave }, { "CancelToGrave", scriptlib::card_cancel_to_grave },
{ "GetTributeRequirement", scriptlib::card_get_tribute_requirement }, { "GetTributeRequirement", scriptlib::card_get_tribute_requirement },
{ "GetBattleTarget", scriptlib::card_get_battle_target }, { "GetBattleTarget", scriptlib::card_get_battle_target },
{ "GetAttackableTarget", scriptlib::card_get_attackable_target },
{ "SetHint", scriptlib::card_set_hint }, { "SetHint", scriptlib::card_set_hint },
{ NULL, NULL } { NULL, NULL }
}; };
......
...@@ -1798,6 +1798,20 @@ int32 scriptlib::card_get_battle_target(lua_State *L) { ...@@ -1798,6 +1798,20 @@ int32 scriptlib::card_get_battle_target(lua_State *L) {
else lua_pushnil(L); else lua_pushnil(L);
return 1; return 1;
} }
int32 scriptlib::card_get_attackable_target(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_CARD, 1);
card* pcard = *(card**) lua_touserdata(L, 1);
duel* pduel = pcard->pduel;
field::card_vector targets;
pduel->game_field->get_attack_target(pcard, &targets);
group* newgroup = pduel->new_group();
for(auto cit = targets.begin(); cit != targets.end(); ++cit)
newgroup->container.insert(*cit);
interpreter::group2value(L, newgroup);
lua_pushboolean(L, pcard->operation_param);
return 2;
}
int32 scriptlib::card_set_hint(lua_State *L) { int32 scriptlib::card_set_hint(lua_State *L) {
check_param_count(L, 3); check_param_count(L, 3);
check_param(L, PARAM_TYPE_CARD, 1); check_param(L, PARAM_TYPE_CARD, 1);
......
...@@ -187,6 +187,7 @@ public: ...@@ -187,6 +187,7 @@ public:
static int32 card_cancel_to_grave(lua_State *L); static int32 card_cancel_to_grave(lua_State *L);
static int32 card_get_tribute_requirement(lua_State *L); static int32 card_get_tribute_requirement(lua_State *L);
static int32 card_get_battle_target(lua_State *L); static int32 card_get_battle_target(lua_State *L);
static int32 card_get_attackable_target(lua_State *L);
static int32 card_set_hint(lua_State *L); static int32 card_set_hint(lua_State *L);
//Effect functions //Effect functions
static int32 effect_new(lua_State *L); static int32 effect_new(lua_State *L);
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
function c1149109.initial_effect(c) function c1149109.initial_effect(c)
--Activate --Activate
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN) e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c1149109.target) e1:SetTarget(c1149109.target)
......
--絶対魔法禁止区域
function c20065549.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(c20065549.etarget)
e2:SetValue(c20065549.efilter)
c:RegisterEffect(e2)
end
function c20065549.etarget(e,c)
return not c:IsType(TYPE_EFFECT)
end
function c20065549.efilter(e,re)
return re:IsActiveType(TYPE_SPELL)
end
...@@ -3,7 +3,6 @@ function c29654737.initial_effect(c) ...@@ -3,7 +3,6 @@ function c29654737.initial_effect(c)
--get card --get card
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(29654737,0)) e1:SetDescription(aux.Stringid(29654737,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCode(EVENT_BATTLE_DESTROYED)
e1:SetCondition(c29654737.condition) e1:SetCondition(c29654737.condition)
......
--ワーム·テンタクルス --ワーム·テンタクルス
function c30299166.initial_effect(c) function c30299166.initial_effect(c)
--special summon --multi atk
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(30299166,0)) e1:SetDescription(aux.Stringid(30299166,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION) e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE) e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1) e1:SetCountLimit(1)
......
--ナイルの恵み
function c30653113.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--recover
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(30653113,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCategory(CATEGORY_RECOVER)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetRange(LOCATION_SZONE)
e2:SetCondition(c30653113.condition)
e2:SetTarget(c30653113.target)
e2:SetOperation(c30653113.operation)
c:RegisterEffect(e2)
end
function c30653113.cfilter(c,tp)
return c:IsPreviousLocation(LOCATION_HAND) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and c:IsReason(REASON_DISCARD)
end
function c30653113.condition(e,tp,eg,ep,ev,re,r,rp)
return rp~=tp and eg:IsExists(c30653113.cfilter,1,nil,tp)
end
function c30653113.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsRelateToEffect(e) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1000)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1000)
end
function c30653113.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
--砂塵の結界
function c31476755.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c31476755.target)
c:RegisterEffect(e1)
--immune
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e2:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_NORMAL))
e2:SetValue(c31476755.efilter)
c:RegisterEffect(e2)
end
function c31476755.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local c=e:GetHandler()
c:SetTurnCounter(0)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EVENT_PHASE+PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_SZONE)
e1:SetOperation(c31476755.desop)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_STANDBY+RESET_SELF_TURN,2)
c:RegisterEffect(e1)
end
function c31476755.desop(e,tp,eg,ep,ev,re,r,rp)
if tp~=Duel.GetTurnPlayer() then return end
local c=e:GetHandler()
local ct=c:GetTurnCounter()
ct=ct+1
c:SetTurnCounter(ct)
if ct==2 then
Duel.Destroy(c,REASON_EFFECT)
end
end
function c31476755.efilter(e,re)
return e:GetHandlerPlayer()~=re:GetHandlerPlayer() and re:IsActiveType(TYPE_SPELL)
end
...@@ -5,7 +5,7 @@ function c39672388.initial_effect(c) ...@@ -5,7 +5,7 @@ function c39672388.initial_effect(c)
e1:SetDescription(aux.Stringid(39672388,0)) e1:SetDescription(aux.Stringid(39672388,0))
e1:SetCategory(CATEGORY_DESTROY) e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c39672388.lvcon) e1:SetCondition(c39672388.lvcon)
e1:SetTarget(c39672388.lvtg) e1:SetTarget(c39672388.lvtg)
......
--魂喰らいの魔刀
function c5371656.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(c5371656.target)
e1:SetOperation(c5371656.operation)
c:RegisterEffect(e1)
--Equip limit
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_EQUIP_LIMIT)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetValue(c5371656.eqlimit)
c:RegisterEffect(e2)
end
function c5371656.eqlimit(e,c)
return c:IsType(TYPE_NORMAL) and c:IsLevelBelow(3)
end
function c5371656.filter(c)
return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsLevelBelow(3)
end
function c5371656.rfilter(c)
local tpe=c:GetType()
return bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0 and c:IsReleasable()
end
function c5371656.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c5371656.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(c5371656.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectTarget(tp,c5371656.filter,tp,LOCATION_MZONE,0,1,1,nil)
local rg=Duel.GetMatchingGroup(c5371656.rfilter,tp,LOCATION_MZONE,0,g:GetFirst())
Duel.Release(rg,REASON_COST)
e:SetLabel(rg:GetCount()*1000)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
end
function c5371656.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
Duel.Equip(tp,e:GetHandler(),tc)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(e:GetLabel())
e1:SetReset(RESET_EVENT+0x1fe0000)
c:RegisterEffect(e1)
end
end
--地縛霊の誘い
function c65743242.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(c65743242.condition)
e1:SetTarget(c65743242.target)
e1:SetOperation(c65743242.activate)
c:RegisterEffect(e1)
end
function c65743242.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=Duel.GetTurnPlayer()
end
function c65743242.filter(c,e)
return c:IsCanBeEffectTarget(e)
end
function c65743242.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local ag=eg:GetFirst():GetAttackableTarget()
local at=Duel.GetAttackTarget()
if chk==0 then return ag:IsExists(c65743242.filter,1,at,e) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local g=ag:FilterSelect(tp,c65743242.filter,1,1,at,e)
Duel.SetTargetCard(g)
end
function c65743242.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangeAttackTarget(tc)
end
end
--突撃指令
function c78986941.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,0x1c0)
e1:SetTarget(c78986941.target)
e1:SetOperation(c78986941.activate)
c:RegisterEffect(e1)
end
function c78986941.rfilter(c,e)
local tpe=c:GetType()
return bit.band(tpe,TYPE_NORMAL)~=0 and bit.band(tpe,TYPE_TOKEN)==0
and c:IsFaceup() and c:IsReleasable() and c:IsReleasableByEffect() and not c:IsImmuneToEffect(e)
end
function c78986941.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(c78986941.rfilter,tp,LOCATION_MZONE,0,1,nil,e)
and Duel.IsExistingMatchingCard(Card.IsDestructable,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local rg=Duel.SelectTarget(tp,c78986941.rfilter,tp,LOCATION_MZONE,0,1,1,nil,e)
local g=Duel.GetMatchingGroup(Card.IsDestructable,tp,0,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function c78986941.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,Card.IsDestructable,tp,0,LOCATION_MZONE,1,1,nil)
if dg:GetCount()>0 then
Duel.Destroy(dg,REASON_EFFECT)
end
end
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