Skip to content

Quarrel Shooter's skills, except Pavise #337

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;
using Melia.Zone.Skills;
using Melia.Zone.Skills.Combat;
using Melia.Zone.World.Actors;
using Melia.Zone.World.Actors.Characters;
using Melia.Zone.World.Actors.Components;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Buff handler for Archer Kneelingshot Buff, which grants
/// extra damage, range, attack speed, and possibly
/// crit rate, but prevents movement.
/// </summary>
/// <remarks>
/// NumArg1: Skill Level
/// NumArg2: Crit bonus
/// </remarks>
[BuffHandler(BuffId.Archer_Kneelingshot)]
public class Archer_Kneelingshot : BuffHandler, IBuffCombatAttackBeforeCalcHandler
{
private const float PAtkBuffRate = 0.15f;
private const float RangeBonus = 35f;
private const float AspdBonus = 250f;

/// <summary>
/// Starts buff, increasing stats and disallowing movement.
/// </summary>
/// <param name="buff"></param>
public override void OnActivate(Buff buff, ActivationType activationType)
{
var target = buff.Target;
buff.Target.AddState(StateType.Held);

var bonusPatk = target.Properties.GetFloat(PropertyName.PATK) * PAtkBuffRate;

AddPropertyModifier(buff, buff.Target, PropertyName.PATK_BM, bonusPatk);
AddPropertyModifier(buff, buff.Target, PropertyName.SkillRange_BM, RangeBonus);
AddPropertyModifier(buff, buff.Target, PropertyName.ASPD_BM, AspdBonus);
}

/// <summary>
/// Ends the buff, resetting stats and allowing movement.
/// </summary>
/// <param name="buff"></param>
public override void OnEnd(Buff buff)
{
buff.Target.RemoveState(StateType.Held);

RemovePropertyModifier(buff, buff.Target, PropertyName.PATK_BM);
RemovePropertyModifier(buff, buff.Target, PropertyName.SkillRange_BM);
RemovePropertyModifier(buff, buff.Target, PropertyName.ASPD_BM);
}

/// <summary>
/// Applies the debuff's effect during the combat calculations.
/// </summary>
/// <param name="buff"></param>
/// <param name="attacker"></param>
/// <param name="target"></param>
/// <param name="skill"></param>
/// <param name="modifier"></param>
/// <param name="skillHitResult"></param>
public void OnAttackBeforeCalc(Buff buff, ICombatEntity attacker, ICombatEntity target, Skill skill, SkillModifier modifier, SkillHitResult skillHitResult)
{
if (buff.NumArg2 > 0)
modifier.BonusCritChance += buff.NumArg2;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;
using Melia.Zone.Skills;
using Melia.Zone.Skills.Combat;
using Melia.Zone.World.Actors;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Buff handler for Block and Shoot Buff, which grants
/// extra block.
/// The covered shot version decreases damage dealt and
/// taken by 50%, and cuts accuracy by 70%
/// </summary>
/// <remarks>
/// NumArg1: Skill Level
/// NumArg2: 1 if Covered Shot is active
/// </remarks>
[BuffHandler(BuffId.BlockAndShoot_Buff)]
public class BlockAndShoot_Buff : BuffHandler, IBuffCombatAttackBeforeCalcHandler, IBuffCombatDefenseBeforeCalcHandler
{
private const float BlkBuffRate = 0.5f;
private const float HRDebuffRate = 0.7f;

/// <summary>
/// Starts buff, increasing Block
/// </summary>
/// <param name="buff"></param>
public override void OnActivate(Buff buff, ActivationType activationType)
{
var target = buff.Target;

var bonusBlk = target.Properties.GetFloat(PropertyName.BLK) * BlkBuffRate;

AddPropertyModifier(buff, buff.Target, PropertyName.BLK_BM, bonusBlk);

if (buff.NumArg2 > 0)
{
var reduceHR = target.Properties.GetFloat(PropertyName.HR) * HRDebuffRate;

AddPropertyModifier(buff, buff.Target, PropertyName.HR_BM, -reduceHR);
}
}

/// <summary>
/// Ends the buff, resetting Block.
/// </summary>
/// <param name="buff"></param>
public override void OnEnd(Buff buff)
{
RemovePropertyModifier(buff, buff.Target, PropertyName.BLK_BM);
if (buff.NumArg2 > 0)
RemovePropertyModifier(buff, buff.Target, PropertyName.HR_BM);
}


/// <summary>
/// Applies the debuff's effect during the combat calculations.
/// </summary>
/// <param name="buff"></param>
/// <param name="attacker"></param>
/// <param name="target"></param>
/// <param name="skill"></param>
/// <param name="modifier"></param>
/// <param name="skillHitResult"></param>
public void OnAttackBeforeCalc(Buff buff, ICombatEntity attacker, ICombatEntity target, Skill skill, SkillModifier modifier, SkillHitResult skillHitResult)
{
if (buff.NumArg2 > 0)
modifier.DamageMultiplier -= 0.5f;
}


/// <summary>
/// Applies the debuff's effect during the combat calculations.
/// </summary>
/// <param name="buff"></param>
/// <param name="attacker"></param>
/// <param name="target"></param>
/// <param name="skill"></param>
/// <param name="modifier"></param>
/// <param name="skillHitResult"></param>
public void OnDefenseBeforeCalc(Buff buff, ICombatEntity attacker, ICombatEntity target, Skill skill, SkillModifier modifier, SkillHitResult skillHitResult)
{
if (buff.NumArg2 > 0)
modifier.DamageMultiplier -= 0.5f;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;
using Melia.Zone.Skills.Combat;
using Melia.Zone.World.Actors;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Buff handler for Rapidfire Block Buff, which grants
/// extra block.
/// </summary>
[BuffHandler(BuffId.RapidFire_Block_Buff)]
public class RapidFire_Block_Buff : BuffHandler
{
private const float BlkBuffRate = 0.2f;

/// <summary>
/// Starts buff, increasing Block
/// </summary>
/// <param name="buff"></param>
public override void OnActivate(Buff buff, ActivationType activationType)
{
var target = buff.Target;

var bonusBlk = target.Properties.GetFloat(PropertyName.BLK) * BlkBuffRate;

AddPropertyModifier(buff, buff.Target, PropertyName.BLK_BM, bonusBlk);
}

/// <summary>
/// Ends the buff, resetting Block.
/// </summary>
/// <param name="buff"></param>
public override void OnEnd(Buff buff)
{
RemovePropertyModifier(buff, buff.Target, PropertyName.BLK_BM);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;

namespace Melia.Zone.Buffs.Handlers.Archers.Ranger
{
/// <summary>
/// Handle for the Rapidfire Debuff, which flatly reduces
/// Crit Dodge by 150
/// </summary>
/// <remarks>
/// NumArg1: Skill Level
/// NumArg2: None
/// </remarks>
[BuffHandler(BuffId.RapidFire_Debuff)]
public class RapidFire_Debuff : BuffHandler
{
private const float CRTDRPenalty = -150f;

public override void OnActivate(Buff buff, ActivationType activationType)
{
AddPropertyModifier(buff, buff.Target, PropertyName.CRTDR_BM, CRTDRPenalty);
}

public override void OnEnd(Buff buff)
{
RemovePropertyModifier(buff, buff.Target, PropertyName.CRTDR_BM);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;
using Melia.Zone.Skills;
using Melia.Zone.Skills.Combat;
using Melia.Zone.World.Actors;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Handle for the Running Shot buff, which adds bonus factor
/// and an extra hit to crossbow normal attacks, as well as
/// increasing attack speed by 10%
/// It also debuffs your movespeed if you use it on a PVP map
/// </summary>
/// <remarks>
/// NumArg1: Skill Level
/// NumArg2: Skill Factor
/// </remarks>
[BuffHandler(BuffId.RunningShot_Buff)]
public class RunningShot_Buff : BuffHandler, IBuffCombatAttackBeforeCalcHandler
{
private const float AspdRateBonus = 0.1f;
private const float MspdDebuff = 2f;

/// <summary>
/// Starts buff, modifying the movement speed.
/// </summary>
/// <param name="buff"></param>
public override void OnActivate(Buff buff, ActivationType activationType)
{
var target = buff.Target;

var aspdBonus = target.Properties.GetFloat(PropertyName.ASPD) * AspdRateBonus;
AddPropertyModifier(buff, target, PropertyName.ASPD_BM, aspdBonus);

// TODO: Should only apply the debuff on PVP maps
// if (caster.Map.IsPvp)

AddPropertyModifier(buff, target, PropertyName.MSPD_BM, -MspdDebuff);
Send.ZC_MSPD(target);
}

/// <summary>
/// Ends the buff, resetting the movement speed.
/// </summary>
/// <param name="buff"></param>
public override void OnEnd(Buff buff)
{
RemovePropertyModifier(buff, buff.Target, PropertyName.ASPD_BM);
RemovePropertyModifier(buff, buff.Target, PropertyName.MSPD_BM);
Send.ZC_MSPD(buff.Target);
}


/// <summary>
/// Applies the buff's effect during the combat calculations.
/// </summary>
/// <param name="buff"></param>
/// <param name="attacker"></param>
/// <param name="target"></param>
/// <param name="skill"></param>
/// <param name="modifier"></param>
/// <param name="skillHitResult"></param>
public void OnAttackBeforeCalc(Buff buff, ICombatEntity attacker, ICombatEntity target, Skill skill, SkillModifier modifier, SkillHitResult skillHitResult)
{
// only applies to crossbow normal attack
if (skill.Id != SkillId.CrossBow_Attack)
return;

// Add extra Factor and +1 hit count
modifier.BonusFactor += buff.NumArg2;
modifier.HitCount++;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.Network;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Handler for ScatterCaltrop_Debuff, which flatly reduces movement speed
/// </summary>
[BuffHandler(BuffId.ScatterCaltrop_Debuff)]
public class ScatterCaltrop_Debuff : BuffHandler
{
private const float MspdDebuff = 10f;

/// <summary>
/// Starts buff, modifying the movement speed.
/// </summary>
/// <param name="buff"></param>
public override void OnActivate(Buff buff, ActivationType activationType)
{
var target = buff.Target;
var caster = buff.Caster;

AddPropertyModifier(buff, target, PropertyName.MSPD_BM, -MspdDebuff);
Send.ZC_MSPD(target);
}

/// <summary>
/// Ends the buff, resetting the movement speed.
/// </summary>
/// <param name="buff"></param>
public override void OnEnd(Buff buff)
{
RemovePropertyModifier(buff, buff.Target, PropertyName.MSPD_BM);
Send.ZC_MSPD(buff.Target);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Melia.Shared.Game.Const;
using Melia.Zone.Buffs.Base;
using Melia.Zone.World.Actors;
using Melia.Zone.World.Actors.Components;

namespace Melia.Zone.Buffs.Handlers.Archers.QuarrelShooter
{
/// <summary>
/// Handle for the ScatterCaltrop Hole Debuff, which prevents movement
/// </summary>
[BuffHandler(BuffId.ScatterCaltrop_Hole_Debuff)]
public class ScatterCaltrop_Hole_Debuff : BuffHandler
{
public override void OnExtend(Buff buff)
{
buff.Target.AddState(StateType.Held, buff.Duration);
}
}
}
Loading