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!
This commit is contained in:
Aleos 2020-09-10 10:27:04 -04:00 committed by GitHub
parent 634e1b3991
commit 0da05e29c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 19 deletions

View File

@ -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);

View File

@ -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;

View File

@ -4,6 +4,8 @@
#ifndef STATUS_HPP
#define STATUS_HPP
#include <vector>
#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<sc_type> 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);