Skip to content

Commit

Permalink
Gravitational Field full official implementation and minor fixes
Browse files Browse the repository at this point in the history
- Gravitational Field will now work as official servers (bugreport:4897)
  * Fixed range of Ganbantein (16->14) and Gravitational Field (9->14)
  * Gravitational Field never misses and can hit hidden targets
  * Similar to Pressure the damage can not be increased or decreased by any means, it even hits GTB users and users protected by Devotion/Sacrifice
  * Renewal damage is now 400+100*level every 500ms (200+200*level every 1000ms in pre-renewal)
  * You can no longer do normal attacks while the skill is active
  * You now can use skills while the skill is active, however, other skills are unable to deal any damage as long as Gravitational Field is active
  * Added the possibility to link different skill unit groups together; if a skill unit group gets deleted, the linked skill unit groups are deleted as well; this was needed because when being hit, all Gravitational Fields of the person being hit need to be removed
  * Gravitational Field can no longer overlap with itself
  * Pressure and Gravitational Field will now be considered "physical normal attacks" and can consequently trigger Autospells; unlike manually cast spells, Autospells can deal damage while Gravitational Field is active
- Fixed that in renewal, weapons with a range of 2 and 3 did depend on DEX instead of STR (fixed #129)
  * Special thanks to NovaRagnarok for the fix
  • Loading branch information
Playtester committed Dec 3, 2014
1 parent 4e376c4 commit 861112b
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 13 deletions.
4 changes: 2 additions & 2 deletions db/pre-re/skill_db.txt
Expand Up @@ -699,8 +699,8 @@
480,5,8,1,-1,0,0,5,5,no,0,0,0,weapon,0,0x20000, PA_SHIELDCHAIN,Shield Chain
481,0,0,0,0,0,0,5,0,no,0,0,0,none,0,0x0, HP_MANARECHARGE,Mana Recharge
482,0,6,4,0,0x1,0,5,1,no,0,0,0,magic,0,0x0, PF_DOUBLECASTING,Double Casting
483,16,6,2,0,0x1,1:2:3:4:5,1,1,no,0,0,0,none,0,0x20, HW_GANBANTEIN,Ganbantein
484,9,6,2,2,0x91,0,5,1,yes,0,0x18000,0,misc,0,0x1030, HW_GRAVITATION,Gravitation Field
483,14,6,2,0,0x1,1:2:3:4:5,1,1,no,0,0,0,none,0,0x20, HW_GANBANTEIN,Ganbantein
484,14,6,2,2,0xD1,0,5,1,yes,0,0x18000,0,misc,0,0x11030, HW_GRAVITATION,Gravitation Field
485,-2,6,1,-1,0x8,0,10,1,no,0,0,0,weapon,0,0x4000, WS_CARTTERMINATION,Cart Termination
486,0,6,4,0,0x1,0,5,1,no,0,0,0,weapon,0,0x4000, WS_OVERTHRUSTMAX,Maximum Power Thrust
487,0,6,4,0,0x1,0,5,1,no,0,0,0,none,0,0x8, CG_LONGINGFREEDOM,Longing for Freedom
Expand Down
4 changes: 2 additions & 2 deletions db/re/skill_db.txt
Expand Up @@ -699,8 +699,8 @@
480,5,8,1,-1,0,0,5,5,no,0,0,0,weapon,0,0x20000, PA_SHIELDCHAIN,Shield Chain
481,0,0,0,0,0,0,5,0,no,0,0,0,none,0,0x0, HP_MANARECHARGE,Mana Recharge
482,0,6,4,0,0x1,0,5,1,no,0,0,0,magic,0,0x0, PF_DOUBLECASTING,Double Casting
483,16,6,2,0,0x1,1:2:3:4:5,1,1,no,0,0,0,none,0,0x20, HW_GANBANTEIN,Ganbantein
484,9,6,2,2,0x91,0,5,1,yes,0,0x18000,0,misc,0,0x1030, HW_GRAVITATION,Gravitation Field
483,14,6,2,0,0x1,1:2:3:4:5,1,1,no,0,0,0,none,0,0x20, HW_GANBANTEIN,Ganbantein
484,14,6,2,2,0xD1,0,5,1,yes,0,0x18000,0,misc,0,0x11030, HW_GRAVITATION,Gravitation Field
485,-2,6,1,-1,0x8,0,10,1,no,0,0,0,weapon,0,0x4000, WS_CARTTERMINATION,Cart Termination
486,0,6,4,0,0x1,0,5,1,no,0,0,0,weapon,0,0x4000, WS_OVERTHRUSTMAX,Maximum Power Thrust
487,0,6,4,0,0x1,0,5,1,no,0,0,0,none,0,0x8, CG_LONGINGFREEDOM,Longing for Freedom
Expand Down
10 changes: 7 additions & 3 deletions src/map/battle.c
Expand Up @@ -841,15 +841,15 @@ int64 battle_calc_damage(struct block_list *src,struct block_list *bl,struct Dam
if( sc && sc->data[SC_INVINCIBLE] && !sc->data[SC_INVINCIBLEOFF] )
return 1;

if (skill_id == PA_PRESSURE)
return damage; //This skill bypass everything else.
if (skill_id == PA_PRESSURE || skill_id == HW_GRAVITATION)
return damage; //These skills bypass everything else.

if( sc && sc->count ) { // SC_* that reduce damage to 0.
if( sc->data[SC_BASILICA] && !(status_get_mode(src)&MD_BOSS) ) {
d->dmg_lv = ATK_BLOCK;
return 0;
}
if( sc->data[SC_WHITEIMPRISON] && skill_id != HW_GRAVITATION ) { // Gravitation and Pressure do damage without removing the effect
if( sc->data[SC_WHITEIMPRISON] ) { // Gravitation and Pressure do damage without removing the effect
if( skill_id == MG_NAPALMBEAT ||
skill_id == MG_SOULSTRIKE ||
skill_id == WL_SOULEXPANSION ||
Expand Down Expand Up @@ -6244,7 +6244,11 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list *
#endif
break;
case HW_GRAVITATION:
#ifdef RENEWAL
md.damage = 500+100*skill_lv;
#else
md.damage = 200+200*skill_lv;
#endif
md.dmotion = 0; //No flinch animation.
break;
case NPC_EVILLAND:
Expand Down
3 changes: 2 additions & 1 deletion src/map/pc.c
Expand Up @@ -8468,7 +8468,8 @@ bool pc_can_attack( struct map_session_data *sd, int target_id ) {
sd->sc.data[SC_TRICKDEAD] ||
(sd->sc.data[SC_VOICEOFSIREN] && sd->sc.data[SC_VOICEOFSIREN]->val2 == target_id) ||
sd->sc.data[SC_BLADESTOP] ||
sd->sc.data[SC_DEEPSLEEP] )
sd->sc.data[SC_DEEPSLEEP] ||
(sd->sc.data[SC_GRAVITATION] && sd->sc.data[SC_GRAVITATION]->val3 == BCT_SELF) )
return false;

return true;
Expand Down
33 changes: 30 additions & 3 deletions src/map/skill.c
Expand Up @@ -1104,6 +1104,11 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1

case PA_PRESSURE:
status_percent_damage(src, bl, 0, 15+5*skill_lv, false);
//Fall through
case HW_GRAVITATION:
//Pressure and Gravitation can trigger physical autospells
attack_type |= BF_NORMAL;
attack_type |= BF_WEAPON;
break;

case RG_RAID:
Expand Down Expand Up @@ -2843,7 +2848,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
{
struct Damage dmg;
struct status_data *sstatus, *tstatus;
struct status_change *tsc;
struct status_change *sc, *tsc;
struct map_session_data *sd, *tsd;
int64 damage;
int8 rmdamage = 0;//magic reflected
Expand Down Expand Up @@ -2873,13 +2878,18 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *

sstatus = status_get_status_data(src);
tstatus = status_get_status_data(bl);
sc= status_get_sc(src);
tsc= status_get_sc(bl);
if (tsc && !tsc->count) tsc = NULL; //Don't need it.

//Trick Dead protects you from damage, but not from buffs and the like, hence it's placed here.
if (tsc && tsc->data[SC_TRICKDEAD])
return 0;

//When Gravitational Field is active, damage can only be dealt by Gravitational Field and Autospells
if(sc && sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF && skill_id != HW_GRAVITATION && !sd->state.autocast)
return 0;

dmg = battle_calc_attack(attack_type,src,bl,skill_id,skill_lv,flag&0xFFF);

//Skotlex: Adjusted to the new system
Expand Down Expand Up @@ -3183,7 +3193,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *

// Instant damage
if( !dmg.amotion ) {
if( (!tsc || (!tsc->data[SC_DEVOTION] && skill_id != CR_REFLECTSHIELD)) && !shadow_flag )
if( (!tsc || (!tsc->data[SC_DEVOTION] && skill_id != CR_REFLECTSHIELD) || skill_id == HW_GRAVITATION) && !shadow_flag )
status_fix_damage(src,bl,damage,dmg.dmotion); //Deal damage before knockback to allow stuff like firewall+storm gust combo.
if( !status_isdead(bl) && additional_effects )
skill_additional_effect(src,bl,skill_id,skill_lv,dmg.flag,dmg.dmg_lv,tick);
Expand All @@ -3206,7 +3216,7 @@ int64 skill_attack (int attack_type, struct block_list* src, struct block_list *
battle_delay_damage(tick, dmg.amotion,src,bl,dmg.flag,skill_id,skill_lv,damage,dmg.dmg_lv,dmg.dmotion, additional_effects);
}

if( tsc && tsc->data[SC_DEVOTION] && skill_id != PA_PRESSURE ) {
if( tsc && tsc->data[SC_DEVOTION] && skill_id != PA_PRESSURE && skill_id != HW_GRAVITATION ) {
struct status_change_entry *sce = tsc->data[SC_DEVOTION];
struct block_list *d_bl = map_id2bl(sce->val1);

Expand Down Expand Up @@ -11883,6 +11893,7 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_
{
struct skill_unit_group *group;
int i, limit, val1 = 0, val2 = 0, val3 = 0;
int link_group_id = 0;
int target, interval, range, unit_flag, req_item = 0;
struct s_skill_unit_layout *layout;
struct map_session_data *sd;
Expand Down Expand Up @@ -12203,13 +12214,17 @@ struct skill_unit_group *skill_unitsetting(struct block_list *src, uint16 skill_
}
}
break;
case HW_GRAVITATION:
if(sc && sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF)
link_group_id = sc->data[SC_GRAVITATION]->val4;
}

// Init skill unit group
nullpo_retr(NULL, (group = skill_initunitgroup(src,layout->count,skill_id,skill_lv,skill_get_unit_id(skill_id,flag&1)+subunt, limit, interval)));
group->val1 = val1;
group->val2 = val2;
group->val3 = val3;
group->link_group_id = link_group_id;
group->target_flag = target;
group->bl_flag = skill_get_unit_bl_target(skill_id);
group->state.ammo_consume = (sd && sd->state.arrow_atk && skill_id != GS_GROUNDDRIFT); //Store if this skill needs to consume ammo.
Expand Down Expand Up @@ -16518,6 +16533,7 @@ static int skill_cell_overlap(struct block_list *bl, va_list ap)
break;
case WZ_ICEWALL:
case HP_BASILICA:
case HW_GRAVITATION:
//These can't be placed on top of themselves (duration can't be refreshed)
if (unit->group->skill_id == skill_id)
{
Expand Down Expand Up @@ -17076,6 +17092,7 @@ struct skill_unit_group* skill_initunitgroup(struct block_list* src, int count,
group->guild_id = status_get_guild_id(src);
group->bg_id = bg_team_get_id(src);
group->group_id = skill_get_new_group_id();
group->link_group_id = 0;
group->unit = (struct skill_unit *)aCalloc(count,sizeof(struct skill_unit));
group->unit_count = count;
group->alive_count = 0;
Expand Down Expand Up @@ -17113,6 +17130,7 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
struct block_list* src;
struct unit_data *ud;
short i, j;
int link_group_id;

if( group == NULL ) {
ShowDebug("skill_delunitgroup: group is NULL (source=%s:%d, %s)! Please report this! (#3504)\n", file, line, func);
Expand Down Expand Up @@ -17228,6 +17246,9 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
group->group_id = 0;
group->unit_count = 0;

link_group_id = group->link_group_id;
group->link_group_id = 0;

// locate this group, swap with the last entry and delete it
ARR_FIND( 0, MAX_SKILLUNITGROUP, i, ud->skillunit[i] == group );
ARR_FIND( i, MAX_SKILLUNITGROUP, j, ud->skillunit[j] == NULL );
Expand All @@ -17239,6 +17260,12 @@ int skill_delunitgroup_(struct skill_unit_group *group, const char* file, int li
} else
ShowError("skill_delunitgroup: Group not found! (src_id: %d skill_id: %d)\n", group->src_id, group->skill_id);

if(link_group_id) {
struct skill_unit_group* group = skill_id2group(link_group_id);
if(group)
skill_delunitgroup(group);
}

return 1;
}

Expand Down
1 change: 1 addition & 0 deletions src/map/skill.h
Expand Up @@ -233,6 +233,7 @@ struct skill_unit_group {
char *valstr; /// String value, used for HT_TALKIEBOX & RG_GRAFFITI
int unit_id; /// Unit ID (for client effect)
int group_id; /// Skill Group ID
int link_group_id; /// Linked group that should be deleted if this one is deleted
int unit_count, /// Number of unit at this group
alive_count; /// Number of alive unit
int item_id; /// Store item used.
Expand Down
3 changes: 1 addition & 2 deletions src/map/status.c
Expand Up @@ -1842,7 +1842,6 @@ bool status_check_skilluse(struct block_list *src, struct block_list *target, ui
(sc->data[SC_TRICKDEAD] && skill_id != NV_TRICKDEAD)
|| (sc->data[SC_AUTOCOUNTER] && !flag && skill_id)
|| (sc->data[SC_GOSPEL] && sc->data[SC_GOSPEL]->val4 == BCT_SELF && skill_id != PA_GOSPEL)
|| (sc->data[SC_GRAVITATION] && sc->data[SC_GRAVITATION]->val3 == BCT_SELF && flag != 2)
)
return false;

Expand Down Expand Up @@ -2162,7 +2161,7 @@ static unsigned short status_base_atk(const struct block_list *bl, const struct
unsigned int status_weapon_atk(struct weapon_atk wa, struct status_data *status)
{
float str = status->str;
if (wa.range > 1)
if (wa.range > 3)
str = status->dex;
// wa.at2 = refinement, wa.atk = base equip atk, wa.atk*str/200 = bonus str
return wa.atk + wa.atk2 + (int)(wa.atk * (str/200));
Expand Down

0 comments on commit 861112b

Please sign in to comment.