Commit 971f808f authored by mercury233's avatar mercury233
parents 60d8b81d 8ec990d5
...@@ -3242,6 +3242,45 @@ int32 field::get_cteffect_evt(effect* feffect, int32 playerid, const tevent& e, ...@@ -3242,6 +3242,45 @@ int32 field::get_cteffect_evt(effect* feffect, int32 playerid, const tevent& e,
} }
return TRUE; return TRUE;
} }
int32 field::check_cteffect_hint(effect* peffect, uint8 playerid) {
card* phandler = peffect->get_handler();
if(phandler->data.type != (TYPE_TRAP | TYPE_CONTINUOUS))
return FALSE;
if(!(peffect->type & EFFECT_TYPE_ACTIVATE))
return FALSE;
if(peffect->code != EVENT_FREE_CHAIN)
return FALSE;
if(peffect->cost || peffect->target || peffect->operation)
return FALSE;
for(auto& efit : phandler->field_effect) {
effect* feffect = efit.second;
if(!(feffect->type & (EFFECT_TYPE_TRIGGER_F | EFFECT_TYPE_TRIGGER_O | EFFECT_TYPE_QUICK_O)))
continue;
if(!feffect->in_range(phandler))
continue;
uint32 code = efit.first;
if(code == EVENT_FREE_CHAIN || code == EVENT_PHASE + infos.phase) {
nil_event.event_code = code;
if(get_cteffect_evt(feffect, playerid, nil_event, FALSE)
&& (code != EVENT_FREE_CHAIN || check_hint_timing(feffect)))
return TRUE;
} else {
for(const auto& ev : core.point_event) {
if(code != ev.event_code)
continue;
if(get_cteffect_evt(feffect, playerid, ev, FALSE))
return TRUE;
}
for(const auto& ev : core.instant_event) {
if(code != ev.event_code)
continue;
if(get_cteffect_evt(feffect, playerid, ev, FALSE))
return TRUE;
}
}
}
return FALSE;
}
int32 field::is_able_to_enter_bp() { int32 field::is_able_to_enter_bp() {
return ((core.duel_options & DUEL_ATTACK_FIRST_TURN) || infos.turn_id != 1) return ((core.duel_options & DUEL_ATTACK_FIRST_TURN) || infos.turn_id != 1)
&& infos.phase < PHASE_BATTLE_START && infos.phase < PHASE_BATTLE_START
......
...@@ -468,6 +468,7 @@ public: ...@@ -468,6 +468,7 @@ public:
chain* get_chain(uint32 chaincount); chain* get_chain(uint32 chaincount);
int32 get_cteffect(effect* peffect, int32 playerid, int32 store); int32 get_cteffect(effect* peffect, int32 playerid, int32 store);
int32 get_cteffect_evt(effect* feffect, int32 playerid, const tevent& e, int32 store); int32 get_cteffect_evt(effect* feffect, int32 playerid, const tevent& e, int32 store);
int32 check_cteffect_hint(effect* peffect, uint8 playerid);
int32 is_able_to_enter_bp(); int32 is_able_to_enter_bp();
void add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2, ptr arg3 = 0, ptr arg4 = 0, void* ptr1 = NULL, void* ptr2 = NULL); void add_process(uint16 type, uint16 step, effect* peffect, group* target, ptr arg1, ptr arg2, ptr arg3 = 0, ptr arg4 = 0, void* ptr1 = NULL, void* ptr2 = NULL);
......
...@@ -1115,7 +1115,7 @@ int32 scriptlib::duel_damage(lua_State *L) { ...@@ -1115,7 +1115,7 @@ int32 scriptlib::duel_damage(lua_State *L) {
uint32 playerid = lua_tointeger(L, 1); uint32 playerid = lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 amount = lua_tointeger(L, 2); int32 amount = std::round(lua_tonumber(L, 2));
if(amount < 0) if(amount < 0)
amount = 0; amount = 0;
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tointeger(L, 3);
...@@ -1133,7 +1133,7 @@ int32 scriptlib::duel_recover(lua_State *L) { ...@@ -1133,7 +1133,7 @@ int32 scriptlib::duel_recover(lua_State *L) {
uint32 playerid = lua_tointeger(L, 1); uint32 playerid = lua_tointeger(L, 1);
if(playerid != 0 && playerid != 1) if(playerid != 0 && playerid != 1)
return 0; return 0;
int32 amount = lua_tointeger(L, 2); int32 amount = std::round(lua_tonumber(L, 2));
if(amount < 0) if(amount < 0)
amount = 0; amount = 0;
uint32 reason = lua_tointeger(L, 3); uint32 reason = lua_tointeger(L, 3);
......
...@@ -2925,7 +2925,6 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint ...@@ -2925,7 +2925,6 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
core.special_summoning.insert(target); core.special_summoning.insert(target);
target->enable_field_effect(false); target->enable_field_effect(false);
check_card_counter(target, 3, target->summon_player); check_card_counter(target, 3, target->summon_player);
uint32 move_player = (target->data.type & TYPE_TOKEN) ? target->owner : target->summon_player;
if(targets && core.duel_rule >= 4) { if(targets && core.duel_rule >= 4) {
uint32 flag1, flag2; uint32 flag1, flag2;
int32 ct1 = get_tofield_count(target, playerid, LOCATION_MZONE, target->summon_player, LOCATION_REASON_TOFIELD, zone, &flag1); int32 ct1 = get_tofield_count(target, playerid, LOCATION_MZONE, target->summon_player, LOCATION_REASON_TOFIELD, zone, &flag1);
...@@ -2944,7 +2943,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint ...@@ -2944,7 +2943,7 @@ int32 field::special_summon_step(uint16 step, group* targets, card* target, uint
zone &= flag1; zone &= flag1;
} }
} }
move_to_field(target, move_player, playerid, LOCATION_MZONE, positions, FALSE, 0, FALSE, zone); move_to_field(target, target->summon_player, playerid, LOCATION_MZONE, positions, FALSE, 0, FALSE, zone);
return FALSE; return FALSE;
} }
case 2: { case 2: {
......
...@@ -1455,7 +1455,7 @@ int32 field::process_phase_event(int16 step, int32 phase) { ...@@ -1455,7 +1455,7 @@ int32 field::process_phase_event(int16 step, int32 phase) {
continue; continue;
peffect->id = infos.field_id++; peffect->id = infos.field_id++;
newchain.triggering_effect = peffect; newchain.triggering_effect = peffect;
if(check_hint_timing(peffect)) if(check_hint_timing(peffect) || check_cteffect_hint(peffect, check_player))
core.spe_effect[check_player]++; core.spe_effect[check_player]++;
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
fc_count++; fc_count++;
...@@ -2153,7 +2153,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori ...@@ -2153,7 +2153,7 @@ int32 field::process_quick_effect(int16 step, int32 skip_freechain, uint8 priori
newchain.set_triggering_place(phandler); newchain.set_triggering_place(phandler);
newchain.triggering_player = priority; newchain.triggering_player = priority;
core.select_chains.push_back(newchain); core.select_chains.push_back(newchain);
if(check_hint_timing(peffect)) if(check_hint_timing(peffect) || check_cteffect_hint(peffect, priority))
core.spe_effect[priority]++; core.spe_effect[priority]++;
} }
} }
......
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