From 0da05e29c37b0f2a12fd29b8f59f900c7b0ebd90 Mon Sep 17 00:00:00 2001 From: Aleos Date: Thu, 10 Sep 2020 10:27:04 -0400 Subject: [PATCH] Corrected some statuses and Mado Gear interaction (#3782) * Follow up to 0d81697. * Added a separate check for Mado Gear and blocking Merchant/Blacksmith/Whitesmith specific statuses. * Harmonized the statuses with the new allowed skill list. Thanks to @slyx88! --- src/map/pc.cpp | 8 +++----- src/map/status.cpp | 30 ++++++++++++++++-------------- src/map/status.hpp | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 2c55eb7830..ec0a859847 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -9560,14 +9560,12 @@ void pc_setoption(struct map_session_data *sd,int type) } if( (sd->class_&MAPID_THIRDMASK) == MAPID_MECHANIC ) { if( type&OPTION_MADOGEAR && !(p_type&OPTION_MADOGEAR) ) { - static const sc_type statuses [] = { SC_MAXIMIZEPOWER, SC_OVERTHRUST, SC_WEAPONPERFECTION, SC_ADRENALINE, SC_CARTBOOST, SC_MELTDOWN, SC_MAXOVERTHRUST }; - status_calc_pc(sd,SCO_NONE); - for (uint8 i = 0; i < ARRAYLENGTH(statuses); i++) { - int skill_id = status_sc2skill(statuses[i]); + for (const auto &sc : mado_statuses) { + uint16 skill_id = status_sc2skill(sc); if (skill_id > 0 && !skill_get_inf2(skill_id, INF2_ALLOWONMADO)) - status_change_end(&sd->bl,statuses[i],INVALID_TIMER); + status_change_end(&sd->bl,sc,INVALID_TIMER); } pc_bonus_script_clear(sd,BSF_REM_ON_MADOGEAR); diff --git a/src/map/status.cpp b/src/map/status.cpp index 17b116d511..39081687fe 100644 --- a/src/map/status.cpp +++ b/src/map/status.cpp @@ -9223,6 +9223,19 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty } } + // Statuses from Merchant family skills that can be blocked while using Madogear; see pc.cpp::pc_setoption for cancellation + if (sc->option & OPTION_MADOGEAR) { + for (const auto &madosc : mado_statuses) { + if (type != madosc) + continue; + + uint16 skill_id = status_sc2skill(type); + + if (skill_id > 0 && !skill_get_inf2(skill_id, INF2_ALLOWONMADO)) + return 0; + } + } + // Adjust tick according to status resistances if( !(flag&(SCSTART_NOAVOID|SCSTART_LOADED)) ) { duration = status_get_sc_def(src, bl, type, rate, duration, flag); @@ -9341,21 +9354,10 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty case SC_OVERTHRUST: if (sc->data[SC_MAXOVERTHRUST]) return 0; // Overthrust can't take effect if under Max Overthrust. [Skotlex] - case SC_MAXOVERTHRUST: - if( sc->option&OPTION_MADOGEAR ) - return 0; // Overthrust and Overthrust Max cannot be used on Mado Gear [Ind] break; case SC_ADRENALINE: - if (sc->data[SC_QUAGMIRE] || - sc->data[SC_DECREASEAGI] || - sc->option&OPTION_MADOGEAR // Adrenaline doesn't affect Mado Gear [Ind] - ) - return 0; - break; case SC_ADRENALINE2: - if (sc->data[SC_QUAGMIRE] || - sc->data[SC_DECREASEAGI] - ) + if (sc->data[SC_QUAGMIRE] || sc->data[SC_DECREASEAGI]) return 0; break; case SC_MAGNIFICAT: @@ -9372,10 +9374,10 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty case SC_SPEARQUICKEN: case SC_TRUESIGHT: case SC_WINDWALK: - case SC_CARTBOOST: case SC_ASSNCROS: if (sc->option&OPTION_MADOGEAR) - return 0; // Mado is immune to Wind Walk, Cart Boost, etc (others above) [Ind] + return 0; // Mado is immune to the above [Ind] + case SC_CARTBOOST: if (sc->data[SC_QUAGMIRE]) return 0; break; diff --git a/src/map/status.hpp b/src/map/status.hpp index 9da276c45a..8367d76bc5 100644 --- a/src/map/status.hpp +++ b/src/map/status.hpp @@ -4,6 +4,8 @@ #ifndef STATUS_HPP #define STATUS_HPP +#include + #include "../common/database.hpp" #include "../common/mmo.hpp" #include "../common/timer.hpp" @@ -2603,6 +2605,19 @@ struct status_change { struct status_change_entry *data[SC_MAX]; }; +/// Statuses that are cancelled/disabled while on Madogear +static const std::vector mado_statuses = { + SC_LOUD, + SC_CARTBOOST, + SC_MELTDOWN, + SC_ADRENALINE, + SC_ADRENALINE2, + SC_WEAPONPERFECTION, + SC_MAXIMIZEPOWER, + SC_OVERTHRUST, + SC_MAXOVERTHRUST +}; + // for looking up associated data sc_type status_skill2sc(int skill); int status_sc2skill(sc_type sc);