Skip to content

Commit

Permalink
Fixed Homunculus Amistr skills (rathena#8556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Daegaladh authored Aug 27, 2024
1 parent 5138ae7 commit ffead57
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 60 deletions.
5 changes: 0 additions & 5 deletions db/pre-re/skill_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30822,7 +30822,6 @@ Body:
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastActDelay: 1000
AfterCastWalkDelay: 1000
Requires:
Expand All @@ -30834,7 +30833,6 @@ Body:
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastActDelay: 30000
AfterCastWalkDelay: 1000
Duration1:
Expand Down Expand Up @@ -30865,16 +30863,13 @@ Body:
Name: HAMI_SKIN
Description: Adamantium Skin
MaxLevel: 5
DamageFlags:
NoDamage: true
- Id: 8008
Name: HAMI_BLOODLUST
Description: Bloodlust
MaxLevel: 3
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastActDelay:
- Level: 1
Time: 300000
Expand Down
7 changes: 7 additions & 0 deletions db/pre-re/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2496,6 +2496,9 @@ Body:
CalcFlags:
Batk: true
Watk: true
Flags:
NoSave: true
RemoveFromHomOnWarp: true
- Status: Fleet
DurationLookup: HFLI_FLEET
CalcFlags:
Expand All @@ -2510,6 +2513,10 @@ Body:
DurationLookup: HAMI_DEFENCE
CalcFlags:
Def: true
Vit: true
Flags:
NoSave: true
RemoveFromHomOnWarp: true
- Status: Incaspdrate
CalcFlags:
Aspd: true
Expand Down
5 changes: 0 additions & 5 deletions db/re/skill_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43106,7 +43106,6 @@ Body:
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastWalkDelay: 1000
Cooldown: 1000
Requires:
Expand All @@ -43118,7 +43117,6 @@ Body:
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastWalkDelay: 1000
Duration1:
- Level: 1
Expand Down Expand Up @@ -43149,16 +43147,13 @@ Body:
Name: HAMI_SKIN
Description: Adamantium Skin
MaxLevel: 5
DamageFlags:
NoDamage: true
- Id: 8008
Name: HAMI_BLOODLUST
Description: Bloodlust
MaxLevel: 3
TargetType: Self
DamageFlags:
NoDamage: true
Hit: Single
AfterCastWalkDelay: 1000
Duration1:
- Level: 1
Expand Down
7 changes: 7 additions & 0 deletions db/re/status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2618,6 +2618,9 @@ Body:
CalcFlags:
Batk: true
Watk: true
Flags:
NoSave: true
RemoveFromHomOnMapWarp: true
- Status: Fleet
DurationLookup: HFLI_FLEET
CalcFlags:
Expand All @@ -2631,7 +2634,11 @@ Body:
- Status: Defence
DurationLookup: HAMI_DEFENCE
CalcFlags:
Def: true
Vit: true
Flags:
NoSave: true
RemoveFromHomOnMapWarp: true
- Status: Incaspdrate
CalcFlags:
Aspd: true
Expand Down
17 changes: 10 additions & 7 deletions doc/status_change.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,12 @@ SC_CHANGE (EFST_HLIF_CHANGE)
val2: VIT increase (20 * val1)
val3: INT increase (30 * val1)

SC_BLOODLUST ()
desc:
val1:
SC_BLOODLUST (EFST_HAMI_BLOODLUST)
desc: Increase the homunculus ATK and has a chance to leech HP from the target
val1: Skill Level
val2: ATK increase (20 + (10 * val1))
val3: Chance to leech HP (9 * val1)%
val4: Leeched HP percentage 20%

SC_FLEET ()
desc:
Expand All @@ -1024,10 +1027,10 @@ SC_SPEED ()
desc:
val1:

SC_DEFENCE ()
desc: Increase Defense, HAMI_DEFENCE effect
val1: (none)
val2: + Def(Pre-renewal) or VIT (Renewal)
SC_DEFENCE (EFST_HAMI_DEFENCE)
desc: Increase VIT and as result VIT-based DEF of the Player and plain VIT of the Homunculus
val1: Skill Level
val2: VIT increase for players, DEF increase for homunculus (5 + (5 * val1)) [Renewal], (2 * val1) [Pre-Renewal]

SC_INCASPDRATE ()
desc: Increase ASPD
Expand Down
4 changes: 2 additions & 2 deletions src/map/battle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1900,8 +1900,8 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
}
}

if ((sce = sc->getSCE(SC_BLOODLUST)) && flag&BF_WEAPON && damage > 0 && rnd()%100 < sce->val3)
status_heal(src, damage * sce->val4 / 100, 0, 3);
if ((sce = sc->getSCE(SC_BLOODLUST)) && flag & BF_WEAPON && damage > 0 && rnd_chance(sce->val3, 100))
status_heal(src, damage * sce->val4 / 100, 0, 1);

if ((sce = sc->getSCE(SC_BLOODSUCKER)) && flag & BF_WEAPON && damage > 0 && rnd() % 100 < (2 * sce->val1 - 1))
status_heal(src, damage * sce->val1 / 100, 0, 3);
Expand Down
31 changes: 18 additions & 13 deletions src/map/skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8236,8 +8236,10 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui
break;
case HLIF_AVOID:
case HAMI_DEFENCE:
sc_start(src,bl,type,100,skill_lv,skill_get_time(skill_id,skill_lv)); // Master
clif_skill_nodamage(src,src,skill_id,skill_lv,sc_start(src,src,type,100,skill_lv,skill_get_time(skill_id,skill_lv))); // Homunc
// Master
sc_start(src, bl, type, 100, skill_lv, skill_get_time(skill_id, skill_lv));
// Homunculus
clif_skill_nodamage(src, src, skill_id, skill_lv, sc_start(src, src, type, 100, skill_lv, skill_get_time(skill_id, skill_lv)));
break;
case NJ_BUNSINJYUTSU:
status_change_end(bl, SC_BUNSINJYUTSU); // on official recasting cancels existing mirror image [helvetica]
Expand Down Expand Up @@ -10670,23 +10672,26 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, ui

case HAMI_CASTLE: //[orn]
if (src != bl && rnd_chance(20 * skill_lv, 100)) {
int x = src->x, y = src->y;
// Get one of the monsters targeting the player and set the homunculus as its new target
if (block_list* tbl = battle_getenemy(bl, BL_MOB, AREA_SIZE); tbl != nullptr) {
if (unit_data* ud = unit_bl2ud(tbl); ud != nullptr)
unit_changetarget_sub(*ud, *src);
}

// Move source
if (unit_movepos(src,bl->x,bl->y,0,0)) {
clif_skill_nodamage(src,src,skill_id,skill_lv,1); // Homunc
int16 x = src->x, y = src->y;
// Move homunculus
if (unit_movepos(src, bl->x, bl->y, 0, false)) {
clif_blown(src);
// Move target
if (unit_movepos(bl,x,y,0,0)) {
clif_skill_nodamage(bl,bl,skill_id,skill_lv,1);
// Move player
if (unit_movepos(bl, x, y, 0, false))
clif_blown(bl);
}
map_foreachinallrange(unit_changetarget,src,AREA_SIZE,BL_MOB,bl,src);
// Show the animation on the homunculus only
clif_skill_nodamage(src, src, skill_id, skill_lv, 1);
}
}
else if (hd && hd->master) // Failed
else if (hd != nullptr && hd->master != nullptr)
clif_skill_fail( *hd->master, skill_id );
else if (sd)
else if (sd != nullptr)
clif_skill_fail( *sd, skill_id );
break;
case HVAN_CHAOTIC: //[orn]
Expand Down
24 changes: 13 additions & 11 deletions src/map/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6686,10 +6686,8 @@ static unsigned short status_calc_vit(struct block_list *bl, status_change *sc,
vit -= vit * sc->getSCE(SC_STRIPARMOR)->val2/100;
if(sc->getSCE(SC_FULL_THROTTLE))
vit += vit * sc->getSCE(SC_FULL_THROTTLE)->val3 / 100;
#ifdef RENEWAL
if(sc->getSCE(SC_DEFENCE))
if(bl->type == BL_PC && sc->getSCE(SC_DEFENCE))
vit += sc->getSCE(SC_DEFENCE)->val2;
#endif
if(sc->getSCE(SC_CHEERUP))
vit += 3;
if(sc->getSCE(SC_GLASTHEIM_STATE))
Expand Down Expand Up @@ -7707,10 +7705,9 @@ static defType status_calc_def(struct block_list *bl, status_change *sc, int def
#ifdef RENEWAL
if (sc->getSCE(SC_ASSUMPTIO))
def += sc->getSCE(SC_ASSUMPTIO)->val1 * 50;
#else
if(sc->getSCE(SC_DEFENCE))
def += sc->getSCE(SC_DEFENCE)->val2;
#endif
if (bl->type == BL_HOM && sc->getSCE(SC_DEFENCE))
def += sc->getSCE(SC_DEFENCE)->val2;
if(sc->getSCE(SC_INCDEFRATE))
def += def * sc->getSCE(SC_INCDEFRATE)->val1/100;
if(sc->getSCE(SC_EARTH_INSIGNIA) && sc->getSCE(SC_EARTH_INSIGNIA)->val1 == 2)
Expand Down Expand Up @@ -11506,16 +11503,21 @@ int status_change_start(struct block_list* src, struct block_list* bl,enum sc_ty
val2 = 10 * val1;
break;
case SC_DEFENCE:
// Vit bonus for players / Def bonus for homunculus
#ifdef RENEWAL
val2 = 5 + (val1 * 5); // Vit bonus
val2 = 5 + (5 * val1);
#else
val2 = 2*val1; // Def bonus
val2 = 2 * val1;
#endif
break;
case SC_BLOODLUST:
val2 = 20+10*val1; // Atk rate change.
val3 = 3*val1; // Leech chance
val4 = 20; // Leech percent
// Atk rate change
val2 = 20 + (10 * val1);
// Leech chance
// It's actually 9 * level on both pre-re and renewal, despite the description
val3 = 9 * val1;
// Leech percent
val4 = 20;
break;
case SC_FLEET:
val2 = 30*val1; // Aspd change
Expand Down
42 changes: 27 additions & 15 deletions src/map/unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3130,32 +3130,44 @@ int unit_counttargeted(struct block_list* bl)
* @param src Current target
* @param target New target
**/
int unit_changetarget(struct block_list *bl, va_list ap) {
struct unit_data *ud = unit_bl2ud(bl);
struct block_list *src = va_arg(ap,struct block_list *);
struct block_list *target = va_arg(ap,struct block_list *);
int unit_changetarget(block_list *bl, va_list ap) {
if (bl == nullptr)
return 1;
unit_data *ud = unit_bl2ud(bl);
block_list *src = va_arg(ap, block_list *);
block_list *target = va_arg(ap, block_list *);

if (!ud || !target || ud->target == target->id)
if (ud == nullptr || src == nullptr || target == nullptr || ud->target == target->id)
return 1;
if (!ud->target && !ud->target_to)
if (ud->target <= 0 && ud->target_to <= 0)
return 1;
if (ud->target != src->id && ud->target_to != src->id)
return 1;

if (bl->type == BL_MOB)
(BL_CAST(BL_MOB,bl))->target_id = target->id;
if (ud->target_to)
ud->target_to = target->id;
else
ud->target_to = 0;
if (ud->skilltarget)
ud->skilltarget = target->id;
unit_set_target(ud, target->id);
unit_changetarget_sub(*ud, *target);

//unit_attack(bl, target->id, ud->state.attack_continue);
return 0;
}

/**
* Changes the target of a unit
* @param ud: Unit data
* @param target: New target data
**/
void unit_changetarget_sub(unit_data& ud, block_list& target) {
if (status_isdead(target))
return;

if (ud.bl->type == BL_MOB)
reinterpret_cast<mob_data*>(ud.bl)->target_id = target.id;
if (ud.target_to > 0)
ud.target_to = target.id;
if (ud.skilltarget > 0)
ud.skilltarget = target.id;
unit_set_target(&ud, target.id);
}

/**
* Removes a bl/ud from the map
* On kill specifics are not performed here, check status_damage()
Expand Down
4 changes: 2 additions & 2 deletions src/map/unit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ void unit_free_pc(map_session_data *sd);
#define unit_remove_map(bl,clrtype) unit_remove_map_(bl,clrtype,__FILE__,__LINE__,__func__)
int unit_remove_map_(struct block_list *bl, clr_type clrtype, const char* file, int line, const char* func);
int unit_free(struct block_list *bl, clr_type clrtype);
int unit_changeviewsize(struct block_list *bl,short size);
int unit_changetarget(struct block_list *bl,va_list ap);
int unit_changetarget(block_list *bl,va_list ap);
void unit_changetarget_sub(unit_data& ud, block_list& target);

// Shadow Scar
void unit_addshadowscar(unit_data &ud, int interval);
Expand Down

0 comments on commit ffead57

Please sign in to comment.