-
Notifications
You must be signed in to change notification settings - Fork 454
Sleep, Innovation, Weakness, and Reflection Summoner Skills #673
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
Changes from all commits
42ba053
65bdba2
f00c91b
c491b2a
7bcc87f
3c5c1f5
90fd3ea
6ce6417
048cf7b
7cca882
8839dd7
81e1c47
b0eae8a
1492df9
a38c405
70e4d36
e32f6af
959f5a9
4722163
51f812e
785575a
1ca7e50
11535bf
9a32658
7585b63
90aaf26
d25bd42
0d18f33
f60c8c1
15ef02a
7b0610a
2f24715
97814a1
1d5cb0d
7ce25e5
6e40bbf
72480af
c8f130d
41e1a4f
d8cb307
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,6 +64,11 @@ public static async ValueTask<HitInfo> CalculateDamageAsync(this IAttacker attac | |
| { | ||
| var defenseAttribute = defender.GetDefenseAttribute(attacker); | ||
| defense = (int)defender.Attributes[defenseAttribute]; | ||
| defense -= (int)(defense * defender.Attributes[Stats.InnovationDefDecrement]); | ||
| if (defense < 0) | ||
| { | ||
| defense = 0; | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
|
|
||
| attacker.GetBaseDmg(skill, out int baseMinDamage, out int baseMaxDamage, out DamageType damageType); | ||
|
|
@@ -309,7 +314,15 @@ public static async ValueTask ApplyMagicEffectAsync(this IAttackable target, IAt | |
| player.CreateMagicEffectPowerUp(skillEntry); | ||
| } | ||
|
|
||
| await target.ApplyMagicEffectAsync(attacker, skillEntry.Skill!.MagicEffectDef!, skillEntry.PowerUpDuration!, skillEntry.PowerUps!).ConfigureAwait(false); | ||
| float chance = target is Player ? skillEntry.PowerUpChancePvp!.Value : skillEntry.PowerUpChance!.Value; | ||
| if (!Rand.NextRandomBool(Convert.ToDouble(chance))) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| var duration = target is Player ? skillEntry.PowerUpDurationPvp! : skillEntry.PowerUpDuration!; | ||
| var powerUps = target is Player ? skillEntry.PowerUpsPvp! : skillEntry.PowerUps!; | ||
| await target.ApplyMagicEffectAsync(attacker, skillEntry.Skill!.MagicEffectDef!, duration, powerUps).ConfigureAwait(false); | ||
| } | ||
|
|
||
| /// <summary> | ||
|
|
@@ -356,6 +369,11 @@ public static async ValueTask ApplyRegenerationAsync(this IAttackable target, Pl | |
| /// <returns>The success of the appliance.</returns> | ||
| public static async ValueTask<bool> TryApplyElementalEffectsAsync(this IAttackable target, IAttacker attacker, SkillEntry skillEntry) | ||
| { | ||
| if (!target.IsAlive) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not aware of any effect that can be applied when the target is dead. This saves some unnecessary computations 😛 |
||
| skillEntry.ThrowNotInitializedProperty(skillEntry.Skill is null, nameof(skillEntry.Skill)); | ||
| var modifier = skillEntry.Skill.ElementalModifierTarget; | ||
| if (modifier is null) | ||
|
|
@@ -389,7 +407,7 @@ public static async ValueTask<bool> TryApplyElementalEffectsAsync(this IAttackab | |
| } | ||
|
|
||
| /// <summary> | ||
| /// Applies the elemental effects of a players skill to the target. | ||
| /// Applies the elemental effects of a monster's skill to the target. | ||
| /// </summary> | ||
| /// <param name="target">The target.</param> | ||
| /// <param name="attacker">The attacker.</param> | ||
|
|
@@ -402,6 +420,11 @@ public static async ValueTask<bool> TryApplyElementalEffectsAsync(this IAttackab | |
| /// </returns> | ||
| public static async ValueTask<bool> TryApplyElementalEffectsAsync(this IAttackable target, IAttacker attacker, Skill skill, IElement? powerUp, IElement? duration, AttributeDefinition? targetAttribute) | ||
| { | ||
| if (!target.IsAlive) | ||
| { | ||
| return false; | ||
| } | ||
|
|
||
| var modifier = skill.ElementalModifierTarget; | ||
| if (modifier is null) | ||
| { | ||
|
|
@@ -445,7 +468,7 @@ public static void ApplyAmmunitionConsumption(this IAttacker attacker, HitInfo h | |
| { | ||
| if (!hitInfo.Attributes.HasFlag(DamageAttributes.Reflected) && attacker.Attributes[Stats.AmmunitionConsumptionRate] > 0.0) | ||
| { | ||
| // Every hit needs ammo. Failed hits don't need ammo. | ||
| // Every hit needs ammo, missed or not | ||
| if (attacker.Attributes[Stats.AmmunitionAmount] < attacker.Attributes[Stats.AmmunitionConsumptionRate]) | ||
| { | ||
| return; | ||
|
|
@@ -773,15 +796,32 @@ private static void GetBaseDmg(this IAttacker attacker, SkillEntry? skill, out i | |
| /// <param name="powerUps">The power ups of the effect.</param> | ||
| private static async ValueTask ApplyMagicEffectAsync(this IAttackable target, IAttacker attacker, MagicEffectDefinition magicEffectDefinition, IElement duration, params (AttributeDefinition Target, IElement Boost)[] powerUps) | ||
| { | ||
| float finalDuration = duration.Value; | ||
|
|
||
| if (magicEffectDefinition.DurationDependsOnTargetLevel) | ||
| { | ||
| var divisor = target is Player ? magicEffectDefinition.PlayerTargetLevelDivisor : magicEffectDefinition.MonsterTargetLevelDivisor; | ||
| if (divisor != 0) | ||
| { | ||
| finalDuration -= target.Attributes[Stats.Level] / divisor; | ||
| } | ||
| } | ||
|
Comment on lines
+801
to
+808
Contributor
Author
|
||
|
|
||
| TimeSpan durationSpan = TimeSpan.FromSeconds(finalDuration); | ||
| if (durationSpan < TimeSpan.FromSeconds(1)) | ||
| { | ||
| return; | ||
| } | ||
|
Comment on lines
+811
to
+814
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saw this on Summoner skills (e.g. zTeamS6.3). Think is a good generalization. |
||
|
|
||
| var isPoisonEffect = magicEffectDefinition.PowerUpDefinitions.Any(e => e.TargetAttribute == Stats.IsPoisoned); | ||
| var magicEffect = isPoisonEffect | ||
| ? new PoisonMagicEffect(powerUps[0].Boost, magicEffectDefinition, TimeSpan.FromSeconds(duration.Value), attacker, target) | ||
| : new MagicEffect(TimeSpan.FromSeconds(duration.Value), magicEffectDefinition, powerUps.Select(p => new MagicEffect.ElementWithTarget(p.Boost, p.Target)).ToArray()); | ||
| ? new PoisonMagicEffect(powerUps[0].Boost, magicEffectDefinition, durationSpan, attacker, target) | ||
| : new MagicEffect(durationSpan, magicEffectDefinition, powerUps.Select(p => new MagicEffect.ElementWithTarget(p.Boost, p.Target)).ToArray()); | ||
|
|
||
| await target.MagicEffectList.AddEffectAsync(magicEffect).ConfigureAwait(false); | ||
| if (target is ISupportWalk walkSupporter | ||
| && walkSupporter.IsWalking | ||
| && magicEffectDefinition.PowerUpDefinitions.Any(e => e.TargetAttribute == Stats.IsFrozen || e.TargetAttribute == Stats.IsStunned)) | ||
| && magicEffectDefinition.PowerUpDefinitions.Any(e => e.TargetAttribute == Stats.IsFrozen || e.TargetAttribute == Stats.IsStunned || e.TargetAttribute == Stats.IsAsleep)) | ||
| { | ||
| await walkSupporter.StopWalkingAsync().ConfigureAwait(false); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -638,7 +638,7 @@ public class Stats | |
| /// <summary> | ||
| /// Gets the explosion skill MST bonus damage, which rises with fire tome strengthener and is added late stage. | ||
| /// </summary> | ||
| public static AttributeDefinition ExplosionBonusDmg { get; } = new(new Guid("543E01C2-5C61-4473-ACF9-8A63A987A230"), "Explosion Bonus Damage (MST)", "The explosion skill (book of samut) bonus damage, which rises with fire stome strengthener and is added at a late stage."); | ||
| public static AttributeDefinition ExplosionBonusDmg { get; } = new(new Guid("543E01C2-5C61-4473-ACF9-8A63A987A230"), "Explosion Bonus Damage (MST)", "The explosion skill (book of samut) bonus damage, which rises with fire tome strengthener and is added at a late stage."); | ||
|
|
||
| /// <summary> | ||
| /// Gets the requiem skill MST bonus damage, which rises with wind tome strengthener and is added late stage. | ||
|
|
@@ -920,6 +920,11 @@ public class Stats | |
| /// <remarks>Only applies to physical damage.</remarks> | ||
| public static AttributeDefinition WeaknessPhysDmgDecrement { get; } = new(new Guid("37497650-139B-4DA1-9FB6-27AEB8F04CF6"), "Weakness Physical Damage Decrement", "The inflicted physical damage decrement due to the magic effects of weakness or killing blow skills, which is multiplied with the final damage and subtracted from it."); | ||
|
|
||
| /// <summary> | ||
| /// Gets the innovation defense decrement due to Summoner's innovation skill attribute definition. | ||
| /// </summary> | ||
| public static AttributeDefinition InnovationDefDecrement { get; } = new(new Guid("D8B3B1C9-B409-4A07-8F4D-8F315DCB173A"), "Innovation Defense Decrement", "The defense decrement due to the magic effect of innovation skill, which is multiplied with the final defense and subtracted from it."); | ||
|
|
||
| /// <summary> | ||
| /// Gets the 'is shield equipped' attribute definition. | ||
| /// </summary> | ||
|
|
@@ -943,7 +948,12 @@ public class Stats | |
| /// <summary> | ||
| /// Gets the attribute definition, which defines if a player has stun effect applied. | ||
| /// </summary> | ||
| public static AttributeDefinition IsStunned { get; } = new(new Guid("22C86BAF-7F27-478D-8075-E4465C2859DD"), "Is stunned", "The player is poisoned and loses health"); | ||
| public static AttributeDefinition IsStunned { get; } = new(new Guid("22C86BAF-7F27-478D-8075-E4465C2859DD"), "Is stunned", "The player is stunned and can't move."); | ||
|
|
||
| /// <summary> | ||
| /// Gets the attribute definition, which defines if a player has asleep effect applied. | ||
| /// </summary> | ||
| public static AttributeDefinition IsAsleep { get; } = new(new Guid("0518F532-7A8F-4491-8A23-98B620608CB3"), "Is asleep", "The player is asleep and can't move until hit."); | ||
|
|
||
| /// <summary> | ||
| /// Gets the ice resistance attribute definition. Value range from 0 to 1. | ||
|
|
@@ -1226,6 +1236,11 @@ public class Stats | |
| /// </summary> | ||
| public static AttributeDefinition FullyRecoverHealthAfterHitChance { get; } = new(new Guid("3CA72C07-9C2C-4FC5-8BCB-9BD737F83664"), "Chance to fully recover health when getting hit", "3rd Wing Option"); | ||
|
|
||
| /// <summary> | ||
| /// Gets the fully reflect damage after hit chance definition. | ||
| /// </summary> | ||
| public static AttributeDefinition FullyReflectDamageAfterHitChance { get; } = new(new Guid("1F7C1E04-4FBD-4FCB-A6C2-EB51A91D8C3E"), "Chance to fully reflect damage when getting hit", "3rd Wing Option"); | ||
|
|
||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| /// <summary> | ||
| /// Gets the health loss after hit definition. | ||
| /// </summary> | ||
|
|
||
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.
For now it's okay. I'd like to have this more generic, but have no idea for a better solution yet.