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

Negative HP or MP costs on attacks do nothing; HP and gold costs never disallow attacks #1077

Open
ohrrpgce-bugbot opened this issue Jan 24, 2016 · 7 comments
Labels
attacks bug Yeah... that's broken heroes rel: ancient Present for a long time, possibly forever

Comments

@ohrrpgce-bugbot
Copy link

ohrrpgce-bugbot commented Jan 24, 2016

[sf#2018]

In r1284 (340ba93) (Aug 2008) James fixed bug 429, "Negative gold cost no longer gives you money". However looking at the cost deducting code now I was surprised to see that negative MP or HP costs for an attack still do nothing, even though you can set negative costs in the attack editor! In fact the help page even documents that negative HP cost cures, even though it hasn't done so for as long as we've had help pages.

I found that r761 (fd8a98c) (July 2006) introduced bug 429 and also introduced another unnoticed bug where negative HP costs stopped healing. Also, r761 (fd8a98c) removed the +/- 50% randomness that HP and MP costs used to have.

The relevant code in r760 (1768884) (atk(9) was HP cost):

   IF atk(9) <> 0 THEN
    hc(who) = 7
    hx(who) = x(who) + (w(who) * .5)
    hy(who) = y(who) + (h(who) * .5)
    temp = large(range(atk(9), 50), 1)
    harm$(who) = STR$(ABS(temp))
    stat(who, 0, 0) = large(stat(who, 0, 0) - temp, 0)
    IF stat(who, 0, 0) <= 0 THEN
     tdwho = who
     stat(tdwho, 0, 0) = 0
     GOSUB triggerfade
    END IF

Current code:

  IF attack.hp_cost > 0 THEN
    WITH bslot(bat.acting)
      .stat.cur.hp = large(.stat.cur.hp - attack.hp_cost, 0)
      .harm.ticks = gen(genDamageDisplayTicks)
      .harm.pos.x = .x + (.w * .5)
      .harm.pos.y = .y + (.h * .5)
      .harm.text = STR(attack.hp_cost)
    END WITH
  END IF

But even going back to a copy of the source code from 2000, I found negative MP costs have always done nothing.

Negative HP costs not working is a bug, but I think negative MP costs would be a nice feature too. But they need to be treated separately. The HP cost bug is so old now. I don't think it's worth treating games since 2006 specially (not fixing it for them) - an older game might have been edited with a version of Custom since 2006 anyway, and you have to explicitly ask for negative costs.
On the other hand negative MP has never worked, so we could reset all negative MP costs to zero if it is implemented.

Negative HP cost isn't totally trivial; the 'REVIVE' block might have to get shifted down afterwards.

From: @rversteegen
Reported version: 20070921 Ubersetzung

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

Also, item costs on attacks used by enemies add/remove act on the player's inventory, but I think that's accepted as a feature, not a bug.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

Also, gold costs were documented as having no effect when used by an enemy, but they have always acted on the player's gold!

Also, HP and gold costs are not checked when deciding whether to allow an attack! Looking at the source from 2000, they never have been.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

Wow, I can't even edit the title or any details of my own bugs.

@ohrrpgce-bugbot
Copy link
Author

ohrrpgce-bugbot commented Jan 25, 2016

Comment author: @bob-the-hamster

Oops! I have absolutely no excuse for leabing thse features untlested for cough ... 18 years

Wow, I can't even edit the title or any details of my own bugs.

I just added Admin permissions to your account

If I had been thinking clearly, I would have wanted gold costs on attacks used by enemies to deduct from their reward gold-- but for now I think correcting the docs to match the reality might be best for that one.

For item costs, I would love to someday have a concept of enemy inventory, but only as a new feature, not as a change to any existing behavior, and not until after enemy data is converted to reload.

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

  • summary: Negative HP or MP costs on attacks do nothing --> Negative HP or MP costs on attacks do nothing; HP and gold costs never disallow attacks

@ohrrpgce-bugbot
Copy link
Author

Comment author: @rversteegen

Also, if the "Check costs when used as an item" attack bit also doesn't check HP or gold costs.

Also, that bit only affects items used in battle. For items used out of battle, costs are never checked.

Attack costs out of battle have other problems too.
Instead of another dozen "Actually check the dang costs when..." bits, I'd like to just have one. So the first thing to do is to draw up a list of all item cost bugs and quirks, figure out which can be fixed with a single bitset, and which we want to be able to toggle separately (like item costs on attacks used by enemies)

@rversteegen
Copy link
Contributor

Also, it was mentioned in the duplicate bug #982 that the full amount of gold is displayed as being deducted regardless of how much you have.

@rversteegen rversteegen added heroes rel: ancient Present for a long time, possibly forever and removed rel: ubersetzung Present in ubersetzung 2007-09-21 labels Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attacks bug Yeah... that's broken heroes rel: ancient Present for a long time, possibly forever
Projects
None yet
Development

No branches or pull requests

2 participants