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:
parent
42810ad44a
commit
ed83999de4
@ -654,7 +654,7 @@
|
||||
1291,Guillotine_Katar,Guillotine Katar,5,56000,,1500,200,,1,1,0x00001000,63,2,34,4,140,1,16,{ bonus bDex,2; bonus bFlee,-30; bonus2 bAddRace,RC_DemiHuman,50; bonus2 bAddRace,RC_Player,50; bonus2 bSkillAtk,"GC_CROSSIMPACT",30; },{},{}
|
||||
1292,Upg_Katar,Upg Katar,5,20,,1000,80,,1,1,0x00001000,63,2,34,3,1,1,16,{ .@r = getrefine(); bonus bBaseAtk,(.@r*10); bonus bCritAtkRate,(.@r*2); if(BaseLevel>70) bonus bBaseAtk,(((BaseLevel-70)/10)*10); },{},{}
|
||||
1293,Velum_Jamadhar,Vellum Jamadhar,5,20,,1200,170,,1,0,0x00001000,63,2,34,4,95,1,16,{ bonus4 bSetDefRace,RC_Player,10000,5000,1; bonus4 bSetMDefRace,RC_Player,10000,5000,1; bonus bAspdRate,getrefine(); },{},{}
|
||||
1294,Velum_Scare,Vellum Scale,5,20,,1200,50,,1,0,0x00001000,63,2,34,4,95,1,16,{ bonus3 bSPVanishRaceRate,RC_Player,10000,10; },{},{}
|
||||
1294,Velum_Scare,Vellum Scale,5,20,,1200,50,,1,0,0x00001000,63,2,34,4,95,1,16,{ bonus3 bSPVanishRaceRate,RC_Player,1000,10; },{},{}
|
||||
1295,Blood_Tears_,Blood Tears,5,20,,1700,120,,1,3,0x00001000,18,2,34,4,55,1,16,{ bonus3 bAutoSpell,"NPC_WIDEBLEEDING",(getrefine()>=9?2:1),30; },{},{}
|
||||
1296,Metal_Katar,Metal Katar,5,20,,0,75,,1,1,0x00001000,63,2,34,3,1,1,16,{ .@r = getrefine(); bonus bBaseAtk,(.@r*5); bonus bCritAtkRate,.@r; .@i = min(BaseLevel/10,12); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
|
||||
1297,Inverse_Scale_,Inverse Scale,5,20,,1500,140,,1,2,0x00001000,18,2,34,4,55,1,16,{ bonus bAtkEle,Ele_Holy; bonus3 bAutoSpell,"NPC_DRAGONFEAR",1,30; },{},{}
|
||||
@ -734,7 +734,7 @@
|
||||
1392,Ygnus_Stale,Ignus Steel,5,56000,,1900,250,,1,1,0x000444A2,63,2,34,4,95,1,7,{ bonus bAtkEle,Ele_Fire; bonus bUnbreakableWeapon; bonus2 bAddEff,Eff_Burning,300; bonus2 bAddEff2,Eff_Burning,300; },{},{}
|
||||
1393,End_Sektura,End Sectora,5,56000,,1900,250,,1,1,0x000444A2,63,2,34,4,95,1,7,{ bonus bAtkEle,Ele_Water; bonus bUnbreakableWeapon; bonus2 bAddEff,Eff_Crystalize,300; bonus2 bAddEff2,Eff_Crystalize,300; },{},{}
|
||||
1394,Upg_Two_Handed_Axe,Upg Two Handed Axe,5,20,,2000,110,,1,1,0x000444A2,63,2,34,3,1,1,7,{ bonus bBaseAtk,(getrefine()*14); if(BaseLevel>70) bonus bBaseAtk,(((BaseLevel-70)/10)*10); },{},{}
|
||||
1395,Velum_Buster,Vellum Buster,5,20,,2500,50,,1,0,0x000444A2,63,2,34,4,95,1,7,{ bonus bUnbreakableWeapon; bonus3 bSPVanishRaceRate,RC_Player,10000,10; },{},{}
|
||||
1395,Velum_Buster,Vellum Buster,5,20,,2500,50,,1,0,0x000444A2,63,2,34,4,95,1,7,{ bonus bUnbreakableWeapon; bonus3 bSPVanishRaceRate,RC_Player,1000,10; },{},{}
|
||||
1396,Velum_Guillotine,Vellum Guillotine,5,20,,5500,300,,1,0,0x000444A2,63,2,34,4,95,1,7,{ bonus bUnbreakableWeapon; bonus2 bAddRace,RC_Player,40; bonus2 bIgnoreDefRaceRate,RC_Player,30; .@r = getrefine(); if(.@r>=6) { bonus2 bSkillAtk,"NC_AXEBOOMERANG",80; bonus2 bSkillAtk,"NC_POWERSWING",80; } if(.@r>=9) { bonus2 bAddRace,RC_Player,60; } },{},{}
|
||||
1397,Bradium_Stonehammer_,Bradium Stonehammer,5,20,,2700,210,,1,2,0x000444A2,63,2,34,4,75,1,7,{ bonus bUnbreakableWeapon; },{},{}
|
||||
1398,Metal_Two_Handed_Axe,Metal Two Handed Axe,5,20,,0,105,,1,1,0x000444A2,63,2,34,3,1,1,7,{ bonus bUnbreakableWeapon; bonus bBaseAtk,(getrefine()*7); .@i = min(BaseLevel/10,12); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
|
||||
@ -1012,7 +1012,7 @@
|
||||
1658,P_Staff3,Eden Staff III,5,0,,0,60:170,,1,0,0x00818314,63,2,2,3,60,0,10,{ bonus bInt,4; },{},{}
|
||||
1659,Recovery_Light,Light of Recovery,5,56000,,400,30:160,,1,1,0x00000100,63,2,2,4,110,1,10,{ bonus bAtkEle,Ele_Holy; bonus bUnbreakableWeapon; .@r = getrefine(); bonus bHealPower,(.@r*6); bonus2 bSkillUseSP,"AL_HEAL",-(.@r*10); bonus2 bSkillUseSP,"AB_CHEAL",-(.@r*12); bonus2 bSkillUseSP,"AB_HIGHNESSHEAL",-(.@r*14); },{},{}
|
||||
1660,Wand_Of_Affection2,Empowered Wand Of Affection,5,20,,500,30:180,,1,1,0x00000100,63,2,2,3,130,1,10,{ bonus bAtkEle,Ele_Holy; bonus bInt,4; bonus bHealPower,20; },{},{}
|
||||
1661,Mental_Destroyer,Mental Destroyer,5,20,,1400,100:50,,1,0,0x00000200,63,2,2,4,95,1,10,{ bonus bInt,10; bonus bUnbreakableWeapon; bonus bUseSPrate,100; bonus bMdef,20; bonus2 bSPVanishRate,10000,5; if(getrefine()>5) { bonus2 bSPVanishRate,10000,5; } },{},{}
|
||||
1661,Mental_Destroyer,Mental Destroyer,5,20,,1400,100:50,,1,0,0x00000200,63,2,2,4,95,1,10,{ .@r = getrefine(); bonus bInt,10; bonus bUnbreakableWeapon; bonus bUseSPrate,100; bonus bMdef,20; bonus3 bSPVanishRate,1000,5+(.@r>5?3:0),BF_NORMAL|BF_SKILL; },{},{}
|
||||
1662,Bone_Wand_,Evil Bone Wand,5,20,,700,40:110,,1,2,0x00818314,63,2,2,3,24,1,10,{ bonus bInt,4; bonus bAtkEle,Ele_Undead; },{},{}
|
||||
1663,Staff_Of_Bordeaux_,Staff Of Bordeaux,5,20,,500,30:180,,1,2,0x00010200,18,2,2,4,50,1,10,{ bonus bInt,2; bonus bDex,1; if(getskilllv("SA_DRAGONOLOGY") == 5) { bonus bUseSPrate,-15; bonus bInt,3; } },{},{}
|
||||
1664,Thorn_Staff_,Thorn Staff of Darkness,5,10,,700,60:160,,,1,0x14,50,2,2,4,75,1,8,{ bonus bInt,3; bonus bDex,3; bonus bVariableCastrate,-getrefine(); bonus bAtkEle,Ele_Dark; },{},{}
|
||||
@ -9537,7 +9537,7 @@
|
||||
18110,Big_CrossBow,Giant Crossbow,5,56000,,900,160,,5,2,0x00000800,63,2,34,4,110,1,11,{ .@r = getrefine(); bonus2 bSkillAtk,"RA_ARROWSTORM",(.@r*5); bonus2 bSkillUseSP,"RA_ARROWSTORM",-(.@r*5); if(readparam(bAgi)>=120){ bonus bAspd,1; } },{},{}
|
||||
18111,Creeper_Bow,Creeper Bow,5,56000,,1500,150,,5,2,0x00080800,63,2,34,3,120,1,11,{ bonus bDex,1; bonus3 bAutoSpell,"PF_SPIDERWEB",1,200; },{},{}
|
||||
18112,Upg_Bow,Upg Bow,5,20,,600,60,,5,1,0x000A0848,63,2,34,3,1,1,11,{ .@r = getrefine(); bonus bBaseAtk,(.@r*7); bonus bLongAtkRate,(.@r*2); if(BaseJob==Job_Hunter) bonus bBaseAtk,20; if(BaseLevel>70) bonus bBaseAtk,(((BaseLevel-70)/10)*10); },{},{}
|
||||
18113,Velum_Arbalest,Vellum Arbalest,5,20,,1100,50,,5,0,0x000A0848,63,2,34,4,95,1,11,{ bonus3 bSPVanishRaceRate,RC_Player,10000,4; bonus bAspd,-5; },{},{}
|
||||
18113,Velum_Arbalest,Vellum Arbalest,5,20,,1100,50,,5,0,0x000A0848,63,2,34,4,95,1,11,{ bonus3 bSPVanishRaceRate,RC_Player,1000,4; bonus bAspd,-5; },{},{}
|
||||
18114,Velum_CrossBow,Vellum CrossBow,5,20,,1100,110,,5,0,0x000A0848,63,2,34,4,95,1,11,{ bonus2 bAddRace,RC_Player,30+getrefine(); bonus2 bIgnoreDefRaceRate,RC_Player,30; },{},{}
|
||||
18115,Orc_Archer_Bow_,Orc Archer Bow,5,20,,1600,120,,5,1,0x000A0848,63,2,34,3,65,1,11,{},{},{}
|
||||
18116,Metal_Bow,Metal Bow,5,20,,0,50,,5,1,0x00080800,63,2,34,3,1,1,11,{ .@r = getrefine(); if(BaseJob==Job_Hunter && Upper!=2) bonus bBaseAtk,10; bonus bBaseAtk,(.@r*3); bonus bLongAtkRate,.@r; .@i = min(BaseLevel/10,12); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
|
||||
@ -10992,7 +10992,7 @@
|
||||
//===================================================================
|
||||
21000,Upg_Twohand_Sword,Upg Two-Handed Sword,5,20,,1500,100,,1,1,0x00004082,63,2,34,3,1,1,3,{ .@r = getrefine(); bonus bBaseAtk,(.@r*12); bonus bMatk,(.@r*5); if(BaseLevel>70) bonus bBaseAtk,(((BaseLevel-70)/10)*10); },{},{}
|
||||
21001,Velum_Claymore,Vellum Claymore,5,20,,3500,260,,1,0,0x00004082,63,2,34,4,95,1,3,{ bonus2 bAddRace,RC_Player,80; bonus2 bIgnoreDefRaceRate,RC_Player,30; .@r = getrefine(); if(.@r>=6) { bonus2 bAddRace,RC_Player,40; } if(.@r>=9) { autobonus2 "{ bonus bShortWeaponDamageReturn,20; bonus bMagicDamageReturn,20; }",6000,2000,BF_WEAPON,"{ specialeffect2 EF_REFLECTSHIELD; }"; } },{},{}
|
||||
21002,Velum_Katzbalger,Vellum Katzbalger,5,20,,2500,100,,1,0,0x00004082,63,2,34,4,95,1,3,{ bonus3 bHPVanishRaceRate,RC_Player,10000,8; },{},{}
|
||||
21002,Velum_Katzbalger,Vellum Katzbalger,5,20,,2500,100,,1,0,0x00004082,63,2,34,4,95,1,3,{ bonus3 bHPVanishRaceRate,RC_Player,1000,8; },{},{}
|
||||
21003,Muramasa_,Muramasa,5,20,,1000,155,,1,2,0x00004082,63,2,34,4,48,1,3,{ bonus bCritical,30; bonus bAspdRate,8; bonus2 bAddEff2,Eff_Curse,10; },{},{}
|
||||
21004,Alca_Bringer_,Alca Bringer,5,20,,3400,280,,2,2,0x00004082,63,2,34,3,100,1,3,{},{},{}
|
||||
21005,Metal_Two_Hand_Sword,Metal Two Hand Sword,5,20,,0,95,,1,1,0x00004082,63,2,34,3,1,1,3,{ .@r = getrefine(); bonus bBaseAtk,(.@r*6); bonus bMatk,(.@r*2); .@i = min(BaseLevel/10,12); if(.@i>2) bonus bBaseAtk,((.@i-2)*5); },{},{}
|
||||
|
@ -374,11 +374,13 @@ bonus2 bSPDrainRate,x,n; Adds a x/10% chance to drain n% SP from inflicted dama
|
||||
|
||||
HP/SP vanish
|
||||
------------
|
||||
bonus2 bHPVanishRate,x,n; Add a x/10% chance of decreasing enemy's HP amount by n% when attacking
|
||||
bonus2 bSPVanishRate,x,n; Add a x/10% chance of decreasing enemy's SP amount by n% when attacking
|
||||
bonus2 bHPVanishRate,x,n; Add a x/10% chance of decreasing enemy's HP amount by n% with a normal attack
|
||||
bonus3 bHPVanishRaceRate,r,x,n; Add a x/10% chance of decreasing enemy's HP amount by n% when attacking, depends on enemy race r
|
||||
bonus3 bHPVanishRate,x,n,bf; Add a x/10% chance of decreasing enemy's HP amount by n% when attacking with trigger criteria bf
|
||||
|
||||
bonus3 bHPVanishRaceRate,r,x,n; Add a x/100% chance of decreasing enemy's HP amount by n% when attacking, depends on enemy race r
|
||||
bonus3 bSPVanishRaceRate,r,x,n; Add a x/100% chance of decreasing enemy's SP amount by n% when attacking, depends on enemy race r
|
||||
bonus2 bSPVanishRate,x,n; Add a x/10% chance of decreasing enemy's SP amount by n% with a normal attack
|
||||
bonus3 bSPVanishRaceRate,r,x,n; Add a x/10% chance of decreasing enemy's SP amount by n% when attacking, depends on enemy race r
|
||||
bonus3 bSPVanishRate,x,n,bf; Add a x/10% chance of decreasing enemy's SP amount by n% when attacking with trigger criteria bf
|
||||
|
||||
bonus3 bStateNoRecoverRace,r,x,t; Set a no recovery state of an enemy of race r at x/100% for t milliseconds with normal attack.
|
||||
|
||||
|
@ -5201,7 +5201,7 @@ static struct Damage initialize_weapon_data(struct block_list *src, struct block
|
||||
wd.miscflag = wflag;
|
||||
wd.flag = BF_WEAPON; //Initial Flag
|
||||
wd.flag |= (skill_id||wd.miscflag)?BF_SKILL:BF_NORMAL; // Baphomet card's splash damage is counted as a skill. [Inkfish]
|
||||
|
||||
wd.isspdamage = false;
|
||||
wd.damage = wd.damage2 =
|
||||
#ifdef RENEWAL
|
||||
wd.statusAtk = wd.statusAtk2 = wd.equipAtk = wd.equipAtk2 = wd.weaponAtk = wd.weaponAtk2 = wd.masteryAtk = wd.masteryAtk2 =
|
||||
@ -6798,6 +6798,34 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
||||
return md;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate vanish damage on a target
|
||||
* @param sd: Player with vanish item
|
||||
* @param target: Target to vanish HP/SP
|
||||
* @param flag: Damage struct battle flag
|
||||
*/
|
||||
void battle_vanish_damage(struct map_session_data *sd, struct block_list *target, int flag)
|
||||
{
|
||||
nullpo_retv(sd);
|
||||
nullpo_retv(target);
|
||||
|
||||
// bHPVanishRate
|
||||
int16 vanish_rate_hp = cap_value(sd->bonus.hp_vanish_rate, 0, INT16_MAX);
|
||||
int8 vanish_hp = cap_value(sd->bonus.hp_vanish_per, INT8_MIN, INT8_MAX);
|
||||
// bSPVanishRate
|
||||
int16 vanish_rate_sp = cap_value(sd->bonus.sp_vanish_rate, 0, INT16_MAX);
|
||||
int8 vanish_sp = cap_value(sd->bonus.sp_vanish_per, INT8_MIN, INT8_MAX);
|
||||
|
||||
if (vanish_hp && !(vanish_rate_hp && sd->bonus.hp_vanish_flag & flag && (vanish_rate_hp >= 1000 || rnd() % 1000 < vanish_rate_hp)))
|
||||
vanish_hp = 0;
|
||||
|
||||
if (vanish_sp && !(vanish_rate_sp && sd->bonus.sp_vanish_flag & flag && (vanish_rate_sp >= 1000 || rnd() % 1000 < vanish_rate_sp)))
|
||||
vanish_sp = 0;
|
||||
|
||||
if (vanish_hp > 0 || vanish_sp > 0)
|
||||
status_percent_damage(&sd->bl, target, -vanish_hp, -vanish_sp, false); // Damage HP/SP applied once
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Battle main entry, from skill_attack
|
||||
*------------------------------------------
|
||||
@ -6828,6 +6856,12 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
|
||||
}
|
||||
else // Some skills like Weaponry Research will cause damage even if attack is dodged
|
||||
d.dmg_lv = ATK_DEF;
|
||||
|
||||
struct map_session_data *sd = BL_CAST(BL_PC, bl);
|
||||
|
||||
if (sd && d.damage + d.damage2 > 1)
|
||||
battle_vanish_damage(sd, target, d.flag);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
@ -6935,69 +6969,39 @@ int64 battle_calc_return_damage(struct block_list* bl, struct block_list *src, i
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate vanish from target
|
||||
* Calculate Vellum damage on a target
|
||||
* @param sd: Player with vanish item
|
||||
* @param target: Target to vanish HP/SP
|
||||
* @param wd: Reference to Damage struct
|
||||
* @param wd: Damage struct reference
|
||||
* @return True on damage done or false if not
|
||||
*/
|
||||
bool battle_vanish(struct map_session_data *sd, struct block_list *target, struct Damage *wd)
|
||||
bool battle_vellum_damage(struct map_session_data *sd, struct block_list *target, struct Damage *wd)
|
||||
{
|
||||
struct status_data *tstatus;
|
||||
int race;
|
||||
|
||||
nullpo_retr(false, sd);
|
||||
nullpo_retr(false, target);
|
||||
nullpo_retr(false, wd);
|
||||
|
||||
tstatus = status_get_status_data(target);
|
||||
race = status_get_race(target);
|
||||
wd->isspdamage = false;
|
||||
|
||||
if (wd->flag) {
|
||||
// bHPVanishRaceRate
|
||||
short vellum_rate_hp = cap_value(sd->hp_vanish_race[race].rate + sd->hp_vanish_race[RC_ALL].rate, 0, SHRT_MAX);
|
||||
short vellum_hp = cap_value(sd->hp_vanish_race[race].per + sd->hp_vanish_race[RC_ALL].per, SHRT_MIN, SHRT_MAX);
|
||||
|
||||
// bSPVanishRaceRate
|
||||
short vellum_rate_sp = cap_value(sd->sp_vanish_race[race].rate + sd->sp_vanish_race[RC_ALL].rate, 0, SHRT_MAX);
|
||||
short vellum_sp = cap_value(sd->sp_vanish_race[race].per + sd->sp_vanish_race[RC_ALL].per, SHRT_MIN, SHRT_MAX);
|
||||
|
||||
// The HP and SP vanish bonus from these items can't stack because of the special damage display.
|
||||
if (vellum_hp && vellum_rate_hp && (vellum_rate_hp >= 10000 || rnd()%10000 < vellum_rate_hp)) {
|
||||
wd->damage = apply_rate(tstatus->max_hp, vellum_hp);
|
||||
wd->damage2 = 0;
|
||||
} else if (vellum_sp && vellum_rate_sp && (vellum_rate_sp >= 10000 || rnd()%10000 < vellum_rate_sp)) {
|
||||
wd->damage = apply_rate(tstatus->max_sp, vellum_sp);
|
||||
wd->damage2 = 0;
|
||||
wd->isspdamage = true;
|
||||
} else // No damage
|
||||
return false;
|
||||
|
||||
return true;
|
||||
} else {
|
||||
// bHPVanishRate
|
||||
short vrate_hp = cap_value(sd->bonus.hp_vanish_rate * 10, 0, SHRT_MAX);
|
||||
short v_hp = cap_value(sd->bonus.hp_vanish_per, SHRT_MIN, SHRT_MAX);
|
||||
|
||||
// bSPVanishRate
|
||||
short vrate_sp = cap_value(sd->bonus.sp_vanish_rate * 10, 0, SHRT_MAX);
|
||||
short v_sp = cap_value(sd->bonus.sp_vanish_per + sd->sp_vanish_race[race].per + sd->sp_vanish_race[RC_ALL].per, SHRT_MIN, SHRT_MAX);
|
||||
|
||||
if (v_hp && vrate_hp && (vrate_hp >= 10000 || rnd()%10000 < vrate_hp))
|
||||
v_hp = -v_hp;
|
||||
else
|
||||
v_hp = 0;
|
||||
|
||||
if (v_sp && vrate_sp && (vrate_sp >= 10000 || rnd()%10000 < vrate_sp))
|
||||
v_sp = -v_sp;
|
||||
else
|
||||
v_sp = 0;
|
||||
|
||||
if ( v_hp < 0 || v_sp < 0 )
|
||||
status_percent_damage(&sd->bl, target, (int8)v_hp, (int8)v_sp, false);
|
||||
struct status_data *tstatus = status_get_status_data(target);
|
||||
// bHPVanishRaceRate
|
||||
int16 vellum_rate_hp = cap_value(sd->hp_vanish_race[tstatus->race].rate + sd->hp_vanish_race[RC_ALL].rate, 0, INT16_MAX);
|
||||
int8 vellum_hp = cap_value(sd->hp_vanish_race[tstatus->race].per + sd->hp_vanish_race[RC_ALL].per, INT8_MIN, INT8_MAX);
|
||||
// bSPVanishRaceRate
|
||||
int16 vellum_rate_sp = cap_value(sd->sp_vanish_race[tstatus->race].rate + sd->sp_vanish_race[RC_ALL].rate, 0, INT16_MAX);
|
||||
int8 vellum_sp = cap_value(sd->sp_vanish_race[tstatus->race].per + sd->sp_vanish_race[RC_ALL].per, INT8_MIN, INT8_MAX);
|
||||
|
||||
// The HP and SP damage bonus from these items don't stack because of the special damage display for SP.
|
||||
// Vellum damage overrides any other damage done as well.
|
||||
if (vellum_hp && vellum_rate_hp && (vellum_rate_hp >= 1000 || rnd() % 1000 < vellum_rate_hp)) {
|
||||
wd->damage = apply_rate(tstatus->max_hp, vellum_hp);
|
||||
wd->damage2 = 0;
|
||||
} else if (vellum_sp && vellum_rate_sp && (vellum_rate_sp >= 1000 || rnd() % 1000 < vellum_rate_sp)) {
|
||||
wd->damage = apply_rate(tstatus->max_sp, vellum_sp);
|
||||
wd->damage2 = 0;
|
||||
wd->isspdamage = true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*===========================================
|
||||
@ -7006,32 +7010,22 @@ bool battle_vanish(struct map_session_data *sd, struct block_list *target, struc
|
||||
void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_)
|
||||
{
|
||||
struct weapon_data *wd;
|
||||
struct Damage d;
|
||||
int64 *damage;
|
||||
int thp = 0, // HP gained
|
||||
tsp = 0, // SP gained
|
||||
//rhp = 0, // HP reduced from target
|
||||
//rsp = 0, // SP reduced from target
|
||||
hp = 0, sp = 0;
|
||||
uint8 i = 0;
|
||||
|
||||
if (!CHK_RACE(race) && !CHK_CLASS(class_))
|
||||
return;
|
||||
|
||||
memset(&d, 0, sizeof(d));
|
||||
|
||||
// Check for vanish HP/SP. !CHECKME: Which first, drain or vanish?
|
||||
battle_vanish(sd, tbl, &d);
|
||||
|
||||
// Check for drain HP/SP
|
||||
hp = sp = i = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
//First two iterations: Right hand
|
||||
if (i < 2) {
|
||||
wd = &sd->right_weapon;
|
||||
damage = &rdamage;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
wd = &sd->left_weapon;
|
||||
damage = &ldamage;
|
||||
}
|
||||
@ -7039,7 +7033,7 @@ void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rda
|
||||
if (*damage <= 0)
|
||||
continue;
|
||||
|
||||
if( i == 1 || i == 3 ) {
|
||||
if (i == 1 || i == 3) {
|
||||
hp = wd->hp_drain_class[class_] + wd->hp_drain_class[CLASS_ALL];
|
||||
hp += battle_calc_drain(*damage, wd->hp_drain_rate.rate, wd->hp_drain_rate.per);
|
||||
|
||||
@ -7126,7 +7120,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
int64 damage;
|
||||
int skillv;
|
||||
struct Damage wd;
|
||||
bool vanish_damage = false;
|
||||
bool vellum_damage = false;
|
||||
|
||||
nullpo_retr(ATK_NONE, src);
|
||||
nullpo_retr(ATK_NONE, target);
|
||||
@ -7297,19 +7291,18 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
}
|
||||
|
||||
wd = battle_calc_attack(BF_WEAPON, src, target, 0, 0, flag);
|
||||
wd.isspdamage = false; // Default normal attacks to non-SP Damage attack until battle_vanish is determined
|
||||
|
||||
if (sd && wd.damage + wd.damage2 > 0)
|
||||
vanish_damage = battle_vanish(sd, target, &wd);
|
||||
if (sd && wd.damage + wd.damage2 > 0 && battle_vellum_damage(sd, target, &wd))
|
||||
vellum_damage = true;
|
||||
|
||||
if( sc && sc->count ) {
|
||||
if (sc->data[SC_EXEEDBREAK]) {
|
||||
if (!is_infinite_defense(target, wd.flag) && !vanish_damage)
|
||||
if (!is_infinite_defense(target, wd.flag) && !vellum_damage)
|
||||
wd.damage *= sc->data[SC_EXEEDBREAK]->val2 / 100;
|
||||
status_change_end(src, SC_EXEEDBREAK, INVALID_TIMER);
|
||||
}
|
||||
if( sc->data[SC_SPELLFIST] ) {
|
||||
if( --(sc->data[SC_SPELLFIST]->val1) >= 0 && !vanish_damage ){
|
||||
if( --(sc->data[SC_SPELLFIST]->val1) >= 0 && !vellum_damage ){
|
||||
if (!is_infinite_defense(target, wd.flag)) {
|
||||
struct Damage ad = battle_calc_attack(BF_MAGIC, src, target, sc->data[SC_SPELLFIST]->val3, sc->data[SC_SPELLFIST]->val4, flag | BF_SHORT);
|
||||
|
||||
@ -7322,7 +7315,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
} else
|
||||
status_change_end(src,SC_SPELLFIST,INVALID_TIMER);
|
||||
}
|
||||
if (sc->data[SC_GIANTGROWTH] && (wd.flag&BF_SHORT) && rnd()%100 < sc->data[SC_GIANTGROWTH]->val2 && !is_infinite_defense(target, wd.flag) && !vanish_damage) {
|
||||
if (sc->data[SC_GIANTGROWTH] && (wd.flag&BF_SHORT) && rnd()%100 < sc->data[SC_GIANTGROWTH]->val2 && !is_infinite_defense(target, wd.flag) && !vellum_damage) {
|
||||
wd.damage <<= 1; // Double Damage
|
||||
skill_break_equip(src, src, EQP_WEAPON, 10, BCT_SELF); // Break chance happens on successful damage increase
|
||||
}
|
||||
@ -7371,7 +7364,7 @@ enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* t
|
||||
|
||||
map_freeblock_lock();
|
||||
|
||||
if( !(tsc && tsc->data[SC_DEVOTION]) && !vanish_damage && skill_check_shadowform(target, damage, wd.div_) ) {
|
||||
if( !(tsc && tsc->data[SC_DEVOTION]) && !vellum_damage && skill_check_shadowform(target, damage, wd.div_) ) {
|
||||
if( !status_isdead(target) )
|
||||
skill_additional_effect(src, target, 0, 0, wd.flag, wd.dmg_lv, tick);
|
||||
if( wd.dmg_lv > ATK_BLOCK )
|
||||
|
@ -91,7 +91,6 @@ struct Damage battle_calc_attack(int attack_type,struct block_list *bl,struct bl
|
||||
int64 battle_calc_return_damage(struct block_list *bl, struct block_list *src, int64 *, int flag, uint16 skill_id, bool status_reflect);
|
||||
|
||||
void battle_drain(struct map_session_data *sd, struct block_list *tbl, int64 rdamage, int64 ldamage, int race, int class_);
|
||||
bool battle_vanish(struct map_session_data *sd, struct block_list *target, struct Damage *wd);
|
||||
|
||||
int battle_attr_ratio(int atk_elem,int def_type, int def_lv);
|
||||
int64 battle_attr_fix(struct block_list *src, struct block_list *target, int64 damage,int atk_elem,int def_type, int def_lv);
|
||||
|
@ -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);
|
||||
|
@ -478,8 +478,9 @@ struct map_session_data {
|
||||
short add_steal_rate;
|
||||
int add_heal_rate, add_heal2_rate;
|
||||
int sp_gain_value, hp_gain_value, magic_sp_gain_value, magic_hp_gain_value;
|
||||
short sp_vanish_rate, hp_vanish_rate;
|
||||
short sp_vanish_per, hp_vanish_per;
|
||||
int sp_vanish_rate, hp_vanish_rate;
|
||||
int sp_vanish_per, hp_vanish_per;
|
||||
int sp_vanish_flag, hp_vanish_flag;
|
||||
unsigned short unbreakable; // chance to prevent ANY equipment breaking [celest]
|
||||
unsigned short unbreakable_equip; //100% break resistance on certain equipment
|
||||
unsigned short unstripable_equip;
|
||||
|
Loading…
x
Reference in New Issue
Block a user