[Ohrrpgce] [ohrrpgce:bugs] #2039 Attack costs megabug

TeeEmCee teeemcee at users.sourceforge.net
Thu Sep 20 04:08:49 PDT 2018




---

** [bugs:#2039] Attack costs megabug**

**Status:** open
**Milestone:** OHRRPGCE
**Labels:** costs attack chains items 
**Created:** Thu Sep 20, 2018 11:08 AM UTC by TeeEmCee
**Last Updated:** Thu Sep 20, 2018 11:08 AM UTC
**Owner:** nobody



I've surveyed all known attack cost bugs (and picked through the code to find more), and found the following 13 bugs/feature-bugs/quirks:

* Bug 2032: When an enemy uses an attack with item or gold costs, it's deducted from the player, and it even checks the player inventory to decide whether the enemy can use it
* Bug 2018: In battle, atkallowed ignores HP and gold costs
* Out of battle, attacks in spell lists ignore HP, gold, and item costs (both atkallowed and subtract_attack_costs), only checking/subtracting MP
* "Check costs when used as an item" only works in-battle, not out of battle. Out of battle there's no cost checking or subtracting for items.
* "Check costs when used as an item" check controls whether items are usable or not, but either way the costs are deducted
* "map cure"/"outside battle cure" ignores all attack costs
* Negative MP, HP or level-MP might cause breakage in atkallowed and elsewhere
* An attack in the battle menu only is disabled by costs if 'check costs as weapon' is on. Either should always check costs or the bit should be renamed
* 'Mutable' attack bit is ignored when costs are ignored: weapons without 'check costs as weapon', and not rechecked before use unless 'recheck costs after delay' is on, and only checked when using an item if "Check costs when used as an item" is ON
* After/Else-chained attack subtract costs, but don't check costs
* Instead-chained attacks subtract costs, and only check costs if (the final Instead attack) has "Recheck costs after delay" ON. Also the original attack is always checked f or costs - the player isn't told the actual costs in the spell list.
 So the bitset does more than it says, and this isn't documented. Maybe it should be renamed "Recheck costs after delay or Instead chain".
* Quirk: the MP-idiot bit only affects MP; such enemies don't lose turns due to other costs not met. I think that's OK.

Plus some dodgy treatment of rechecking Level-MP costs, which currently can't lead to problems because other attacks can't change level-MP, but might in future:

* Even if "Recheck costs after delay" is ON, Level-MP costs are not rechecked in generate_atkscript.
* Level-MP costs are also not rechecked in battle_targetting unlike other costs (in case of change of situation between when the player selects an attack and when they select a target)


Here's what I propose be done about this mess.

* Fix the following simple bugs without any backcompat bit:
    * The bad handling of negative HP or MP
    * Make battle_targetting and "Recheck costs after delay" re-check level-MP

* I suggest only one new backcompat bit "Correct handling of attack costs" which:
    * Fixes atkallowed in-battle to check HP and gold costs
    * Fixes atkallowed and subtract_attack_costs out-of-battle so costs in spell lists work fully
    * Makes "Check costs when used as an item" work out-of-battle, not just in-battle. Note that out-of-battle, HP and MP costs have to be ignored because no specific hero is using it.
    * Maybe changes handling of Mutable?

* (Actually a feature) I think there should be a three way option in the Costs submenu:
 "Check and subtract costs/Check but don't subtract costs/Subtract but don't check costs" would be very useful. (You shouldn't have to use chains bits to accomplish that.) Checking costs without subtracting is useful for chains where the actual cost is subtracted later.


* Make it controllable whether chained attacks check or subtract costs.
    * Maybe add two chaining options bitsets to make After/Else/Instead chained attacks not check, or not  subtract, costs. (The chain bits won't cause costs to be checked/subtracted if they wouldn't normally.)  All four combinations seem useful. I guess the current behaviour for After/Else chains is an alright default.
    * If a chained attack checks costs but doesn't meet them, should the attack fail, or should the chain fail?  (The latter being as if there was no chain - So for Instead chains, the original attack happens, for Regular  chains, the Else chain is considered.)  This could even be two separate bits. But I think the simplest solution would be to make cost checking cause  the chain to fail so it effectively becomes a chain condition, working the same as the others.
    * The "Recheck costs after delay" attack bit could be used to get the other behaviour, causing the attack to  fail, simply by renaming it to "Recheck costs after delay or chain" to document what it already does.  Or should this bit be split into two, after delay and after chain?
    * Also there's the question of how to handle Instead chains that go through multiple attacks: should the  Skip Checking/Subtracting Costs bits be used from the first chain (which might be After/Else), the last chain,  or all of them?
      Does this indicate that it's better to have "Skip Checking/Subtracting Costs when Chained to"  bits on the attacks instead of the chains?
      Based on the above, it's clear that a "Don't chain if costs not met" chain bit applies to all steps of a chain,  while the "Recheck costs after delay or chain" attack bit is only checked for the final attack in the chain.
      And it feels like a bit to avoid subtracting costs after a chain would be consistent as an attack bit  rather than a chain bit.

* Add new attack bit, "Deduct costs when used as an item"

* Add a setting to control whether gold and item costs come out of the player inventory (current), or the attacker inventory (deducting from enemy's rewards), or only apply to heroes. Also, it would be cool to an additional setting to have item costs which are required but not deducted/expended. That would also allow the 'gold/item costs check player inventory' setting to make more sense when used by enemies.

* Make 'check costs as weapon' not apply to attacks directly in a battle menu, instead add a setting to attacks in the battle menu for whether to apply costs. And set it automatically, from the 'check costs as weapon' bit, for existing battle menu items.

* Add an argument to "map cure"/"outside battle cure" to deduct costs, defaulting to not if omitted. If the attacker isn't specified,  then HP and MP costs are ignored.
* Add a script command to check costs for an attack. Attacker is optional; HP and MP are ignored without attacker.

* I'm not sure what to do about Mutable attacks.
 You may or may not want Mutable to affect weapon and item attacks, but making 'check costs as weapon/item' do double-duty for these is bad, and renaming the bits would result in a confusing mouthful. As for chained attacks, I think there should be an extra chain option bit like "Respect attack's Mutable bit" instead of conflating with option bits for attack costs.

Someday a nice feature might be to process Instead chains even before the player picks an attack in a spell list, so they can see what the actual costs will be. But a lot of Instead chains are probably for failure conditions, and differing costs won't be a problem.





---

Sent from sourceforge.net because ohrrpgce at lists.motherhamster.org is subscribed to https://sourceforge.net/p/ohrrpgce/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/ohrrpgce/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20180920/9741ab66/attachment.html>


More information about the Ohrrpgce mailing list