summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c20
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/map.h7
-rw-r--r--src/map/pc.c44
-rw-r--r--src/map/pc.h3
-rw-r--r--src/map/skill.c23
6 files changed, 62 insertions, 37 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 93e2e98fb..3f9441aa4 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -824,20 +824,6 @@ static int battle_blewcount_bonus(struct map_session_data *sd, int skill_num)
return 0;
}
-int battle_skillatk_bonus(struct map_session_data *sd, int skill_num)
-{
- int i;
- if (!sd->skillatk[0].id)
- return 0;
- for (i = 0; i < MAX_PC_BONUS && sd->skillatk[i].id &&
- sd->skillatk[i].id != skill_num; i++);
-
- if (i < MAX_PC_BONUS && sd->skillatk[i].id)
- return sd->skillatk[i].val;
-
- return 0;
-}
-
struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);
struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag);
@@ -1637,7 +1623,7 @@ static struct Damage battle_calc_weapon_attack(
if(sd)
{
- if (skill_num && (i = battle_skillatk_bonus(sd, skill_num)))
+ if (skill_num && (i = pc_skillatk_bonus(sd, skill_num)))
ATK_ADDRATE(i);
if(skill_num != PA_SACRIFICE && skill_num != MO_INVESTIGATE &&
@@ -2334,7 +2320,7 @@ struct Damage battle_calc_magic_attack(
if(sd) {
//Damage bonuses
- if ((i = battle_skillatk_bonus(sd, skill_num)))
+ if ((i = pc_skillatk_bonus(sd, skill_num)))
ad.damage += ad.damage*i/100;
//Ignore Defense?
@@ -2631,7 +2617,7 @@ struct Damage battle_calc_misc_attack(
md.damage=md.damage*cardfix/10000;
}
- if (sd && (i = battle_skillatk_bonus(sd, skill_num)))
+ if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
md.damage += md.damage*i/100;
if(md.damage < 0)
diff --git a/src/map/battle.h b/src/map/battle.h
index 1bd781f2b..ca9563ce6 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -29,8 +29,6 @@ int battle_calc_return_damage(struct block_list *bl, int *damage, int direct, in
void battle_drain(struct map_session_data *sd, struct block_list *tbl, int rdamage, int ldamage, int race, int boss);
-int battle_skillatk_bonus(struct map_session_data *sd, int skill_num);
-
int battle_attr_fix(struct block_list *src, struct block_list *target, int damage,int atk_elem,int def_type, int def_lv);
// ダメージ最終計算
diff --git a/src/map/map.h b/src/map/map.h
index 4ec216a3e..c7a6556c5 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -670,9 +670,9 @@ struct map_session_data {
short id, rate, arrow_rate;
unsigned char flag;
} addeff[MAX_PC_BONUS], addeff2[MAX_PC_BONUS];
- struct { //skillatk raises bonus dmg% of skills, skillblown increases bonus blewcount for some skills.
+ struct { //skillatk raises bonus dmg% of skills, skillheal increases heal%, skillblown increases bonus blewcount for some skills.
short id, val;
- } skillatk[MAX_PC_BONUS], skillblown[MAX_PC_BONUS];
+ } skillatk[MAX_PC_BONUS], skillheal[5], skillblown[MAX_PC_BONUS];
struct {
short class_, rate;
} add_def[MAX_PC_BONUS], add_mdef[MAX_PC_BONUS],
@@ -1169,7 +1169,7 @@ enum _sp {
SP_ADDEFF, SP_RESEFF, // 1012-1013
SP_BASE_ATK,SP_ASPD_RATE,SP_HP_RECOV_RATE,SP_SP_RECOV_RATE,SP_SPEED_RATE, // 1014-1018
SP_CRITICAL_DEF,SP_NEAR_ATK_DEF,SP_LONG_ATK_DEF, // 1019-1021
- SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_FREE2, SP_MATK_RATE, // 1022-1025
+ SP_DOUBLE_RATE, SP_DOUBLE_ADD_RATE, SP_SKILL_HEAL, SP_MATK_RATE, // 1022-1025
SP_IGNORE_DEF_ELE,SP_IGNORE_DEF_RACE, // 1026-1027
SP_ATK_RATE,SP_SPEED_ADDRATE,SP_FREE3, // 1028-1030
SP_MAGIC_ATK_DEF,SP_MISC_ATK_DEF, // 1031-1032
@@ -1201,7 +1201,6 @@ enum _sp {
SP_INTRAVISION, SP_ADD_MONSTER_DROP_ITEMGROUP, SP_SP_LOSS_RATE, // 2038-2040
SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE //2041
//Before adding another, note that these are free:
- //1024 (SP_FREE2, previous matk)
//1030 (SP_FREE3, previous AspdAddRate)
//2022 (SP_FREE, previous bDefIgnoreMob)
};
diff --git a/src/map/pc.c b/src/map/pc.c
index d4fd5f94c..85ad38115 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -2209,10 +2209,26 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
case SP_SKILL_ATK:
if(sd->state.lr_flag == 2)
break;
- for (i = 0; i < MAX_PC_BONUS && sd->skillatk[i].id != 0 && sd->skillatk[i].id != type2; i++);
- if (i == MAX_PC_BONUS)
+ for (i = 0; i < ARRAYLENGTH(sd->skillatk) && sd->skillatk[i].id != 0 && sd->skillatk[i].id != type2; i++);
+ if (i == ARRAYLENGTH(sd->skillatk))
+ { //Better mention this so the array length can be updated. [Skotlex]
+ ShowDebug("run_script: bonus2 bSkillAtk reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillatk), type2, val);
+ break;
+ }
+ if (sd->skillatk[i].id == type2)
+ sd->skillatk[i].val += val;
+ else {
+ sd->skillatk[i].id = type2;
+ sd->skillatk[i].val = val;
+ }
+ break;
+ case SP_SKILL_HEAL:
+ if(sd->state.lr_flag == 2)
+ break;
+ for (i = 0; i < ARRAYLENGTH(sd->skillatk) && sd->skillatk[i].id != 0 && sd->skillatk[i].id != type2; i++);
+ if (i == ARRAYLENGTH(sd->skillatk))
{ //Better mention this so the array length can be updated. [Skotlex]
- ShowDebug("run_script: bonus2 bSkillAtk reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", MAX_PC_BONUS, type2, val);
+ ShowDebug("run_script: bonus2 bSkillAtk reached it's limit (%d skills per character), bonus skill %d (+%d%%) lost.\n", ARRAYLENGTH(sd->skillatk), type2, val);
break;
}
if (sd->skillatk[i].id == type2)
@@ -4792,6 +4808,28 @@ int pc_resethate(struct map_session_data* sd)
return 0;
}
+int pc_skillatk_bonus(struct map_session_data *sd, int skill_num)
+{
+ int i;
+ for (i = 0; i < ARRAYLENGTH(sd->skillatk) && sd->skillatk[i].id; i++)
+ {
+ if (sd->skillatk[i].id == skill_num)
+ return sd->skillatk[i].val;
+ }
+ return 0;
+}
+
+int pc_skillheal_bonus(struct map_session_data *sd, int skill_num)
+{
+ int i;
+ for (i = 0; i < ARRAYLENGTH(sd->skillheal) && sd->skillheal[i].id; i++)
+ {
+ if (sd->skillheal[i].id == skill_num)
+ return sd->skillheal[i].val;
+ }
+ return 0;
+}
+
static int pc_respawn(int tid,unsigned int tick,int id,int data)
{
struct map_session_data *sd = map_id2sd(id);
diff --git a/src/map/pc.h b/src/map/pc.h
index ae7aeeda5..bced5ec01 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -205,6 +205,9 @@ int pc_unequipitem(struct map_session_data*,int,int);
int pc_checkitem(struct map_session_data*);
int pc_useitem(struct map_session_data*,int);
+int pc_skillatk_bonus(struct map_session_data *sd, int skill_num);
+int pc_skillheal_bonus(struct map_session_data *sd, int skill_num);
+
void pc_damage(struct map_session_data *sd,struct block_list *src,unsigned int hp, unsigned int sp);
int pc_dead(struct map_session_data *sd,struct block_list *src);
void pc_revive(struct map_session_data *sd,unsigned int hp, unsigned int sp);
diff --git a/src/map/skill.c b/src/map/skill.c
index f35de5edd..339525d93 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -849,13 +849,8 @@ int skill_calc_heal (struct block_list *src, struct block_list *target, int skil
return battle_config.max_heal;
heal = ( status_get_lv(src)+status_get_int(src) )/8 *(4+ skill_lv*8);
- if(src->type == BL_PC)
- {
- if ((skill = pc_checkskill((TBL_PC*)src, HP_MEDITATIO)) > 0)
- heal += heal * skill * 2 / 100;
- if ((skill = battle_skillatk_bonus((TBL_PC*)src, AL_HEAL)) > 0)
- heal += heal * skill / 100;
- }
+ if(src->type == BL_PC && ((skill = pc_checkskill((TBL_PC*)src, HP_MEDITATIO)) > 0))
+ heal += heal * skill * 2 / 100;
if(src->type == BL_HOM && (skill = merc_hom_checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0)
heal += heal * skill * 2 / 100;
@@ -3450,6 +3445,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (status_isimmune(bl) || (dstmd && dstmd->class_ == MOBID_EMPERIUM))
heal=0;
if (sd) {
+ if ((i = pc_skillheal_bonus(sd, skillid)))
+ heal += heal * i / 100;
if (sd && dstsd && sd->status.partner_id == dstsd->status.char_id &&
(sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE && sd->status.sex == 0)
heal = heal*2;
@@ -4667,7 +4664,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
sp = sp * (100 + pc_checkskill(dstsd,MG_SRECOVERY)*10) / 100;
}
}
- if ((i = battle_skillatk_bonus(sd, skillid)) > 0)
+ if ((i = pc_skillheal_bonus(sd, skillid)))
{
hp += hp * i / 100;
sp += sp * i / 100;
@@ -5640,6 +5637,8 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
if (!bl) bl = src;
i = skill_calc_heal( src, bl, 1+rand()%skilllv);
+ if (sd && (rnd = pc_skillheal_bonus(sd, skillid)) > 0)
+ i += i * rnd / 100;
//Eh? why double skill packet?
clif_skill_nodamage(src,bl,AL_HEAL,i,1);
clif_skill_nodamage(src,bl,skillid,i,1);
@@ -6297,7 +6296,7 @@ int skill_castend_pos2 (struct block_list *src, int x, int y, int skillid, int s
i = pc_checkskill(sd,CR_SLIMPITCHER)*10
+ pc_checkskill(sd,AM_POTIONPITCHER)*10
+ pc_checkskill(sd,AM_LEARNINGPOTION)*5
- + battle_skillatk_bonus(sd, skillid);
+ + pc_skillheal_bonus(sd, skillid);
potion_hp = potion_hp * (100+i)/100;
potion_sp = potion_sp * (100+i)/100;
@@ -6703,8 +6702,6 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid,
case NPC_EVILLAND:
val1=(skilllv+3)*2;
val2=(skilllv>6)?(skillid == PR_SANCTUARY?777:666):skilllv*100;
- if (sd && (i = battle_skillatk_bonus(sd, skillid)) > 0)
- val2 += val2 * i / 100;
break;
case WZ_FIREPILLAR:
@@ -7272,6 +7269,8 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
int heal = sg->val2;
if (tstatus->hp >= tstatus->max_hp)
break;
+ if (sd && (type = pc_skillheal_bonus(sd, sg->skill_id)))
+ heal += heal * type / 100;
if (tsc && tsc->count && tsc->data[SC_CRITICALWOUND].timer!=-1)
heal -= heal * tsc->data[SC_CRITICALWOUND].val2 / 100;
if (status_isimmune(bl))
@@ -7450,6 +7449,8 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if (sg->src_id == bl->id)
break;
heal = sg->val2;
+ if (sd && (type = pc_skillheal_bonus(sd, sg->skill_id)))
+ heal += heal * type / 100;
if(tsc && tsc->count && tsc->data[SC_CRITICALWOUND].timer!=-1)
heal -= heal * tsc->data[SC_CRITICALWOUND].val2 / 100;
clif_skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);