summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2015-01-17 03:34:18 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2015-01-17 03:34:18 +0800
commit67fbbd2b41ae93c095232bb6b07615261245436f (patch)
tree4ff4414947b8e01dcac45aa789c325142eef7c8c
parent06166cac023cefa193926de5a47dd7bc11f298b3 (diff)
downloadhercules-67fbbd2b41ae93c095232bb6b07615261245436f.tar.gz
hercules-67fbbd2b41ae93c095232bb6b07615261245436f.tar.bz2
hercules-67fbbd2b41ae93c095232bb6b07615261245436f.tar.xz
hercules-67fbbd2b41ae93c095232bb6b07615261245436f.zip
Fixed Bug#8497
-http://hercules.ws/board/tracker/issue-8497-all-mercenaries-miss-hit-for-0/?gopid=24434#entry24434 Signed-off-by: malufett <malufett.eat.my.binaries@gmail.com>
-rw-r--r--src/map/clif.c18
-rw-r--r--src/map/status.c61
2 files changed, 49 insertions, 30 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index c20d6585e..9db3cee03 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -16096,13 +16096,27 @@ void clif_mercenary_info(struct map_session_data *sd) {
WFIFOL(fd,2) = md->bl.id;
// Mercenary shows ATK as a random value between ATK ~ ATK2
- atk = rnd()%(mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk;
- WFIFOW(fd,6) = cap_value(atk, 0, INT16_MAX);
+#ifdef RENEWAL
+ atk = status->get_weapon_atk(&md->bl, &mstatus->rhw, 0);
+#else
+ atk = rnd() % (mstatus->rhw.atk2 - mstatus->rhw.atk + 1) + mstatus->rhw.atk;
+#endif
+ WFIFOW(fd, 6) = cap_value(atk, 0, INT16_MAX);
+#ifdef RENEWAL
+ atk = status->base_matk(&md->bl, mstatus, status->get_lv(&md->bl));
+ WFIFOW(fd,8) = cap_value(atk, 0, INT16_MAX);
+#else
WFIFOW(fd,8) = cap_value(mstatus->matk_max, 0, INT16_MAX);
+#endif
WFIFOW(fd,10) = mstatus->hit;
WFIFOW(fd,12) = mstatus->cri/10;
+#ifdef RENEWAL
+ WFIFOW(fd, 14) = mstatus->def2;
+ WFIFOW(fd, 16) = mstatus->mdef2;
+#else
WFIFOW(fd,14) = mstatus->def;
WFIFOW(fd,16) = mstatus->mdef;
+#endif
WFIFOW(fd,18) = mstatus->flee;
WFIFOW(fd,20) = mstatus->amotion;
safestrncpy((char*)WFIFOP(fd,22), md->db->name, NAME_LENGTH);
diff --git a/src/map/status.c b/src/map/status.c
index 9a63e32a5..fbd039fdc 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4090,7 +4090,7 @@ unsigned short status_base_atk(const struct block_list *bl, const struct status_
if ( bl->type == BL_PC )
#ifdef RENEWAL
str = (int)(dstr + (float)dex / 5 + (float)st->luk / 3 + (float)((TBL_PC*)bl)->status.base_level / 4);
- else if ( bl->type == BL_MOB )
+ else if ( bl->type == BL_MOB || bl->type == BL_MER )
str = dstr + ((TBL_MOB*)bl)->level;
#else
str += dex / 5 + st->luk / 5;
@@ -4106,13 +4106,15 @@ static inline unsigned short status_base_matk_max(const struct status_data *st)
unsigned short status_base_matk(struct block_list *bl, const struct status_data *st, int level) {
#ifdef RENEWAL
switch ( bl->type ) {
- case BL_MOB:
- return st->int_ + level;
- case BL_HOM:
- return status_get_homint(bl) + level;
- case BL_PC:
- default: // temporary until all are formulated
- return st->int_ + (st->int_ / 2) + (st->dex / 5) + (st->luk / 3) + (level / 4);
+ case BL_MOB:
+ return st->int_ + level;
+ case BL_HOM:
+ return status_get_homint(bl) + level;
+ case BL_MER:
+ return st->int_ + st->int_ / 5 * st->int_ / 5;
+ case BL_PC:
+ default: // temporary until all are formulated
+ return st->int_ + (st->int_ / 2) + (st->dex / 5) + (st->luk / 3) + (level / 4);
}
#else
return 0;
@@ -4140,7 +4142,7 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level)
st->rhw.atk2 = (status_get_homluk(bl) + status_get_homstr(bl) + status_get_homdex(bl)) / 3;
} else {
st->hit += level + st->dex + (bl->type == BL_PC ? st->luk / 3 + 175 : 150); //base level + ( every 1 dex = +1 hit ) + (every 3 luk = +1 hit) + 175
- st->flee += level + st->agi + (bl->type == BL_PC ? st->luk / 5 : 0) + 100; //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100
+ st->flee += level + st->agi + (bl->type == BL_MER ? 0: (bl->type == BL_PC ? st->luk / 5 : 0) + 100); //base level + ( every 1 agi = +1 flee ) + (every 5 luk = +1 flee) + 100
st->def2 += (int)(((float)level + st->vit) / 2 + (bl->type == BL_PC ? ((float)st->agi / 5) : 0)); //base level + (every 2 vit = +1 def) + (every 5 agi = +1 def)
st->mdef2 += (int)(bl->type == BL_PC ? (st->int_ + ((float)level / 4) + ((float)(st->dex + st->vit) / 5)) : ((float)(st->int_ + level) / 4)); //(every 4 base level = +1 mdef) + (every 1 int = +1 mdef) + (every 5 dex = +1 mdef) + (every 5 vit = +1 mdef)
}
@@ -4185,7 +4187,6 @@ void status_calc_misc(struct block_list *bl, struct status_data *st, int level)
st->def2 = st->vit + level / 10 + st->vit / 5;
st->mdef2 = level / 10 + st->int_ / 5;
#endif
- break;
default:
if ( battle_config.critical_rate != 100 )
st->cri = st->cri*battle_config.critical_rate / 100;
@@ -11462,7 +11463,7 @@ int status_get_weapon_atk(struct block_list *bl, struct weapon_atk *watk, int fl
min = (int)(watk->atk - variance + strdex_bonus) + watk->atk2;
max = (int)(watk->atk + variance + strdex_bonus) + watk->atk2;
}
- else if (bl->type == BL_MOB && watk->atk){
+ else if ((bl->type == BL_MOB || bl->type == BL_MER) && watk->atk){
min = watk->atk * 80 / 100;
max = watk->atk * 120 / 100;
}
@@ -11545,23 +11546,27 @@ void status_get_matk_sub(struct block_list *bl, int flag, unsigned short *matk_m
*matk_max = *matk_min;
switch ( bl->type ) {
- case BL_PC:
- //This is the only portion in MATK that varies depending on the weapon level and refinement rate.
- if ( (st->rhw.matk + st->lhw.matk) > 0 ) {
- int wMatk = st->rhw.matk + st->lhw.matk; // Left and right matk stacks
- int variance = wMatk * st->rhw.wlv / 10; // Only use right hand weapon level
- *matk_min += wMatk - variance;
- *matk_max += wMatk + variance;
- }
- break;
- case BL_MOB:
- *matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
- *matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
- break;
- case BL_HOM:
- *matk_min += (status_get_homint(bl) + status_get_homdex(bl)) / 5;
- *matk_max += (status_get_homluk(bl) + status_get_homint(bl) + status_get_homdex(bl)) / 3;
- break;
+ case BL_PC:
+ //This is the only portion in MATK that varies depending on the weapon level and refinement rate.
+ if ( (st->rhw.matk + st->lhw.matk) > 0 ) {
+ int wMatk = st->rhw.matk + st->lhw.matk; // Left and right matk stacks
+ int variance = wMatk * st->rhw.wlv / 10; // Only use right hand weapon level
+ *matk_min += wMatk - variance;
+ *matk_max += wMatk + variance;
+ }
+ break;
+ case BL_MER:
+ *matk_min += 70 * ((TBL_MER*)bl)->battle_status.rhw.atk2 / 100;
+ *matk_max += 130 * ((TBL_MER*)bl)->battle_status.rhw.atk2 / 100;
+ break;
+ case BL_MOB:
+ *matk_min += 70 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
+ *matk_max += 130 * ((TBL_MOB*)bl)->status.rhw.atk2 / 100;
+ break;
+ case BL_HOM:
+ *matk_min += (status_get_homint(bl) + status_get_homdex(bl)) / 5;
+ *matk_max += (status_get_homluk(bl) + status_get_homint(bl) + status_get_homdex(bl)) / 3;
+ break;
}
#else // not RENEWAL