TomenetGame / tomenet

TomeNET is an online multiplayer roguelike role-playing game
https://www.tomenet.eu/
Other
69 stars 11 forks source link

Ammo break chance display reflects skill #46

Closed char-lotl closed 11 months ago

char-lotl commented 12 months ago

This is my most involved feature yet. Where before the Inspect (shift+I) screen for a piece of ammo might say

It has 20% chances to break upon hit.

this feature is designed to allow the breakage chance displayed here to depend on the relevant ranged skill of the player, such that it might read

It has an 8.3% chance to break upon hit.

I also changed the phrasing to read more naturally, including vowel handling (a/an). It's possible a function that takes a number and outputs whether it starts with a vowel for a/an purposes (e.g. "an 8% chance" vs. "a 7% chance") might be useful to have over in utils.c, alongside the existing is_a_vowel function.

Anyway, I was also unsure of where to put the function declaration. I stuck it in externs.h as a first guess, even though it isn't called externally, since there wasn't an object1.h for it to go in, but I wanted to consult about the right approach to take.

CBlueGH commented 11 months ago

Sorry, was out of town >,> (and lazy whistle)