Commit a5ad1bf2 authored by VanillaSalt's avatar VanillaSalt

fix

parent 68a5a293
...@@ -607,6 +607,18 @@ uint32 card::check_xyz_level(card* pcard, uint32 lv) { ...@@ -607,6 +607,18 @@ uint32 card::check_xyz_level(card* pcard, uint32 lv) {
return (lev >> 16) & 0xffff; return (lev >> 16) & 0xffff;
return 0; return 0;
} }
uint32 card::get_base_attribute() {
if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER))
return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.attribute;
int32 batt = data.attribute;
effect_set effects;
filter_effect(EFFECT_CHANGE_BASE_ATTRIBUTE, &effects);
if(effects.size())
batt = effects.get_last()->get_value(this);
return batt;
}
uint32 card::get_attribute() { uint32 card::get_attribute() {
if(assume_type == ASSUME_ATTRIBUTE) if(assume_type == ASSUME_ATTRIBUTE)
return assume_value; return assume_value;
...@@ -617,8 +629,8 @@ uint32 card::get_attribute() { ...@@ -617,8 +629,8 @@ uint32 card::get_attribute() {
if (temp.attribute != 0xffffffff) if (temp.attribute != 0xffffffff)
return temp.attribute; return temp.attribute;
effect_set effects; effect_set effects;
int32 attribute = data.attribute; int32 attribute = get_base_attribute();
temp.attribute = data.attribute; temp.attribute = attribute;
filter_effect(EFFECT_ADD_ATTRIBUTE, &effects, FALSE); filter_effect(EFFECT_ADD_ATTRIBUTE, &effects, FALSE);
filter_effect(EFFECT_REMOVE_ATTRIBUTE, &effects, FALSE); filter_effect(EFFECT_REMOVE_ATTRIBUTE, &effects, FALSE);
filter_effect(EFFECT_CHANGE_ATTRIBUTE, &effects); filter_effect(EFFECT_CHANGE_ATTRIBUTE, &effects);
...@@ -634,6 +646,18 @@ uint32 card::get_attribute() { ...@@ -634,6 +646,18 @@ uint32 card::get_attribute() {
temp.attribute = 0xffffffff; temp.attribute = 0xffffffff;
return attribute; return attribute;
} }
uint32 card::get_base_race() {
if (current.location != LOCATION_MZONE && !(data.type & TYPE_MONSTER))
return 0;
if(!(current.location & (LOCATION_MZONE + LOCATION_GRAVE)))
return data.race;
int32 brac = data.race;
effect_set effects;
filter_effect(EFFECT_CHANGE_BASE_RACE, &effects);
if(effects.size())
brac = effects.get_last()->get_value(this);
return brac;
}
uint32 card::get_race() { uint32 card::get_race() {
if(assume_type == ASSUME_RACE) if(assume_type == ASSUME_RACE)
return assume_value; return assume_value;
...@@ -644,8 +668,8 @@ uint32 card::get_race() { ...@@ -644,8 +668,8 @@ uint32 card::get_race() {
if (temp.race != 0xffffffff) if (temp.race != 0xffffffff)
return temp.race; return temp.race;
effect_set effects; effect_set effects;
int32 race = data.race; int32 race = get_base_race();
temp.race = data.race; temp.race = race;
filter_effect(EFFECT_ADD_RACE, &effects, FALSE); filter_effect(EFFECT_ADD_RACE, &effects, FALSE);
filter_effect(EFFECT_REMOVE_RACE, &effects, FALSE); filter_effect(EFFECT_REMOVE_RACE, &effects, FALSE);
filter_effect(EFFECT_CHANGE_RACE, &effects); filter_effect(EFFECT_CHANGE_RACE, &effects);
......
...@@ -153,7 +153,9 @@ public: ...@@ -153,7 +153,9 @@ public:
uint32 get_synchro_level(card* pcard); uint32 get_synchro_level(card* pcard);
uint32 get_ritual_level(card* pcard); uint32 get_ritual_level(card* pcard);
uint32 check_xyz_level(card* pcard, uint32 lv); uint32 check_xyz_level(card* pcard, uint32 lv);
uint32 get_base_attribute();
uint32 get_attribute(); uint32 get_attribute();
uint32 get_base_race();
uint32 get_race(); uint32 get_race();
uint32 get_lscale(); uint32 get_lscale();
uint32 get_rscale(); uint32 get_rscale();
......
...@@ -278,9 +278,11 @@ public: ...@@ -278,9 +278,11 @@ public:
#define EFFECT_ADD_RACE 120 // #define EFFECT_ADD_RACE 120 //
#define EFFECT_REMOVE_RACE 121 // #define EFFECT_REMOVE_RACE 121 //
#define EFFECT_CHANGE_RACE 122 // #define EFFECT_CHANGE_RACE 122 //
#define EFFECT_CHANGE_BASE_RACE 123 //
#define EFFECT_ADD_ATTRIBUTE 125 // #define EFFECT_ADD_ATTRIBUTE 125 //
#define EFFECT_REMOVE_ATTRIBUTE 126 // #define EFFECT_REMOVE_ATTRIBUTE 126 //
#define EFFECT_CHANGE_ATTRIBUTE 127 // #define EFFECT_CHANGE_ATTRIBUTE 127 //
#define EFFECT_CHANGE_BASE_ATTRIBUTE 128 //
#define EFFECT_UPDATE_LEVEL 130 // #define EFFECT_UPDATE_LEVEL 130 //
#define EFFECT_CHANGE_LEVEL 131 // #define EFFECT_CHANGE_LEVEL 131 //
#define EFFECT_UPDATE_RANK 132 // #define EFFECT_UPDATE_RANK 132 //
......
...@@ -149,7 +149,7 @@ int32 scriptlib::card_get_origin_attribute(lua_State *L) { ...@@ -149,7 +149,7 @@ int32 scriptlib::card_get_origin_attribute(lua_State *L) {
if(pcard->status & STATUS_NO_LEVEL) if(pcard->status & STATUS_NO_LEVEL)
lua_pushinteger(L, 0); lua_pushinteger(L, 0);
else else
lua_pushinteger(L, pcard->data.attribute); lua_pushinteger(L, pcard->get_base_attribute());
return 1; return 1;
} }
int32 scriptlib::card_get_race(lua_State *L) { int32 scriptlib::card_get_race(lua_State *L) {
...@@ -166,7 +166,7 @@ int32 scriptlib::card_get_origin_race(lua_State *L) { ...@@ -166,7 +166,7 @@ int32 scriptlib::card_get_origin_race(lua_State *L) {
if(pcard->status & STATUS_NO_LEVEL) if(pcard->status & STATUS_NO_LEVEL)
lua_pushinteger(L, 0); lua_pushinteger(L, 0);
else else
lua_pushinteger(L, pcard->data.race); lua_pushinteger(L, pcard->get_base_race());
return 1; return 1;
} }
int32 scriptlib::card_get_attack(lua_State *L) { int32 scriptlib::card_get_attack(lua_State *L) {
...@@ -1880,7 +1880,7 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) { ...@@ -1880,7 +1880,7 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect = pduel->new_effect(); peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_ATTRIBUTE; peffect->code = EFFECT_CHANGE_BASE_ATTRIBUTE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE; peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000; peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = attribute; peffect->value = attribute;
...@@ -1889,7 +1889,7 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) { ...@@ -1889,7 +1889,7 @@ int32 scriptlib::card_add_trap_monster_attribute(lua_State *L) {
peffect = pduel->new_effect(); peffect = pduel->new_effect();
peffect->owner = pcard; peffect->owner = pcard;
peffect->type = EFFECT_TYPE_SINGLE; peffect->type = EFFECT_TYPE_SINGLE;
peffect->code = EFFECT_CHANGE_RACE; peffect->code = EFFECT_CHANGE_BASE_RACE;
peffect->flag = EFFECT_FLAG_CANNOT_DISABLE; peffect->flag = EFFECT_FLAG_CANNOT_DISABLE;
peffect->reset_flag = RESET_EVENT + 0x47e0000; peffect->reset_flag = RESET_EVENT + 0x47e0000;
peffect->value = race; peffect->value = race;
......
...@@ -2731,12 +2731,17 @@ int32 scriptlib::duel_toss_dice(lua_State * L) { ...@@ -2731,12 +2731,17 @@ int32 scriptlib::duel_toss_dice(lua_State * L) {
check_param_count(L, 2); check_param_count(L, 2);
duel* pduel = interpreter::get_duel_info(L); duel* pduel = interpreter::get_duel_info(L);
int32 playerid = lua_tointeger(L, 1); int32 playerid = lua_tointeger(L, 1);
int32 count = lua_tointeger(L, 2); int32 count1 = lua_tointeger(L, 2);
if((playerid != 0 && playerid != 1) || count <= 0) int32 count2 = 0;
return 0; if(lua_gettop(L) > 2)
if(count > 5) count2 = lua_tointeger(L, 3);
count = 5; if((playerid != 0 && playerid != 1) || count1 <= 0 || count2 < 0)
pduel->game_field->add_process(PROCESSOR_TOSS_DICE, 0, pduel->game_field->core.reason_effect, 0, (pduel->game_field->core.reason_player << 16) + playerid, count); return 0;
if(count1 > 5)
count1 = 5;
if(count2 > 5 - count1)
count2 = 5 - count1;
pduel->game_field->add_process(PROCESSOR_TOSS_DICE, 0, pduel->game_field->core.reason_effect, 0, (pduel->game_field->core.reason_player << 16) + playerid, count1 + (count2 << 16));
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) {
......
...@@ -4524,7 +4524,7 @@ int32 field::toss_coin(uint16 step, effect * reason_effect, uint8 reason_player, ...@@ -4524,7 +4524,7 @@ int32 field::toss_coin(uint16 step, effect * reason_effect, uint8 reason_player,
} }
return TRUE; return TRUE;
} }
int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, uint8 playerid, uint8 count) { int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, uint8 playerid, uint8 count1, uint8 count2) {
switch(step) { switch(step) {
case 0: { case 0: {
effect_set eset; effect_set eset;
...@@ -4535,7 +4535,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, ...@@ -4535,7 +4535,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
e.reason_player = core.reason_player; e.reason_player = core.reason_player;
e.event_player = playerid; e.event_player = playerid;
e.event_value = count; e.event_value = count;
for(uint8 i = 0; i < 5; ++i) for(int32 i = 0; i < 5; ++i)
core.dice_result[i] = 0; core.dice_result[i] = 0;
filter_field_effect(EFFECT_TOSS_DICE_REPLACE, &eset); filter_field_effect(EFFECT_TOSS_DICE_REPLACE, &eset);
for(int32 i = eset.size() - 1; i >= 0; --i) { for(int32 i = eset.size() - 1; i >= 0; --i) {
...@@ -4547,12 +4547,21 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, ...@@ -4547,12 +4547,21 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
if(!peffect) { if(!peffect) {
pduel->write_buffer8(MSG_TOSS_DICE); pduel->write_buffer8(MSG_TOSS_DICE);
pduel->write_buffer8(playerid); pduel->write_buffer8(playerid);
pduel->write_buffer8(count); pduel->write_buffer8(count1);
for(int32 i = 0; i < count; ++i) { for(int32 i = 0; i < count1; ++i) {
core.dice_result[i] = pduel->get_next_integer(1, 6); core.dice_result[i] = pduel->get_next_integer(1, 6);
pduel->write_buffer8(core.dice_result[i]); pduel->write_buffer8(core.dice_result[i]);
} }
raise_event((card*)0, EVENT_TOSS_DICE_NEGATE, reason_effect, 0, reason_player, playerid, count); if(count2 > 0) {
pduel->write_buffer8(MSG_TOSS_DICE);
pduel->write_buffer8(1 - playerid);
pduel->write_buffer8(count2);
for(int32 i = 0; i < count2; ++i) {
core.dice_result[count1 + i] = pduel->get_next_integer(1, 6);
pduel->write_buffer8(core.dice_result[count1 + i]);
}
}
raise_event((card*)0, EVENT_TOSS_DICE_NEGATE, reason_effect, 0, reason_player, playerid, count1 + (count2 << 16));
process_instant_event(); process_instant_event();
return FALSE; return FALSE;
} else { } else {
...@@ -4562,7 +4571,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player, ...@@ -4562,7 +4571,7 @@ int32 field::toss_dice(uint16 step, effect * reason_effect, uint8 reason_player,
} }
} }
case 1: { case 1: {
raise_event((card*)0, EVENT_TOSS_DICE, reason_effect, 0, reason_player, playerid, count); raise_event((card*)0, EVENT_TOSS_DICE, reason_effect, 0, reason_player, playerid, count1 + (count2 << 16));
process_instant_event(); process_instant_event();
return TRUE; return TRUE;
} }
......
...@@ -580,8 +580,8 @@ int32 field::process() { ...@@ -580,8 +580,8 @@ int32 field::process() {
return PROCESSOR_WAITING + pduel->bufferlen; return PROCESSOR_WAITING + pduel->bufferlen;
} }
case PROCESSOR_TOSS_DICE: { case PROCESSOR_TOSS_DICE: {
if (toss_dice(it->step, it->peffect, (it->arg1 >> 16), it->arg1 & 0xff, it->arg2)) { if(toss_dice(it->step, it->peffect, it->arg1 >> 16, it->arg1 & 0xff, it->arg2 & 0xff, it->arg2 >> 16)) {
for(int32 i = 0; i < it->arg2; ++i) for(int32 i = 0; i < (it->arg2 & 0xff) + (it->arg2 >> 16); ++i)
pduel->lua->add_param(core.dice_result[i], PARAM_TYPE_INT); pduel->lua->add_param(core.dice_result[i], PARAM_TYPE_INT);
core.units.pop_front(); core.units.pop_front();
} else } else
......
...@@ -16,8 +16,7 @@ function c3549275.operation(e,tp,eg,ep,ev,re,r,rp) ...@@ -16,8 +16,7 @@ function c3549275.operation(e,tp,eg,ep,ev,re,r,rp)
local d1=0 local d1=0
local d2=0 local d2=0
while d1==d2 do while d1==d2 do
d1=Duel.TossDice(tp,1) d1,d2=Duel.TossDice(tp,1,1)
d2=Duel.TossDice(1-tp,1)
end end
if d1<d2 then if d1<d2 then
if d2==6 then Duel.Damage(tp,6000,REASON_EFFECT) else Duel.Damage(tp,d2*500,REASON_EFFECT) end if d2==6 then Duel.Damage(tp,6000,REASON_EFFECT) else Duel.Damage(tp,d2*500,REASON_EFFECT) end
......
...@@ -20,11 +20,10 @@ function c39454112.diceop(e,tp,eg,ep,ev,re,r,rp) ...@@ -20,11 +20,10 @@ function c39454112.diceop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,0,39454112) Duel.Hint(HINT_CARD,0,39454112)
local dc={Duel.GetDiceResult()} local dc={Duel.GetDiceResult()}
local ac=1 local ac=1
if ev>1 then local ct=bit.band(ev,0xff)+bit.rshift(ev,16)
local t={} if ct>1 then
for i=1,ev do t[i]=i end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(39454112,1)) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(39454112,1))
ac=Duel.AnnounceNumber(tp,table.unpack(t)) ac=Duel.AnnounceNumber(tp,table.unpack(dc,1,ct))
end end
if dc[ac]==1 or dc[ac]==3 or dc[ac]==5 then dc[ac]=6 if dc[ac]==1 or dc[ac]==3 or dc[ac]==5 then dc[ac]=6
else dc[ac]=1 end else dc[ac]=1 end
......
...@@ -24,6 +24,8 @@ function c83241722.coinop(e,tp,eg,ep,ev,re,r,rp) ...@@ -24,6 +24,8 @@ function c83241722.coinop(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(83241722,0)) then if Duel.SelectYesNo(tp,aux.Stringid(83241722,0)) then
Duel.Hint(HINT_CARD,0,83241722) Duel.Hint(HINT_CARD,0,83241722)
Duel.RegisterFlagEffect(tp,83241722,RESET_PHASE+PHASE_END,0,1) Duel.RegisterFlagEffect(tp,83241722,RESET_PHASE+PHASE_END,0,1)
Duel.TossDice(ep,ev) local ct1=bit.band(ev,0xff)
local ct2=bit.rshift(ev,16)
Duel.TossDice(ep,ct1,ct2)
end 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