- Changed function itemdb_group to itemdb_group_bonus, it now calculates the total group bonuses of a player for a given item.
- Changed itemhealrate to itemgrouphealrate, added a structure itemhealrate to allow storing item-healing bonuses per item. - Modified bAddItemHealRate so it can receive both item-id and item-group values (since the first item-id is +500, there's no risk of mixing them up). git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8136 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
5ef4f71588
commit
04edacd3d9
@ -3,6 +3,9 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
2006/08/04
|
2006/08/04
|
||||||
|
* Modified bAddItemHealRate so it can receive both item-id and item-group
|
||||||
|
values (since the first item-id is +500, there's no risk of mixing them
|
||||||
|
up). [Skotlex]
|
||||||
* Removed settings enemy_critical_rate, homun_critical_rate. Added settings
|
* Removed settings enemy_critical_rate, homun_critical_rate. Added settings
|
||||||
enable_critical (defaults to specify only players), mob_critical_rate and
|
enable_critical (defaults to specify only players), mob_critical_rate and
|
||||||
critical_rate. The last applies to all non-mobs and non-players
|
critical_rate. The last applies to all non-mobs and non-players
|
||||||
|
@ -183,7 +183,9 @@ bonus4 bAutoSpellWhenHit,x,y,n,i; n/10% chance to cast skill x of level y when
|
|||||||
|
|
||||||
//---- 2/22 new card effects ----
|
//---- 2/22 new card effects ----
|
||||||
|
|
||||||
bonus2 bAddItemHealRate,n,x; Increases HP recovered by n type items by x%
|
bonus2 bAddItemHealRate,n,x; Increases HP recovered by n type items by x%,
|
||||||
|
you can also use direct item IDs instead
|
||||||
|
of group values.
|
||||||
(Check db/item_group_db.txt)
|
(Check db/item_group_db.txt)
|
||||||
|
|
||||||
//---- 3/15 new card effects ----
|
//---- 3/15 new card effects ----
|
||||||
|
@ -111,36 +111,25 @@ int itemdb_searchrandomid(int group)
|
|||||||
ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group);
|
ShowError("itemdb_searchrandomid: No item entries for group id %d\n", group);
|
||||||
return UNKNOWN_ITEM_ID;
|
return UNKNOWN_ITEM_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* Returns the group this item belongs to.
|
* Calculates total item-group related bonuses for the given item. [Skotlex]
|
||||||
* Skips general random item givers (gift/blue/violet box)
|
|
||||||
*------------------------------------------
|
*------------------------------------------
|
||||||
*/
|
*/
|
||||||
int itemdb_group (int nameid)
|
int itemdb_group_bonus(struct map_session_data *sd, int itemid)
|
||||||
{
|
{
|
||||||
int i, j;
|
int bonus = 0, i, j;
|
||||||
for (i=0; i < MAX_ITEMGROUP; i++) {
|
for (i=0; i < MAX_ITEMGROUP; i++) {
|
||||||
switch (i) {
|
if (!sd->itemgrouphealrate[i])
|
||||||
case IG_BLUEBOX:
|
continue;
|
||||||
case IG_VIOLETBOX:
|
|
||||||
case IG_CARDALBUM:
|
|
||||||
case IG_GIFTBOX:
|
|
||||||
case IG_COOKIEBAG:
|
|
||||||
case IG_GIFTBOX_1:
|
|
||||||
case IG_GIFTBOX_2:
|
|
||||||
case IG_GIFTBOX_3:
|
|
||||||
case IG_GIFTBOX_4:
|
|
||||||
case IG_GIFTBOXCHINA:
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j=0; j < itemgroup_db[i].qty; j++) {
|
for (j=0; j < itemgroup_db[i].qty; j++) {
|
||||||
if (itemgroup_db[i].id[j] == nameid)
|
if (itemgroup_db[i].id[j] == itemid)
|
||||||
return i;
|
{
|
||||||
|
bonus += sd->itemgrouphealrate[i];
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return bonus;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
|
@ -104,7 +104,7 @@ struct item_data* itemdb_exists(int nameid);
|
|||||||
#define itemdb_available(n) (itemdb_exists(n) && itemdb_search(n)->flag.available)
|
#define itemdb_available(n) (itemdb_exists(n) && itemdb_search(n)->flag.available)
|
||||||
#define itemdb_viewid(n) (itemdb_search(n)->view_id)
|
#define itemdb_viewid(n) (itemdb_search(n)->view_id)
|
||||||
#define itemdb_autoequip(n) (itemdb_search(n)->flag.autoequip)
|
#define itemdb_autoequip(n) (itemdb_search(n)->flag.autoequip)
|
||||||
int itemdb_group(int nameid);
|
int itemdb_group_bonus(struct map_session_data *sd, int itemid);
|
||||||
|
|
||||||
int itemdb_searchrandomid(int flags);
|
int itemdb_searchrandomid(int flags);
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ struct map_session_data {
|
|||||||
int magic_addsize[3];
|
int magic_addsize[3];
|
||||||
int critaddrace[RC_MAX];
|
int critaddrace[RC_MAX];
|
||||||
int expaddrace[RC_MAX];
|
int expaddrace[RC_MAX];
|
||||||
int itemhealrate[MAX_ITEMGROUP];
|
int itemgrouphealrate[MAX_ITEMGROUP];
|
||||||
short sp_gain_race[RC_MAX];
|
short sp_gain_race[RC_MAX];
|
||||||
// zeroed arrays end here.
|
// zeroed arrays end here.
|
||||||
// zeroed structures start here
|
// zeroed structures start here
|
||||||
@ -651,6 +651,10 @@ struct map_session_data {
|
|||||||
short id, group;
|
short id, group;
|
||||||
int race, rate;
|
int race, rate;
|
||||||
} add_drop[MAX_PC_BONUS];
|
} add_drop[MAX_PC_BONUS];
|
||||||
|
struct {
|
||||||
|
int nameid;
|
||||||
|
int rate;
|
||||||
|
} itemhealrate[MAX_PC_BONUS];
|
||||||
// zeroed structures end here
|
// zeroed structures end here
|
||||||
// zeroed vars start here.
|
// zeroed vars start here.
|
||||||
int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
|
int arrow_atk,arrow_ele,arrow_cri,arrow_hit;
|
||||||
|
30
src/map/pc.c
30
src/map/pc.c
@ -2167,10 +2167,18 @@ int pc_bonus2(struct map_session_data *sd,int type,int type2,int val)
|
|||||||
case SP_ADD_ITEM_HEAL_RATE:
|
case SP_ADD_ITEM_HEAL_RATE:
|
||||||
if(sd->state.lr_flag == 2)
|
if(sd->state.lr_flag == 2)
|
||||||
break;
|
break;
|
||||||
if (type2 < MAX_ITEMGROUP)
|
if (type2 < MAX_ITEMGROUP) { //Group bonus
|
||||||
sd->itemhealrate[type2] += val;
|
sd->itemgrouphealrate[type2] += val;
|
||||||
else
|
break;
|
||||||
ShowWarning("pc_bonus2: AddItemHealRate: Group %d is beyond limit (%d).\n", type2, MAX_ITEMGROUP);
|
}
|
||||||
|
//Standard item bonus.
|
||||||
|
for(i=0; i < MAX_PC_BONUS && sd->itemhealrate[i].nameid && sd->itemhealrate[i].nameid != type2; i++);
|
||||||
|
if(i == MAX_PC_BONUS) {
|
||||||
|
ShowWarning("pc_bonus2: Reached max (%d) number of item heal bonuses per character!\n", MAX_PC_BONUS);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sd->itemhealrate[i].nameid = type2;
|
||||||
|
sd->itemhealrate[i].rate += val;
|
||||||
break;
|
break;
|
||||||
case SP_EXP_ADDRACE:
|
case SP_EXP_ADDRACE:
|
||||||
if(sd->state.lr_flag != 2)
|
if(sd->state.lr_flag != 2)
|
||||||
@ -5329,7 +5337,7 @@ void pc_heal(struct map_session_data *sd,unsigned int hp,unsigned int sp, int ty
|
|||||||
*/
|
*/
|
||||||
int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
|
int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
|
||||||
{
|
{
|
||||||
int bonus, type;
|
int i, bonus;
|
||||||
|
|
||||||
if(hp) {
|
if(hp) {
|
||||||
bonus = 100 + (sd->battle_status.vit<<1)
|
bonus = 100 + (sd->battle_status.vit<<1)
|
||||||
@ -5337,8 +5345,16 @@ int pc_itemheal(struct map_session_data *sd,int itemid, int hp,int sp)
|
|||||||
+ pc_checkskill(sd,AM_LEARNINGPOTION)*5;
|
+ pc_checkskill(sd,AM_LEARNINGPOTION)*5;
|
||||||
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
|
// A potion produced by an Alchemist in the Fame Top 10 gets +50% effect [DracoRPG]
|
||||||
bonus += (potion_flag==2)?50:(potion_flag==3?100:0);
|
bonus += (potion_flag==2)?50:(potion_flag==3?100:0);
|
||||||
if ((type = itemdb_group(itemid)) > 0 && type < MAX_ITEMGROUP && sd->itemhealrate[type])
|
//Item Group bonuses
|
||||||
bonus += bonus * sd->itemhealrate[type] / 100;
|
bonus += bonus*itemdb_group_bonus(sd, itemid)/100;
|
||||||
|
//Individual item bonuses.
|
||||||
|
for(i = 0; i < MAX_PC_BONUS && sd->itemhealrate[i].nameid; i++)
|
||||||
|
{
|
||||||
|
if (sd->itemhealrate[i].nameid == itemid) {
|
||||||
|
bonus += bonus*sd->itemhealrate[i].rate/100;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if(bonus!=100)
|
if(bonus!=100)
|
||||||
hp = hp * bonus / 100;
|
hp = hp * bonus / 100;
|
||||||
}
|
}
|
||||||
|
@ -1539,7 +1539,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
|
|||||||
+ sizeof(sd->magic_addsize)
|
+ sizeof(sd->magic_addsize)
|
||||||
+ sizeof(sd->critaddrace)
|
+ sizeof(sd->critaddrace)
|
||||||
+ sizeof(sd->expaddrace)
|
+ sizeof(sd->expaddrace)
|
||||||
+ sizeof(sd->itemhealrate)
|
+ sizeof(sd->itemgrouphealrate)
|
||||||
+ sizeof(sd->sp_gain_race)
|
+ sizeof(sd->sp_gain_race)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1578,6 +1578,7 @@ int status_calc_pc(struct map_session_data* sd,int first)
|
|||||||
+ sizeof(sd->add_dmg)
|
+ sizeof(sd->add_dmg)
|
||||||
+ sizeof(sd->add_mdmg)
|
+ sizeof(sd->add_mdmg)
|
||||||
+ sizeof(sd->add_drop)
|
+ sizeof(sd->add_drop)
|
||||||
|
+ sizeof(sd->itemhealrate)
|
||||||
);
|
);
|
||||||
|
|
||||||
// vars zeroing. ints, shorts, chars. in that order.
|
// vars zeroing. ints, shorts, chars. in that order.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user