-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sadhu skills #302
Open
felipecastagnarodecarvalho
wants to merge
25
commits into
NoCode-NoLife:master
Choose a base branch
from
felipecastagnarodecarvalho:sadhu_skills
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sadhu skills #302
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9d14ab5
Initial Sadhu skill's implementations
felipecastagnarodecarvalho 0f1cfaa
[WIP] Sadhu skills
felipecastagnarodecarvalho 8a0803a
Merge branch 'master' of https://github.com/NoCode-NoLife/melia into …
felipecastagnarodecarvalho cdf1740
Adding the first sadhu Skill - Prakriti
felipecastagnarodecarvalho 01a2f3a
Polishing Prakriti
felipecastagnarodecarvalho bd6a41f
Adding Anila skill
felipecastagnarodecarvalho 3c5e170
Adding Possession skill (sadhu) + skill base class inheritance
felipecastagnarodecarvalho 80ff162
Adding Enira sadhu skill
felipecastagnarodecarvalho 5aa0295
Working on the sadhu arts that creates clones
felipecastagnarodecarvalho 020d514
Small Update (Sadhu)
felipecastagnarodecarvalho cef4651
Merge branch 'master' into sadhu_skills
felipecastagnarodecarvalho 70535a7
[WIP] Sadhu skills tweek
felipecastagnarodecarvalho e2203f0
Messing up with the IA (for dummies)
felipecastagnarodecarvalho d3fba4d
Minor changes Sadhu
felipecastagnarodecarvalho 60bc776
Minor update sadhu
felipecastagnarodecarvalho 507317e
Merging master
felipecastagnarodecarvalho 10cda3d
Updating sadhu dummy AI
felipecastagnarodecarvalho f2b09d5
Merging master
felipecastagnarodecarvalho 2c6492c
Sadhu skills - Working on the hability skills
felipecastagnarodecarvalho 9ede990
Adding last two Sadhu skills
felipecastagnarodecarvalho e6f87ac
Updating skill file names
felipecastagnarodecarvalho 888b8d5
Merging master
felipecastagnarodecarvalho d55e4af
Merge branch 'master' into sadhu_skills
felipecastagnarodecarvalho 73e8c55
[WIP
felipecastagnarodecarvalho 1a49524
Resolving review conversations
felipecastagnarodecarvalho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,6 @@ public enum HitType : short | |
KnockBack = 3, | ||
KnockDown = 4, | ||
Type18 = 18, | ||
Type33 = 33, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
src/ZoneServer/Buffs/Handlers/Clerics/Sadhu/OOBE_Anila_Buff.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
using System; | ||
using Melia.Shared.Game.Const; | ||
using Melia.Zone.Buffs.Base; | ||
using Melia.Zone.Network; | ||
using Melia.Zone.Skills.Combat; | ||
using Melia.Zone.Skills; | ||
using Melia.Zone.Skills.SplashAreas; | ||
using Melia.Zone.World.Actors; | ||
using Melia.Zone.World.Actors.Characters; | ||
using Melia.Zone.World.Actors.Pads; | ||
using Melia.Zone.World.Actors.Monsters; | ||
using static Melia.Zone.Skills.SkillUseFunctions; | ||
using Melia.Shared.World; | ||
|
||
namespace Melia.Zone.Buffs.Handlers.Clerics.Sadhu | ||
{ | ||
/// <summary> | ||
/// Handler for the Out Of Body Experience (OOBE) Anila Buff | ||
/// which makes the character go back to original position after a while | ||
/// and leave an effect that damages enemies on hit by a wave effect | ||
/// </summary> | ||
[BuffHandler(BuffId.OOBE_Anila_Buff)] | ||
public class OOBE_Anila_Buff : Sadhu_BuffHandler_Base | ||
{ | ||
public override void OnActivate(Buff buff, ActivationType activationType) | ||
{ | ||
var caster = buff.Caster; | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (caster.IsAbilityActive(AbilityId.Sadhu35) || caster is not Character casterCharacter) | ||
return; | ||
|
||
var dummyCharacter = casterCharacter.Map.GetDummyCharacter((int)buff.NumArg2); | ||
|
||
if (dummyCharacter != null) | ||
{ | ||
dummyCharacter.Died += this.OnDummyDied; | ||
} | ||
} | ||
|
||
public override void OnEnd(Buff buff) | ||
{ | ||
var caster = buff.Caster; | ||
|
||
if (caster is not Character casterCharacter) | ||
return; | ||
|
||
var skillCharacter = casterCharacter is DummyCharacter dummyCharacter && dummyCharacter.Owner.IsAbilityActive(AbilityId.Sadhu35) | ||
? dummyCharacter.Owner | ||
: caster; | ||
|
||
if (skillCharacter.TryGetSkill(SkillId.Sadhu_Anila, out var skill)) | ||
{ | ||
skillCharacter.SetAttackState(true); | ||
|
||
var pad = new Pad(PadName.Sadhu_Anila_Effect_Pad, skillCharacter, skill, new Square(caster.Position, caster.Direction, 50, 65)); | ||
|
||
pad.Position = caster.Position; | ||
pad.Trigger.MaxActorCount = 7; | ||
pad.Trigger.LifeTime = TimeSpan.FromSeconds(10); | ||
pad.Trigger.Subscribe(TriggerType.Enter, this.OnCollisionEnter); | ||
|
||
caster.Map.AddPad(pad); | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (casterCharacter is DummyCharacter dummyCharacter2 && dummyCharacter2.Owner.IsAbilityActive(AbilityId.Sadhu35)) | ||
{ | ||
Send.ZC_SKILL_READY(dummyCharacter2.Owner, caster, skill, caster.Position, caster.Position); | ||
Send.ZC_NORMAL.UpdateSkillEffect(dummyCharacter2.Owner, caster.Handle, caster.Position, caster.Direction, Position.Zero); | ||
Send.ZC_SKILL_MELEE_GROUND(dummyCharacter2.Owner, caster, skill, caster.Position, ForceId.GetNew(), null); | ||
} else | ||
{ | ||
skill.IncreaseOverheat(); | ||
} | ||
} | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (casterCharacter is DummyCharacter dummyCharacter3 && dummyCharacter3.Owner.IsAbilityActive(AbilityId.Sadhu35)) | ||
{ | ||
this.RemoveDummyCharacter(dummyCharacter3); | ||
return; | ||
} | ||
|
||
casterCharacter.Properties.Modify(PropertyName.MSPD_BM, -buff.NumArg1); | ||
|
||
Send.ZC_NORMAL.EndOutOfBodyBuff(casterCharacter, BuffId.OOBE_Anila_Buff); | ||
Send.ZC_NORMAL.UpdateModelColor(casterCharacter, 255, 255, 255, 255, 0.01f); | ||
|
||
Send.ZC_PLAY_SOUND(casterCharacter, "skl_eff_yuchae_end_2"); | ||
|
||
this.ReturnToBody(casterCharacter, (int)buff.NumArg2); | ||
} | ||
|
||
/// <summary> | ||
/// Called when an actor enters the skill's pad area. | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="args"></param> | ||
private void OnCollisionEnter(object sender, PadTriggerActorArgs args) | ||
{ | ||
var pad = args.Trigger; | ||
var creator = args.Creator; | ||
var target = args.Initiator; | ||
|
||
if (pad.Trigger.AtCapacity) | ||
return; | ||
|
||
if (!creator.CanAttack(target)) | ||
return; | ||
|
||
this.Attack(pad.Skill, creator, target); | ||
} | ||
|
||
/// <summary> | ||
/// Attacks the target | ||
/// </summary> | ||
/// <param name="skill"></param> | ||
/// <param name="caster"></param> | ||
private void Attack(Skill skill, ICombatEntity caster, ICombatEntity target) | ||
{ | ||
var modifier = SkillModifier.MultiHit(3); | ||
var skillHitResult = SCR_SkillHit(caster, target, skill, modifier); | ||
|
||
target.TakeDamage(skillHitResult.Damage, caster); | ||
|
||
var hit = new HitInfo(caster, target, skill, skillHitResult, TimeSpan.FromMilliseconds(200)); | ||
|
||
Send.ZC_HIT_INFO(caster, target, hit); | ||
} | ||
} | ||
} |
185 changes: 185 additions & 0 deletions
185
src/ZoneServer/Buffs/Handlers/Clerics/Sadhu/OOBE_Moksha_Buff.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
using System; | ||
using Melia.Shared.Game.Const; | ||
using Melia.Zone.Buffs.Base; | ||
using Melia.Zone.Network; | ||
using Melia.Zone.Skills.Combat; | ||
using Melia.Zone.Skills; | ||
using Melia.Zone.Skills.SplashAreas; | ||
using Melia.Zone.World.Actors; | ||
using Melia.Zone.World.Actors.Characters; | ||
using Melia.Zone.World.Actors.Pads; | ||
using Melia.Zone.World.Actors.Monsters; | ||
using static Melia.Zone.Skills.SkillUseFunctions; | ||
using Melia.Shared.World; | ||
using System.Collections.Generic; | ||
|
||
namespace Melia.Zone.Buffs.Handlers.Clerics.Sadhu | ||
{ | ||
/// <summary> | ||
/// Handler for the Out Of Body Experience (OOBE) Anila Buff | ||
/// which makes the character go back to original position after a while | ||
/// and leave an effect that damages enemies on hit by a wave effect | ||
/// </summary> | ||
[BuffHandler(BuffId.OOBE_Moksha_Buff)] | ||
public class OOBE_Moksha_Buff : Sadhu_BuffHandler_Base | ||
{ | ||
public override void OnActivate(Buff buff, ActivationType activationType) | ||
{ | ||
var caster = buff.Caster; | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (caster.IsAbilityActive(AbilityId.Sadhu35) || caster is not Character casterCharacter) | ||
return; | ||
|
||
var dummyCharacter = casterCharacter.Map.GetDummyCharacter((int)buff.NumArg2); | ||
|
||
if (dummyCharacter != null) | ||
{ | ||
dummyCharacter.Died += this.OnDummyDied; | ||
} | ||
} | ||
|
||
public override void OnEnd(Buff buff) | ||
{ | ||
var caster = buff.Caster; | ||
|
||
if (caster is not Character casterCharacter) | ||
return; | ||
|
||
var skillCharacter = casterCharacter is DummyCharacter dummyCharacter && dummyCharacter.Owner.IsAbilityActive(AbilityId.Sadhu35) | ||
? dummyCharacter.Owner | ||
: caster; | ||
|
||
if (skillCharacter.TryGetSkill(SkillId.Sadhu_Moksha, out var skill)) | ||
{ | ||
skillCharacter.SetAttackState(true); | ||
|
||
var pad = new Pad(PadName.Sadhu_Moksha_Pad, skillCharacter, skill, new Circle(caster.Position, 100)); | ||
|
||
pad.Position = caster.Position; | ||
pad.Trigger.MaxActorCount = 10; | ||
pad.Trigger.LifeTime = TimeSpan.FromSeconds(5); | ||
pad.Trigger.UpdateInterval = TimeSpan.FromSeconds(1); | ||
pad.Trigger.Subscribe(TriggerType.Update, this.OnUpdate); | ||
pad.Trigger.Subscribe(TriggerType.Destroy, this.OnDestroyPad); | ||
|
||
caster.Map.AddPad(pad); | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (casterCharacter is DummyCharacter dummyCharacter2 && dummyCharacter2.Owner.IsAbilityActive(AbilityId.Sadhu35)) | ||
{ | ||
Send.ZC_SKILL_READY(dummyCharacter2.Owner, caster, skill, caster.Position, caster.Position); | ||
Send.ZC_NORMAL.UpdateSkillEffect(dummyCharacter2.Owner, caster.Handle, caster.Position, caster.Direction, Position.Zero); | ||
Send.ZC_SKILL_MELEE_GROUND(dummyCharacter2.Owner, caster, skill, caster.Position, ForceId.GetNew(), null); | ||
} else | ||
{ | ||
skill.IncreaseOverheat(); | ||
} | ||
} | ||
|
||
// [Arts] Spirit Expert: Wandering Soul | ||
if (casterCharacter is DummyCharacter dummyCharacter3 && dummyCharacter3.Owner.IsAbilityActive(AbilityId.Sadhu35)) | ||
{ | ||
this.RemoveDummyCharacter(dummyCharacter3); | ||
return; | ||
} | ||
|
||
casterCharacter.Properties.Modify(PropertyName.MSPD_BM, -buff.NumArg1); | ||
|
||
Send.ZC_NORMAL.EndOutOfBodyBuff(casterCharacter, BuffId.OOBE_Moksha_Buff); | ||
Send.ZC_NORMAL.UpdateModelColor(casterCharacter, 255, 255, 255, 255, 0.01f); | ||
|
||
Send.ZC_PLAY_SOUND(casterCharacter, "skl_eff_yuchae_end_2"); | ||
|
||
this.ReturnToBody(casterCharacter, (int)buff.NumArg2); | ||
} | ||
|
||
/// <summary> | ||
/// Called in regular intervals while the pad is on a map. | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="args"></param> | ||
private void OnUpdate(object sender, PadTriggerArgs args) | ||
{ | ||
var pad = args.Trigger; | ||
var caster = args.Creator; | ||
var skill = args.Skill; | ||
|
||
var targets = pad.Trigger.GetAttackableEntities(caster); | ||
|
||
// The explosion has its own maximum target count which is separate from the skill | ||
var maxTargets = pad.Trigger.MaxActorCount; | ||
|
||
if (ZoneServer.Instance.Conf.World.DisableSDR) | ||
maxTargets = int.MaxValue; | ||
|
||
foreach (var target in targets.LimitRandom(maxTargets)) | ||
{ | ||
this.Attack(skill, caster, target); | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Executes end attack when the pad ends. | ||
/// </summary> | ||
/// <param name="sender"></param> | ||
/// <param name="args"></param> | ||
private void OnDestroyPad(object sender, PadTriggerArgs args) | ||
{ | ||
var pad = args.Trigger; | ||
var creator = args.Creator; | ||
|
||
this.EndAttack(pad.Skill, creator, (ISplashArea)pad.Area); | ||
} | ||
|
||
/// <summary> | ||
/// Attacks the target | ||
/// </summary> | ||
/// <param name="skill"></param> | ||
/// <param name="caster"></param> | ||
private void Attack(Skill skill, ICombatEntity caster, ICombatEntity target) | ||
{ | ||
var skillHitResult = SCR_SkillHit(caster, target, skill); | ||
|
||
target.TakeDamage(skillHitResult.Damage, caster); | ||
|
||
var hit = new HitInfo(caster, target, skill, skillHitResult, TimeSpan.FromMilliseconds(0)); | ||
|
||
Send.ZC_HIT_INFO(caster, target, hit); | ||
} | ||
|
||
/// <summary> | ||
/// Executes the end attack when the skill's pad ends | ||
/// </summary> | ||
/// <param name="skill"></param> | ||
/// <param name="caster"></param> | ||
/// <param name="splashArea"></param> | ||
private void EndAttack(Skill skill, ICombatEntity caster, ISplashArea splashArea) | ||
{ | ||
var damageDelay = TimeSpan.FromMilliseconds(50); | ||
var skillHitDelay = TimeSpan.Zero; | ||
|
||
var targets = caster.Map.GetAttackableEntitiesIn(caster, splashArea); | ||
|
||
// The explosion has its own maximum target count which is separate from the skill | ||
var maxTargets = 10; | ||
|
||
if (ZoneServer.Instance.Conf.World.DisableSDR) | ||
maxTargets = int.MaxValue; | ||
|
||
foreach (var target in targets.LimitRandom(maxTargets)) | ||
{ | ||
var skillHitResult = SCR_SkillHit(caster, target, skill); | ||
|
||
target.TakeDamage(skillHitResult.Damage, caster); | ||
|
||
// 6 Consecutive hits instead of a single packet | ||
for (int i = 0; i < 6; i++) | ||
{ | ||
var hit = new HitInfo(caster, target, skill, skillHitResult, TimeSpan.FromMilliseconds(i * 150)); | ||
Send.ZC_HIT_INFO(caster, target, hit); | ||
} | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I gotta say, frankly, I'm a bit unhappy with these buff handlers. The code is pretty difficult to follow, especially with all the conditionals for dummy characters and lack of comments. Additionally, you're duplicating a lot of code even though you went to the trouble of adding a base handler class, which could handle much of it. Such as the entire
OnActivate
method, which is verbatim the same for all of them, the same one line to get the skill character, and more.I would like to see these handlers receive a bit more structure and documentation, because as is, I can't follow any of this without reading, studying, and analyzing the entire code and the skill descriptions. And while this might be acceptable for the time being, at some point someone else will want to or have to change something about this job, and if they have to spend the same amount of time as you did initially writing this code, that's far from ideal.