Commit c8ddaa2d authored by edo9300's avatar edo9300

Update

parent 94474f2d
...@@ -547,7 +547,7 @@ public: ...@@ -547,7 +547,7 @@ public:
int32 select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable, int32 min, int32 max); int32 select_tribute_cards(int16 step, uint8 playerid, uint8 cancelable, int32 min, int32 max);
int32 toss_coin(uint16 step, effect* reason_effect, uint8 reason_player, uint8 playerid, uint8 count); int32 toss_coin(uint16 step, effect* reason_effect, uint8 reason_player, uint8 playerid, uint8 count);
int32 toss_dice(uint16 step, effect* reason_effect, uint8 reason_player, uint8 playerid, uint8 count1, uint8 count2); int32 toss_dice(uint16 step, effect* reason_effect, uint8 reason_player, uint8 playerid, uint8 count1, uint8 count2);
int32 rock_paper_scissors(uint16 step); int32 rock_paper_scissors(uint16 step, uint8 repeat);
int32 select_battle_command(uint16 step, uint8 playerid); int32 select_battle_command(uint16 step, uint8 playerid);
int32 select_idle_command(uint16 step, uint8 playerid); int32 select_idle_command(uint16 step, uint8 playerid);
......
...@@ -2986,7 +2986,10 @@ int32 scriptlib::duel_toss_dice(lua_State * L) { ...@@ -2986,7 +2986,10 @@ int32 scriptlib::duel_toss_dice(lua_State * L) {
} }
int32 scriptlib::duel_rock_paper_scissors(lua_State * L) { int32 scriptlib::duel_rock_paper_scissors(lua_State * L) {
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
pduel->game_field->add_process(PROCESSOR_ROCK_PAPER_SCISSORS, 1, 0, 0, 0, 0); uint8 repeat = TRUE;
if (lua_gettop(L) > 0)
repeat = lua_toboolean(L, 1);
pduel->game_field->add_process(PROCESSOR_ROCK_PAPER_SCISSORS, 1, 0, 0, repeat, 0);
return lua_yield(L, 0); return lua_yield(L, 0);
} }
int32 scriptlib::duel_get_coin_result(lua_State * L) { int32 scriptlib::duel_get_coin_result(lua_State * L) {
......
...@@ -5374,7 +5374,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, ...@@ -5374,7 +5374,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
} }
return TRUE; return TRUE;
} }
int32 field::rock_paper_scissors(uint16 step) { int32 field::rock_paper_scissors(uint16 step, uint8 repeat) {
switch (step) { switch (step) {
case 1: { case 1: {
pduel->write_buffer8(MSG_ROCK_PAPER_SCISSORS); pduel->write_buffer8(MSG_ROCK_PAPER_SCISSORS);
...@@ -5382,22 +5382,24 @@ int32 field::rock_paper_scissors(uint16 step) { ...@@ -5382,22 +5382,24 @@ int32 field::rock_paper_scissors(uint16 step) {
return FALSE; return FALSE;
} }
case 2: { case 2: {
core.units.begin()->arg1 = returns.ivalue[0]; core.units.begin()->arg2 = returns.ivalue[0];
pduel->write_buffer8(MSG_ROCK_PAPER_SCISSORS); pduel->write_buffer8(MSG_ROCK_PAPER_SCISSORS);
pduel->write_buffer8(1); pduel->write_buffer8(1);
return FALSE; return FALSE;
} }
case 3: { case 3: {
core.units.begin()->arg2 = returns.ivalue[0]; core.units.begin()->arg2 = core.units.begin()->arg2 + (returns.ivalue[0] << 2);
pduel->write_buffer8(MSG_HAND_RES); pduel->write_buffer8(MSG_HAND_RES);
pduel->write_buffer8(core.units.begin()->arg1);
pduel->write_buffer8(core.units.begin()->arg2); pduel->write_buffer8(core.units.begin()->arg2);
if(core.units.begin()->arg1 == core.units.begin()->arg2) { if((core.units.begin()->arg2 & 0x3) == ((core.units.begin()->arg2 >> 2) & 0x3)) {
if(repeat) {
core.units.begin()->step = 0; core.units.begin()->step = 0;
return FALSE; return FALSE;
} else if((core.units.begin()->arg1 == 1 && core.units.begin()->arg2 == 2) } else
|| (core.units.begin()->arg1 == 2 && core.units.begin()->arg2 == 3) returns.ivalue[0] = PLAYER_NONE;
|| (core.units.begin()->arg1 == 3 && core.units.begin()->arg2 == 1)) { } else if(((core.units.begin()->arg2 & 0x3) == 1 && ((core.units.begin()->arg2 >> 2) & 0x3) == 2)
|| ((core.units.begin()->arg2 & 0x3) == 2 && ((core.units.begin()->arg2 >> 2) & 0x3) == 3)
|| ((core.units.begin()->arg2 & 0x3) == 3 && ((core.units.begin()->arg2 >> 2) & 0x3) == 1)) {
returns.ivalue[0] = 1; returns.ivalue[0] = 1;
} else { } else {
returns.ivalue[0] = 0; returns.ivalue[0] = 0;
......
...@@ -618,7 +618,7 @@ int32 field::process() { ...@@ -618,7 +618,7 @@ int32 field::process() {
return pduel->bufferlen; return pduel->bufferlen;
} }
case PROCESSOR_ROCK_PAPER_SCISSORS: { case PROCESSOR_ROCK_PAPER_SCISSORS: {
if (rock_paper_scissors(it->step)) { if (rock_paper_scissors(it->step, it->arg1)) {
pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT); pduel->lua->add_param(returns.ivalue[0], PARAM_TYPE_INT);
core.units.pop_front(); core.units.pop_front();
} else } else
......
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