summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-01 22:19:18 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-09-01 22:19:18 +0000
commitc9181667d0cea7e6cfe99745d18c760c4a797912 (patch)
tree78f32c3f99a5e11ff7ee4b3af70035f0e5235e6b /src/map
parentde683beed6af67c57efd4b762a9797f98d4e28c6 (diff)
downloadhercules-c9181667d0cea7e6cfe99745d18c760c4a797912.tar.gz
hercules-c9181667d0cea7e6cfe99745d18c760c4a797912.tar.bz2
hercules-c9181667d0cea7e6cfe99745d18c760c4a797912.tar.xz
hercules-c9181667d0cea7e6cfe99745d18c760c4a797912.zip
- More code for mercenaries and starting work on restrictions.
* Heal and Sanctuary skills have their effectiveness on mercenaries reduced by 50%. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13183 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/battle.c14
-rw-r--r--src/map/npc.c2
-rw-r--r--src/map/script.c1
-rw-r--r--src/map/skill.c30
-rw-r--r--src/map/status.c23
5 files changed, 49 insertions, 21 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 2ea509299..150a6a39b 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -99,6 +99,7 @@ int battle_gettarget(struct block_list* bl)
case BL_MOB: return ((struct mob_data*)bl)->target_id;
case BL_PET: return ((struct pet_data*)bl)->target_id;
case BL_HOM: return ((struct homun_data*)bl)->ud.target;
+ case BL_MER: return ((struct mercenary_data*)bl)->ud.target;
}
return 0;
}
@@ -3315,19 +3316,18 @@ bool battle_check_range(struct block_list *src,struct block_list *bl,int range)
nullpo_retr(false, src);
nullpo_retr(false, bl);
- if(src->m != bl->m) // ˆα‚€ƒ}ƒbƒv
+ if( src->m != bl->m )
return false;
- if (!check_distance_bl(src, bl, range))
+ if( !check_distance_bl(src, bl, range) )
return false;
- if((d=distance_bl(src, bl)) < 2) //No need for path checking.
- return true;
+ if( (d = distance_bl(src, bl)) < 2 )
+ return true; // No need for path checking.
- if (d> AREA_SIZE)
- return false; //Avoid targetting objects beyond your range of sight.
+ if( d > AREA_SIZE )
+ return false; // Avoid targetting objects beyond your range of sight.
- // ?αŠQ•¨”»’θ
return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y,CELL_CHKWALL);
}
diff --git a/src/map/npc.c b/src/map/npc.c
index cc87aa611..592bd88f1 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2946,7 +2946,7 @@ int do_final_npc(void)
if ((bl = map_id2bl(i))){
if (bl->type == BL_NPC)
npc_unload((struct npc_data *)bl);
- else if (bl->type&(BL_MOB|BL_PET|BL_HOM))
+ else if (bl->type&(BL_MOB|BL_PET|BL_HOM|BL_MER))
unit_free(bl, 0);
}
}
diff --git a/src/map/script.c b/src/map/script.c
index 8897c4082..d2a77036b 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -12223,6 +12223,7 @@ BUILDIN_FUNC(rid2name)
case BL_NPC: script_pushstrcopy(st,((TBL_NPC*)bl)->exname); break;
case BL_PET: script_pushstrcopy(st,((TBL_PET*)bl)->pet.name); break;
case BL_HOM: script_pushstrcopy(st,((TBL_HOM*)bl)->homunculus.name); break;
+ case BL_MER: script_pushstrcopy(st,((TBL_MER*)bl)->db->name); break;
default:
ShowError("buildin_rid2name: BL type unknown.\n");
script_pushconststr(st,"");
diff --git a/src/map/skill.c b/src/map/skill.c
index 146b74c6f..03f9725d5 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -275,6 +275,9 @@ int skill_calc_heal (struct block_list *src, struct block_list *target, int skil
if(src->type == BL_HOM && (skill = merc_hom_checkskill(((TBL_HOM*)src), HLIF_BRAIN)) > 0)
heal += heal * skill * 2 / 100;
+ if(src->type == BL_MER)
+ heal /= 2;
+
sc = status_get_sc(target);
if( sc && sc->count )
{
@@ -6840,15 +6843,15 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
break;
case UNT_SANCTUARY:
- if (battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race==RC_DEMON)
- { //Only damage enemies with offensive Sanctuary. [Skotlex]
- if(battle_check_target(&src->bl,bl,BCT_ENEMY)>0 &&
- skill_attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0))
- // reduce healing count if this was meant for damaging [hekate]
- sg->val1 -= 2;
- } else {
+ if( battle_check_undead(tstatus->race, tstatus->def_ele) || tstatus->race==RC_DEMON )
+ { //Only damage enemies with offensive Sanctuary. [Skotlex]
+ if( battle_check_target(&src->bl,bl,BCT_ENEMY) > 0 && skill_attack(BF_MAGIC, ss, &src->bl, bl, sg->skill_id, sg->skill_lv, tick, 0) )
+ sg->val1 -= 2; // reduce healing count if this was meant for damaging [hekate]
+ }
+ else
+ {
int heal = sg->val2;
- if (tstatus->hp >= tstatus->max_hp)
+ if( tstatus->hp >= tstatus->max_hp )
break;
if( tsc )
{
@@ -6857,14 +6860,17 @@ int skill_unit_onplace_timer (struct skill_unit *src, struct block_list *bl, uns
if( tsc->data[SC_CRITICALWOUND] )
heal -= heal * tsc->data[SC_CRITICALWOUND]->val2 / 100;
}
- if (status_isimmune(bl))
- heal = 0; /* ι»„ι‡‘θŸ²γ‚«γƒΌγƒ‰οΌˆγƒ’γƒΌγƒ«ι‡οΌοΌ‰ */
+ if( bl->type == BL_MER )
+ heal /= 2;
+ if( status_isimmune(bl) )
+ heal = 0;
+
clif_skill_nodamage(&src->bl, bl, AL_HEAL, heal, 1);
status_heal(bl, heal, 0, 0);
- if (diff >= 500)
+ if( diff >= 500 )
sg->val1--;
}
- if (sg->val1 <= 0)
+ if( sg->val1 <= 0 )
skill_delunitgroup(NULL,sg);
break;
diff --git a/src/map/status.c b/src/map/status.c
index 58a320849..59ae8f306 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -4089,6 +4089,7 @@ int status_get_class(struct block_list *bl)
case BL_MOB: return ((TBL_MOB*)bl)->vd->class_; //Class used on all code should be the view class of the mob.
case BL_PET: return ((TBL_PET*)bl)->pet.class_;
case BL_HOM: return ((TBL_HOM*)bl)->homunculus.class_;
+ case BL_MER: return ((TBL_MER*)bl)->mercenary.class_;
case BL_NPC: return ((TBL_NPC*)bl)->class_;
}
return 0;
@@ -6772,7 +6773,7 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
}
//On Aegis, when turning off a status change, first goes the sc packet, then the option packet.
- if (vd && pcdb_checkid(vd->class_))
+ if( vd && pcdb_checkid(vd->class_) )
clif_status_change(bl,StatusIconChangeTable[type],0);
else if (sd)
clif_status_load(bl,StatusIconChangeTable[type],0);
@@ -6783,6 +6784,26 @@ int status_change_end(struct block_list* bl, enum sc_type type, int tid)
if (calc_flag)
status_calc_bl(bl,calc_flag);
+ if( bl->type == BL_MER )
+ switch( type )
+ { // Update Status Window
+ case SC_MERC_HPUP:
+ clif_mercenary_updatestatus(((TBL_MER*)bl)->master, SP_MAXHP);
+ break;
+ case SC_MERC_SPUP:
+ clif_mercenary_updatestatus(((TBL_MER*)bl)->master, SP_MAXSP);
+ break;
+ case SC_MERC_FLEEUP:
+ clif_mercenary_updatestatus(((TBL_MER*)bl)->master, SP_MERCFLEE);
+ break;
+ case SC_MERC_ATKUP:
+ clif_mercenary_updatestatus(((TBL_MER*)bl)->master, SP_ATK1);
+ break;
+ case SC_MERC_HITUP:
+ clif_mercenary_updatestatus(((TBL_MER*)bl)->master, SP_HIT);
+ break;
+ }
+
if(opt_flag&4) //Out of hiding, invoke on place.
skill_unit_move(bl,gettick(),1);