summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-29 18:30:25 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-08-29 18:30:25 +0000
commit4eb0c37f3c4c9bc545a37afcbfdd0493df29de28 (patch)
tree61e0caaaba6a9bab1431ec1be4e9cf103f2a17ee /src/map/pc.c
parentad8fe4131ee71b832d9cf5c75997705ff0f9770a (diff)
downloadhercules-4eb0c37f3c4c9bc545a37afcbfdd0493df29de28.tar.gz
hercules-4eb0c37f3c4c9bc545a37afcbfdd0493df29de28.tar.bz2
hercules-4eb0c37f3c4c9bc545a37afcbfdd0493df29de28.tar.xz
hercules-4eb0c37f3c4c9bc545a37afcbfdd0493df29de28.zip
- Added bonus bSkillHeal to distinguish offensive skill damage increases from healing power boosts.
- Moved battle_skillatk_bonus to pc.c, cleaned up the related skillatk bonus code to consider the skillheal bonus option. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11085 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c44
1 files changed, 41 insertions, 3 deletions
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);