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

Show spells affecting creature in first person mode #295

Closed
mefistotelis opened this issue Aug 18, 2015 · 21 comments · Fixed by #1337
Closed

Show spells affecting creature in first person mode #295

mefistotelis opened this issue Aug 18, 2015 · 21 comments · Fixed by #1337

Comments

@mefistotelis
Copy link
Member

Originally reported on Google Code with ID 295

When in first person mode it is impossible to see which spells affect the creature you
possess. This makes some valid strategies difficult to pull of.

This is particular important for the invisibility spell, where you also want to see
the effect when you're being compromised or are temporary visible because you've been
attacked.
Also consider spells like armor, freeze, chicken, speed, etc.

Note this is true for spells casted on self, by enemy creatures, by the enemy keeper
and also by yourself before possessing the creature.

Reported by Loobinex on 2014-05-06 20:57:30

@mefistotelis
Copy link
Member Author

I skipped the second paragraph:

It would be very nice to have a GUI element showing which spells are affecting the
creature you possess. Possibly by showing the spell icon in the top of the screen.

Reported by Loobinex on 2014-05-06 20:59:46

@mefistotelis
Copy link
Member Author

I agree, that would be very helpful.

The icons could even overlay each other, so it wouldn't take much space on the screen.

Spells which are going to end soon should be marked somehow, ie. by blinking.

The spells casted on a creature can be easily taken from cctrl->casted_spells[] array.

Reported by mefistotelis on 2014-05-06 22:23:00

  • Status changed: Accepted

@mefistotelis
Copy link
Member Author

On Issue #579 HeMeng86 requested some further specs on this issue. See attached screenshot.

* Spell icons on the top left. Overlay not needed because there's not that many spell
effects to affect a creature at the same time.

* Icons for all spell effects both creature and keeper spells affecting the creature
to be shown.

* Nice to have: Spell icon to slowly start blinking (between 'dis' and 'std' icon)
when there is just 5 seconds of effect left. Fast blinking when there is just 2 seconds
left.

Reported by Loobinex on 2015-04-26 10:15:01


- _Attachment: 295.png
![295.png](https://storage.googleapis.com/google-code-attachments/keeperfx/issue-295/comment-3/295.png)_

@mefistotelis
Copy link
Member Author

Implementing this requires adding "SymbolSprites" option to spells first.

Currently, keeper powers and creature instances have their graphics icons, but spells don't. And since there is no simple mapping of k.power->spell or cr.instance->spell, trying to link spell to an instance would be a pain.

@Loobinex
Copy link
Member

What are spells? And can I help?

@mefistotelis
Copy link
Member Author

Hm, you could add option "SymbolSprites = nn nn" to each spell definition in magic.cfg.
But first I have to add support of such option to the code.

What are spells - let's start with instances.

Creatures have "creature instances" assigned. There is up to 10 of them, and we often call them "creature spells" - but they're really not, they're instances.
Now, each instance stores information on how and when a creature can cast it (ie. reload time, or animation while casting). Some instances are directly triggering a spell which can affect a nearby enemy (or caster, ie. for heal), and some can affect at distance, in which case they need something to be delivered to the target - shots. There are also instances which do not provide any such effect and are just graphical, ie. toking or roaring. To conclude - instance can cast a spell, or it can create a shot which will cast a spell on impact, or it can do neither of these.

Finally, the actual influence on a target creature is applied by a spell. And since they were only used to influence a creature, spells had no need to include their sprite symbol representation.

@Loobinex
Copy link
Member

Easy enough: creature.7z

@mefistotelis
Copy link
Member Author

I'm not sure what is the file you sent.. looks like an older version of creature.cfg.

Anyway, in recent version instances have "SymbolSprites". What we need is copy these lines to corresponding spells in magic.cfg.

@Loobinex
Copy link
Member

Sorry, uploaded wrong file.

magic.7z

@mefistotelis
Copy link
Member Author

Only 10 out of 30 spells have graphics symbols?

Well, should be enough to implement the feature.

@Loobinex
Copy link
Member

I only took the ones with a 'status' effect on the player. For example wind spell is technically affecting the player when being blown away, but I don't think that counts as a status. Being 'frozen' or 'Slowed' is a status.
This way you don't have to make a separate list of which spells should display icons and which ones don't.

If you want me to list sprites for all spells that's fine too, it took me less than 5 minutes to make this file in the first place so it's hardly any work to add the remaining symbol sprites.

@mefistotelis
Copy link
Member Author

All sprite numbers should be set; if a spell has no continuous effect, then a function which checks for that effect will always return false, so it's not a problem.

@Loobinex
Copy link
Member

Ok. I did not manage to do the drain spell. I looked everywhere, the icon just doesn't seem to be there. Not in the file lists, not in the GFX package not anywhere.

Well, in the game it does have an icon.

Everything else is in:
magic.7z

@mefistotelis
Copy link
Member Author

fxdata/creature.cfg:

[instance17]
Name = DRAIN
...
SymbolSprites = 513

@Loobinex
Copy link
Member

Ok, I've added that in.
Looking at the sprite list that's 'symbols_32/progress_red.png', so apparently that's not the proper place to look.

magic.7z

@mefistotelis
Copy link
Member Author

Isn't that the line before, "symbols_32/heartcircle.png" ?

Anyway, the changes are good; I will soon commit them.

@Loobinex
Copy link
Member

510: options_64/cassist_btn_black.png
511: symbols_64/goldpot_sml.png
512: symbols_64/heartcircle.png
513: symbols_64/progress_red.png
514: symbols_64/progress_blue.png

@mefistotelis
Copy link
Member Author

Oh, right - it is the 'drain' icon, looks like I just misinterpreted it while naming.

@Loobinex
Copy link
Member

You're right. Could not have guessed that, but those 2 items are indeed the disabled/enabled drain icons. If you plan to fix this, perhaps you can also do something about the missing 'crspell_64/rebound_dis.png' that should have been 356.

On an unrelated note, are the 'bonus_box_std.png' icons used for anything?

bonus_box_std bonus_box_dis

@mefistotelis
Copy link
Member Author

Position 396/397 looks unused, I will place the rebound there.

Good find, btw!

@mefistotelis
Copy link
Member Author

Implementation notes, in case someone else does it:

  • use creature_affected_by_spell() to check if each spell is affecting a creature
  • use SpellInfo.medsym_sprite_idx to get sprite to be shown for each spell
  • use draw_gui_panel_sprite_left() or similar function to do the drawing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants