Corrected Vellum and Vanish item bonuses (#4030)

* Fixes #4016.
* Cleaned up the way Vellum damage and Vanish damage are calculated.
* Implemented bonus3 bSPVanishRate/bHPVanishRate.
* Updated Mental Destroyer item bonus.
* Cleaned up and added documentation.
Thanks to @Balferian!
This commit is contained in:
Aleos
2019-03-23 15:02:49 -04:00
committed by GitHub
parent 42810ad44a
commit ed83999de4
6 changed files with 123 additions and 104 deletions

View File

@@ -2555,8 +2555,7 @@ bool pc_addautobonus(std::vector<s_autobonus> &bonus, const char *script, short
*/
void pc_delautobonus(struct map_session_data* sd, std::vector<s_autobonus> &bonus, bool restore)
{
if (!sd)
return;
nullpo_retv(sd);
std::vector<s_autobonus>::iterator it = bonus.begin();
@@ -2603,8 +2602,8 @@ void pc_delautobonus(struct map_session_data* sd, std::vector<s_autobonus> &bonu
*/
void pc_exeautobonus(struct map_session_data *sd, std::vector<s_autobonus> *bonus, struct s_autobonus *autobonus)
{
if (!sd || !autobonus)
return;
nullpo_retv(sd);
nullpo_retv(autobonus);
if (autobonus->active != INVALID_TIMER)
delete_timer(autobonus->active, pc_endautobonus);
@@ -2658,6 +2657,8 @@ TIMER_FUNC(pc_endautobonus){
*/
static void pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, short flag)
{
nullpo_retv(sd);
struct weapon_data *wd = (sd->state.lr_flag ? &sd->left_weapon : &sd->right_weapon);
if (wd->addele2.size() == MAX_PC_BONUS) {
@@ -2701,6 +2702,8 @@ static void pc_bonus_addele(struct map_session_data* sd, unsigned char ele, shor
*/
static void pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, short flag)
{
nullpo_retv(sd);
if (sd->subele2.size() == MAX_PC_BONUS) {
ShowWarning("pc_bonus_subele: Reached max (%d) number of resist element damage bonuses per character!\n", MAX_PC_BONUS);
return;
@@ -3575,12 +3578,14 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
if(sd->state.lr_flag != 2) {
sd->bonus.sp_vanish_rate += type2;
sd->bonus.sp_vanish_per += val;
sd->bonus.sp_vanish_flag = BF_WEAPON;
}
break;
case SP_HP_VANISH_RATE: // bonus2 bHPVanishRate,x,n;
if(sd->state.lr_flag != 2) {
sd->bonus.hp_vanish_rate += type2;
sd->bonus.hp_vanish_per += val;
sd->bonus.hp_vanish_flag = BF_WEAPON;
}
break;
case SP_GET_ZENY_NUM: // bonus2 bGetZenyNum,x,n;
@@ -3994,12 +3999,13 @@ void pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
}
/**
* Gives item bonus to player for format: bonus3 bBonusName,type2,val;
* @param sd
* @param type Bonus type used by bBonusName
* @param type2
* @param val Value that usually for rate or fixed value
*/
* Gives item bonus to player for format: bonus3 bBonusName,type2,type3,val;
* @param sd
* @param type Bonus type used by bBonusName
* @param type2
* @param type3
* @param val Value that usually for rate or fixed value
*/
void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
{
nullpo_retv(sd);
@@ -4086,6 +4092,23 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
sd->hp_vanish_race[type2].per += val;
}
break;
case SP_SP_VANISH_RATE: // bonus3 bSPVanishRate,x,n,bf;
if(sd->state.lr_flag != 2) {
sd->bonus.sp_vanish_rate += type2;
sd->bonus.sp_vanish_per += type3;
sd->bonus.sp_vanish_flag |= val;
}
break;
case SP_HP_VANISH_RATE: // bonus3 bHPVanishRate,x,n,bf;
if(sd->state.lr_flag != 2) {
sd->bonus.hp_vanish_rate += type2;
sd->bonus.hp_vanish_per += type3;
sd->bonus.hp_vanish_flag |= val;
}
break;
case SP_STATE_NORECOVER_RACE: // bonus3 bStateNoRecoverRace,r,x,t;
PC_BONUS_CHK_RACE(type2, SP_STATE_NORECOVER_RACE);
if (sd->state.lr_flag == 2)
@@ -4117,13 +4140,14 @@ void pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
}
/**
* Gives item bonus to player for format: bonus4 bBonusName,type2,type3,val;
* @param sd
* @param type Bonus type used by bBonusName
* @param type2
* @param type3
* @param val Value that usually for rate or fixed value
*/
* Gives item bonus to player for format: bonus4 bBonusName,type2,type3,type4,val;
* @param sd
* @param type Bonus type used by bBonusName
* @param type2
* @param type3
* @param type4
* @param val Value that usually for rate or fixed value
*/
void pc_bonus4(struct map_session_data *sd,int type,int type2,int type3,int type4,int val)
{
nullpo_retv(sd);