Commit 395605e8 authored by argon.sun's avatar argon.sun

bug fix

parent 11cad46b
...@@ -530,7 +530,7 @@ void Game::Analyze(void* pd, char* engbuf) { ...@@ -530,7 +530,7 @@ void Game::Analyze(void* pd, char* engbuf) {
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = NetManager::ReadInt8(pbuf); player = NetManager::ReadInt8(pbuf);
count = NetManager::ReadInt8(pbuf); count = NetManager::ReadInt8(pbuf);
pbuf += count * 12; pbuf += 9 + count * 11;
mainGame->SendGameMessage(player, offset, pbuf - offset); mainGame->SendGameMessage(player, offset, pbuf - offset);
mainGame->WaitforResponse(player); mainGame->WaitforResponse(player);
break; break;
...@@ -1593,6 +1593,8 @@ bool Game::SolveMessage(void* pd, char* msg, int len) { ...@@ -1593,6 +1593,8 @@ bool Game::SolveMessage(void* pd, char* msg, int len) {
int selecting_player = NetManager::ReadInt8(pbuf); int selecting_player = NetManager::ReadInt8(pbuf);
int count = NetManager::ReadInt8(pbuf); int count = NetManager::ReadInt8(pbuf);
int specount = NetManager::ReadInt8(pbuf); int specount = NetManager::ReadInt8(pbuf);
int hint0 = NetManager::ReadInt32(pbuf);
int hint1 = NetManager::ReadInt32(pbuf);
int c, l, s, code, desc; int c, l, s, code, desc;
ClientCard* pcard; ClientCard* pcard;
mainGame->dField.activatable_cards.clear(); mainGame->dField.activatable_cards.clear();
...@@ -3242,7 +3244,7 @@ bool Game::AnalyzeReplay(void* pd, char* engbuf) { ...@@ -3242,7 +3244,7 @@ bool Game::AnalyzeReplay(void* pd, char* engbuf) {
case MSG_SELECT_CHAIN: { case MSG_SELECT_CHAIN: {
player = NetManager::ReadInt8(pbuf); player = NetManager::ReadInt8(pbuf);
count = NetManager::ReadInt8(pbuf); count = NetManager::ReadInt8(pbuf);
pbuf += count * 12; pbuf += 9 + count * 11;
return rep.ReadNextResponse(); return rep.ReadNextResponse();
} }
case MSG_SELECT_PLACE: case MSG_SELECT_PLACE:
......
...@@ -939,7 +939,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va ...@@ -939,7 +939,7 @@ int32 interpreter::call_coroutine(int32 f, uint32 param_count, uint32 * yield_va
return COROUTINE_ERROR; return COROUTINE_ERROR;
} }
} }
//Convert a pointer to a lua value, use "p"+pointer value as the name, +1 -0 //Convert a pointer to a lua value, +1 -0
void interpreter::card2value(lua_State* L, card* pcard) { void interpreter::card2value(lua_State* L, card* pcard) {
if (!pcard || pcard->ref_handle == 0) if (!pcard || pcard->ref_handle == 0)
lua_pushnil(L); lua_pushnil(L);
...@@ -970,13 +970,12 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) { ...@@ -970,13 +970,12 @@ int32 interpreter::get_function_handle(lua_State* L, int32 index) {
return ref; return ref;
} }
void interpreter::set_duel_info(lua_State* L, duel* pduel) { void interpreter::set_duel_info(lua_State* L, duel* pduel) {
lua_pushinteger(L, (ptr) pduel); lua_pushlightuserdata(L, pduel);
int32 ref = luaL_ref(L, LUA_REGISTRYINDEX); luaL_ref(L, LUA_REGISTRYINDEX);
lua_setglobal(L, "__duel");
} }
duel* interpreter::get_duel_info(lua_State * L) { duel* interpreter::get_duel_info(lua_State * L) {
lua_getglobal(L, "__duel"); lua_rawgeti(L, LUA_REGISTRYINDEX, 3);
ptr pduel = lua_tointeger(L, -1); duel* pduel = (duel*)lua_topointer(L, -1);
lua_pop(L, 1); lua_pop(L, 1);
return (duel*) pduel; return pduel;
} }
...@@ -272,12 +272,12 @@ int32 field::select_chain(uint16 step, uint8 playerid, uint8 spe_count) { ...@@ -272,12 +272,12 @@ int32 field::select_chain(uint16 step, uint8 playerid, uint8 spe_count) {
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(core.select_chains.size()); pduel->write_buffer8(core.select_chains.size());
pduel->write_buffer8(spe_count); pduel->write_buffer8(spe_count);
effect* peffect; pduel->write_buffer32(pduel->game_field->core.hint_timing[playerid]);
card* pcard; pduel->write_buffer32(pduel->game_field->core.hint_timing[1 - playerid]);
std::sort(core.select_chains.begin(), core.select_chains.end(), chain::chain_operation_sort); std::sort(core.select_chains.begin(), core.select_chains.end(), chain::chain_operation_sort);
for(uint32 i = 0; i < core.select_chains.size(); ++i) { for(uint32 i = 0; i < core.select_chains.size(); ++i) {
peffect = core.select_chains[i].triggering_effect; effect* peffect = core.select_chains[i].triggering_effect;
pcard = peffect->handler; card* pcard = peffect->handler;
pduel->write_buffer32(pcard->data.code); pduel->write_buffer32(pcard->data.code);
pduel->write_buffer8(pcard->current.controler); pduel->write_buffer8(pcard->current.controler);
pduel->write_buffer8(pcard->current.location); pduel->write_buffer8(pcard->current.location);
......
...@@ -2464,8 +2464,8 @@ int32 field::process_battle_command(uint16 step) { ...@@ -2464,8 +2464,8 @@ int32 field::process_battle_command(uint16 step) {
return FALSE; return FALSE;
} }
} }
core.attack_target = 0; returns.ivalue[0] = -2;
core.units.begin()->step = 6; core.units.begin()->step = 5;
return FALSE; return FALSE;
} }
if(core.units.begin()->arg2) { if(core.units.begin()->arg2) {
......
...@@ -12,6 +12,7 @@ function c69031175.initial_effect(c) ...@@ -12,6 +12,7 @@ function c69031175.initial_effect(c)
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e2:SetValue(1)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--counter --counter
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
......
...@@ -241,7 +241,7 @@ function Auxiliary.FOperationCode2(code1,code2,sub,insf) ...@@ -241,7 +241,7 @@ function Auxiliary.FOperationCode2(code1,code2,sub,insf)
return function(e,tp,eg,ep,ev,re,r,rp,gc,chkf) return function(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
if gc then if gc then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL)
local g1=g:FilterSelect(tp,Auxiliary.FConditionFilter21,1,1,nil,code1,code2) local g1=eg:FilterSelect(tp,Auxiliary.FConditionFilter21,1,1,nil,code1,code2)
Duel.SetFusionMaterial(g1) Duel.SetFusionMaterial(g1)
return return
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