[Rules] Add Archery/Throwing Ammo Consumption Rules. (#1743)

- Add RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption")
- Add RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
This commit is contained in:
Kinglykrab 2021-11-12 23:04:09 -05:00 committed by GitHub
parent 3c87480553
commit 8b83a13560
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 5 deletions

View File

@ -489,6 +489,8 @@ RULE_BOOL(Combat, UseExtendedPoisonProcs, false, "Allow old school poisons to la
RULE_BOOL(Combat, EnableSneakPull, false, "Enable implementation of Sneak Pull")
RULE_INT(Combat, SneakPullAssistRange, 400, "Modified range of assist for sneak pull")
RULE_BOOL(Combat, Classic2HBAnimation, false, "2HB will use the 2 hand piercing animation instead of the overhead slashing animation")
RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption")
RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
RULE_CATEGORY_END()
RULE_CATEGORY(NPC)

View File

@ -756,11 +756,22 @@ void Client::RangedAttack(Mob* other, bool CanDoubleAttack) {
//EndlessQuiver AA base1 = 100% Chance to avoid consumption arrow.
int ChanceAvoidConsume = aabonuses.ConsumeProjectile + itembonuses.ConsumeProjectile + spellbonuses.ConsumeProjectile;
if (RangeItem->ExpendableArrow || !ChanceAvoidConsume || (ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)){
// Consume Ammo, unless Ammo Consumption is disabled or player has Endless Quiver
bool consumes_ammo = RuleB(Combat, ArcheryConsumesAmmo);
if (
consumes_ammo &&
(
RangeItem->ExpendableArrow ||
!ChanceAvoidConsume ||
(ChanceAvoidConsume < 100 && zone->random.Int(0,99) > ChanceAvoidConsume)
)
) {
DeleteItemInInventory(ammo_slot, 1, true);
LogCombat("Consumed one arrow from slot [{}]", ammo_slot);
LogCombat("Consumed Archery Ammo from slot {}.", ammo_slot);
} else if (!consumes_ammo) {
LogCombat("Archery Ammo Consumption is disabled.");
} else {
LogCombat("Endless Quiver prevented ammo consumption");
LogCombat("Endless Quiver prevented Ammo Consumption.");
}
CheckIncreaseSkill(EQ::skills::SkillArchery, GetTarget(), -15);
@ -1338,8 +1349,14 @@ void Client::ThrowingAttack(Mob* other, bool CanDoubleAttack) { //old was 51
DoThrowingAttackDmg(other, RangeWeapon, item);
//consume ammo
DeleteItemInInventory(ammo_slot, 1, true);
// Consume Ammo, unless Ammo Consumption is disabled
if (RuleB(Combat, ThrowingConsumesAmmo)) {
DeleteItemInInventory(ammo_slot, 1, true);
LogCombat("Consumed Throwing Ammo from slot {}.", ammo_slot);
} else {
LogCombat("Throwing Ammo Consumption is disabled.");
}
CommonBreakInvisibleFromCombat();
}