Commit 996c4464 authored by argon.sun's avatar argon.sun

fix

parent 98b387fb
......@@ -644,7 +644,7 @@ void interpreter::add_param(ptr param, int32 type, bool front) {
else
params.push_back(make_pair((void*)param, type));
}
void interpreter::push_param(lua_State* L) {
void interpreter::push_param(lua_State* L, bool is_coroutine) {
uint32 type;
int32 pushed = 0;
for (auto it = params.begin(); it != params.end(); ++it) {
......@@ -688,9 +688,15 @@ void interpreter::push_param(lua_State* L) {
int32 index = (int32)(ptr)it->first;
if(index > 0)
lua_pushvalue(L, index);
else {
lua_pushnil(L);
// lua_pushvalue(L, index - pushed);
else if(is_coroutine) {
//copy value from current_state to new stack
lua_pushvalue(current_state, index);
int32 ref = luaL_ref(current_state, LUA_REGISTRYINDEX);
lua_rawgeti(L, LUA_REGISTRYINDEX, ref);
luaL_unref(current_state, LUA_REGISTRYINDEX, ref);
} else {
//the calling function is pushed before the params, so the actual index is: index - pushed -1
lua_pushvalue(L, index - pushed - 1);
}
break;
}
......@@ -956,8 +962,8 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
return OPERATION_FAIL;
}
}
push_param(rthread, true);
current_state = rthread;
push_param(rthread);
int32 result = lua_resume(rthread, 0, param_count);
if (result == 0) {
coroutines.erase(f);
......
......@@ -55,7 +55,7 @@ public:
int32 load_card_script(uint32 code);
void add_param(void* param, int32 type, bool front = false);
void add_param(ptr param, int32 type, bool front = false);
void push_param(lua_State* L);
void push_param(lua_State* L, bool is_coroutine = false);
int32 call_function(int32 f, uint32 param_count, uint32 ret_count);
int32 call_card_function(card *pcard, char *f, uint32 param_count, uint32 ret_count);
int32 call_code_function(uint32 code, char *f, uint32 param_count, uint32 ret_count);
......
......@@ -19,6 +19,6 @@ function c12694768.target(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,500)
end
function c12694768.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.Recover(tp,500,REASON_EFFECT)
Duel.Recover(1-tp,500,REASON_EFFECT)
Duel.Damage(tp,500,REASON_EFFECT)
Duel.Damage(1-tp,500,REASON_EFFECT)
end
--ダイガスタ·ファルコス
function c37106911.initial_effect(c)
function c34109611.initial_effect(c)
--synchro summon
aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsSetCard,0x10),1)
c:EnableReviveLimit()
--atkup
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(37106911,0))
e1:SetDescription(aux.Stringid(34109611,0))
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(c37106911.condition)
e1:SetOperation(c37106911.operation)
e1:SetCondition(c34109611.condition)
e1:SetOperation(c34109611.operation)
c:RegisterEffect(e1)
end
function c37106911.condition(e,tp,eg,ep,ev,re,r,rp)
function c34109611.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO
end
function c37106911.filter(c)
function c34109611.filter(c)
return c:IsFaceup() and c:IsSetCard(0x10)
end
function c37106911.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c37106911.filter,tp,LOCATION_MZONE,0,nil)
function c34109611.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(c34109611.filter,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
while tc do
local e1=Effect.CreateEffect(e:GetHandler())
......
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