Commit 0471c223 authored by Fluorohydride's avatar Fluorohydride

fix GetActivatingLocation()

parent f3469874
......@@ -508,9 +508,6 @@ int32 scriptlib::effect_get_activate_location(lua_State *L) {
check_param_count(L, 1);
check_param(L, PARAM_TYPE_EFFECT, 1);
effect* peffect = *(effect**) lua_touserdata(L, 1);
if(peffect->type & (EFFECT_TYPE_ACTIVATE | EFFECT_TYPE_IGNITION | EFFECT_TYPE_QUICK_O | EFFECT_TYPE_QUICK_F))
lua_pushinteger(L, peffect->handler->current.location);
else
lua_pushinteger(L, peffect->s_range);
lua_pushinteger(L, peffect->s_range);
return 1;
}
\ No newline at end of file
......@@ -1964,6 +1964,8 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
pr = effects.activate_effect.equal_range(evit->event_code);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, *evit)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
......@@ -1981,6 +1983,8 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
pr = effects.quick_o_effect.equal_range(evit->event_code);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, *evit)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
......@@ -2028,6 +2032,8 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
if(core.global_flag & GLOBALFLAG_DELAYED_QUICKEFFECT) {
for(auto eit = core.delayed_quick.begin(); eit != core.delayed_quick.end(); ++eit) {
peffect = eit->first;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
const tevent& evt = eit->second;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, evt, TRUE, FALSE, FALSE)) {
newchain.flag = 0;
......@@ -2048,6 +2054,8 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, nil_event)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
......@@ -2065,6 +2073,8 @@ int32 field::process_quick_effect(int16 step, int32 special, uint8 priority) {
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
if(peffect->is_chainable(priority) && peffect->is_activateable(priority, nil_event)) {
newchain.flag = 0;
newchain.chain_id = infos.field_id++;
......@@ -2392,6 +2402,8 @@ int32 field::process_idle_command(uint16 step) {
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.triggering_effect = peffect;
if(peffect->is_activateable(infos.turn_player, nil_event))
core.select_chains.push_back(newchain);
......@@ -2399,12 +2411,16 @@ int32 field::process_idle_command(uint16 step) {
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.triggering_effect = peffect;
if(peffect->is_activateable(infos.turn_player, nil_event))
core.select_chains.push_back(newchain);
}
for(eit = effects.ignition_effect.begin(); eit != effects.ignition_effect.end(); ++eit) {
peffect = eit->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.triggering_effect = peffect;
if(peffect->is_activateable(infos.turn_player, nil_event))
core.select_chains.push_back(newchain);
......@@ -2619,6 +2635,8 @@ int32 field::process_battle_command(uint16 step) {
pr = effects.activate_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.triggering_effect = peffect;
if(peffect->is_activateable(infos.turn_player, nil_event) && peffect->get_speed() > 1)
core.select_chains.push_back(newchain);
......@@ -2626,6 +2644,8 @@ int32 field::process_battle_command(uint16 step) {
pr = effects.quick_o_effect.equal_range(EVENT_FREE_CHAIN);
for(; pr.first != pr.second; ++pr.first) {
peffect = pr.first->second;
peffect->s_range = peffect->handler->current.location;
peffect->o_range = peffect->handler->current.sequence;
newchain.triggering_effect = peffect;
if(peffect->is_activateable(infos.turn_player, nil_event))
core.select_chains.push_back(newchain);
......
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