summaryrefslogtreecommitdiff
path: root/src/map/skill.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/skill.c')
-rw-r--r--src/map/skill.c471
1 files changed, 231 insertions, 240 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index 3b7378022..3669431f0 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -366,7 +366,7 @@ int skill_get_range2 (struct block_list *bl, uint16 skill_id, uint16 skill_lv) {
}
int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 skill_id, uint16 skill_lv, bool heal) {
- int skill, hp;
+ int skill2_lv, hp;
struct map_session_data *sd = BL_CAST(BL_PC, src);
struct map_session_data *tsd = BL_CAST(BL_PC, target);
struct status_change* sc;
@@ -399,21 +399,21 @@ int skill_calc_heal(struct block_list *src, struct block_list *target, uint16 sk
#else
hp = ( iStatus->get_lv(src) + status_get_int(src) ) / 8 * (4 + ( skill_id == AB_HIGHNESSHEAL ? ( sd ? pc->checkskill(sd,AL_HEAL) : 10 ) : skill_lv ) * 8);
#endif
- if( sd && ((skill = pc->checkskill(sd, HP_MEDITATIO)) > 0) )
- hp += hp * skill * 2 / 100;
- else if( src->type == BL_HOM && (skill = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
- hp += hp * skill * 2 / 100;
+ if( sd && ((skill2_lv = pc->checkskill(sd, HP_MEDITATIO)) > 0) )
+ hp += hp * skill2_lv * 2 / 100;
+ else if( src->type == BL_HOM && (skill2_lv = homun->checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0 )
+ hp += hp * skill2_lv * 2 / 100;
break;
}
if( ( (target && target->type == BL_MER) || !heal ) && skill_id != NPC_EVILLAND )
hp >>= 1;
- if( sd && (skill = pc->skillheal_bonus(sd, skill_id)) )
- hp += hp*skill/100;
+ if( sd && (skill2_lv = pc->skillheal_bonus(sd, skill_id)) )
+ hp += hp*skill2_lv/100;
- if( tsd && (skill = pc->skillheal2_bonus(tsd, skill_id)) )
- hp += hp*skill/100;
+ if( tsd && (skill2_lv = pc->skillheal2_bonus(tsd, skill_id)) )
+ hp += hp*skill2_lv/100;
sc = iStatus->get_sc(target);
if( sc && sc->count ) {
@@ -2837,19 +2837,19 @@ int skill_area_sub (struct block_list *bl, va_list ap) {
}
int skill_check_unit_range_sub (struct block_list *bl, va_list ap) {
- struct skill_unit *unit;
+ struct skill_unit *su;
uint16 skill_id,g_skill_id;
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
if(bl->prev == NULL || bl->type != BL_SKILL)
return 0;
- if(!unit->alive)
+ if(!su->alive)
return 0;
skill_id = va_arg(ap,int);
- g_skill_id = unit->group->skill_id;
+ g_skill_id = su->group->skill_id;
switch (skill_id) {
case MH_STEINWAND:
@@ -3945,10 +3945,9 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
int maxlv = skill->get_max(skill_id); // learnable level
int count = 0;
int x, y;
- struct skill_unit* unit;
+ struct skill_unit *su;
- if( skill_lv > maxlv )
- {
+ if( skill_lv > maxlv ) {
if( src->type == BL_MOB && skill_lv == 10 )
range = 4;
else
@@ -3956,16 +3955,14 @@ int skill_castend_damage_id (struct block_list* src, struct block_list *bl, uint
}
for( y = src->y - range; y <= src->y + range; ++y )
- for( x = src->x - range; x <= src->x + range; ++x )
- {
- if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) )
- {
+ for( x = src->x - range; x <= src->x + range; ++x ) {
+ if( !iMap->find_skill_unit_oncell(src,x,y,SA_LANDPROTECTOR,NULL,1) ) {
if( src->type != BL_PC || iMap->getcell(src->m,x,y,CELL_CHKWATER) ) // non-players bypass the water requirement
count++; // natural water cell
- else if( (unit = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL || (unit = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL )
- {
+ else if( (su = iMap->find_skill_unit_oncell(src,x,y,SA_DELUGE,NULL,1)) != NULL
+ || (su = iMap->find_skill_unit_oncell(src,x,y,NJ_SUITON,NULL,1)) != NULL ) {
count++; // skill-induced water cell
- skill->delunit(unit); // consume cell
+ skill->delunit(su); // consume cell
}
}
}
@@ -9036,9 +9033,9 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
skill->attack(BF_WEAPON,src,src,bl,GN_SLINGITEM_RANGEMELEEATK,skill_lv,tick,flag);
} else //Otherwise, it fails, shows animation and removes items.
clif->skill_fail(sd,GN_SLINGITEM_RANGEMELEEATK,0xa,0);
- } else if( itemdb_is_GNthrowable(ammo_id) ){
+ } else if( itemdb_is_GNthrowable(ammo_id) ) {
struct script_code *scriptroot = sd->inventory_data[i]->script;
- if( !script )
+ if( !scriptroot )
break;
if( dstsd )
script->run(scriptroot,0,dstsd->bl.id,npc->fake_nd->bl.id);
@@ -10410,30 +10407,30 @@ int skill_dance_overlap_sub(struct block_list* bl, va_list ap) {
//Does the song/dance overlapping -> dissonance check. [Skotlex]
//When flag is 0, this unit is about to be removed, cancel the dissonance effect
//When 1, this unit has been positioned, so start the cancel effect.
-int skill_dance_overlap(struct skill_unit* unit, int flag) {
- if (!unit || !unit->group || !(unit->group->state.song_dance&0x1))
+int skill_dance_overlap(struct skill_unit* su, int flag) {
+ if (!su || !su->group || !(su->group->state.song_dance&0x1))
return 0;
- if (unit->val1 != unit->group->skill_id) {
+ if (su->val1 != su->group->skill_id) {
//Reset state
- unit->val1 = unit->group->skill_id;
- unit->val2 &= ~UF_ENSEMBLE;
+ su->val1 = su->group->skill_id;
+ su->val2 &= ~UF_ENSEMBLE;
}
- return iMap->foreachincell(skill->dance_overlap_sub, unit->bl.m,unit->bl.x,unit->bl.y,BL_SKILL, unit,flag);
+ return iMap->foreachincell(skill->dance_overlap_sub, su->bl.m,su->bl.x,su->bl.y,BL_SKILL, su,flag);
}
/*==========================================
* Converts this group information so that it is handled as a Dissonance or Ugly Dance cell.
* Flag: 0 - Convert, 1 - Revert.
*------------------------------------------*/
-bool skill_dance_switch(struct skill_unit* unit, int flag) {
+bool skill_dance_switch(struct skill_unit* su, int flag) {
static int prevflag = 1; // by default the backup is empty
static struct skill_unit_group backup;
- struct skill_unit_group* group = unit->group;
+ struct skill_unit_group* group = su->group;
// val2&UF_ENSEMBLE is a hack to indicate dissonance
- if ( !(group->state.song_dance&0x1 && unit->val2&UF_ENSEMBLE) )
+ if ( !(group->state.song_dance&0x1 && su->val2&UF_ENSEMBLE) )
return false;
if( flag == prevflag ) {
@@ -10446,7 +10443,7 @@ bool skill_dance_switch(struct skill_unit* unit, int flag) {
prevflag = flag;
if( !flag ) { //Transform
- uint16 skill_id = unit->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE;
+ uint16 skill_id = su->val2&UF_SONG ? BA_DISSONANCE : DC_UGLYDANCE;
// backup
backup.skill_id = group->skill_id;
@@ -10885,7 +10882,7 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
limit = group->limit;
for( i = 0; i < layout->count; i++ ) {
- struct skill_unit *unit;
+ struct skill_unit *su;
int ux = x + layout->dx[i];
int uy = y + layout->dy[i];
int val1 = skill_lv;
@@ -10964,19 +10961,19 @@ struct skill_unit_group* skill_unitsetting (struct block_list *src, uint16 skill
if( !alive )
continue;
- nullpo_retr(NULL, unit=skill->initunit(group,i,ux,uy,val1,val2));
- unit->limit=limit;
- unit->range=range;
+ nullpo_retr(NULL, su=skill->initunit(group,i,ux,uy,val1,val2));
+ su->limit=limit;
+ su->range=range;
if (skill_id == PF_FOGWALL && alive == 2) {
//Double duration of cells on top of Deluge/Suiton
- unit->limit *= 2;
- group->limit = unit->limit;
+ su->limit *= 2;
+ group->limit = su->limit;
}
// execute on all targets standing on this cell
if (range==0 && active_flag)
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),1);
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
}
if (!group->alive_count) { //No cells? Something that was blocked completely by Land Protector?
@@ -12085,37 +12082,37 @@ static int skill_unit_onleft (uint16 skill_id, struct block_list *bl, unsigned i
* flag&4: Invoke a onleft call (the unit might be scheduled for deletion)
*------------------------------------------*/
int skill_unit_effect (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = va_arg(ap,struct skill_unit*);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = va_arg(ap,struct skill_unit*);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
unsigned int flag = va_arg(ap,unsigned int);
uint16 skill_id;
bool dissonance;
- if( (!unit->alive && !(flag&4)) || bl->prev == NULL )
+ if( (!su->alive && !(flag&4)) || bl->prev == NULL )
return 0;
nullpo_ret(group);
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
//Necessary in case the group is deleted after calling on_place/on_out [Skotlex]
skill_id = group->skill_id;
//Target-type check.
- if( !(group->bl_flag&bl->type && battle->check_target(&unit->bl,bl,group->target_flag)>0) ) {
+ if( !(group->bl_flag&bl->type && battle->check_target(&su->bl,bl,group->target_flag)>0) ) {
if( (flag&4) && ( group->state.song_dance&0x1 || (group->src_id == bl->id && group->state.song_dance&0x2) ) )
skill->unit_onleft(skill_id, bl, tick);//Ensemble check to terminate it.
} else {
if( flag&1 )
- skill->unit_onplace(unit,bl,tick);
+ skill->unit_onplace(su,bl,tick);
else
- skill->unit_onout(unit,bl,tick);
+ skill->unit_onout(su,bl,tick);
if( flag&4 )
skill->unit_onleft(skill_id, bl, tick);
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
@@ -12304,15 +12301,15 @@ int skill_check_pc_partner (struct map_session_data *sd, uint16 skill_id, uint16
*
*------------------------------------------*/
int skill_check_condition_mob_master_sub (struct block_list *bl, va_list ap) {
- int *c,src_id,mob_class,skill;
+ int *c,src_id,mob_class,skill_id;
struct mob_data *md;
md=(struct mob_data*)bl;
src_id=va_arg(ap,int);
mob_class=va_arg(ap,int);
- skill=va_arg(ap,int);
+ skill_id=va_arg(ap,int);
c=va_arg(ap,int *);
- if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill == AM_SPHEREMINE?2:skill == KO_ZANZOU?4:skill == MH_SUMMON_LEGION?1:3) )
+ if( md->master_id != src_id || md->special_state.ai != (unsigned)(skill_id == AM_SPHEREMINE?2:skill_id == KO_ZANZOU?4:skill_id == MH_SUMMON_LEGION?1:3) )
return 0; //Non alchemist summoned mobs have nothing to do here.
if(md->class_==mob_class)
(*c)++;
@@ -14674,16 +14671,16 @@ struct skill_unit_group *skill_locate_element_field(struct block_list *bl) {
// for graffiti cleaner [Valaris]
int skill_graffitiremover (struct block_list *bl, va_list ap) {
- struct skill_unit *unit=NULL;
+ struct skill_unit *su=NULL;
nullpo_ret(bl);
nullpo_ret(ap);
- if(bl->type!=BL_SKILL || (unit=(struct skill_unit *)bl) == NULL)
+ if(bl->type!=BL_SKILL || (su=(struct skill_unit *)bl) == NULL)
return 0;
- if((unit->group) && (unit->group->unit_id == UNT_GRAFFITI))
- skill->delunit(unit);
+ if((su->group) && (su->group->unit_id == UNT_GRAFFITI))
+ skill->delunit(su);
return 0;
}
@@ -14702,9 +14699,8 @@ int skill_greed (struct block_list *bl, va_list ap) {
return 0;
}
//For Ranger's Detonator [Jobbie/3CeAM]
-int skill_detonator(struct block_list *bl, va_list ap)
-{
- struct skill_unit *unit=NULL;
+int skill_detonator(struct block_list *bl, va_list ap) {
+ struct skill_unit *su=NULL;
struct block_list *src;
int unit_id;
@@ -14712,14 +14708,14 @@ int skill_detonator(struct block_list *bl, va_list ap)
nullpo_ret(ap);
src = va_arg(ap,struct block_list *);
- if( bl->type != BL_SKILL || (unit = (struct skill_unit *)bl) == NULL || !unit->group )
+ if( bl->type != BL_SKILL || (su = (struct skill_unit *)bl) == NULL || !su->group )
return 0;
- if( unit->group->src_id != src->id )
+ if( su->group->src_id != src->id )
return 0;
- unit_id = unit->group->unit_id;
- switch( unit_id )
- { //List of Hunter and Ranger Traps that can be detonate.
+ unit_id = su->group->unit_id;
+ switch( unit_id ) {
+ //List of Hunter and Ranger Traps that can be detonate.
case UNT_BLASTMINE:
case UNT_SANDMAN:
case UNT_CLAYMORETRAP:
@@ -14727,23 +14723,23 @@ int skill_detonator(struct block_list *bl, va_list ap)
case UNT_CLUSTERBOMB:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- switch(unit_id){
+ switch(unit_id) {
case UNT_TALKIEBOX:
- clif->talkiebox(bl,unit->group->valstr);
- unit->group->val2 = -1;
+ clif->talkiebox(bl,su->group->valstr);
+ su->group->val2 = -1;
break;
case UNT_CLAYMORETRAP:
case UNT_FIRINGTRAP:
case UNT_ICEBOUNDTRAP:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag|BL_SKILL|~BCT_SELF,bl,unit->group->tick);
+ iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag|BL_SKILL|~BCT_SELF,bl,su->group->tick);
break;
default:
- iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(unit->group->skill_id,unit->group->skill_lv),unit->group->bl_flag,bl,unit->group->tick);
+ iMap->foreachinrange(skill->trap_splash,bl,skill->get_splash(su->group->skill_id,su->group->skill_lv),su->group->bl_flag,bl,su->group->tick);
}
clif->changetraplook(bl, UNT_USED_TRAPS);
- unit->group->limit = DIFF_TICK(timer->gettick(),unit->group->tick) +
+ su->group->limit = DIFF_TICK(timer->gettick(),su->group->tick) +
(unit_id == UNT_TALKIEBOX ? 5000 : (unit_id == UNT_CLUSTERBOMB || unit_id == UNT_ICEBOUNDTRAP? 2500 : (unit_id == UNT_FIRINGTRAP ? 0 : 1500)) );
- unit->group->unit_id = UNT_USED_TRAPS;
+ su->group->unit_id = UNT_USED_TRAPS;
break;
}
return 0;
@@ -14755,31 +14751,31 @@ int skill_detonator(struct block_list *bl, va_list ap)
int skill_cell_overlap(struct block_list *bl, va_list ap) {
uint16 skill_id;
int *alive;
- struct skill_unit *unit;
+ struct skill_unit *su;
skill_id = va_arg(ap,int);
alive = va_arg(ap,int *);
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
- if( unit == NULL || unit->group == NULL || (*alive) == 0 )
+ if( su == NULL || su->group == NULL || (*alive) == 0 )
return 0;
switch (skill_id) {
case SA_LANDPROTECTOR:
- if( unit->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex]
+ if( su->group->skill_id == SA_LANDPROTECTOR ) {//Check for offensive Land Protector to delete both. [Skotlex]
(*alive) = 0;
- skill->delunit(unit);
+ skill->delunit(su);
return 1;
}
- if( !(skill->get_inf2(unit->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || unit->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps
- skill->delunit(unit);
+ if( !(skill->get_inf2(su->group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP)) || su->group->skill_id == WZ_FIREPILLAR ) { //It deletes everything except songs/dances and traps
+ skill->delunit(su);
return 1;
}
break;
case HW_GANBANTEIN:
case LG_EARTHDRIVE:
- if( !(unit->group->state.song_dance&0x1) ) {// Don't touch song/dance.
- skill->delunit(unit);
+ if( !(su->group->state.song_dance&0x1) ) {// Don't touch song/dance.
+ skill->delunit(su);
return 1;
}
break;
@@ -14789,14 +14785,13 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
// The official implementation makes them fail to appear when casted on top of ANYTHING
// but I wonder if they didn't actually meant to fail when casted on top of each other?
// hence, I leave the alternate implementation here, commented. [Skotlex]
- if (unit->range <= 0)
- {
+ if (su->range <= 0) {
(*alive) = 0;
return 1;
}
/*
- switch (unit->group->skill_id)
- { //These cannot override each other.
+ switch (su->group->skill_id) {
+ //These cannot override each other.
case SA_VOLCANO:
case SA_DELUGE:
case SA_VIOLENTGALE:
@@ -14806,7 +14801,7 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
*/
break;
case PF_FOGWALL:
- switch(unit->group->skill_id) {
+ switch(su->group->skill_id) {
case SA_VOLCANO: //Can't be placed on top of these
case SA_VIOLENTGALE:
(*alive) = 0;
@@ -14819,14 +14814,15 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
}
break;
case HP_BASILICA:
- if (unit->group->skill_id == HP_BASILICA)
- { //Basilica can't be placed on top of itself to avoid map-cell stacking problems. [Skotlex]
+ if (su->group->skill_id == HP_BASILICA) {
+ //Basilica can't be placed on top of itself to avoid map-cell stacking problems. [Skotlex]
(*alive) = 0;
return 1;
}
break;
case GN_CRAZYWEED_ATK:
- switch(unit->group->unit_id){ //TODO: look for other ground skills that are affected.
+ switch(su->group->unit_id) {
+ //TODO: look for other ground skills that are affected.
case UNT_WALLOFTHORN:
case UNT_THORNS_TRAP:
case UNT_BLOODYLUST:
@@ -14839,13 +14835,14 @@ int skill_cell_overlap(struct block_list *bl, va_list ap) {
case UNT_VIOLENTGALE:
case UNT_SAFETYWALL:
case UNT_PNEUMA:
- skill->delunit(unit);
+ skill->delunit(su);
return 1;
}
break;
}
- if (unit->group->skill_id == SA_LANDPROTECTOR && !(skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) { //It deletes everything except songs/dances/traps
+ if (su->group->skill_id == SA_LANDPROTECTOR && !(skill->get_inf2(skill_id)&(INF2_SONG_DANCE|INF2_TRAP))) {
+ //It deletes everything except songs/dances/traps
(*alive) = 0;
return 1;
}
@@ -14880,17 +14877,17 @@ int skill_chastle_mob_changetarget(struct block_list *bl,va_list ap)
int skill_trap_splash (struct block_list *bl, va_list ap) {
struct block_list *src;
int tick;
- struct skill_unit *unit;
+ struct skill_unit *su;
struct skill_unit_group *sg;
struct block_list *ss;
src = va_arg(ap,struct block_list *);
- unit = (struct skill_unit *)src;
+ su = (struct skill_unit *)src;
tick = va_arg(ap,int);
- if( !unit->alive || bl->prev == NULL )
+ if( !su->alive || bl->prev == NULL )
return 0;
- nullpo_ret(sg = unit->group);
+ nullpo_ret(sg = su->group);
nullpo_ret(ss = iMap->id2bl(sg->src_id));
if(battle->check_target(src,bl,sg->target_flag) <= 0)
@@ -14977,22 +14974,22 @@ int skill_trap_splash (struct block_list *bl, va_list ap) {
int skill_maelstrom_suction(struct block_list *bl, va_list ap) {
uint16 skill_id, skill_lv;
- struct skill_unit *unit;
+ struct skill_unit *su;
skill_id = va_arg(ap,int);
skill_lv = va_arg(ap,int);
- unit = (struct skill_unit *)bl;
+ su = (struct skill_unit *)bl;
- if( unit == NULL || unit->group == NULL )
+ if( su == NULL || su->group == NULL )
return 0;
if( skill->get_inf2(skill_id)&INF2_TRAP )
return 0;
- if( unit->group->skill_id == SC_MAELSTROM ){
+ if( su->group->skill_id == SC_MAELSTROM ) {
struct block_list *src;
- if( (src = iMap->id2bl(unit->group->src_id)) ){
- int sp = unit->group->skill_lv * skill_lv;
+ if( (src = iMap->id2bl(su->group->src_id)) ) {
+ int sp = su->group->skill_lv * skill_lv;
if( src->type == BL_PC )
sp += ((TBL_PC*)src)->status.job_level / 5;
iStatus->heal(src, 0, sp/2, 1);
@@ -15085,81 +15082,80 @@ bool skill_check_camouflage(struct block_list *bl, struct status_change_entry *s
/*==========================================
*
*------------------------------------------*/
-struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2)
-{
- struct skill_unit *unit;
+struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2) {
+ struct skill_unit *su;
nullpo_retr(NULL, group);
nullpo_retr(NULL, group->unit); // crash-protection against poor coding
- nullpo_retr(NULL, unit=&group->unit[idx]);
+ nullpo_retr(NULL, su=&group->unit[idx]);
if( iMap->getcell(iMap->id2bl(group->src_id)->m, x, y, CELL_CHKMAELSTROM) )
- return unit;
+ return su;
- if(!unit->alive)
+ if(!su->alive)
group->alive_count++;
- unit->bl.id=iMap->get_new_object_id();
- unit->bl.type=BL_SKILL;
- unit->bl.m=group->map;
- unit->bl.x=x;
- unit->bl.y=y;
- unit->group=group;
- unit->alive=1;
- unit->val1=val1;
- unit->val2=val2;
+ su->bl.id=iMap->get_new_object_id();
+ su->bl.type=BL_SKILL;
+ su->bl.m=group->map;
+ su->bl.x=x;
+ su->bl.y=y;
+ su->group=group;
+ su->alive=1;
+ su->val1=val1;
+ su->val2=val2;
- idb_put(skillunit_db, unit->bl.id, unit);
- iMap->addiddb(&unit->bl);
- iMap->addblock(&unit->bl);
+ idb_put(skillunit_db, su->bl.id, su);
+ iMap->addiddb(&su->bl);
+ iMap->addblock(&su->bl);
// perform oninit actions
switch (group->skill_id) {
case WZ_ICEWALL:
- iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,5);
- clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,5,AREA);
- skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
- map[unit->bl.m].icewall_num++;
+ iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,5);
+ clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,5,AREA);
+ skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,true);
+ map[su->bl.m].icewall_num++;
break;
case SA_LANDPROTECTOR:
- skill->unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,true);
+ skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,true);
break;
case HP_BASILICA:
- skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,true);
+ skill->unitsetmapcell(su,HP_BASILICA,group->skill_lv,CELL_BASILICA,true);
break;
case SC_MAELSTROM:
- skill->unitsetmapcell(unit,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,true);
+ skill->unitsetmapcell(su,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,true);
break;
default:
if (group->state.song_dance&0x1) //Check for dissonance.
- skill->dance_overlap(unit, 1);
+ skill->dance_overlap(su, 1);
break;
}
- clif->skill_setunit(unit);
+ clif->skill_setunit(su);
- return unit;
+ return su;
}
/*==========================================
*
*------------------------------------------*/
-int skill_delunit (struct skill_unit* unit) {
+int skill_delunit (struct skill_unit* su) {
struct skill_unit_group *group;
- nullpo_ret(unit);
- if( !unit->alive )
+ nullpo_ret(su);
+ if( !su->alive )
return 0;
- unit->alive=0;
+ su->alive=0;
- nullpo_ret(group=unit->group);
+ nullpo_ret(group=su->group);
if( group->state.song_dance&0x1 ) //Cancel dissonance effect.
- skill->dance_overlap(unit, 0);
+ skill->dance_overlap(su, 0);
// invoke onout event
- if( !unit->range )
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),4);
+ if( !su->range )
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),4);
// perform ondelete actions
switch (group->skill_id) {
@@ -15170,16 +15166,16 @@ int skill_delunit (struct skill_unit* unit) {
}
break;
case WZ_ICEWALL:
- iMap->setgatcell(unit->bl.m,unit->bl.x,unit->bl.y,unit->val2);
- clif->changemapcell(0,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
- skill->unitsetmapcell(unit,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
- map[unit->bl.m].icewall_num--;
+ iMap->setgatcell(su->bl.m,su->bl.x,su->bl.y,su->val2);
+ clif->changemapcell(0,su->bl.m,su->bl.x,su->bl.y,su->val2,ALL_SAMEMAP); // hack to avoid clientside cell bug
+ skill->unitsetmapcell(su,WZ_ICEWALL,group->skill_lv,CELL_ICEWALL,false);
+ map[su->bl.m].icewall_num--;
break;
case SA_LANDPROTECTOR:
- skill->unitsetmapcell(unit,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,false);
+ skill->unitsetmapcell(su,SA_LANDPROTECTOR,group->skill_lv,CELL_LANDPROTECTOR,false);
break;
case HP_BASILICA:
- skill->unitsetmapcell(unit,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
+ skill->unitsetmapcell(su,HP_BASILICA,group->skill_lv,CELL_BASILICA,false);
break;
case RA_ELECTRICSHOCKER: {
struct block_list* target = iMap->id2bl(group->val2);
@@ -15188,7 +15184,7 @@ int skill_delunit (struct skill_unit* unit) {
}
break;
case SC_MAELSTROM:
- skill->unitsetmapcell(unit,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,false);
+ skill->unitsetmapcell(su,SC_MAELSTROM,group->skill_lv,CELL_MAELSTROM,false);
break;
case SC_MANHOLE: // Note : Removing the unit don't remove the status (official info)
if( group->val2 ) { // Someone Traped
@@ -15199,12 +15195,12 @@ int skill_delunit (struct skill_unit* unit) {
break;
}
- clif->skill_delunit(unit);
+ clif->skill_delunit(su);
- unit->group=NULL;
- iMap->delblock(&unit->bl); // don't free yet
- iMap->deliddb(&unit->bl);
- idb_remove(skillunit_db, unit->bl.id);
+ su->group=NULL;
+ iMap->delblock(&su->bl); // don't free yet
+ iMap->deliddb(&su->bl);
+ idb_remove(skillunit_db, su->bl.id);
if(--group->alive_count==0)
skill->del_unitgroup(group,ALC_MARK);
@@ -15496,11 +15492,11 @@ struct skill_unit_group_tickset *skill_unitgrouptickset_search (struct block_lis
*
*------------------------------------------*/
int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = va_arg(ap,struct skill_unit *);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = va_arg(ap,struct skill_unit *);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
- if( !unit->alive || bl->prev == NULL )
+ if( !su->alive || bl->prev == NULL )
return 0;
nullpo_ret(group);
@@ -15508,10 +15504,10 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
if( !(skill->get_inf2(group->skill_id)&(INF2_SONG_DANCE|INF2_TRAP|INF2_NOLP)) && iMap->getcell(bl->m, bl->x, bl->y, CELL_CHKLANDPROTECTOR) )
return 0; //AoE skills are ineffective. [Skotlex]
- if( battle->check_target(&unit->bl,bl,group->target_flag) <= 0 )
+ if( battle->check_target(&su->bl,bl,group->target_flag) <= 0 )
return 0;
- skill->unit_onplace_timer(unit,bl,tick);
+ skill->unit_onplace_timer(su,bl,tick);
return 1;
}
@@ -15520,22 +15516,21 @@ int skill_unit_timer_sub_onplace (struct block_list* bl, va_list ap) {
* @see DBApply
*/
int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
- struct skill_unit* unit = DB->data2ptr(data);
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = DB->data2ptr(data);
+ struct skill_unit_group* group = su->group;
unsigned int tick = va_arg(ap,unsigned int);
bool dissonance;
- struct block_list* bl = &unit->bl;
+ struct block_list* bl = &su->bl;
- if( !unit->alive )
+ if( !su->alive )
return 0;
nullpo_ret(group);
// check for expiration
- if( !group->state.guildaura && (DIFF_TICK(tick,group->tick) >= group->limit || DIFF_TICK(tick,group->tick) >= unit->limit) )
- {// skill unit expired (inlined from skill_unit_onlimit())
- switch( group->unit_id )
- {
+ if( !group->state.guildaura && (DIFF_TICK(tick,group->tick) >= group->limit || DIFF_TICK(tick,group->tick) >= su->limit) ) {
+ // skill unit expired (inlined from skill_unit_onlimit())
+ switch( group->unit_id ) {
case UNT_BLASTMINE:
#ifdef RENEWAL
case UNT_CLAYMORETRAP:
@@ -15548,14 +15543,14 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
group->unit_id = UNT_USED_TRAPS;
//clif->changetraplook(bl, UNT_FIREPILLAR_ACTIVE);
group->limit=DIFF_TICK(tick+1500,group->tick);
- unit->limit=DIFF_TICK(tick+1500,group->tick);
+ su->limit=DIFF_TICK(tick+1500,group->tick);
break;
case UNT_ANKLESNARE:
case UNT_ELECTRICSHOCKER:
if( group->val2 > 0 || group->val3 == SC_ESCAPE ) {
// Used Trap don't returns back to item
- skill->delunit(unit);
+ skill->delunit(su);
break;
}
case UNT_SKIDTRAP:
@@ -15578,27 +15573,27 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list* src;
- if( unit->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC )
- { // revert unit back into a trap
+ if( su->val1 > 0 && (src = iMap->id2bl(group->src_id)) != NULL && src->type == BL_PC ) {
+ // revert unit back into a trap
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
item_tmp.nameid = group->item_id?group->item_id:ITEMID_TRAP;
item_tmp.identify = 1;
iMap->addflooritem(&item_tmp,1,bl->m,bl->x,bl->y,0,0,0,0);
}
- skill->delunit(unit);
+ skill->delunit(su);
}
break;
case UNT_WARP_ACTIVE:
// warp portal opens (morph to a UNT_WARP_WAITING cell)
group->unit_id = skill->get_unit_id(group->skill_id, 1); // UNT_WARP_WAITING
- clif->changelook(&unit->bl, LOOK_BASE, group->unit_id);
+ clif->changelook(&su->bl, LOOK_BASE, group->unit_id);
// restart timers
group->limit = skill->get_time(group->skill_id,group->skill_lv);
- unit->limit = skill->get_time(group->skill_id,group->skill_lv);
+ su->limit = skill->get_time(group->skill_id,group->skill_lv);
// apply effect to all units standing on it
- iMap->foreachincell(skill->unit_effect,unit->bl.m,unit->bl.x,unit->bl.y,group->bl_flag,&unit->bl,timer->gettick(),1);
+ iMap->foreachincell(skill->unit_effect,su->bl.m,su->bl.x,su->bl.y,group->bl_flag,&su->bl,timer->gettick(),1);
break;
case UNT_CALLFAMILY:
@@ -15608,35 +15603,35 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
sd = iMap->charid2sd(group->val1);
group->val1 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
}
if(group->val2) {
sd = iMap->charid2sd(group->val2);
group->val2 = 0;
if (sd && !map[sd->bl.m].flag.nowarp)
- pc->setpos(sd,map_id2index(unit->bl.m),unit->bl.x,unit->bl.y,CLR_TELEPORT);
+ pc->setpos(sd,map_id2index(su->bl.m),su->bl.x,su->bl.y,CLR_TELEPORT);
}
- skill->delunit(unit);
+ skill->delunit(su);
}
break;
case UNT_REVERBERATION:
- if( unit->val1 <= 0 ) { // If it was deactivated.
- skill->delunit(unit);
+ if( su->val1 <= 0 ) { // If it was deactivated.
+ skill->delunit(su);
break;
}
clif->changetraplook(bl,UNT_USED_TRAPS);
iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
- unit->limit = DIFF_TICK(tick,group->tick)+1000;
+ su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
break;
case UNT_FEINTBOMB: {
struct block_list *src = iMap->id2bl(group->src_id);
if( src )
- iMap->foreachinrange(skill->area_sub, &group->unit->bl, unit->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
- skill->delunit(unit);
+ iMap->foreachinrange(skill->area_sub, &group->unit->bl, su->range, splash_target(src), src, SC_FEINTBOMB, group->skill_lv, tick, BCT_ENEMY|SD_ANIMATION|1, skill->castend_damage_id);
+ skill->delunit(su);
break;
}
@@ -15644,27 +15639,26 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
{
struct block_list *src = iMap->id2bl(group->src_id);
struct status_change *sc;
- if( !src || (sc = iStatus->get_sc(src)) == NULL || !sc->data[SC_BANDING] )
- {
- skill->delunit(unit);
+ if( !src || (sc = iStatus->get_sc(src)) == NULL || !sc->data[SC_BANDING] ) {
+ skill->delunit(su);
break;
}
// This unit isn't removed while SC_BANDING is active.
group->limit = DIFF_TICK(tick+group->interval,group->tick);
- unit->limit = DIFF_TICK(tick+group->interval,group->tick);
+ su->limit = DIFF_TICK(tick+group->interval,group->tick);
}
break;
default:
- skill->delunit(unit);
+ skill->delunit(su);
}
} else {// skill unit is still active
switch( group->unit_id ) {
case UNT_ICEWALL:
// icewall loses 50 hp every second
- unit->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
- if( unit->val1 <= 0 && unit->limit + group->tick > tick + 700 )
- unit->limit = DIFF_TICK(tick+700,group->tick);
+ su->val1 -= SKILLUNITTIMER_INTERVAL/20; // trap's hp
+ if( su->val1 <= 0 && su->limit + group->tick > tick + 700 )
+ su->limit = DIFF_TICK(tick+700,group->tick);
break;
case UNT_BLASTMINE:
case UNT_SKIDTRAP:
@@ -15676,9 +15670,9 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
case UNT_FREEZINGTRAP:
case UNT_TALKIEBOX:
case UNT_ANKLESNARE:
- if( unit->val1 <= 0 ) {
+ if( su->val1 <= 0 ) {
if( group->unit_id == UNT_ANKLESNARE && group->val2 > 0 )
- skill->delunit(unit);
+ skill->delunit(su);
else {
clif->changetraplook(bl, group->unit_id==UNT_LANDMINE?UNT_FIREPILLAR_ACTIVE:UNT_USED_TRAPS);
group->limit = DIFF_TICK(tick, group->tick) + 1500;
@@ -15687,16 +15681,16 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
break;
case UNT_REVERBERATION:
- if( unit->val1 <= 0 ){
+ if( su->val1 <= 0 ) {
clif->changetraplook(bl,UNT_USED_TRAPS);
iMap->foreachinrange(skill->trap_splash, bl, skill->get_splash(group->skill_id, group->skill_lv), group->bl_flag, bl, tick);
group->limit = DIFF_TICK(tick,group->tick)+1000;
- unit->limit = DIFF_TICK(tick,group->tick)+1000;
+ su->limit = DIFF_TICK(tick,group->tick)+1000;
group->unit_id = UNT_USED_TRAPS;
}
break;
case UNT_WALLOFTHORN:
- if( unit->val1 <= 0 ) {
+ if( su->val1 <= 0 ) {
group->unit_id = UNT_USED_TRAPS;
group->limit = DIFF_TICK(tick, group->tick) + 1500;
}
@@ -15705,22 +15699,21 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
//Don't continue if unit or even group is expired and has been deleted.
- if( !group || !unit->alive )
+ if( !group || !su->alive )
return 0;
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
- if( unit->range >= 0 && group->interval != -1 )
- {
+ if( su->range >= 0 && group->interval != -1 ) {
if( battle_config.skill_wall_check )
- iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinshootrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
else
- iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, unit->range, group->bl_flag, bl,tick);
+ iMap->foreachinrange(skill->unit_timer_sub_onplace, bl, su->range, group->bl_flag, bl,tick);
- if(unit->range == -1) //Unit disabled, but it should not be deleted yet.
+ if(su->range == -1) //Unit disabled, but it should not be deleted yet.
group->unit_id = UNT_USED_TRAPS;
else if( group->unit_id == UNT_TATAMIGAESHI ) {
- unit->range = -1; //Disable processed cell.
+ su->range = -1; //Disable processed cell.
if (--group->val1 <= 0) { // number of live cells
//All tiles were processed, disable skill.
group->target_flag=BCT_NOONE;
@@ -15729,7 +15722,7 @@ int skill_unit_timer_sub(DBKey key, DBData *data, va_list ap) {
}
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
@@ -15751,8 +15744,8 @@ static int skill_unit_temp[20]; // temporary storage for tracking skill unit sk
*
*------------------------------------------*/
int skill_unit_move_sub (struct block_list* bl, va_list ap) {
- struct skill_unit* unit = (struct skill_unit *)bl;
- struct skill_unit_group* group = unit->group;
+ struct skill_unit* su = (struct skill_unit *)bl;
+ struct skill_unit_group* group = su->group;
struct block_list* target = va_arg(ap,struct block_list*);
unsigned int tick = va_arg(ap,unsigned int);
@@ -15764,25 +15757,25 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
nullpo_ret(group);
- if( !unit->alive || target->prev == NULL )
+ if( !su->alive || target->prev == NULL )
return 0;
- if( flag&1 && ( unit->group->skill_id == PF_SPIDERWEB || unit->group->skill_id == GN_THORNS_TRAP ) )
+ if( flag&1 && ( su->group->skill_id == PF_SPIDERWEB || su->group->skill_id == GN_THORNS_TRAP ) )
return 0; // Fiberlock is never supposed to trigger on skill->unit_move. [Inkfish]
- dissonance = skill->dance_switch(unit, 0);
+ dissonance = skill->dance_switch(su, 0);
//Necessary in case the group is deleted after calling on_place/on_out [Skotlex]
- skill_id = unit->group->skill_id;
+ skill_id = su->group->skill_id;
- if( unit->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411
+ if( su->group->interval != -1 && !(skill->get_unit_flag(skill_id)&UF_DUALMODE) && skill_id != BD_LULLABY ) //Lullaby is the exception, bugreport:411
{ //Non-dualmode unit skills with a timer don't trigger when walking, so just return
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
}
//Target-type check.
- if( !(group->bl_flag&target->type && battle->check_target(&unit->bl,target,group->target_flag) > 0) ) {
+ if( !(group->bl_flag&target->type && battle->check_target(&su->bl,target,group->target_flag) > 0) ) {
if( group->src_id == target->id && group->state.song_dance&0x2 ) { //Ensemble check to see if they went out/in of the area [Skotlex]
if( flag&1 ) {
if( flag&2 ) { //Clear this skill id.
@@ -15805,19 +15798,19 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
skill->unit_onleft(skill_id,target,tick);
}
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
return 0;
} else {
if( flag&1 ) {
- int result = skill->unit_onplace(unit,target,tick);
+ int result = skill->unit_onplace(su,target,tick);
if( flag&2 && result ) { //Clear skill ids we have stored in onout.
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == result );
if( i < ARRAYLENGTH(skill_unit_temp) )
skill_unit_temp[i] = 0;
}
} else {
- int result = skill->unit_onout(unit,target,tick);
+ int result = skill->unit_onout(su,target,tick);
if( flag&2 && result ) { //Store this unit id.
ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 );
if( i < ARRAYLENGTH(skill_unit_temp) )
@@ -15830,7 +15823,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) {
//TODO: Normally, this is dangerous since the unit and group could be freed
//inside the onout/onplace functions. Currently it is safe because we know song/dance
//cells do not get deleted within them. [Skotlex]
- if( dissonance ) skill->dance_switch(unit, 1);
+ if( dissonance ) skill->dance_switch(su, 1);
if( flag&4 )
skill->unit_onleft(skill_id,target,tick);
@@ -15877,8 +15870,8 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
int i,j;
unsigned int tick = timer->gettick();
int *m_flag;
- struct skill_unit *unit1;
- struct skill_unit *unit2;
+ struct skill_unit *su1;
+ struct skill_unit *su2;
if (group == NULL)
return 0;
@@ -15899,49 +15892,47 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
// 1: Unit will move to a slot that had another unit of the same group (skill_unit_onplace not needed)
// 2: Another unit from same group will end up positioned on this unit (skill_unit_onout not needed)
// 3: Both 1+2.
- for(i=0;i<group->unit_count;i++){
- unit1=&group->unit[i];
- if (!unit1->alive || unit1->bl.m!=m)
+ for(i=0;i<group->unit_count;i++) {
+ su1=&group->unit[i];
+ if (!su1->alive || su1->bl.m!=m)
continue;
- for(j=0;j<group->unit_count;j++){
- unit2=&group->unit[j];
- if (!unit2->alive)
+ for(j=0;j<group->unit_count;j++) {
+ su2=&group->unit[j];
+ if (!su2->alive)
continue;
- if (unit1->bl.x+dx==unit2->bl.x && unit1->bl.y+dy==unit2->bl.y){
+ if (su1->bl.x+dx==su2->bl.x && su1->bl.y+dy==su2->bl.y) {
m_flag[i] |= 0x1;
}
- if (unit1->bl.x-dx==unit2->bl.x && unit1->bl.y-dy==unit2->bl.y){
+ if (su1->bl.x-dx==su2->bl.x && su1->bl.y-dy==su2->bl.y) {
m_flag[i] |= 0x2;
}
}
}
j = 0;
for (i=0;i<group->unit_count;i++) {
- unit1=&group->unit[i];
- if (!unit1->alive)
+ su1=&group->unit[i];
+ if (!su1->alive)
continue;
if (!(m_flag[i]&0x2)) {
if (group->state.song_dance&0x1) //Cancel dissonance effect.
- skill->dance_overlap(unit1, 0);
- iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,4);
+ skill->dance_overlap(su1, 0);
+ iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,4);
}
//Move Cell using "smart" criteria (avoid useless moving around)
- switch(m_flag[i])
- {
+ switch(m_flag[i]) {
case 0:
//Cell moves independently, safely move it.
- iMap->moveblock(&unit1->bl, unit1->bl.x+dx, unit1->bl.y+dy, tick);
+ iMap->moveblock(&su1->bl, su1->bl.x+dx, su1->bl.y+dy, tick);
break;
case 1:
//Cell moves unto another cell, look for a replacement cell that won't collide
//and has no cell moving into it (flag == 2)
- for(;j<group->unit_count;j++)
- {
+ for(;j<group->unit_count;j++) {
if(m_flag[j]!=2 || !group->unit[j].alive)
continue;
//Move to where this cell would had moved.
- unit2 = &group->unit[j];
- iMap->moveblock(&unit1->bl, unit2->bl.x+dx, unit2->bl.y+dy, tick);
+ su2 = &group->unit[j];
+ iMap->moveblock(&su1->bl, su2->bl.x+dx, su2->bl.y+dy, tick);
j++; //Skip this cell as we have used it.
break;
}
@@ -15952,9 +15943,9 @@ int skill_unit_move_unit_group (struct skill_unit_group *group, int16 m, int16 d
}
if (!(m_flag[i]&0x2)) { //We only moved the cell in 0-1
if (group->state.song_dance&0x1) //Check for dissonance effect.
- skill->dance_overlap(unit1, 1);
- clif->skill_setunit(unit1);
- iMap->foreachincell(skill->unit_effect,unit1->bl.m,unit1->bl.x,unit1->bl.y,group->bl_flag,&unit1->bl,tick,1);
+ skill->dance_overlap(su1, 1);
+ clif->skill_setunit(su1);
+ iMap->foreachincell(skill->unit_effect,su1->bl.m,su1->bl.x,su1->bl.y,group->bl_flag,&su1->bl,tick,1);
}
}
aFree(m_flag);
@@ -16168,9 +16159,9 @@ int skill_produce_mix (struct map_session_data *sd, uint16 skill_id, int nameid,
+ pc->checkskill(sd,AM_PHARMACY)*300 + sd->status.job_level*20
+ (status->int_/2)*10 + status->dex*10+status->luk*10;
if(homun_alive(sd->hd)) {//Player got a homun
- int skill;
- if((skill=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change
- make_per += skill*100; //+1% bonus per level
+ int skill2_lv;
+ if((skill2_lv=homun->checkskill(sd->hd,HVAN_INSTRUCT)) > 0) //His homun is a vanil with instruction change
+ make_per += skill2_lv*100; //+1% bonus per level
}
switch(nameid){
case 501: // Red Potion