Skip to content
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

Cost allowance for "give_equipment" #55048

Merged
merged 1 commit into from
Feb 4, 2022

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Feb 3, 2022

Summary

None

Purpose of change

Fixes #14619.
Requesting an item from an NPC gives you credit with that NPC, as an unintentional side-effect of "add_debt" and "give_equipment".

Describe the solution

(This solution is derived from a comment on #52818 (comment))

Instead of giving the player credit with the NPC, use a temporary allowance for the cost of the item:

"effect": {
  "give_equipment": {
    "allowance": [ [ "TRUST", 1 ], [ "VALUE", 3 ], [ "ALTRUISM", 2 ], [ "TOTAL", 300 ] ]
  }
}

The allowance accepts either a flat integer, or a group of trial modifiers similar to "add_debt". This allows talk_function::give_equipment_allowance to pull the item cost from the allowance (as well as any existing debt with the NPC), and ensures that none the leftover credit is added to the NPC's debt.

The regular "add_debt" and "give_equipment" (without allowance) effects remain the same, so they can still be used like before.

Describe alternatives you've considered

Testing

  1. Before asking the NPC for an item, player has zero credit/debt:

trade_before

  1. Requesting an item from the NPC (using option a, since it provides an allowance):

equipment_obtained

  1. Afterwards, player still has zero credit/debt with the NPC:

trade_after

Additional context

wow, that's a really old bug :P

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Feb 3, 2022
@NetSysFire NetSysFire added <Bugfix> This is a fix for a bug (or closes open issue) NPC / Factions NPCs, AI, Speech, Factions, Ownership labels Feb 3, 2022
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 3, 2022
@kevingranade kevingranade merged commit a728b25 into CleverRaven:master Feb 4, 2022
@dseguin dseguin deleted the equipment_allowance branch February 4, 2022 00:10
@Leland
Copy link
Contributor

Leland commented Feb 4, 2022

thanks for solving ancient stuff! kudos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) json-styled JSON lint passed, label assigned by github actions NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Persuading NPC to give you equipment also increases your trading Credit with them
4 participants