summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorL0ne_W0lf <L0ne_W0lf@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-08-18 19:24:27 +0000
committerL0ne_W0lf <L0ne_W0lf@54d463be-8e91-2dee-dedb-b68131a5f0ec>2010-08-18 19:24:27 +0000
commit480fd5dec044c10579f0e9b5b24ce92a5b38fc7d (patch)
tree7255c561a69e2f7055c5b88b352d79df56bbbc38 /src/map/pc.c
parentc024c27068518fef269dc9dbe5c1d01a0b50d963 (diff)
downloadhercules-480fd5dec044c10579f0e9b5b24ce92a5b38fc7d.tar.gz
hercules-480fd5dec044c10579f0e9b5b24ce92a5b38fc7d.tar.bz2
hercules-480fd5dec044c10579f0e9b5b24ce92a5b38fc7d.tar.xz
hercules-480fd5dec044c10579f0e9b5b24ce92a5b38fc7d.zip
* Added bonus3 bAdd/SubEle, which allows you to specify a battle flag as well! Dun dun dun!
- The bonuses are addititive to existing bAdd/SubEles, as that's how it appears to work. - Updated Asprika to use new bonus3 bSubEle. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14381 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 04027c42d..70a433c0e 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1729,6 +1729,71 @@ int pc_endautobonus(int tid, unsigned int tick, int id, intptr data)
return 0;
}
+int pc_bonus_addele(struct map_session_data* sd, unsigned char ele, short rate, short flag)
+{
+ int i;
+ struct weapon_data* wd;
+
+ wd = (sd->state.lr_flag ? &sd->left_weapon : &sd->right_weapon);
+
+ ARR_FIND(0, MAX_PC_BONUS, i, wd->addele2[i].rate == 0);
+
+ if (i == MAX_PC_BONUS)
+ {
+ ShowWarning("pc_addele: Reached max (%d) possible bonuses for this player.\n", MAX_PC_BONUS);
+ return 0;
+ }
+
+ if (!(flag&BF_RANGEMASK))
+ flag |= BF_SHORT|BF_LONG;
+ if (!(flag&BF_WEAPONMASK))
+ flag |= BF_WEAPON;
+ if (!(flag&BF_SKILLMASK))
+ {
+ if (flag&(BF_MAGIC|BF_MISC))
+ flag |= BF_SKILL;
+ if (flag&BF_WEAPON)
+ flag |= BF_NORMAL|BF_SKILL;
+ }
+
+ wd->addele2[i].ele = ele;
+ wd->addele2[i].rate = rate;
+ wd->addele2[i].flag = flag;
+
+ return 0;
+}
+
+int pc_bonus_subele(struct map_session_data* sd, unsigned char ele, short rate, short flag)
+{
+ int i;
+
+ ARR_FIND(0, MAX_PC_BONUS, i, sd->subele2[i].rate == 0);
+
+ if (i == MAX_PC_BONUS)
+ {
+ ShowWarning("pc_subele: Reached max (%d) possible bonuses for this player.\n", MAX_PC_BONUS);
+ return 0;
+ }
+
+ if (!(flag&BF_RANGEMASK))
+ flag |= BF_SHORT|BF_LONG;
+ if (!(flag&BF_WEAPONMASK))
+ flag |= BF_WEAPON;
+ if (!(flag&BF_SKILLMASK))
+ {
+ if (flag&(BF_MAGIC|BF_MISC))
+ flag |= BF_SKILL;
+ if (flag&BF_WEAPON)
+ flag |= BF_NORMAL|BF_SKILL;
+ }
+
+ sd->subele2[i].ele = ele;
+ sd->subele2[i].rate = rate;
+ sd->subele2[i].flag = flag;
+
+ return 0;
+}
+
/*==========================================
* ? 備品による能力等のボ?ナス設定
*------------------------------------------*/
@@ -2856,6 +2921,24 @@ int pc_bonus3(struct map_session_data *sd,int type,int type2,int type3,int val)
if( sd->state.lr_flag != 2 )
pc_bonus_addeff_onskill(sd->addeff3, ARRAYLENGTH(sd->addeff3), (sc_type)type3, val, type2, 2);
break;
+
+ case SP_ADDELE:
+ if (type2 > ELE_MAX) {
+ ShowWarning("pc_bonus3 (SP_ADDELE): element %d is out of range.\n", type2);
+ break;
+ }
+ if (sd->state.lr_flag != 2)
+ pc_bonus_addele(sd, (unsigned char)type2, type3, val);
+ break;
+
+ case SP_SUBELE:
+ if (type2 > ELE_MAX) {
+ ShowWarning("pc_bonus3 (SP_SUBELE): element %d is out of range.\n", type2);
+ break;
+ }
+ if (sd->state.lr_flag != 2)
+ pc_bonus_subele(sd, (unsigned char)type2, type3, val);
+ break;
default:
ShowWarning("pc_bonus3: unknown type %d %d %d %d!\n",type,type2,type3,val);