* Various small cleanups.
- Fixed truncation warnings in @statuspoint, @skillpoint and @str/@agi/@vit/@int/@dex/@luk (since r14436). - Fixed data type inconsistency in @statuspoint and @skillpoint (since r5762, related r13541). - Silenced truncation warnings in CR_ACIDDEMONSTRATION damage calculation and cardfix application (since r13700). - Reformatted unit_blown to make it look cleaner (follow up to r14492). git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/renewal@14493 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
f91260ea57
commit
09968c0815
@ -3,6 +3,11 @@ Date Added
|
|||||||
2010/11/23
|
2010/11/23
|
||||||
* Added script command pushpc, which is required by newer scripts. [Ai4rei]
|
* Added script command pushpc, which is required by newer scripts. [Ai4rei]
|
||||||
- Moved knockback-part of skill_blown into unit_blown, to allow unconditional knockback required by pushpc without copy-pasting code.
|
- Moved knockback-part of skill_blown into unit_blown, to allow unconditional knockback required by pushpc without copy-pasting code.
|
||||||
|
* Various small cleanups. [Ai4rei]
|
||||||
|
- Fixed truncation warnings in @statuspoint, @skillpoint and @str/@agi/@vit/@int/@dex/@luk (since r14436).
|
||||||
|
- Fixed data type inconsistency in @statuspoint and @skillpoint (since r5762, related r13541).
|
||||||
|
- Silenced truncation warnings in CR_ACIDDEMONSTRATION damage calculation and cardfix application (since r13700).
|
||||||
|
- Reformatted unit_blown to make it look cleaner (follow up to r14492).
|
||||||
2010/11/22
|
2010/11/22
|
||||||
* mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei]
|
* mail_deliveryfail no longer attempts to log (since r12910) and give items (since r11855), when there is no item attached to the mail (bugreport:3239). [Ai4rei]
|
||||||
* Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275). [Ai4rei]
|
* Fixed a crash when shutting down char-server (TXT only), after it failed to load storage save data (since r1275). [Ai4rei]
|
||||||
|
@ -2849,19 +2849,35 @@ ACMD_FUNC(displaystatus)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
ACMD_FUNC(statuspoint)
|
ACMD_FUNC(statuspoint)
|
||||||
{
|
{
|
||||||
int point, new_status_point;
|
int point;
|
||||||
|
unsigned int new_status_point;
|
||||||
|
|
||||||
if (!message || !*message || (point = atoi(message)) == 0) {
|
if (!message || !*message || (point = atoi(message)) == 0) {
|
||||||
clif_displaymessage(fd, "Please, enter a number (usage: @stpoint <number of points>).");
|
clif_displaymessage(fd, "Please, enter a number (usage: @stpoint <number of points>).");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (point < 0 && sd->status.status_point < -point)
|
if(point < 0)
|
||||||
new_status_point = 0;
|
{
|
||||||
|
if(sd->status.status_point < (unsigned int)(-point))
|
||||||
|
{
|
||||||
|
new_status_point = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_status_point = sd->status.status_point + point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(UINT_MAX - sd->status.status_point < (unsigned int)point)
|
||||||
|
{
|
||||||
|
new_status_point = UINT_MAX;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
new_status_point = cap_value((int64)sd->status.status_point + point, 0, INT_MAX);
|
{
|
||||||
|
new_status_point = sd->status.status_point + point;
|
||||||
|
}
|
||||||
|
|
||||||
if (new_status_point != (int)sd->status.status_point) {
|
if (new_status_point != sd->status.status_point) {
|
||||||
sd->status.status_point = new_status_point;
|
sd->status.status_point = new_status_point;
|
||||||
clif_updatestatus(sd, SP_STATUSPOINT);
|
clif_updatestatus(sd, SP_STATUSPOINT);
|
||||||
clif_displaymessage(fd, msg_txt(174)); // Number of status points changed.
|
clif_displaymessage(fd, msg_txt(174)); // Number of status points changed.
|
||||||
@ -2881,7 +2897,8 @@ ACMD_FUNC(statuspoint)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
ACMD_FUNC(skillpoint)
|
ACMD_FUNC(skillpoint)
|
||||||
{
|
{
|
||||||
int point, new_skill_point;
|
int point;
|
||||||
|
unsigned int new_skill_point;
|
||||||
nullpo_retr(-1, sd);
|
nullpo_retr(-1, sd);
|
||||||
|
|
||||||
if (!message || !*message || (point = atoi(message)) == 0) {
|
if (!message || !*message || (point = atoi(message)) == 0) {
|
||||||
@ -2889,12 +2906,27 @@ ACMD_FUNC(skillpoint)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (point < 0 && sd->status.skill_point < -point)
|
if(point < 0)
|
||||||
new_skill_point = 0;
|
{
|
||||||
|
if(sd->status.skill_point < (unsigned int)(-point))
|
||||||
|
{
|
||||||
|
new_skill_point = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_skill_point = sd->status.skill_point + point;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(UINT_MAX - sd->status.skill_point < (unsigned int)point)
|
||||||
|
{
|
||||||
|
new_skill_point = UINT_MAX;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
new_skill_point = cap_value((int64)sd->status.skill_point + point, 0, INT_MAX);
|
{
|
||||||
|
new_skill_point = sd->status.skill_point + point;
|
||||||
|
}
|
||||||
|
|
||||||
if (new_skill_point != (int)sd->status.skill_point) {
|
if (new_skill_point != sd->status.skill_point) {
|
||||||
sd->status.skill_point = new_skill_point;
|
sd->status.skill_point = new_skill_point;
|
||||||
clif_updatestatus(sd, SP_SKILLPOINT);
|
clif_updatestatus(sd, SP_SKILLPOINT);
|
||||||
clif_displaymessage(fd, msg_txt(175)); // Number of skill points changed.
|
clif_displaymessage(fd, msg_txt(175)); // Number of skill points changed.
|
||||||
@ -2948,7 +2980,7 @@ ACMD_FUNC(zeny)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
ACMD_FUNC(param)
|
ACMD_FUNC(param)
|
||||||
{
|
{
|
||||||
int i, value = 0, new_value, max;
|
int i, value = 0, new_value;
|
||||||
const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" };
|
const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" };
|
||||||
short* status[6];
|
short* status[6];
|
||||||
//we don't use direct initialization because it isn't part of the c standard.
|
//we don't use direct initialization because it isn't part of the c standard.
|
||||||
@ -2977,10 +3009,20 @@ ACMD_FUNC(param)
|
|||||||
status[4] = &sd->status.dex;
|
status[4] = &sd->status.dex;
|
||||||
status[5] = &sd->status.luk;
|
status[5] = &sd->status.luk;
|
||||||
|
|
||||||
max = SHRT_MAX;
|
if(value < 0 && *status[i] < -value)
|
||||||
new_value = cap_value((int64)*status[i] + value, 1, max);
|
{
|
||||||
|
new_value = 1;
|
||||||
|
}
|
||||||
|
else if(SHRT_MAX - *status[i] < value)
|
||||||
|
{
|
||||||
|
new_value = SHRT_MAX;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
new_value = *status[i] + value;
|
||||||
|
}
|
||||||
|
|
||||||
if (new_value != (int)*status[i]) {
|
if (new_value != *status[i]) {
|
||||||
*status[i] = new_value;
|
*status[i] = new_value;
|
||||||
clif_updatestatus(sd, SP_STR + i);
|
clif_updatestatus(sd, SP_STR + i);
|
||||||
clif_updatestatus(sd, SP_USTR + i);
|
clif_updatestatus(sd, SP_USTR + i);
|
||||||
|
@ -2770,7 +2770,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
|||||||
break;
|
break;
|
||||||
case CR_ACIDDEMONSTRATION: // updated the formula based on a Japanese formula found to be exact [Reddozen]
|
case CR_ACIDDEMONSTRATION: // updated the formula based on a Japanese formula found to be exact [Reddozen]
|
||||||
if(tstatus->vit+sstatus->int_) //crash fix
|
if(tstatus->vit+sstatus->int_) //crash fix
|
||||||
md.damage = (int64)7*tstatus->vit*sstatus->int_*sstatus->int_ / (10*(tstatus->vit+sstatus->int_));
|
md.damage = (int)((int64)7*tstatus->vit*sstatus->int_*sstatus->int_ / (10*(tstatus->vit+sstatus->int_)));
|
||||||
else
|
else
|
||||||
md.damage = 0;
|
md.damage = 0;
|
||||||
if (tsd) md.damage>>=1;
|
if (tsd) md.damage>>=1;
|
||||||
@ -2886,7 +2886,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
|
|||||||
cardfix=cardfix*(100-tsd->long_attack_def_rate)/100;
|
cardfix=cardfix*(100-tsd->long_attack_def_rate)/100;
|
||||||
|
|
||||||
if (cardfix != 10000)
|
if (cardfix != 10000)
|
||||||
md.damage=(int64)md.damage*cardfix/10000;
|
md.damage=(int)((int64)md.damage*cardfix/10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
|
if (sd && (i = pc_skillatk_bonus(sd, skill_num)))
|
||||||
|
@ -572,46 +572,70 @@ uint8 unit_getdir(struct block_list *bl)
|
|||||||
// &1 Do not send position update packets.
|
// &1 Do not send position update packets.
|
||||||
int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
|
int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
|
||||||
{
|
{
|
||||||
int nx, ny, ret;
|
int nx, ny, result;
|
||||||
struct skill_unit* su = BL_CAST(BL_SKILL, bl);
|
struct map_session_data* sd;
|
||||||
|
struct skill_unit* su = NULL;
|
||||||
|
|
||||||
ret=path_blownpos(bl->m,bl->x,bl->y,dx,dy,count);
|
if(count)
|
||||||
nx = ret>>16;
|
|
||||||
ny = ret&0xffff;
|
|
||||||
|
|
||||||
if (!su)
|
|
||||||
unit_stop_walking(bl,0);
|
|
||||||
|
|
||||||
dx = nx - bl->x;
|
|
||||||
dy = ny - bl->y;
|
|
||||||
|
|
||||||
if (!dx && !dy) //Could not knockback.
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
|
|
||||||
|
|
||||||
if(su)
|
|
||||||
skill_unit_move_unit_group(su->group,bl->m,dx,dy);
|
|
||||||
else
|
|
||||||
map_moveblock(bl, nx, ny, gettick());
|
|
||||||
|
|
||||||
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
|
|
||||||
|
|
||||||
if(!(flag&0x1))
|
|
||||||
clif_blown(bl);
|
|
||||||
|
|
||||||
if( bl->type == BL_PC )
|
|
||||||
{
|
{
|
||||||
TBL_PC *sd = (TBL_PC*)bl;
|
sd = BL_CAST(BL_PC, bl);
|
||||||
if( sd->touching_id )
|
su = BL_CAST(BL_SKILL, bl);
|
||||||
npc_touchnext_areanpc(sd,false);
|
|
||||||
if( map_getcell(bl->m,bl->x,bl->y,CELL_CHKNPC) )
|
|
||||||
npc_touch_areanpc(sd,bl->m,bl->x,bl->y);
|
|
||||||
else
|
|
||||||
sd->areanpc_id=0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count; //Return amount of knocked back cells.
|
result = path_blownpos(bl->m, bl->x, bl->y, dx, dy, count);
|
||||||
|
|
||||||
|
nx = result>>16;
|
||||||
|
ny = result&0xffff;
|
||||||
|
|
||||||
|
if(!su)
|
||||||
|
{
|
||||||
|
unit_stop_walking(bl, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
dx = nx-bl->x;
|
||||||
|
dy = ny-bl->y;
|
||||||
|
|
||||||
|
if(dx || dy)
|
||||||
|
{
|
||||||
|
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
|
||||||
|
|
||||||
|
if(su)
|
||||||
|
{
|
||||||
|
skill_unit_move_unit_group(su->group, bl->m, dx, dy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
map_moveblock(bl, nx, ny, gettick());
|
||||||
|
}
|
||||||
|
|
||||||
|
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
|
||||||
|
|
||||||
|
if(!(flag&1))
|
||||||
|
{
|
||||||
|
clif_blown(bl);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sd)
|
||||||
|
{
|
||||||
|
if(sd->touching_id)
|
||||||
|
{
|
||||||
|
npc_touchnext_areanpc(sd, false);
|
||||||
|
}
|
||||||
|
if(map_getcell(bl->m, bl->x, bl->y, CELL_CHKNPC))
|
||||||
|
{
|
||||||
|
npc_touch_areanpc(sd, bl->m, bl->x, bl->y);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sd->areanpc_id = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{// could not knockback
|
||||||
|
count = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return count; // return amount of knocked back cells
|
||||||
}
|
}
|
||||||
|
|
||||||
//Warps a unit/ud to a given map/position.
|
//Warps a unit/ud to a given map/position.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user